forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[D&D] Basic saving, loading, and updating (opensearch-project#1870)
* [D&D] Enable basic saving and loading - Add `/edit` route - Sync state for saving and loading - Add setter for vizualization slice - Switch from BrowserRouter to Router - Add version to saved objects - Add savedWizardLoader to services - store visualization and style states separately - add version - update breadcrumb handling - move useSavedWizardVis to top_nav - handle savedObjectNotFound - use savedObjectLoader correctly - allow copy on save - update url and chrome on save - add type for WizardVisSavedObject fixes opensearch-project#1867 Signed-off-by: Josh Romero <rmerqg@amazon.com>
- Loading branch information
1 parent
378cf99
commit 27ed718
Showing
17 changed files
with
322 additions
and
84 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
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
42 changes: 42 additions & 0 deletions
42
src/plugins/wizard/public/application/utils/breadcrumbs.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,42 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { i18n } from '@osd/i18n'; | ||
import { VISUALIZE_ID } from '../../../common'; | ||
|
||
const defaultEditText = i18n.translate('wizard.editor.defaultEditBreadcrumbText', { | ||
defaultMessage: 'Edit', | ||
}); | ||
|
||
export function getVisualizeLandingBreadcrumbs(navigateToApp) { | ||
return [ | ||
{ | ||
text: i18n.translate('wizard.listing.breadcrumb', { | ||
defaultMessage: 'Visualize', | ||
}), | ||
onClick: () => navigateToApp(VISUALIZE_ID), | ||
}, | ||
]; | ||
} | ||
|
||
export function getCreateBreadcrumbs(navigateToApp) { | ||
return [ | ||
...getVisualizeLandingBreadcrumbs(navigateToApp), | ||
{ | ||
text: i18n.translate('wizard.editor.createBreadcrumb', { | ||
defaultMessage: 'Create', | ||
}), | ||
}, | ||
]; | ||
} | ||
|
||
export function getEditBreadcrumbs(text: string = defaultEditText, navigateToApp) { | ||
return [ | ||
...getVisualizeLandingBreadcrumbs(navigateToApp), | ||
{ | ||
text, | ||
}, | ||
]; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/plugins/wizard/public/application/utils/get_saved_wizard_vis.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,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { WizardServices } from '../..'; | ||
|
||
export const getSavedWizardVis = async (services: WizardServices, wizardVisId?: string) => { | ||
const { savedWizardLoader } = services; | ||
if (!savedWizardLoader) { | ||
return {}; | ||
} | ||
const savedWizardVis = await savedWizardLoader.get(wizardVisId); | ||
|
||
return savedWizardVis; | ||
}; |
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
Oops, something went wrong.