From 56cff7f781625a56154f14fc9234dd505f1510c4 Mon Sep 17 00:00:00 2001 From: VassilisAsteriou <32526516+VassilisAsteriou@users.noreply.github.com> Date: Mon, 12 Aug 2019 10:31:14 +0300 Subject: [PATCH] Add Kibana App specific URL to the help menu (#34739) (#42580) * Add Dashboard help menu * Add Discover help menu * Add Visualize help menu --- .../public/dashboard/help_menu/help_menu.js | 42 +++++++++++++++++++ .../dashboard/help_menu/help_menu_util.js | 31 ++++++++++++++ .../kibana/public/dashboard/index.js | 3 ++ .../kibana/public/visualize/editor/editor.js | 3 ++ .../public/visualize/help_menu/help_menu.js | 42 +++++++++++++++++++ .../visualize/help_menu/help_menu_util.js | 31 ++++++++++++++ .../visualize/listing/visualize_listing.js | 4 ++ 7 files changed, 156 insertions(+) create mode 100644 src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu.js create mode 100644 src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu_util.js create mode 100644 src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu.js create mode 100644 src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu_util.js diff --git a/src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu.js b/src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu.js new file mode 100644 index 00000000000000..56b2bd253381c7 --- /dev/null +++ b/src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu.js @@ -0,0 +1,42 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { Fragment, PureComponent } from 'react'; +import { EuiButton, EuiHorizontalRule, EuiSpacer } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links'; + +export class HelpMenu extends PureComponent { + render() { + return ( + + + + + + + + ); + } +} diff --git a/src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu_util.js b/src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu_util.js new file mode 100644 index 00000000000000..aeabff2d97007b --- /dev/null +++ b/src/legacy/core_plugins/kibana/public/dashboard/help_menu/help_menu_util.js @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { render, unmountComponentAtNode } from 'react-dom'; +import { HelpMenu } from './help_menu'; + +export function addHelpMenuToAppChrome(chrome) { + chrome.helpExtension.set(domElement => { + render(, domElement); + return () => { + unmountComponentAtNode(domElement); + }; + }); +} diff --git a/src/legacy/core_plugins/kibana/public/dashboard/index.js b/src/legacy/core_plugins/kibana/public/dashboard/index.js index 31e7f58649d382..712e05c92e5e8b 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/index.js +++ b/src/legacy/core_plugins/kibana/public/dashboard/index.js @@ -37,6 +37,7 @@ import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_regis import { DashboardListing, EMPTY_FILTER } from './listing/dashboard_listing'; import { uiModules } from 'ui/modules'; import 'ui/capabilities/route_setup'; +import { addHelpMenuToAppChrome } from './help_menu/help_menu_util'; import { npStart } from 'ui/new_platform'; @@ -56,6 +57,7 @@ function createNewDashboardCtrl($scope) { $scope.visitVisualizeAppLinkText = i18n.translate('kbn.dashboard.visitVisualizeAppLinkText', { defaultMessage: 'visit the Visualize app', }); + addHelpMenuToAppChrome(chrome); } uiRoutes @@ -108,6 +110,7 @@ uiRoutes defaultMessage: 'Dashboards', }), }]); + addHelpMenuToAppChrome(chrome); }, resolve: { dash: function ($route, Private, redirectWhenMissing, kbnUrl) { diff --git a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js index 6f402ad59e38da..2ad7b420e316a4 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js @@ -54,6 +54,7 @@ import { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal'; import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal'; import { getEditBreadcrumbs, getCreateBreadcrumbs } from '../breadcrumbs'; import { npStart } from 'ui/new_platform'; +import { addHelpMenuToAppChrome } from '../help_menu/help_menu_util'; import { extractTimeFilter, changeTimeFilter } from '../../../../data/public'; import { start as data } from '../../../../data/public/legacy'; @@ -658,5 +659,7 @@ function VisEditor( vis.type.feedbackMessage; }; + addHelpMenuToAppChrome(chrome); + init(); } diff --git a/src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu.js b/src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu.js new file mode 100644 index 00000000000000..d95f7ea85c5db2 --- /dev/null +++ b/src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu.js @@ -0,0 +1,42 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { Fragment, PureComponent } from 'react'; +import { EuiButton, EuiHorizontalRule, EuiSpacer } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links'; + +export class HelpMenu extends PureComponent { + render() { + return ( + + + + + + + + ); + } +} diff --git a/src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu_util.js b/src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu_util.js new file mode 100644 index 00000000000000..aeabff2d97007b --- /dev/null +++ b/src/legacy/core_plugins/kibana/public/visualize/help_menu/help_menu_util.js @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { render, unmountComponentAtNode } from 'react-dom'; +import { HelpMenu } from './help_menu'; + +export function addHelpMenuToAppChrome(chrome) { + chrome.helpExtension.set(domElement => { + render(, domElement); + return () => { + unmountComponentAtNode(domElement); + }; + }); +} diff --git a/src/legacy/core_plugins/kibana/public/visualize/listing/visualize_listing.js b/src/legacy/core_plugins/kibana/public/visualize/listing/visualize_listing.js index 54162e8f802218..ab4b0e1cfc28bf 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/listing/visualize_listing.js +++ b/src/legacy/core_plugins/kibana/public/visualize/listing/visualize_listing.js @@ -25,6 +25,8 @@ import chrome from 'ui/chrome'; import { wrapInI18nContext } from 'ui/i18n'; import { toastNotifications } from 'ui/notify'; import { SavedObjectsClientProvider } from 'ui/saved_objects'; +import { addHelpMenuToAppChrome } from '../help_menu/help_menu_util'; + import { VisualizeListingTable } from './visualize_listing_table'; import { NewVisModal } from '../wizard/new_vis_modal'; import { VisualizeConstants } from '../visualize_constants'; @@ -120,4 +122,6 @@ export function VisualizeListingController($injector, createNewVis) { ]); this.listingLimit = config.get('savedObjects:listingLimit'); + + addHelpMenuToAppChrome(chrome); }