diff --git a/CHANGELOG.md b/CHANGELOG.md index d7be07729e4d..15bbb40293c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [MD] Tweak multiple data source design doc [#2724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2724) - Corrected README and help command of osd-plugin-helpers ([#2810](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2810)) - Add `current-usage.md` and more details to `README.md` of `charts` plugin ([#2695](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2695)) +- [Doc] Add readme for global query persistence ([#3001](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3001)) ### 🛠 Maintenance diff --git a/src/plugins/opensearch_dashboards_utils/docs/global_query_param.md b/src/plugins/opensearch_dashboards_utils/docs/global_query_param.md index 5fd6ebce02c1..62f3a4f42684 100644 --- a/src/plugins/opensearch_dashboards_utils/docs/global_query_param.md +++ b/src/plugins/opensearch_dashboards_utils/docs/global_query_param.md @@ -1,13 +1,13 @@ # Global query parameters -Current there are five plugins that have implemented global data persistence ability in Opensearch Dashboards, and they are visualize, discover, timeline, dashboards, and vis-builder. Global query parameters include globally pinned filters, time range and time refresh intervals. These parameters are not only persisted across the action of refresh, but also persisted among all the plugins that have global data persistence ability. +As of 12/1/2022, there are five plugins that have implemented global data persistence ability in OpenSearch Dashboards, and they are visualize, discover, Timeline, dashboards, and vis-builder. Global query parameters include globally pinned filters, time range and time refresh intervals. These parameters are not only persisted across the action of refresh, but also persisted among all the plugins that have global data persistence ability. For example, we set a specific time range and time refresh interval when trying to a new visualization. When we navigate to the dashboard page, we can see the previous time range and time refresh interval that are set within the visualization app are still there. However, when we create a filter, it will only be persisted within that specific plugin since it is not a global filter. We can make a filter become a global filter by selecting `Pin across all apps`. Only global filters are persisted across all other globally persistent plugins within the application. # Steps to add global data persistence ability to a plugin -1. Call [`createOsdUrlTracker()`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/051656069a5b319f114416c6657af43358b92fae/src/plugins/opensearch_dashboards_utils/public/state_management/url/osd_url_tracker.ts#L68) in the set up function within public/plugin.ts +1. Call [`createOsdUrlTracker()`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/opensearch_dashboards_utils/public/state_management/url/osd_url_tracker.ts) in the set up function within public/plugin.ts * declare two private variables: `appStateUpdater` observable and `stopUrlTracking()` ```ts private appStateUpdater = new BehaviorSubject(() => ({})); @@ -51,7 +51,7 @@ For example, we set a specific time range and time refresh interval when trying }; ``` -2. Set [`osdUrlStateStorage()`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/051656069a5b319f114416c6657af43358b92fae/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync_state_storage/create_osd_url_state_storage.ts#L83) service +2. Set [`osdUrlStateStorage()`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync_state_storage/create_osd_url_state_storage.ts#L83) service * when setting the plugin services, set osdUrlStateStorage service by calling `createOsdUrlStateStorage()` with the current history, useHash and withNotifyErrors ```ts @@ -91,9 +91,10 @@ For example, we set a specific time range and time refresh interval when trying }, [query, osdUrlStateStorage, pathname]); ``` - 4. If not, add query services from data plugin +4. If not already, add query services from data plugin * in public/plugin_services.ts, add query services - + ```ts export const [getQueryService, setQueryService] = createGetterSetter('Query'); ``` +