Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow modifying unknown/custom advanced settings #4924

Merged
merged 9 commits into from
Sep 14, 2015

Conversation

epixa
Copy link
Contributor

@epixa epixa commented Sep 11, 2015

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.

custom-setting

Fixes #4684

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.
A unit test is also included since the function is now importable.
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.
define(function (require) {
var _ = require('lodash');

var IMMUTABLE_CONFIG_VALS = ['buildNum'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there are any other fields in .kibana/config that we should whitelist. buildNum was the only one in my local setup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding buildNum to the defaults file (which is more of a schema file at this point) and giving it a readOnly attribute, or something to that effect? It would probably be easier to manage the the schema if all of the field properties were listed in one place, rather than in defaults and is_mutable_config.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea

@epixa
Copy link
Contributor Author

epixa commented Sep 11, 2015

Assuming my assumption about immutable fields is correct, this should be good to go.

@epixa epixa added the review label Sep 11, 2015
@w33ble w33ble assigned w33ble and unassigned rashidkpc Sep 11, 2015
@epixa epixa added the v4.2.0 label Sep 11, 2015
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.
@epixa
Copy link
Contributor Author

epixa commented Sep 11, 2015

@spalger How about that?

@spalger
Copy link
Contributor

spalger commented Sep 11, 2015

👍

@w33ble
Copy link
Contributor

w33ble commented Sep 11, 2015

I've never noticed context in mocha before. I dig it.

Seems like settings/__tests__ should be moved to settings/sections/advanced/__tests__, possibly all the way into lib too. I realize that's not where it was before, but all the tests in just cover the advanced libs, and it's better to have the tests closer to the files they actually test.

@@ -3,8 +3,7 @@
<div class="bs-callout bs-callout-warning">
<h4>Caution: You can break stuff here</h4>
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind putting some new lines in here? We don't really enforce line length in HTML, but newlines in HTML text don't affect the result either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all! I actually prefer to hard break paragraphs in html.

@epixa
Copy link
Contributor Author

epixa commented Sep 11, 2015

So __tests__ directories are not simply at the root of each module but rather at the same level of the tree as the files they are testing?

@epixa
Copy link
Contributor Author

epixa commented Sep 11, 2015

Or perhaps something like __tests__/sections/advanced/lib?

@w33ble
Copy link
Contributor

w33ble commented Sep 11, 2015

__tests__ is just a convention we use, the run script looks for **/__tests__/**/*.js, and filters out anything starting with _, so we can include little test libs with little effort that way too. The intention is to keep the tests next to the code, so I'd probably avoid doing deep paths in the __tests__ stuff.

Unless @spalger thinks it's a good idea for some reason. Sounds like he has some plans to change how the test paths will work in the future.

@spalger
Copy link
Contributor

spalger commented Sep 11, 2015

I personally would put the tests right next to the thing they exercise. Not only does it make it easier to see that there are tests for this bit of code, it makes refactoring a bit easier and eventually will allow us to do something like ./bin/kibana test plugins/kibana/settings/sections/advanced/lib

The __tests__ directories should reside alongside of the code they are
testing.
@epixa
Copy link
Contributor Author

epixa commented Sep 11, 2015

Works for me. I moved the whole __tests__ directory into lib since those were the only tests inside it.

@epixa
Copy link
Contributor Author

epixa commented Sep 11, 2015

jenkins, test it

@w33ble
Copy link
Contributor

w33ble commented Sep 12, 2015

This LGTM. I found an issue while testing, and submitted a pr to you against this branch: epixa#1

Take a look at that, it'd be nice to get that into this PR as well.

@w33ble w33ble assigned epixa and unassigned w33ble Sep 12, 2015
unhook the change:config listener on destroy
@epixa epixa assigned w33ble and unassigned epixa Sep 12, 2015
@epixa
Copy link
Contributor Author

epixa commented Sep 12, 2015

Merged.

w33ble added a commit that referenced this pull request Sep 14, 2015
Allow modifying unknown/custom advanced settings
@w33ble w33ble merged commit 89d0b16 into elastic:master Sep 14, 2015
@epixa epixa deleted the 4684-unknown-settings branch September 14, 2015 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants