Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Add help menu #32561

Merged
merged 5 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions x-pack/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { timefilter } from 'ui/timefilter';
import { Provider } from 'react-redux';
import { createMapStore } from '../store/store';
import { GisMap } from '../components/gis_map';
import { addHelpMenuToAppChrome } from '../help_menu_util';
import {
setSelectedLayer,
setRefreshConfig,
Expand Down Expand Up @@ -208,6 +209,8 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
{ text: $scope.map.title }
]);

addHelpMenuToAppChrome(chrome);

async function doSave(saveOptions) {
await store.dispatch(clearTransientLayerStateAndCloseFlyout());
savedMap.syncWithStore(store.getState());
Expand Down
17 changes: 17 additions & 0 deletions x-pack/plugins/maps/public/help_menu_util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { HelpMenu } from './shared/components/help_menu';

export function addHelpMenuToAppChrome(chrome) {
chrome.helpExtension.set(domElement => {
render(<HelpMenu/>, domElement);
return () => {
unmountComponentAtNode(domElement);
};
});
}
37 changes: 37 additions & 0 deletions x-pack/plugins/maps/public/shared/components/help_menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { Fragment, PureComponent } from 'react';
import { EuiButton, EuiHorizontalRule, EuiSpacer, EuiLink } from '@elastic/eui';
import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

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}/maps.html`} target="_blank">
<FormattedMessage
id="xpack.maps.helpMenu.docLabel"
defaultMessage="Maps documentation"
/>
</EuiButton>
<EuiSpacer />
<EuiLink
href="https://github.com/elastic/kibana/issues/new"
target="_blank"
>
{i18n.translate('xpack.maps.helpMenu.feedbackLinkText', {
defaultMessage: 'Provide feedback for the Maps application'
})}
</EuiLink>
</Fragment>
);
}
}
3 changes: 3 additions & 0 deletions x-pack/plugins/maps/public/shared/components/map_listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { addHelpMenuToAppChrome } from '../../help_menu_util';
import chrome from 'ui/chrome';

export const EMPTY_FILTER = '';

Expand Down Expand Up @@ -55,6 +57,7 @@ export class MapListing extends React.Component {

componentDidMount() {
this.fetchItems();
addHelpMenuToAppChrome(chrome);
}

debouncedFetch = _.debounce(async (filter) => {
Expand Down