-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update from CPTNB/OpenSearch-Dashboards@6487f13
- Loading branch information
CPTNB
committed
Aug 8, 2022
1 parent
3d4cde9
commit 3fd6a7d
Showing
3 changed files
with
86 additions
and
0 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
42 changes: 42 additions & 0 deletions
42
upstream_readmes/src/plugins/saved_objects_management/README.md
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 @@ | ||
# Saved objects management | ||
|
||
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. | ||
|
||
From the primary UI page, this plugin allows you to: | ||
1. Search/view/delete saved objects and their relationships | ||
2. Import/export saved objects | ||
3. Inspect/edit raw saved object values without validation | ||
|
||
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). | ||
|
||
## Making a new saved object type manageable | ||
|
||
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) | ||
2. Register saved object type via `core.savedObjects.registerType(...)` as part of plugin server setup method | ||
3. Implement a way to save the object (e.g. via `savedObjectsClient.create(...)` or a `savedObjectLoader`) | ||
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`) | ||
|
||
## Enabling edit links from saved objects management | ||
|
||
1. Make sure `management.getInAppUrl` method of the `SavedObjectsType` is defined with a `path` (which will specify the link target) and the `uiCapabilitiesPath` | ||
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 | ||
3. Create default plugin capabilities provider | ||
4. Register plugin capabilities via `core.capabilities.registerProvider(...);` as part of plugin server setup method | ||
|
||
## Using saved objects management to inspect/edit new plugin objects | ||
|
||
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. | ||
|
||
### Creating `savedObjectLoader` | ||
|
||
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`. | ||
2. Create a `savedObjectLoader` creation function that returns a `new SavedObjectLoader(YourSavedObjectClass, savedObjectsClient)` | ||
3. Return that `savedObjectLoader` as part of your public plugin `start` method | ||
|
||
### Registering | ||
|
||
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. | ||
|
||
1. Add your plugin to the `optionalPlugins` array in `./opensearch_dashboards.json` | ||
2. Update the `StartDependencies` interface of this plugin to include the public plugin start type | ||
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. |
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,36 @@ | ||
# Wizard | ||
|
||
An OpenSearch Dashboards plugin for a visualization experience that makes exploring data and creating visualizations much easier. It will act as an additional way to create visualizations alongside the exiting tools within the current visualizations plugin. The tool will be incremental to the visualization tools available to users in OpenSearch Dashboards today. | ||
|
||
## Usage | ||
|
||
To use this plugin, navigate to: | ||
|
||
Visualize -> Create Visualization -> Wizard | ||
|
||
## Add a visualization | ||
|
||
All new visualizations currently reside in [public/visualizations](./public/visualizations). To add a new one, create a new visualization directory and add the required code (below) to setup and register a new vis type. | ||
|
||
### Anatomy of a visualization | ||
|
||
``` | ||
metric/ | ||
├─ index.ts | ||
├─ metric_viz_type.ts | ||
├─ to_expression.ts | ||
├─ components/ | ||
├─ metric_viz_options.tsx | ||
``` | ||
|
||
Outline: | ||
- `index.ts`: Exposes the `create<Viz>Config` function that is used to register the viz type | ||
- `<vizName>_viz_type.ts`: Contains the config that the type service needs to register the new vis type | ||
- `to_expression.ts`: The expression function that the plugin will use to render the visualization given the state of the plugin | ||
- `<vizName>_viz_options.tsx`: The component that will render the other properties that user can set in the `Style` tab | ||
|
||
**Notes:** | ||
|
||
- Currently only the metric viz is defined, so schema properties that other vis types might need may be missing and require further setup. | ||
- `to_expression` has not yet been abstracted into a common utility for different visualizations. Adding more visualization types should make it easier to identify which parts of expression creation are common, and which are visualization-specific. | ||
|