Skip to content

Commit

Permalink
Add Kibana App specific URL to the help menu (#34739) (#42580)
Browse files Browse the repository at this point in the history
* Add Dashboard help menu

* Add Discover help menu

* Add Visualize help menu
  • Loading branch information
VassilisAsteriou authored and maryia-lapata committed Nov 1, 2019
1 parent 1c3f072 commit 56cff7f
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 (
<Fragment>
<EuiHorizontalRule margin="none" />
<EuiSpacer />
<EuiButton
fill
iconType="popout"
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/dashboard.html`}
target="_blank"
>
<FormattedMessage id="kbn.dashboard.helpMenu.docLabel" defaultMessage="Dashboard documentation" />
</EuiButton>
</Fragment>
);
}
}
Original file line number Diff line number Diff line change
@@ -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(<HelpMenu/>, domElement);
return () => {
unmountComponentAtNode(domElement);
};
});
}
3 changes: 3 additions & 0 deletions src/legacy/core_plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -56,6 +57,7 @@ function createNewDashboardCtrl($scope) {
$scope.visitVisualizeAppLinkText = i18n.translate('kbn.dashboard.visitVisualizeAppLinkText', {
defaultMessage: 'visit the Visualize app',
});
addHelpMenuToAppChrome(chrome);
}

uiRoutes
Expand Down Expand Up @@ -108,6 +110,7 @@ uiRoutes
defaultMessage: 'Dashboards',
}),
}]);
addHelpMenuToAppChrome(chrome);
},
resolve: {
dash: function ($route, Private, redirectWhenMissing, kbnUrl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -658,5 +659,7 @@ function VisEditor(
vis.type.feedbackMessage;
};

addHelpMenuToAppChrome(chrome);

init();
}
Original file line number Diff line number Diff line change
@@ -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 (
<Fragment>
<EuiHorizontalRule margin="none" />
<EuiSpacer />
<EuiButton
fill
iconType="popout"
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/visualize.html`}
target="_blank"
>
<FormattedMessage id="kbn.visualize.helpMenu.docLabel" defaultMessage="Visualize documentation" />
</EuiButton>
</Fragment>
);
}
}
Original file line number Diff line number Diff line change
@@ -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(<HelpMenu/>, domElement);
return () => {
unmountComponentAtNode(domElement);
};
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -120,4 +122,6 @@ export function VisualizeListingController($injector, createNewVis) {
]);

this.listingLimit = config.get('savedObjects:listingLimit');

addHelpMenuToAppChrome(chrome);
}

0 comments on commit 56cff7f

Please sign in to comment.