From f9db07dcc2b7b015169d4e4fd666bbd765ba6434 Mon Sep 17 00:00:00 2001 From: Vassilis Asteriou Date: Sat, 3 Aug 2019 12:19:53 +0300 Subject: [PATCH 1/4] Dashboard help menu --- .../public/dashboard/help_menu/help_menu.js | 42 +++++++++++++++++++ .../dashboard/help_menu/help_menu_util.js | 31 ++++++++++++++ .../kibana/public/dashboard/index.js | 3 ++ 3 files changed, 76 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 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 3eff43db2fd9d6..5993c723a81fce 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/index.js +++ b/src/legacy/core_plugins/kibana/public/dashboard/index.js @@ -38,6 +38,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'; // load directives import '../../../data/public'; @@ -55,6 +56,7 @@ function createNewDashboardCtrl($scope) { $scope.visitVisualizeAppLinkText = i18n.translate('kbn.dashboard.visitVisualizeAppLinkText', { defaultMessage: 'visit the Visualize app', }); + addHelpMenuToAppChrome(chrome); } uiRoutes @@ -107,6 +109,7 @@ uiRoutes defaultMessage: 'Dashboards', }), }]); + addHelpMenuToAppChrome(chrome); }, resolve: { dash: function ($route, Private, redirectWhenMissing, kbnUrl) { From 27374d73482d069a1c7218fed82f161927227f2e Mon Sep 17 00:00:00 2001 From: Vassilis Asteriou Date: Sat, 3 Aug 2019 12:53:57 +0300 Subject: [PATCH 2/4] Discover help menu --- .../components/help_menu/help_menu.js | 42 +++++++++++++++++++ .../components/help_menu/help_menu_util.js | 31 ++++++++++++++ .../public/discover/controllers/discover.js | 3 ++ 3 files changed, 76 insertions(+) create mode 100644 src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js create mode 100644 src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu_util.js diff --git a/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js b/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js new file mode 100644 index 00000000000000..0298156884d618 --- /dev/null +++ b/src/legacy/core_plugins/kibana/public/discover/components/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/discover/components/help_menu/help_menu_util.js b/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu_util.js new file mode 100644 index 00000000000000..aeabff2d97007b --- /dev/null +++ b/src/legacy/core_plugins/kibana/public/discover/components/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/discover/controllers/discover.js b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js index 377fd72e9c7713..290b92a395e00c 100644 --- a/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js @@ -70,6 +70,7 @@ import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_s import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../breadcrumbs'; import { buildVislibDimensions } from 'ui/visualize/loader/pipeline_helpers/build_pipeline'; import 'ui/capabilities/route_setup'; +import { addHelpMenuToAppChrome } from '../components/help_menu/help_menu_util'; const fetchStatuses = { UNINITIALIZED: 'uninitialized', @@ -1027,5 +1028,7 @@ function discoverController( return; } + addHelpMenuToAppChrome(chrome); + init(); } From 8f7eaca05a5b9b30a228125afcb9da7afcaeabd9 Mon Sep 17 00:00:00 2001 From: Vassilis Asteriou Date: Mon, 5 Aug 2019 11:28:58 +0300 Subject: [PATCH 3/4] Visualize help menu --- .../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 | 3 ++ 4 files changed, 79 insertions(+) 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/visualize/editor/editor.js b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js index 6db6e2c9ad1c9b..3668024947f82d 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'; uiRoutes @@ -558,5 +559,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..037e1c8dfa7aa3 --- /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 b321dd4d8297ee..73afccf2a288ad 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,7 @@ import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; import chrome from 'ui/chrome'; import { wrapInI18nContext } from 'ui/i18n'; import { toastNotifications } from 'ui/notify'; +import { addHelpMenuToAppChrome } from '../help_menu/help_menu_util'; import { VisualizeListingTable } from './visualize_listing_table'; import { NewVisModal } from '../wizard/new_vis_modal'; @@ -111,4 +112,6 @@ export function VisualizeListingController($injector, createNewVis) { }]); this.listingLimit = config.get('savedObjects:listingLimit'); + + addHelpMenuToAppChrome(chrome); } From 33deab1b05de91655c3885cd1654c4825820d9d4 Mon Sep 17 00:00:00 2001 From: Vassilis Asteriou Date: Mon, 5 Aug 2019 11:46:45 +0300 Subject: [PATCH 4/4] Fixed formatted message ids --- .../kibana/public/discover/components/help_menu/help_menu.js | 2 +- .../core_plugins/kibana/public/visualize/help_menu/help_menu.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js b/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js index 0298156884d618..95db1b686f7aaa 100644 --- a/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js +++ b/src/legacy/core_plugins/kibana/public/discover/components/help_menu/help_menu.js @@ -34,7 +34,7 @@ export class HelpMenu extends PureComponent { href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/discover.html`} target="_blank" > - + ); 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 index 037e1c8dfa7aa3..d95f7ea85c5db2 100644 --- 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 @@ -34,7 +34,7 @@ export class HelpMenu extends PureComponent { href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/visualize.html`} target="_blank" > - + );