mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Resolving unused settings bug when plugin is disabled (#10291)
Backports PR #10246 **Commit 1:** Resolving unused settings bug when plugin is disabled * Original sha:c829139732
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-06T14:33:24Z **Commit 2:** Revert "Resolving unused settings bug when plugin is disabled" This reverts commitc829139732
. * Original sha:81538f444d
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:16:45Z **Commit 3:** Replacing a disabled plugin's config with a simple schema/config with enabled set to false * Original sha:7e66762022
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:28:41Z
This commit is contained in:
parent
dd2b6f9fab
commit
8826fdd41f
1 changed files with 7 additions and 2 deletions
|
@ -6,6 +6,7 @@ import toPath from 'lodash/internal/toPath';
|
|||
import Collection from '../../utils/collection';
|
||||
import { transformDeprecations } from '../config/transform_deprecations';
|
||||
import { createTransform } from '../../deprecation';
|
||||
import Joi from 'joi';
|
||||
|
||||
const byIdCache = Symbol('byIdCache');
|
||||
const pluginApis = Symbol('pluginApis');
|
||||
|
@ -24,9 +25,13 @@ async function addPluginConfig(pluginCollection, plugin) {
|
|||
config.extendSchema(configSchema, transformedPluginSettings, plugin.configPrefix);
|
||||
}
|
||||
|
||||
function removePluginConfig(pluginCollection, plugin) {
|
||||
function disablePluginConfig(pluginCollection, plugin) {
|
||||
// when disabling a plugin's config we remove the existing schema and
|
||||
// replace it with a simple schema/config that only has enabled set to false
|
||||
const { config } = pluginCollection.kbnServer;
|
||||
config.removeSchema(plugin.configPrefix);
|
||||
const schema = Joi.object({ enabled: Joi.bool() });
|
||||
config.extendSchema(schema, { enabled: false }, plugin.configPrefix);
|
||||
}
|
||||
|
||||
module.exports = class Plugins extends Collection {
|
||||
|
@ -60,7 +65,7 @@ module.exports = class Plugins extends Collection {
|
|||
}
|
||||
|
||||
async disable(plugin) {
|
||||
removePluginConfig(this, plugin);
|
||||
disablePluginConfig(this, plugin);
|
||||
this.delete(plugin);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue