From 2378e6282dfb0fd3b110039f93a7706c0dddf5d9 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 11:47:14 -0400 Subject: [PATCH 1/8] Allow custom fields in advanced settings If the kibana index includes any custom key/value pairs in the config, they will be editable on the advanced settings panel. All custom settings appear at the bottom of the list and are visually labeled as a "custom setting". When the trash can icon is clicked, custom settings are removed entirely from the index. --- .../sections/advanced/advanced_row.html | 5 +- .../settings/sections/advanced/index.html | 3 +- .../settings/sections/advanced/index.js | 64 +++++++++++++------ 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/src/plugins/kibana/public/settings/sections/advanced/advanced_row.html b/src/plugins/kibana/public/settings/sections/advanced/advanced_row.html index f17e38bdbdc4b..51d419b166715 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/advanced_row.html +++ b/src/plugins/kibana/public/settings/sections/advanced/advanced_row.html @@ -1,9 +1,12 @@ {{conf.name}} - + (Default: {{conf.defVal == undefined ? 'null' : conf.defVal}}) + + (Custom setting) +
diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.html b/src/plugins/kibana/public/settings/sections/advanced/index.html index 6417250d22135..8609653e48869 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.html +++ b/src/plugins/kibana/public/settings/sections/advanced/index.html @@ -3,8 +3,7 @@

Caution: You can break stuff here

