Skip to content

Commit 1e34c06

Browse files
ashwin-pcabbashusCPTNBjoshuarrrrkaddy645
authored
[Feature] Adds the Drag and Drop editor to Visualize (#1966)
* [Chore] Moves Drag and Drop to new branch (#1400) * Initial Drag and Drop plugin code (#946) * Initial Drag and Drop plugin code Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Adds state management to Drag and Drop Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Moves Drag and Drop to create visualization menu Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Field Search in Data panel (#995) Add ability to search on index fields Signed-off-by: Abbas Hussain <abbas_10690@yahoo.com> * Adds initial type service (#1260) Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: updates viz modal snapshot Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix(License): Fixes license headers Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> Co-authored-by: Abbas Hussain <abbashus@amazon.com> * [D&D] Type Service Contributions (#1402) * feat(Contributions): Simple working contributions Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat(Contributions): Add new field from dropbox Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat(Contributions): Working edit mode Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix(Contributions): Fixes switching dropbox fields Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: Updates license headers Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat(Contributions): Adds initial drag & drop validation Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat(Dropbox): Allows multiple instances of the same field Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat(Dropbox): Working reorder fields Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat(Contributions): Working container contributions Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: clean up exports Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * test(Contribution): Adds unit test `mergeArrays` Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * test(TypeService): Adds plugin unit tests Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: remove redundant code Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * test(Functional): Updates Chart types Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Refactor to use AggService and introduce metric visualization (#1734) * partial progress Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * simle workign metric using aggShemas Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * updated VisualizationTypeOptions to be a generic Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * partially working metric style options Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * all state objects are serializeable Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * working delete and reorder Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: cleanup agg service changes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Adds the data source selector and a useIndexPatterns hook (#1763) Signed-off-by: Brooke Green <cptn@amazon.com> * [D&D] Adding and editing an aggregation + metric color ranges (#1781) * edit and add agg works Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * edit agg using draft state Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * cleanup dropbox field icon Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Adds other metric style props Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Updated comment Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Enable basic saved object management (#1816) * [D&D] Enable basic saved object management - Create README stub for saved_objects_management plugin - Register wizard saved object loader with management plugin - Add management methods to SavedObjectsType - Add capabilities provider to wizard - Add saved wizard vis SavedObjectClass and SavedObjectLoader - Add public plugin start method partially addresses #1620 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [Doc] Add clarifications to README for save objects management plugin Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Adds drop validation (#1833) * edit and add agg works Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * edit agg using draft state Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Adds other metric style props Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat: Adds agg type validation and defaults on drop Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: refactor filter Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: updates D&D icon (#1844) Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Chore/remove contributions (#1843) * adds min/max validation Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * relocated contributions Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Some more cleanup Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * minor fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * one more unnecessary file Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: Seconday panel title Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: Updates Field selector (#1845) Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Adding breadcrumbs for drag and drop creation (#1797) Signed-off-by: Brooke Green <cptn@amazon.com> * fix(D&D): fixes reloading app (#1855) Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Dropbox style and animations (#1863) * fix dropbox styles and added animations Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * simpler usePrefersReducedMotion Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix drop target animation Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Basic saving, loading, and updating (#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 #1867 Signed-off-by: Josh Romero <rmerqg@amazon.com> * chore: Adds a few readme's (#1894) Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Empty-workspace polish (#1900) * empty workspace polish Signed-off-by: kaddy645 <xdeskart@amazon.com> * pr update Signed-off-by: kaddy645 <xdeskart@amazon.com> * pr update 2 Signed-off-by: kaddy645 <xdeskart@amazon.com> * [D&D] Fix: Topnav updates aggregation parameters (#1905) * fix(D&D): Fixes top nav query and timerange Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix(D&D): Handles topnav state update Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Add a flag in the YAML config to enable and disable the D&D plugin (#1889) Resolves Issue - #1877 Signed-off-by: Manasvini B Suryanarayana <manasvis@amazon.com> * fix(Workspace): Fixes illustration and copy (#1916) Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Misc fixes (#1924) * fix: minor fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: nit syntax fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: simplify useSavedWizardVis Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Enable basic embeddable panels (#1911) - add embeddable, embeddable component, embeddable factory - update `toExpression` to allow passing services - register embeddable factory in plugin setup fixes #1908 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Fix scss lint and available fields (#1927) * fix(Lint): fixes scss linting issues Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: Filter field types correctly Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: minor Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Add wizard saved objects to vis list (#1933) via appExtensions of alias registration fixes #1887 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Feature/experimental (#1934) * feat: experimental banner Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * feat: experimental embeddable Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: experimental banner location Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Remove search/hasMatch embeddable vestiges (#1935) - removedebugging rendering - also update embeddables icon fixes #1910, #1925 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Refactor and cleanup embeddables (#1947) General plugin updates (#1939): - add start service getters/setters to plugin service - move setters from setup to start so they're available to embeddable Embeddable updates: - use getters instead of depending on start services in constructor - remove wizard from add panel "create" list - add correct edit paths/URLs for linking to wizard #1940 - add basic error embeddable rendering - render via ExpressionLoader instead of wizard_component #1920 - wizard_component no longer used, but updated for future use - add subscription handling for query, filter, timerange changes #1937 - fix clone/replace panel actions #1943, #1944 - fix title/description panel rendering #1921 - add inspection panel action #1936 Asset updates: - Update empty workspace illustration - Add secondary fill icon version to match new visualization icons fixes #1936, #1920, #1937, #1940, #1921, #1939, #1941, #1943, #1944 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Fix index pattern state and loading (#1949) Remove useIndexPattern hook in favor of useIndexPatterns fixes #1917 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Fix duplicate title warning (#1950) fixes #1918 Signed-off-by: Josh Romero <rmerqg@amazon.com> * [D&D] Adds autosave while editing aggregation (#1953) * fest: Adds autosave while editing agg Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: autosave order Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: spelling Co-authored-by: Josh Romero <rmerqg@amazon.com> Co-authored-by: Josh Romero <rmerqg@amazon.com> * [D&D] Fixes autosave with debounce (#1965) * fix: autosave editing Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: improve workspace animation Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: show invalid field when editing Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: header offset Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * Update src/plugins/saved_objects_management/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/saved_objects_management/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/saved_objects_management/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/server/index.ts Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/server/types.ts Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/wizard/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * Update src/plugins/saved_objects_management/README.md Co-authored-by: Josh Romero <rmerqg@amazon.com> * [D&D] Final fixes (#2071) * chore: Disable wizard by default Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: remove routes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: remove translations Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: nit fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: adds license to scss files Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: drop hover dark mode Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: nit fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * [D&D] Initial functional tests (#2070) * fix: searchable dropdown Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: broken empty test Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * test(FTR): Adds basic functional tests for D&D Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * test(FTR): Adds CI group 13 to test workflow Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * fix: nit fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: att test to jenkinsfile Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: minor nit fixes Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: downgrade redux-toolkit for plugin compatibility Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> * chore: add docker config flag Signed-off-by: Ashwin Pc <ashwinpc@amazon.com> Co-authored-by: Abbas Hussain <abbashus@amazon.com> Co-authored-by: Brooke <97559014+CPTNB@users.noreply.github.com> Co-authored-by: Josh Romero <rmerqg@amazon.com> Co-authored-by: Kartik Desai <xdeskart@amazon.com> Co-authored-by: Manasvini B Suryanarayana <manasvis@amazon.com>
1 parent 54f2aeb commit 1e34c06

File tree

127 files changed

+5499
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+5499
-127
lines changed

.github/workflows/build_and_test_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
name: Run functional tests
7676
strategy:
7777
matrix:
78-
group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
78+
group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ]
7979
steps:
8080
- run: echo Running functional tests for ciGroup${{ matrix.group }}
8181

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def functionalDynamicParallelSteps(image){
6868
"ciGroup10",
6969
"ciGroup11",
7070
"ciGroup12",
71+
"ciGroup13",
7172
]
7273
for (int i = 0; i < ciGroups.size(); i++) {
7374
def currentCiGroup = ciGroups[i];

TESTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ To run specific functional tests, you can run by CI group:
5050

5151
To debug functional tests:
5252
Say that you would want to debug a test in CI group 1, you can run the following command in your environment:
53-
`node --debug-brk --inspect scripts/functional_tests.js --config test/functional/config.js --include ciGroup1 --debug`
53+
`node --inspect-brk --inspect scripts/functional_tests.js --config test/functional/config.js --include ciGroup1 --debug`
5454

5555
This will print off an address, to which you could open your chrome browser on your instance and navigate to `chrome://inspect/#devices` and inspect the functional test runner `scripts/functional_tests.js`.
5656

@@ -89,9 +89,24 @@ Automated testing is provided with Jenkins for Continuous Integration. Jenkins e
8989
Selenium tests are run in headless mode on CI. Locally the same tests will be executed in a real browser. You can activate headless mode by setting the environment variable:
9090
`export TEST_BROWSER_HEADLESS=1`
9191

92+
Since local Selenium tests are run in a real browser, the dev environment should have a desktop environment and Google Chrome or Chromium installed to run the tests.
93+
9294
By default the version of OpenSearch Dashboards will pull the snapshot of the same version of OpenSearch if available while running a few integration tests and for running functional tests. However, if the version of OpenSearch Dashboards is not available, you can build OpenSearch locally and point the functional test runner to the executable with:
9395
`export TEST_OPENSEARCH_FROM=[local directory of OpenSearch executable]`
9496

97+
Selinium tests require a chromedriver and a corresponding version of chrome to run properly. Depending on the version of chromedriver used, you may need to use a version of Google Chrome that is not the latest version. You can do this by running:
98+
99+
```sh
100+
# Enter the version of chrome that you want to install
101+
CHROME_VERSION=100.0.4896.127-1
102+
103+
# Download Chrome to a temp directory
104+
curl -sSL "https://dl.google.com/linux/linux_signing_key.pub" | sudo apt-key add - && wget -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb"
105+
106+
# Install/Downgrade Chrome
107+
sudo apt-get install -y --allow-downgrades /tmp/chrome.deb
108+
```
109+
95110
# Misc
96111
Although Jest is the standard for this project, there are a few Mocha tests that still exist. You can run these tests by running:
97112
`yarn test:mocha`

config/opensearch_dashboards.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,7 @@
216216
# Set the value of this setting to false to suppress search usage telemetry
217217
# for reducing the load of OpenSearch cluster.
218218
# data.search.usageTelemetry.enabled: false
219+
220+
# Set the value of this setting to true to start exploring wizard
221+
# functionality in Visualization.
222+
# wizard.enabled: false

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"@osd/std": "1.0.0",
141141
"@osd/ui-framework": "1.0.0",
142142
"@osd/ui-shared-deps": "1.0.0",
143+
"@reduxjs/toolkit": "^1.6.1",
143144
"@types/yauzl": "^2.9.1",
144145
"JSONStream": "1.3.5",
145146
"abortcontroller-polyfill": "^1.4.0",

src/dev/build/tasks/os_packages/docker_generator/resources/bin/opensearch-dashboards-docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ opensearch_dashboards_vars=(
149149
telemetry.optIn
150150
telemetry.optInStatusUrl
151151
telemetry.sendUsageFrom
152+
wizard.enabled
152153
)
153154

154155
longopts=''

src/plugins/navigation/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
The navigation plugins exports the `TopNavMenu` component.
44
It also provides a stateful version of it on the `start` contract.
55

6+
## navigation.ui.TopNavMenu
7+
8+
The `naivgation.ui` module exposes the `TopNavMenu` component that features The search bar, time filter and menu options to be used across the app in multiple locations. It primarity consists of 2 components:
9+
10+
- Menu options: Options to show on the menu bar alongside the breadcrumbs
11+
- Search bar: The [`data.ui.SearchBar`](../data/public/ui/search_bar/) component responsible for the query bar, time filter and field filters.
12+
13+
Most of the logic for the component resides in the `SearchBar` component. This simply adds a way to add menu options on top of the search bar.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Saved objects management
2+
3+
Provides a UI (via the `management` plugin) to find and manage all saved objects in one place (you can see the primary page by navigating to `/app/management/opensearch-dashboards/objects`). Not to be confused with the `savedObjects` plugin, which provides all the core capabilities of saved objects.
4+
5+
From the primary UI page, this plugin allows you to:
6+
1. Search/view/delete saved objects and their relationships
7+
2. Import/export saved objects
8+
3. Inspect/edit raw saved object values without validation
9+
10+
For 3., this plugin can also be used to provide a route/page for editing, such as `/app/management/opensearch-dashboards/objects/savedVisualizations/{visualizationId}`, although plugins are also free to provide or host alternate routes for this purpose (see index patterns, for instance, which provide their own integration and UI via the `management` plugin directly).
11+
12+
## Making a new saved object type manageable
13+
14+
1. Create a new `SavedObjectsType` or add the `management` property to an existing one. (See [`SavedObjectsTypeManagementDefinition`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/e1380f14deb98cc7cce55c3b82c2d501826a78c3/src/core/server/saved_objects/types.ts#L247-L285) for explanation of its properties)
15+
2. Register saved object type via `core.savedObjects.registerType(...)` as part of plugin server setup method
16+
3. Implement a way to save the object (e.g. via `savedObjectsClient.create(...)` or a `savedObjectLoader`)
17+
4. After these steps, you should be able to save objects and view/search for them in Saved Objects management (`/app/management/opensearch-dashboards/objects`)
18+
19+
## Enabling edit links from saved objects management
20+
21+
1. Make sure `management.getInAppUrl` method of the `SavedObjectsType` is defined with a `path` (which will specify the link target) and the `uiCapabilitiesPath`
22+
2. For `uiCapabilitiesPath` to work without additional hardcoding, it should be in the format `{plugin}.show`, so that [the default logic of `src/plugins/saved_objects_management/public/lib/in_app_url.ts`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/a9984f63a38e964007ab94fae99237a14d8f9ee2/src/plugins/saved_objects_management/public/lib/in_app_url.ts#L48-L50) will correctly match. Otherwise, you'll need to [add a case for your `uiCapabilities` path](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/a9984f63a38e964007ab94fae99237a14d8f9ee2/src/plugins/saved_objects_management/public/lib/in_app_url.ts#L45-L47) to that function
23+
3. Create default plugin capabilities provider
24+
4. Register plugin capabilities via `core.capabilities.registerProvider(...);` as part of plugin server setup method
25+
26+
## Using saved objects management to inspect/edit new plugin objects
27+
28+
You'll notice that when clicking on the "Inspect" button from the saved objects management table, you'll usually be routed to something like `/app/management/opensearch-dashboards/objects/savedVisualizations/` (where the route itself is determined by the `management.getEditUrl` method of the `SavedObjectsType`). But to register a similar route for a new saved object type, you'll need to create a new `savedObjectLoader` and register it with the management plugin.
29+
30+
### Creating `savedObjectLoader`
31+
32+
1. In your plugin's public directory, create a class for your saved object that extends `SavedObjectClass`. The mapping should match the `mappings` defined in your `SavedObjectsType`.
33+
2. Create a `savedObjectLoader` creation function that returns a `new SavedObjectLoader(YourSavedObjectClass, savedObjectsClient)`
34+
3. Return that `savedObjectLoader` as part of your public plugin `start` method
35+
36+
### Registering
37+
38+
Ideally, we'd allow plugins to self-register their `savedObjectLoader` and (declare a dependency on this plugin). However, as currently implemented, any plugins that want this plugin to handle their inspect routes need to be added as optional dependencies and registered here.
39+
40+
1. Add your plugin to the `optionalPlugins` array in `./opensearch_dashboards.json`
41+
2. Update the `StartDependencies` interface of this plugin to include the public plugin start type
42+
3. Update `registerServices` to register a new type of `SavedObjectLoader`, where `id` will be the route, `title` will likely match your saved object type, and `service` is your `SavedObjectLoader` that is defined in your plugin start.

src/plugins/saved_objects_management/opensearch_dashboards.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"server": true,
55
"ui": true,
66
"requiredPlugins": ["management", "data"],
7-
"optionalPlugins": ["dashboard", "visualizations", "discover", "home"],
7+
"optionalPlugins": ["dashboard", "visualizations", "discover", "home", "wizard"],
88
"extraPublicDirs": ["public/lib"],
99
"requiredBundles": ["opensearchDashboardsReact", "home"]
1010
}

src/plugins/saved_objects_management/public/plugin.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
import { i18n } from '@osd/i18n';
3232
import { CoreSetup, CoreStart, Plugin } from 'src/core/public';
33+
34+
import { WizardStart } from '../../wizard/public';
3335
import { ManagementSetup } from '../../management/public';
3436
import { DataPublicPluginStart } from '../../data/public';
3537
import { DashboardStart } from '../../dashboard/public';
@@ -69,6 +71,7 @@ export interface StartDependencies {
6971
dashboard?: DashboardStart;
7072
visualizations?: VisualizationsStart;
7173
discover?: DiscoverStart;
74+
wizard?: WizardStart;
7275
}
7376

7477
export class SavedObjectsManagementPlugin

0 commit comments

Comments
 (0)