Skip to content

Commit

Permalink
Fix visAugmenter forming empty key-value pairs in its calls to the …
Browse files Browse the repository at this point in the history
…`SavedObject` API (#5190) (#5192)

Fixes #5187

Signed-off-by: Miki <[email protected]>
(cherry picked from commit c27d2f5)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Miki <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent 9b1d128 commit f039a55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/plugins/vis_augmenter/public/utils/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,12 @@ describe('utils', () => {
expect(loader.findAll).toHaveBeenCalledWith(
'',
100,
[],
undefined,
{
type: 'visualization',
id: visId1 as string,
},
[]
undefined
);
});
it('single plugin resource is propagated to findAll()', async () => {
Expand All @@ -391,7 +391,7 @@ describe('utils', () => {
expect(loader.findAll).toHaveBeenCalledWith(
'resource-1',
100,
[],
undefined,
{
type: 'visualization',
id: visId1 as string,
Expand All @@ -411,7 +411,7 @@ describe('utils', () => {
expect(loader.findAll).toHaveBeenCalledWith(
'resource-1|resource-2',
100,
[],
undefined,
{
type: 'visualization',
id: visId1 as string,
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/vis_augmenter/public/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ export const getAugmentVisSavedObjs = async (
);
}
try {
// If there is specified plugin resource IDs, add a search string and search field
// into findAll() fn call
// If there are any plugin resource IDs specified, add a search string and search field
// into findAll() call
const pluginResourceIdsSpecified =
pluginResourceIds !== undefined && pluginResourceIds.length > 0;
Array.isArray(pluginResourceIds) && pluginResourceIds.length > 0;
const resp = await loader?.findAll(
pluginResourceIdsSpecified ? pluginResourceIds.join('|') : '',
pluginResourceIdsSpecified ? pluginResourceIds!.join('|') : '',
100,
[],
undefined,
{
type: 'visualization',
id: visId as string,
},
pluginResourceIdsSpecified ? ['pluginResource.id'] : []
pluginResourceIdsSpecified ? ['pluginResource.id'] : undefined
);
return (get(resp, 'hits', []) as any[]) as ISavedAugmentVis[];
} catch (e) {
Expand Down

0 comments on commit f039a55

Please sign in to comment.