Added .get, renamed .getAll as .getRaw, added new .getAll method#7374
Added .get, renamed .getAll as .getRaw, added new .getAll method#7374bevacqua merged 12 commits intoelastic:masterfrom
Conversation
|
What would you say to adding a cache for these settings? One thing that was unexpected/frustrating when I first tried to use this API was that the |
|
Sounds good but also would need a hook to learn about changes made directly against the index? |
src/ui/settings/index.js
Outdated
There was a problem hiding this comment.
We should probably have some tests for these higher level methods.
|
@bevacqua do we still have code that directly accesses the config in the .kibana index? Or are you thinking of user's modifying it themselves outside of Kibana? |
|
I meant users. I was told to trust no one. |
|
Haha ok. I think there's a case to be made for users modifying Kibana internal data at their own risk, but it's not a huge deal, I'm ok with leaving it as is if we wanna play it safe. In that case the code looks good, but I would like to see some tests that exercise those getters at least. Also one other note, since I am using |
|
I'd say block your issue on this one and I'll add tests so we can merge it before you do yours. Can you x-ref them? |
|
Yeah left a note on my PR. Like I said, very unlikely that one will be ready first anyways. |
|
|
jenkins, test it |
src/ui/settings/__tests__/index.js
Outdated
There was a problem hiding this comment.
I think these tests can be simplified by creating a separate "returns a promise" test that makes this kind of assertion instead of repeating it within each test. This will make each test's description more accurate, make the tests more readable since they will be testing "just one thing", and the tests themselves will be deflated a bit.
describe('#setMany()', () => {
it('returns a promise', () => {
const { uiSettings } = instantiate();
const result = uiSettings.setMany({});
expect(typeof result.then).to.be('function');
});
it('updates a single value in one operation', () => {
/* ... */
});
it('updates several values in one operation', () => {
/* ... */
});
});There was a problem hiding this comment.
Totally. Split out assertions into separate tests.
|
jenkins, test it |
|
@Bargs 🏓 (Ping) |
src/ui/settings/__tests__/index.js
Outdated
There was a problem hiding this comment.
Do we know what promise implementation is returned? If so, expect.js's constructor assertion could be used instead of duck typing:
expect(result).to.be.a(Promise);
|
One thing that's not obvious to me from the tests or the documentation is the difference between |
|
Just a suggestion: expect.js's |
|
@bevacqua just a few minor questions/comments |
|
@Bargs The non-flat methods aren't flat because the metadata is used on the client-side, and to maintain the format for easy merging |
|
Oh, wow, I didn't expect |
|
Yeah, it sucks... that's why I'd still like to switch to Chai. |
|
@Bargs Added comments, used |
3c84c81 to
40d2898
Compare
|
jenkins, test it |
1 similar comment
|
jenkins, test it |
|
Pending tests passing, LGTM |
40d2898 to
1673b31
Compare
|
jenkins, test it |
|
jenkins, test this |
|
LGTM |
Added .get, renamed .getAll as .getRaw, added new .getAll method Former-commit-id: 05f6a56
`v93.2.0`⏩`v93.3.0` --- ## [`v93.3.0`](https://github.com/elastic/eui/releases/v93.3.0) - Added new `EuiDataGrid` new prop: `cellContext`, an optional object of additional props passed to the cell render function. ([#7374](elastic/eui#7374)) - `EuiBreadcrumbs`'s `popoverContent` API now accepts a render function that will be passed a `closePopover` callback, allowing consumers to close the breadcrumb popover from their popover content ([#7555](elastic/eui#7555)) **Bug fixes** - Fixed missing animation on native `EuiProgress` bar update ([#7538](elastic/eui#7538)) - Fixed an `EuiDataGrid` bug with `gridStyle.rowClasses`, where custom consumer classes that began with `euiDataGridRow` would not be correctly removed/reapplied ([#7549](elastic/eui#7549)) - Fixed a visual `EuiDataGrid` bug where `EuiCheckbox`es within control columns were not vertically centered within single height rows ([#7549](elastic/eui#7549))
As pointed out by @Bargs in #7301, the
.getmethod was missing from the server-side settings config module. I took the liberty of also changing.getAllinto.getRawsince it returns the entire manifest objects for the settings (includes descriptions, user-provided, and default values), and added a new.getAllimplementation where an object of configuration key/value pairs is provided.