From a48df33066cf0bcb7b67691db8aa2d0fffb1fd7e Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Tue, 2 Jun 2020 14:20:40 +0200 Subject: [PATCH] refactor: includeHidden -> includeHiddenIndices --- .../home/index_list/index_table/index_table.js | 17 ++++++++--------- .../public/application/store/selectors/index.js | 2 +- .../store/selectors/indices_filter.test.ts | 6 ++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js b/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js index dc96346a04d00..360a39971b535 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js +++ b/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js @@ -94,7 +94,7 @@ export class IndexTable extends Component { super(props); this.state = { - showHiddenIndices: false, + includeHiddenIndices: false, dataStreamFilter: undefined, selectedIndicesMap: {}, }; @@ -130,11 +130,10 @@ export class IndexTable extends Component { syncUrlParams() { const { location } = this.props; - // Check if the we have the includeHidden query param - const { includeHidden } = qs.parse((location && location.search) || ''); - const nextValue = includeHidden === 'true'; - if (this.state.includeHidden !== nextValue) { - this.setState({ includeHidden: nextValue }); + const { includeHiddenIndices } = qs.parse((location && location.search) || ''); + const nextValue = includeHiddenIndices === 'true'; + if (this.state.includeHiddenIndices !== nextValue) { + this.setState({ includeHiddenIndices: nextValue }); } } @@ -142,9 +141,9 @@ export class IndexTable extends Component { const { pathname, search } = this.props.location; const params = qs.parse(search); if (hidden) { - params.includeHidden = 'true'; + params.includeHiddenIndices = 'true'; } else { - delete params.includeHidden; + delete params.includeHiddenIndices; } this.props.history.push(pathname + '?' + qs.stringify(params)); } @@ -497,7 +496,7 @@ export class IndexTable extends Component { this.setIncludeHiddenParam(event.target.checked)} label={ { let indexArray = allIds.map((indexName) => indices[indexName]); indexArray = filterByToggles(indexArray, tableState.toggleNameToVisibleMap); - const { includeHidden: includeHiddenParam, dataStreams: dataStreamsParam } = qs.parse( + const { includeHiddenIndices: includeHiddenParam, dataStreams: dataStreamsParam } = qs.parse( tableLocation.search ); const includeHidden = includeHiddenParam === 'true'; diff --git a/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts b/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts index d77b1be9f0547..ef32a1ba93ca9 100644 --- a/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts +++ b/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts @@ -37,7 +37,9 @@ describe('getFilteredIndices selector', () => { }); it('includes hidden indices', () => { - expect(getFilteredIndices(state, { location: { search: '?includeHidden=true' } })).toEqual([ + expect( + getFilteredIndices(state, { location: { search: '?includeHiddenIndices=true' } }) + ).toEqual([ { name: 'index1', hidden: true, dataStream: '123' }, { name: 'index2', hidden: false }, { name: 'index3', dataStream: 'abc' }, @@ -56,7 +58,7 @@ describe('getFilteredIndices selector', () => { it('filters based on data stream and includes hidden indices', () => { expect( getFilteredIndices(state, { - location: { search: '?includeHidden=true&dataStreams=123,abc,does-not-exist' }, + location: { search: '?includeHiddenIndices=true&dataStreams=123,abc,does-not-exist' }, }) ).toEqual([ { name: 'index1', hidden: true, dataStream: '123' },