Be careful in here, these settings are for very advanced users only. Tweaks you make here can break large portions of Kibana. - Some of these settings may be undocumented, unsupported or experimental. Blanking a field will cause Kibana to use its internal - defaults which may be unacceptable given other configuration directives. + Some of these settings may be undocumented, unsupported or experimental. If a field has a default value, blanking the field will reset it to its default which may be unacceptable given other configuration directives. Deleting a custom setting will permanently remove it from Kibana's config.
diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.js b/src/plugins/kibana/public/settings/sections/advanced/index.js index 40e1c7fa7981e..4f3ec0f5a15ee 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.js +++ b/src/plugins/kibana/public/settings/sections/advanced/index.js @@ -20,6 +20,7 @@ define(function (require) { ESC: 27 }; + var IMMUTABLE_CONFIG_VALS = ['buildNum']; var NAMED_EDITORS = ['json', 'array', 'boolean', 'select']; var NORMAL_EDITOR = ['number', 'string', 'null', 'undefined']; @@ -32,30 +33,51 @@ define(function (require) { return !(conf.json || conf.array || conf.bool || conf.normal); } + function notDefaultConfig(configName) { + return !(configName in configDefaults); + } + + function notImmutableConfig(configName) { + return !_.contains(IMMUTABLE_CONFIG_VALS, configName); + } + + function toEditableConfig(def, name, value) { + var isCustom = !def; + if (isCustom) def = {}; + + var conf = { + name, + value, + isCustom, + defVal: def.value, + type: getValType(def, value), + description: def.description, + options: def.options + }; + + var editor = getEditorType(conf); + conf.json = editor === 'json'; + conf.select = editor === 'select'; + conf.bool = editor === 'boolean'; + conf.array = editor === 'array'; + conf.normal = editor === 'normal'; + conf.tooComplex = !editor; + + return conf; + } + function readConfigVals() { var configVals = config._vals(); - $scope.configs = _.map(configDefaults, function (def, name) { - var val = configVals[name]; - var conf = { - name: name, - defVal: def.value, - type: getValType(def, val), - description: def.description, - options: def.options, - value: val, - }; - - var editor = getEditorType(conf); - conf.json = editor === 'json'; - conf.select = editor === 'select'; - conf.bool = editor === 'boolean'; - conf.array = editor === 'array'; - conf.normal = editor === 'normal'; - conf.tooComplex = !editor; - - return conf; - }); + var customConfig = Object.keys(configVals) + .filter(notDefaultConfig) + .filter(notImmutableConfig) + .map(name => toEditableConfig(false, name, configVals[name])); + + $scope.configs = _(configDefaults) + .map((def, name) => toEditableConfig(def, name, configVals[name])) + .concat(customConfig) + .value(); } readConfigVals(); From 3932bd00d5439fa07b33c9f51de89f30c5b6f3c8 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 12:08:42 -0400 Subject: [PATCH 2/8] Move getEditorType to its own module A unit test is also included since the function is now importable. --- .../settings/__tests__/get_editor_type.js | 27 +++++++++++++++++++ .../settings/sections/advanced/index.js | 8 +----- .../sections/advanced/lib/get_editor_type.js | 17 ++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 src/plugins/kibana/public/settings/__tests__/get_editor_type.js create mode 100644 src/plugins/kibana/public/settings/sections/advanced/lib/get_editor_type.js diff --git a/src/plugins/kibana/public/settings/__tests__/get_editor_type.js b/src/plugins/kibana/public/settings/__tests__/get_editor_type.js new file mode 100644 index 0000000000000..968a3cf3f44bf --- /dev/null +++ b/src/plugins/kibana/public/settings/__tests__/get_editor_type.js @@ -0,0 +1,27 @@ + +var getEditorType = require('plugins/kibana/settings/sections/advanced/lib/get_editor_type'); +var expect = require('expect.js'); + +describe('Settings', function () { + describe('Advanced', function () { + describe('getEditorType(conf)', function () { + context('when given type has a named editor', function () { + it('returns that named editor', function () { + expect(getEditorType({ type: 'json' })).to.equal('json'); + expect(getEditorType({ type: 'array' })).to.equal('array'); + expect(getEditorType({ type: 'boolean' })).to.equal('boolean'); + expect(getEditorType({ type: 'select' })).to.equal('select'); + }); + }); + + context('when given a type of number, string, null, or undefined', function () { + it('returns "normal"', function () { + expect(getEditorType({ type: 'number' })).to.equal('normal'); + expect(getEditorType({ type: 'string' })).to.equal('normal'); + expect(getEditorType({ type: 'null' })).to.equal('normal'); + expect(getEditorType({ type: 'undefined' })).to.equal('normal'); + }); + }); + }); + }); +}); diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.js b/src/plugins/kibana/public/settings/sections/advanced/index.js index 4f3ec0f5a15ee..9e604846e088d 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.js +++ b/src/plugins/kibana/public/settings/sections/advanced/index.js @@ -1,6 +1,7 @@ define(function (require) { var _ = require('lodash'); var getValType = require('plugins/kibana/settings/sections/advanced/lib/get_val_type'); + var getEditorType = require('plugins/kibana/settings/sections/advanced/lib/get_editor_type'); require('plugins/kibana/settings/sections/advanced/advanced_row'); @@ -21,13 +22,6 @@ define(function (require) { }; var IMMUTABLE_CONFIG_VALS = ['buildNum']; - var NAMED_EDITORS = ['json', 'array', 'boolean', 'select']; - var NORMAL_EDITOR = ['number', 'string', 'null', 'undefined']; - - function getEditorType(conf) { - if (_.contains(NAMED_EDITORS, conf.type)) return conf.type; - if (_.contains(NORMAL_EDITOR, conf.type)) return 'normal'; - } function isTypeComplex(conf) { return !(conf.json || conf.array || conf.bool || conf.normal); diff --git a/src/plugins/kibana/public/settings/sections/advanced/lib/get_editor_type.js b/src/plugins/kibana/public/settings/sections/advanced/lib/get_editor_type.js new file mode 100644 index 0000000000000..54ec1e240bbf3 --- /dev/null +++ b/src/plugins/kibana/public/settings/sections/advanced/lib/get_editor_type.js @@ -0,0 +1,17 @@ +define(function (require) { + var _ = require('lodash'); + + var NAMED_EDITORS = ['json', 'array', 'boolean', 'select']; + var NORMAL_EDITOR = ['number', 'string', 'null', 'undefined']; + + /** + * @param {object} advanced setting configuration object + * @returns {string} the editor type to use when editing value + */ + function getEditorType(conf) { + if (_.contains(NAMED_EDITORS, conf.type)) return conf.type; + if (_.contains(NORMAL_EDITOR, conf.type)) return 'normal'; + } + + return getEditorType; +}); From 120a2a7f54f172acd7c7655c7ee36293851388c2 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 13:51:48 -0400 Subject: [PATCH 3/8] Move editable config creation to utility file The function is now unit tested as well. There are a few flags of the resulting configuration object that are not yet tested, but they're really behaviors of the returned value based on the current state rather than behaviors of toEditableConfig itself. --- .../settings/__tests__/to_editable_config.js | 86 +++++++++++++++++++ .../settings/sections/advanced/index.js | 28 +----- .../advanced/lib/to_editable_config.js | 38 ++++++++ 3 files changed, 125 insertions(+), 27 deletions(-) create mode 100644 src/plugins/kibana/public/settings/__tests__/to_editable_config.js create mode 100644 src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js diff --git a/src/plugins/kibana/public/settings/__tests__/to_editable_config.js b/src/plugins/kibana/public/settings/__tests__/to_editable_config.js new file mode 100644 index 0000000000000..7a9a78d34f0ad --- /dev/null +++ b/src/plugins/kibana/public/settings/__tests__/to_editable_config.js @@ -0,0 +1,86 @@ + +var toEditableConfig = require('plugins/kibana/settings/sections/advanced/lib/to_editable_config'); +var expect = require('expect.js'); + +describe('Settings', function () { + describe('Advanced', function () { + describe('toEditableConfig(def, name, value)', function () { + it('sets name', function () { + expect(invoke({ name: 'who' }).name).to.equal('who'); + }); + + it('sets value', function () { + expect(invoke({ value: 'what' }).value).to.equal('what'); + }); + + it('sets type', function () { + expect(invoke({ value: 'what' }).type).to.be('string'); + expect(invoke({ value: 0 }).type).to.be('number'); + expect(invoke({ value: [] }).type).to.be('array'); + }); + + context('when given a setting definition object', function () { + var def; + beforeEach(function () { + def = { + value: 'the original', + description: 'the one and only', + options: 'all the options' + }; + }); + + it('is not marked as custom', function () { + expect(invoke({ def }).isCustom).to.be.false; + }); + + it('sets a default value', function () { + expect(invoke({ def }).defVal).to.equal(def.value); + }); + + it('sets a description', function () { + expect(invoke({ def }).description).to.equal(def.description); + }); + + it('sets options', function () { + expect(invoke({ def }).options).to.equal(def.options); + }); + + context('that contains a type', function () { + it('sets that type', function () { + def.type = 'something'; + expect(invoke({ def }).type).to.equal(def.type); + }); + }); + + context('that contains a value of type array', function () { + it('sets type to array', function () { + def.value = []; + expect(invoke({ def }).type).to.equal('array'); + }); + }); + }); + + context('when not given a setting definition object', function () { + it('is marked as custom', function () { + expect(invoke().isCustom).to.be.true; + }); + + it('sets defVal to undefined', function () { + expect(invoke().defVal).to.be.undefined; + }); + + it('sets description to undefined', function () { + expect(invoke().description).to.be.undefined; + }); + + it('sets options to undefined', function () { + expect(invoke().options).to.be.undefined; + }); + }); + }); + }); +}); + +function invoke({ def = false, name = 'woah', value = 'forreal' } = {}) { + return toEditableConfig(def, name, value); +} diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.js b/src/plugins/kibana/public/settings/sections/advanced/index.js index 9e604846e088d..3f1918a370964 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.js +++ b/src/plugins/kibana/public/settings/sections/advanced/index.js @@ -1,7 +1,6 @@ define(function (require) { var _ = require('lodash'); - var getValType = require('plugins/kibana/settings/sections/advanced/lib/get_val_type'); - var getEditorType = require('plugins/kibana/settings/sections/advanced/lib/get_editor_type'); + var toEditableConfig = require('plugins/kibana/settings/sections/advanced/lib/to_editable_config'); require('plugins/kibana/settings/sections/advanced/advanced_row'); @@ -35,31 +34,6 @@ define(function (require) { return !_.contains(IMMUTABLE_CONFIG_VALS, configName); } - function toEditableConfig(def, name, value) { - var isCustom = !def; - if (isCustom) def = {}; - - var conf = { - name, - value, - isCustom, - defVal: def.value, - type: getValType(def, value), - description: def.description, - options: def.options - }; - - var editor = getEditorType(conf); - conf.json = editor === 'json'; - conf.select = editor === 'select'; - conf.bool = editor === 'boolean'; - conf.array = editor === 'array'; - conf.normal = editor === 'normal'; - conf.tooComplex = !editor; - - return conf; - } - function readConfigVals() { var configVals = config._vals(); diff --git a/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js b/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js new file mode 100644 index 0000000000000..5b0bb8ea22bf6 --- /dev/null +++ b/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js @@ -0,0 +1,38 @@ +define(function (require) { + var _ = require('lodash'); + var getValType = require('./get_val_type'); + var getEditorType = require('./get_editor_type'); + + /** + * @param {object} advanced setting definition object + * @param {object} name of setting + * @param {object} current value of setting + * @returns {object} the editable config object + */ + function toEditableConfig(def, name, value) { + var isCustom = !def; + if (isCustom) def = {}; + + var conf = { + name, + value, + isCustom, + defVal: def.value, + type: getValType(def, value), + description: def.description, + options: def.options + }; + + var editor = getEditorType(conf); + conf.json = editor === 'json'; + conf.select = editor === 'select'; + conf.bool = editor === 'boolean'; + conf.array = editor === 'array'; + conf.normal = editor === 'normal'; + conf.tooComplex = !editor; + + return conf; + } + + return toEditableConfig; +}); From 8c49d4f879dd0cafc55cac8a0f71452a1dbdb1a2 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 13:54:27 -0400 Subject: [PATCH 4/8] Move isImmutableConfig to a utility file And test it. --- .../settings/__tests__/is_immutable_config.js | 17 +++++++++++++++++ .../public/settings/sections/advanced/index.js | 8 ++------ .../advanced/lib/is_immutable_config.js | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 src/plugins/kibana/public/settings/__tests__/is_immutable_config.js create mode 100644 src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js diff --git a/src/plugins/kibana/public/settings/__tests__/is_immutable_config.js b/src/plugins/kibana/public/settings/__tests__/is_immutable_config.js new file mode 100644 index 0000000000000..279a9c9de723f --- /dev/null +++ b/src/plugins/kibana/public/settings/__tests__/is_immutable_config.js @@ -0,0 +1,17 @@ + +var isImmutableConfig = require('plugins/kibana/settings/sections/advanced/lib/is_immutable_config'); +var expect = require('expect.js'); + +describe('Settings', function () { + describe('Advanced', function () { + describe('isImmutableConfig(configName)', function () { + it('returns true given an immutable field name', function () { + expect(isImmutableConfig('buildNum')).to.be.true; + }); + + it('returns false given any value that does not match the whitelist', function () { + expect(isImmutableConfig('something else')).to.be.false; + }); + }); + }); +}); diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.js b/src/plugins/kibana/public/settings/sections/advanced/index.js index 3f1918a370964..799da42ed07ca 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.js +++ b/src/plugins/kibana/public/settings/sections/advanced/index.js @@ -1,6 +1,8 @@ define(function (require) { var _ = require('lodash'); var toEditableConfig = require('plugins/kibana/settings/sections/advanced/lib/to_editable_config'); + var isImmutableConfig = require('plugins/kibana/settings/sections/advanced/lib/is_immutable_config'); + var notImmutableConfig = _.negate(isImmutableConfig); require('plugins/kibana/settings/sections/advanced/advanced_row'); @@ -20,8 +22,6 @@ define(function (require) { ESC: 27 }; - var IMMUTABLE_CONFIG_VALS = ['buildNum']; - function isTypeComplex(conf) { return !(conf.json || conf.array || conf.bool || conf.normal); } @@ -30,10 +30,6 @@ define(function (require) { return !(configName in configDefaults); } - function notImmutableConfig(configName) { - return !_.contains(IMMUTABLE_CONFIG_VALS, configName); - } - function readConfigVals() { var configVals = config._vals(); diff --git a/src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js b/src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js new file mode 100644 index 0000000000000..6e3104cf1cf25 --- /dev/null +++ b/src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js @@ -0,0 +1,15 @@ +define(function (require) { + var _ = require('lodash'); + + var IMMUTABLE_CONFIG_VALS = ['buildNum']; + + /** + * @param {string} name of configuration + * @returns {boolean} whether the given name matches an immutable field name + */ + function isImmutableConfig(configName) { + return _.contains(IMMUTABLE_CONFIG_VALS, configName); + } + + return isImmutableConfig; +}); From cb97f7934318058d6abb8ee3a8bad41e3ba70369 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 15:56:26 -0400 Subject: [PATCH 5/8] Remove immutable config in favor of readonly default Rather than having to maintain possible configuration values in two different places, the "immutable field" logic is removed in favor of defining readonly fields in the default config file. --- .../settings/__tests__/is_immutable_config.js | 17 ----------------- .../public/settings/sections/advanced/index.js | 4 +--- .../advanced/lib/is_immutable_config.js | 15 --------------- .../sections/advanced/lib/to_editable_config.js | 1 + src/ui/public/config/defaults.js | 3 +++ 5 files changed, 5 insertions(+), 35 deletions(-) delete mode 100644 src/plugins/kibana/public/settings/__tests__/is_immutable_config.js delete mode 100644 src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js diff --git a/src/plugins/kibana/public/settings/__tests__/is_immutable_config.js b/src/plugins/kibana/public/settings/__tests__/is_immutable_config.js deleted file mode 100644 index 279a9c9de723f..0000000000000 --- a/src/plugins/kibana/public/settings/__tests__/is_immutable_config.js +++ /dev/null @@ -1,17 +0,0 @@ - -var isImmutableConfig = require('plugins/kibana/settings/sections/advanced/lib/is_immutable_config'); -var expect = require('expect.js'); - -describe('Settings', function () { - describe('Advanced', function () { - describe('isImmutableConfig(configName)', function () { - it('returns true given an immutable field name', function () { - expect(isImmutableConfig('buildNum')).to.be.true; - }); - - it('returns false given any value that does not match the whitelist', function () { - expect(isImmutableConfig('something else')).to.be.false; - }); - }); - }); -}); diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.js b/src/plugins/kibana/public/settings/sections/advanced/index.js index 799da42ed07ca..69f22110b316a 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.js +++ b/src/plugins/kibana/public/settings/sections/advanced/index.js @@ -1,8 +1,6 @@ define(function (require) { var _ = require('lodash'); var toEditableConfig = require('plugins/kibana/settings/sections/advanced/lib/to_editable_config'); - var isImmutableConfig = require('plugins/kibana/settings/sections/advanced/lib/is_immutable_config'); - var notImmutableConfig = _.negate(isImmutableConfig); require('plugins/kibana/settings/sections/advanced/advanced_row'); @@ -35,11 +33,11 @@ define(function (require) { var customConfig = Object.keys(configVals) .filter(notDefaultConfig) - .filter(notImmutableConfig) .map(name => toEditableConfig(false, name, configVals[name])); $scope.configs = _(configDefaults) .map((def, name) => toEditableConfig(def, name, configVals[name])) + .reject('readonly') .concat(customConfig) .value(); } diff --git a/src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js b/src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js deleted file mode 100644 index 6e3104cf1cf25..0000000000000 --- a/src/plugins/kibana/public/settings/sections/advanced/lib/is_immutable_config.js +++ /dev/null @@ -1,15 +0,0 @@ -define(function (require) { - var _ = require('lodash'); - - var IMMUTABLE_CONFIG_VALS = ['buildNum']; - - /** - * @param {string} name of configuration - * @returns {boolean} whether the given name matches an immutable field name - */ - function isImmutableConfig(configName) { - return _.contains(IMMUTABLE_CONFIG_VALS, configName); - } - - return isImmutableConfig; -}); diff --git a/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js b/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js index 5b0bb8ea22bf6..a147cb61c31e4 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js +++ b/src/plugins/kibana/public/settings/sections/advanced/lib/to_editable_config.js @@ -17,6 +17,7 @@ define(function (require) { name, value, isCustom, + readonly: !!def.readonly, defVal: def.value, type: getValType(def, value), description: def.description, diff --git a/src/ui/public/config/defaults.js b/src/ui/public/config/defaults.js index f1e90f22aadbb..3897e574f6ecc 100644 --- a/src/ui/public/config/defaults.js +++ b/src/ui/public/config/defaults.js @@ -3,6 +3,9 @@ define(function () { // wraped in provider so that a new instance is given to each app/test return { + 'buildNum': { + readonly: true + }, 'query:queryString:options': { value: '{ "analyze_wildcard": true }', description: 'Options for the lucene query string parser', From 659a6da3cd6176456aa3856aaae4032026f9bef7 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 17:47:51 -0400 Subject: [PATCH 6/8] Hard break long paragraph on 80 chars --- .../kibana/public/settings/sections/advanced/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.html b/src/plugins/kibana/public/settings/sections/advanced/index.html index 8609653e48869..a2894631dc868 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.html +++ b/src/plugins/kibana/public/settings/sections/advanced/index.html @@ -2,8 +2,12 @@

Caution: You can break stuff here

- Be careful in here, these settings are for very advanced users only. Tweaks you make here can break large portions of Kibana. - Some of these settings may be undocumented, unsupported or experimental. If a field has a default value, blanking the field will reset it to its default which may be unacceptable given other configuration directives. Deleting a custom setting will permanently remove it from Kibana's config. + Be careful in here, these settings are for very advanced users only. + Tweaks you make here can break large portionsof Kibana. Some of these + settings may be undocumented, unsupported or experimental. If a field has + a default value, blanking the field will reset it to its default which + may be unacceptable given other configuration directives. Deleting a + custom setting will permanently remove it from Kibana's config.
From 5a4cadb275137aa329210ac39b7bfef3f7294139 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 11 Sep 2015 18:24:11 -0400 Subject: [PATCH 7/8] Move advanced settings lib tests to lib The __tests__ directories should reside alongside of the code they are testing. --- .../{ => sections/advanced/lib}/__tests__/get_editor_type.js | 0 .../{ => sections/advanced/lib}/__tests__/get_val_type.js | 0 .../{ => sections/advanced/lib}/__tests__/to_editable_config.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/plugins/kibana/public/settings/{ => sections/advanced/lib}/__tests__/get_editor_type.js (100%) rename src/plugins/kibana/public/settings/{ => sections/advanced/lib}/__tests__/get_val_type.js (100%) rename src/plugins/kibana/public/settings/{ => sections/advanced/lib}/__tests__/to_editable_config.js (100%) diff --git a/src/plugins/kibana/public/settings/__tests__/get_editor_type.js b/src/plugins/kibana/public/settings/sections/advanced/lib/__tests__/get_editor_type.js similarity index 100% rename from src/plugins/kibana/public/settings/__tests__/get_editor_type.js rename to src/plugins/kibana/public/settings/sections/advanced/lib/__tests__/get_editor_type.js diff --git a/src/plugins/kibana/public/settings/__tests__/get_val_type.js b/src/plugins/kibana/public/settings/sections/advanced/lib/__tests__/get_val_type.js similarity index 100% rename from src/plugins/kibana/public/settings/__tests__/get_val_type.js rename to src/plugins/kibana/public/settings/sections/advanced/lib/__tests__/get_val_type.js diff --git a/src/plugins/kibana/public/settings/__tests__/to_editable_config.js b/src/plugins/kibana/public/settings/sections/advanced/lib/__tests__/to_editable_config.js similarity index 100% rename from src/plugins/kibana/public/settings/__tests__/to_editable_config.js rename to src/plugins/kibana/public/settings/sections/advanced/lib/__tests__/to_editable_config.js From 34992c0f515ba4b090ba1b43ff966471336548ea Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Fri, 11 Sep 2015 18:13:42 -0700 Subject: [PATCH 8/8] unhook the change:config listener on destroy --- .../kibana/public/settings/sections/advanced/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.js b/src/plugins/kibana/public/settings/sections/advanced/index.js index 69f22110b316a..bcff939994f56 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.js +++ b/src/plugins/kibana/public/settings/sections/advanced/index.js @@ -42,8 +42,12 @@ define(function (require) { .value(); } + // react to changes of the config values + var unhook = $rootScope.$on('change:config', readConfigVals); + $scope.$on('$destroy', unhook); + + // initial config setup readConfigVals(); - $rootScope.$on('change:config', readConfigVals); } }; });