-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Save Object Aggregation View] Fix for export all after scroll count …
…response changed in PR#2656 (#2696) * Fix for filterSavedObjectCounts for namespaceRegistry Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix saved_objects_table.test.tsx Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> * Correct reference to namespacesToInclude Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use filteredTypeCounts Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use namespaces similar to types for fetchObjects Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use _all to represent query for all namespaces Signed-off-by: Craig Perkins <cwperx@amazon.com> * Pass all registered namespaces Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch back signature of scroll_count Signed-off-by: Craig Perkins <cwperx@amazon.com> * Change countOptions to options Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use not not instead of in Signed-off-by: Craig Perkins <cwperx@amazon.com> * Filter namespaces to only include namespace that have been registered Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add filterQuery with tests Signed-off-by: Craig Perkins <cwperx@amazon.com> * Update license headers and address review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: Craig Perkins <cwperx@amazon.com>
- Loading branch information
Showing
9 changed files
with
112 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/plugins/saved_objects_management/public/lib/filter_query.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { filterQuery } from './filter_query'; | ||
|
||
describe('filterQuery', () => { | ||
it('should return full list of allowed vals, requested values unspecified', () => { | ||
const allowedVals = ['config', 'index-pattern', 'url', 'query']; | ||
const requestedVals = undefined; | ||
|
||
const expected = ['config', 'index-pattern', 'url', 'query']; | ||
expect(filterQuery(allowedVals, requestedVals)).toEqual(expected); | ||
}); | ||
|
||
it('should return list of all requested values, all values within allowed values', () => { | ||
const allowedVals = ['config', 'index-pattern', 'url', 'query']; | ||
const requestedVals = ['config', 'index-pattern']; | ||
|
||
const expected = ['config', 'index-pattern']; | ||
expect(filterQuery(allowedVals, requestedVals)).toEqual(expected); | ||
}); | ||
|
||
it('should return only allowed values within requested values', () => { | ||
const allowedVals = ['config', 'index-pattern', 'url', 'query']; | ||
const requestedVals = ['config', 'index-pattern', 'forbidden']; | ||
|
||
const expected = ['config', 'index-pattern']; | ||
expect(filterQuery(allowedVals, requestedVals)).toEqual(expected); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
src/plugins/saved_objects_management/public/lib/filter_query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export function filterQuery(allowedVals: string[], requestedVals?: string[]): string[] { | ||
const filteredVals = requestedVals | ||
? allowedVals.filter((val) => requestedVals.includes(val)) | ||
: allowedVals; | ||
return filteredVals; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters