Skip to content

Commit

Permalink
Add code that will work for settings link even outside uptime app.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed May 15, 2020
1 parent c2ad6d0 commit f8e3c7e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiLink } from '@elastic/eui';
import { EuiExpression, EuiPopover } from '@elastic/eui';
import { Link } from 'react-router-dom';
import React, { useState } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { SETTINGS_ROUTE } from '../../../../common/constants';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';

interface SettingsMessageExpressionPopoverProps {
'aria-label': string;
Expand All @@ -25,6 +25,8 @@ export const SettingsMessageExpressionPopover: React.FC<SettingsMessageExpressio
value,
id,
}) => {
const kibana = useKibana();
const path = kibana.services?.application?.getUrlForApp('uptime', { path: 'settings' });
const [isOpen, setIsOpen] = useState(false);
return (
<EuiPopover
Expand All @@ -50,7 +52,7 @@ export const SettingsMessageExpressionPopover: React.FC<SettingsMessageExpressio
settingsPageLink: (
// this link is wrapped around a span so we can also change the UI state
// and hide the alert flyout before triggering the navigation to the settings page
<Link to={SETTINGS_ROUTE} data-test-subj="xpack.uptime.alerts.tlsFlyout.linkToSettings">
<EuiLink href={path} data-test-subj="xpack.uptime.alerts.tlsFlyout.linkToSettings">
<span
onClick={() => {
setAlertFlyoutVisible(false);
Expand All @@ -63,7 +65,7 @@ export const SettingsMessageExpressionPopover: React.FC<SettingsMessageExpressio
>
settings page
</span>
</Link>
</EuiLink>
),
}}
/>
Expand Down

0 comments on commit f8e3c7e

Please sign in to comment.