Skip to content

Commit

Permalink
[Metrics UI] Fix alert management to open without refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Jul 29, 2020
1 parent dd605c4 commit 340f01a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { useAlertPrefillContext } from '../../../alerting/use_alert_prefill';
import { AlertFlyout } from './alert_flyout';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
import { ManageAlertsContextMenuItem } from './manage_alerts_context_menu_item';

export const InventoryAlertDropdown = () => {
const [popoverOpen, setPopoverOpen] = useState(false);
Expand All @@ -35,15 +36,7 @@ export const InventoryAlertDropdown = () => {
defaultMessage="Create alert"
/>
</EuiContextMenuItem>,
<EuiContextMenuItem
icon="tableOfContents"
key="manageLink"
href={kibana.services?.application?.getUrlForApp(
'management/insightsAndAlerting/triggersActions/alerts'
)}
>
<FormattedMessage id="xpack.infra.alerting.manageAlerts" defaultMessage="Manage alerts" />
</EuiContextMenuItem>,
<ManageAlertsContextMenuItem />,
];
/* eslint-disable-next-line react-hooks/exhaustive-deps */
}, [kibana.services]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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 { EuiContextMenuItem } from '@elastic/eui';
import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { useLinkProps } from '../../../hooks/use_link_props';

export const ManageAlertsContextMenuItem = () => {
const manageAlertsLinkProps = useLinkProps({
app: 'management',
pathname: '/insightsAndAlerting/triggersActions/alerts',
});
return (
<EuiContextMenuItem icon="tableOfContents" key="manageLink" {...manageAlertsLinkProps}>
<FormattedMessage id="xpack.infra.alerting.manageAlerts" defaultMessage="Manage alerts" />
</EuiContextMenuItem>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
import { useAlertPrefillContext } from '../../use_alert_prefill';
import { AlertFlyout } from './alert_flyout';
import { ManageAlertsContextMenuItem } from '../../inventory/components/manage_alerts_context_menu_item';

export const MetricsAlertDropdown = () => {
const [popoverOpen, setPopoverOpen] = useState(false);
Expand All @@ -35,15 +36,7 @@ export const MetricsAlertDropdown = () => {
defaultMessage="Create alert"
/>
</EuiContextMenuItem>,
<EuiContextMenuItem
icon="tableOfContents"
key="manageLink"
href={kibana.services?.application?.getUrlForApp(
'management/insightsAndAlerting/triggersActions/alerts'
)}
>
<FormattedMessage id="xpack.infra.alerting.manageAlerts" defaultMessage="Manage alerts" />
</EuiContextMenuItem>,
<ManageAlertsContextMenuItem />,
];
/* eslint-disable-next-line react-hooks/exhaustive-deps */
}, [kibana.services]);
Expand Down

0 comments on commit 340f01a

Please sign in to comment.