Skip to content

Commit

Permalink
Add link to advanced setting in Discover (#101154)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Tim Roes and kibanamachine committed Jun 7, 2021
1 parent 2a71047 commit f10f25d
Showing 1 changed file with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@ import ReactDOM from 'react-dom';
import { I18nStart } from 'kibana/public';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiSpacer, EuiButton, EuiText, EuiWrappingPopover, EuiCode } from '@elastic/eui';
import {
EuiSpacer,
EuiButton,
EuiText,
EuiWrappingPopover,
EuiCode,
EuiHorizontalRule,
EuiButtonEmpty,
EuiTextAlign,
} from '@elastic/eui';
import { getServices } from '../../../kibana_services';
import './open_options_popover.scss';
import { DOC_TABLE_LEGACY } from '../../../../common';

const container = document.createElement('div');
let isOpen = false;

interface OptionsPopoverProps {
Expand Down Expand Up @@ -77,11 +87,29 @@ export function OptionsPopover(props: OptionsPopoverProps) {
defaultMessage: 'Get started',
})}
</EuiButton>
<EuiHorizontalRule margin="s" />
<EuiTextAlign textAlign="center">
<EuiButtonEmpty
iconType="gear"
size="s"
href={addBasePath(`/app/management/kibana/settings?query=category:(discover)`)}
>
{i18n.translate('discover.openOptionsPopover.gotToAllSettings', {
defaultMessage: 'All Discover options',
})}
</EuiButtonEmpty>
</EuiTextAlign>
</div>
</EuiWrappingPopover>
);
}

function onClose() {
ReactDOM.unmountComponentAtNode(container);
document.body.removeChild(container);
isOpen = false;
}

export function openOptionsPopover({
I18nContext,
anchorElement,
Expand All @@ -90,17 +118,11 @@ export function openOptionsPopover({
anchorElement: HTMLElement;
}) {
if (isOpen) {
onClose();
return;
}

isOpen = true;
const container = document.createElement('div');
const onClose = () => {
ReactDOM.unmountComponentAtNode(container);
document.body.removeChild(container);
isOpen = false;
};

document.body.appendChild(container);

const element = (
Expand Down

0 comments on commit f10f25d

Please sign in to comment.