Skip to content

Commit

Permalink
[D&D] Add wizard saved objects to vis list (opensearch-project#1933)
Browse files Browse the repository at this point in the history
via appExtensions of alias registration

fixes opensearch-project#1887

Signed-off-by: Josh Romero <rmerqg@amazon.com>
  • Loading branch information
joshuarrrr authored and ashwin-pc committed Aug 3, 2022
1 parent abb6905 commit 7e12ac8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* under the License.
*/

import { SavedObjectAttributes } from 'opensearch-dashboards/public';
import { TriggerContextMapping } from '../../../ui_actions/public';

export interface VisualizationListItem {
Expand All @@ -51,7 +52,7 @@ export interface VisualizationsAppExtension {
toListItem: (savedObject: {
id: string;
type: string;
attributes: object;
attributes: SavedObjectAttributes;
}) => VisualizationListItem;
}

Expand Down
18 changes: 17 additions & 1 deletion src/plugins/wizard/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from './types';
import { WizardEmbeddableFactoryDefinition, WIZARD_EMBEDDABLE } from './embeddable';
import wizardIcon from './assets/wizard_icon.svg';
import { PLUGIN_ID, PLUGIN_NAME } from '../common';
import { EDIT_PATH, PLUGIN_ID, PLUGIN_NAME, WIZARD_SAVED_OBJECT } from '../common';
import { TypeService } from './services/type_service';
import { getPreloadedStore } from './application/utils/state_management';
import { setAggService, setIndexPatterns } from './plugin_services';
Expand Down Expand Up @@ -119,6 +119,22 @@ export class WizardPlugin
stage: 'experimental',
aliasApp: PLUGIN_ID,
aliasPath: '#/',
appExtensions: {
visualizations: {
docTypes: [PLUGIN_ID],
toListItem: ({ id, attributes }) => ({
description: attributes?.description,
editApp: PLUGIN_ID,
editUrl: `${EDIT_PATH}/${encodeURIComponent(id)}`,
icon: wizardIcon,
id,
savedObjectType: WIZARD_SAVED_OBJECT,
stage: 'experimental',
title: attributes?.title,
typeTitle: PLUGIN_NAME,
}),
},
},
});

return {
Expand Down

0 comments on commit 7e12ac8

Please sign in to comment.