-
Notifications
You must be signed in to change notification settings - Fork 916
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) (#2733) * Fix for filterSavedObjectCounts for namespaceRegistry Signed-off-by: Craig Perkins <[email protected]> * Fix saved_objects_table.test.tsx Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> * Correct reference to namespacesToInclude Signed-off-by: Craig Perkins <[email protected]> * Use filteredTypeCounts Signed-off-by: Craig Perkins <[email protected]> * Use namespaces similar to types for fetchObjects Signed-off-by: Craig Perkins <[email protected]> * Use _all to represent query for all namespaces Signed-off-by: Craig Perkins <[email protected]> * Pass all registered namespaces Signed-off-by: Craig Perkins <[email protected]> * Switch back signature of scroll_count Signed-off-by: Craig Perkins <[email protected]> * Change countOptions to options Signed-off-by: Craig Perkins <[email protected]> * Use not not instead of in Signed-off-by: Craig Perkins <[email protected]> * Filter namespaces to only include namespace that have been registered Signed-off-by: Craig Perkins <[email protected]> * Add filterQuery with tests Signed-off-by: Craig Perkins <[email protected]> * Update license headers and address review comments Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit d8f66d3)
- 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