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)

Fixes #5187

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki authored Oct 4, 2023
1 parent 677fdf5 commit c27d2f5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
18 changes: 10 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,20 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [TSVB, Dashboards] Fix inconsistent dark mode code editor themes ([#4609](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4609))
- [Table Visualization] Fix width of multiple tables when rendered in column view ([#4638](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4638))
- [Legacy Maps] Fix dark mode style overrides ([#4658](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4658))
- [BUG] Fix management overview page duplicate rendering ([#4636](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4636))
- Fix management overview page duplicate rendering ([#4636](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4636))
- Bump `agentkeepalive` to v4.5.0 to solve a problem preventing the use `https://ip` in `opensearch.hosts` ([#4949](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4949))
- [Table Vis] Fix filter actions on data table vis cells ([#4837](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4837))
- Fix broken app when management is turned off ([#4891](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4891))
- Correct the generated path for downloading plugins by their names on Windows ([#4953](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4953))
- [BUG] Fix buildPointSeriesData unit test fails due to local timezone ([#4992](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4992))
- [BUG][Data Explorer][Discover] Fix total hits issue for no time based data ([#5087](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5087))
- [BUG][Data Explorer][Discover] Add onQuerySubmit to top nav and allow force update to embeddable ([#5160](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5160))
- [BUG][Discover] Fix misc navigation issues ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168))
- [BUG][Discover] Fix mobile view ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168))
- [BUG][Data Explorer][Discover] Automatically load solo added default index pattern ([#5171](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5171))
- [BUG][Data Explorer][Discover] Allow data grid to auto adjust size based on fetched data count ([#5191](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5191))
- Fix `buildPointSeriesData` unit test fails due to local timezone ([#4992](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4992))
- [Data Explorer][Discover] Fix total hits issue for no time based data ([#5087](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5087))
- [Data Explorer][Discover] Add onQuerySubmit to top nav and allow force update to embeddable ([#5160](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5160))
- [Discover] Fix misc navigation issues ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168))
- [Discover] Fix mobile view ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168))
- Fix `visAugmenter` forming empty key-value pairs in its calls to the `SavedObject` API ([#5190](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5190))
- [Data Explorer][Discover] Automatically load solo added default index pattern ([#5171](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5171))
- [Data Explorer][Discover] Allow data grid to auto adjust size based on fetched data count ([#5191](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5191))


### 🚞 Infrastructure

Expand Down
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 c27d2f5

Please sign in to comment.