From 85c532b66d9b0112828c6e5bfe24d5613b4c909b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Oct 2023 23:59:02 +0000 Subject: [PATCH] [Fix] Added documentation link for the dev tools' help menu (#5166) * Add documentation link to dev tool's help menu Signed-off-by: Willie Hung * Add CHANGELOG Signed-off-by: Willie Hung * Edit CHANGELOG message Signed-off-by: Willie Hung * Edit CHANGELOG message Signed-off-by: Willie Hung * Changed new file copyright license Signed-off-by: Willie Hung * Update new snapshots Signed-off-by: Willie Hung --------- Signed-off-by: Willie Hung Co-authored-by: Ashwin P Chandran (cherry picked from commit 60f4c8f767d7ef46ced257d2521f67d36cf62774) Signed-off-by: github-actions[bot] # Conflicts: # CHANGELOG.md --- .../public/doc_links/doc_links_service.ts | 2 ++ .../dashboard_listing.test.tsx.snap | 5 ++++ .../dashboard_top_nav.test.tsx.snap | 6 +++++ src/plugins/dev_tools/public/application.tsx | 4 +++- src/plugins/dev_tools/public/utils/util.ts | 24 +++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/plugins/dev_tools/public/utils/util.ts diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 7dd8c6561ade..0acf4524ab14 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -388,6 +388,8 @@ export class DocLinksService { ganttCharts: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}gantt`, // https://opensearch.org/docs/latest/dashboards/reporting/ reporting: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}reporting`, + // https://opensearch.org/docs/latest/dashboards/dev-tools/index-dev/ + devTools: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}dev-tools/index-dev/`, notebooks: { // https://opensearch.org/docs/latest/dashboards/notebooks/ base: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}notebooks`, diff --git a/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap b/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap index 1b3c486615c8..848106a7fba3 100644 --- a/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap +++ b/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap @@ -794,6 +794,7 @@ exports[`dashboard listing hideWriteControls 1`] = ` "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -1886,6 +1887,7 @@ exports[`dashboard listing render table listing with initial filters from URL 1` "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -3039,6 +3041,7 @@ exports[`dashboard listing renders call to action when no dashboards exist 1`] = "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -4192,6 +4195,7 @@ exports[`dashboard listing renders table rows 1`] = ` "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -5345,6 +5349,7 @@ exports[`dashboard listing renders warning when listingLimit is exceeded 1`] = ` "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap b/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap index 101e0e520304..b0f1abee686a 100644 --- a/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap +++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap @@ -686,6 +686,7 @@ exports[`Dashboard top nav render in embed mode 1`] = ` "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -1603,6 +1604,7 @@ exports[`Dashboard top nav render in embed mode, and force hide filter bar 1`] = "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -2520,6 +2522,7 @@ exports[`Dashboard top nav render in embed mode, components can be forced show b "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -3437,6 +3440,7 @@ exports[`Dashboard top nav render in full screen mode with appended URL param bu "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -4354,6 +4358,7 @@ exports[`Dashboard top nav render in full screen mode, no componenets should be "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", @@ -5271,6 +5276,7 @@ exports[`Dashboard top nav render with all components 1`] = ` "dataSource": Object { "guide": "https://opensearch.org/docs/mocked-test-branch/dashboards/discover/multi-data-sources/", }, + "devTools": "https://opensearch.org/docs/mocked-test-branch/dashboards/dev-tools/index-dev/", "dql": Object { "base": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql", "boolean_query": "https://opensearch.org/docs/mocked-test-branch/dashboards/dql/#boolean-query", diff --git a/src/plugins/dev_tools/public/application.tsx b/src/plugins/dev_tools/public/application.tsx index 8c1c936de646..3b2a8d78ccd6 100644 --- a/src/plugins/dev_tools/public/application.tsx +++ b/src/plugins/dev_tools/public/application.tsx @@ -57,6 +57,7 @@ import { useEffectOnce } from 'react-use'; import { getDataSources } from '../../data_source_management/public/components/utils'; import { DevToolApp } from './dev_tool'; import { DevToolsSetupDependencies } from './plugin'; +import { addHelpMenuToAppChrome } from './utils/util'; interface DevToolsWrapperProps { devTools: readonly DevToolApp[]; @@ -254,7 +255,7 @@ function setBreadcrumbs(chrome: ChromeStart) { } export function renderApp( - { application, chrome, savedObjects, notifications }: CoreStart, + { application, chrome, docLinks, savedObjects, notifications }: CoreStart, element: HTMLElement, history: ScopedHistory, devTools: readonly DevToolApp[], @@ -265,6 +266,7 @@ export function renderApp( return () => {}; } + addHelpMenuToAppChrome(chrome, docLinks); setBadge(application, chrome); setBreadcrumbs(chrome); setTitle(chrome); diff --git a/src/plugins/dev_tools/public/utils/util.ts b/src/plugins/dev_tools/public/utils/util.ts new file mode 100644 index 000000000000..7738e84bd15f --- /dev/null +++ b/src/plugins/dev_tools/public/utils/util.ts @@ -0,0 +1,24 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { i18n } from '@osd/i18n'; +import { CoreStart } from 'opensearch-dashboards/public'; + +export function addHelpMenuToAppChrome( + chrome: CoreStart['chrome'], + docLinks: CoreStart['docLinks'] +) { + chrome.setHelpExtension({ + appName: i18n.translate('devTools.helpMenu.appName', { + defaultMessage: 'Dev Tools', + }), + links: [ + { + linkType: 'documentation', + href: `${docLinks.links.opensearchDashboards.devTools}`, + }, + ], + }); +}