mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Hide APM alerting menu if alerting plugin is disabled (#61907) * Hide APM alerting menu if alerting plugin is disabled Checks for presence of plugin and does not display the link if the plugin is disabled. Use `xpack.alerting.enabled: false` in config/kibana.dev.yml to try it. Fixes #61048. * Remove duplicate import Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
b9c999ae80
commit
eaeac31b12
2 changed files with 18 additions and 14 deletions
|
@ -28,8 +28,10 @@ export function ServiceDetails({ tab }: Props) {
|
|||
const canSaveAlerts = !!plugin.core.application.capabilities.apm[
|
||||
'alerting:save'
|
||||
];
|
||||
const isAlertingPluginEnabled = 'alerting' in plugin.plugins;
|
||||
|
||||
const isAlertingAvailable = canReadAlerts || canSaveAlerts;
|
||||
const isAlertingAvailable =
|
||||
isAlertingPluginEnabled && (canReadAlerts || canSaveAlerts);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
|
@ -4,48 +4,49 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { ApmRoute } from '@elastic/apm-rum-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Route, Router, Switch } from 'react-router-dom';
|
||||
import { ApmRoute } from '@elastic/apm-rum-react';
|
||||
import styled from 'styled-components';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { AlertType } from '../../../../../plugins/apm/common/alert_types';
|
||||
import {
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
Plugin,
|
||||
PluginInitializerContext
|
||||
} from '../../../../../../src/core/public';
|
||||
import { featureCatalogueEntry } from './featureCatalogueEntry';
|
||||
import { DataPublicPluginSetup } from '../../../../../../src/plugins/data/public';
|
||||
import { HomePublicPluginSetup } from '../../../../../../src/plugins/home/public';
|
||||
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
|
||||
import { PluginSetupContract as AlertingPluginPublicSetup } from '../../../../../plugins/alerting/public';
|
||||
import { AlertType } from '../../../../../plugins/apm/common/alert_types';
|
||||
import { LicensingPluginSetup } from '../../../../../plugins/licensing/public';
|
||||
import {
|
||||
AlertsContextProvider,
|
||||
TriggersAndActionsUIPublicPluginSetup
|
||||
} from '../../../../../plugins/triggers_actions_ui/public';
|
||||
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
|
||||
import { routes } from '../components/app/Main/route_config';
|
||||
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
|
||||
import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs';
|
||||
import { ErrorRateAlertTrigger } from '../components/shared/ErrorRateAlertTrigger';
|
||||
import { TransactionDurationAlertTrigger } from '../components/shared/TransactionDurationAlertTrigger';
|
||||
import { ApmPluginContext } from '../context/ApmPluginContext';
|
||||
import { LicenseProvider } from '../context/LicenseContext';
|
||||
import { LoadingIndicatorProvider } from '../context/LoadingIndicatorContext';
|
||||
import { LocationProvider } from '../context/LocationContext';
|
||||
import { MatchedRouteProvider } from '../context/MatchedRouteContext';
|
||||
import { UrlParamsProvider } from '../context/UrlParamsContext';
|
||||
import { createCallApmApi } from '../services/rest/createCallApmApi';
|
||||
import { createStaticIndexPattern } from '../services/rest/index_pattern';
|
||||
import { px, unit, units } from '../style/variables';
|
||||
import { history } from '../utils/history';
|
||||
import { featureCatalogueEntry } from './featureCatalogueEntry';
|
||||
import { getConfigFromInjectedMetadata } from './getConfigFromInjectedMetadata';
|
||||
import { setHelpExtension } from './setHelpExtension';
|
||||
import { toggleAppLinkInNav } from './toggleAppLinkInNav';
|
||||
import { setReadonlyBadge } from './updateBadge';
|
||||
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
|
||||
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
|
||||
import {
|
||||
TriggersAndActionsUIPublicPluginSetup,
|
||||
AlertsContextProvider
|
||||
} from '../../../../../plugins/triggers_actions_ui/public';
|
||||
import { ErrorRateAlertTrigger } from '../components/shared/ErrorRateAlertTrigger';
|
||||
import { TransactionDurationAlertTrigger } from '../components/shared/TransactionDurationAlertTrigger';
|
||||
import { createCallApmApi } from '../services/rest/createCallApmApi';
|
||||
|
||||
export const REACT_APP_ROOT_ID = 'react-apm-root';
|
||||
|
||||
|
@ -75,6 +76,7 @@ export type ApmPluginSetup = void;
|
|||
export type ApmPluginStart = void;
|
||||
|
||||
export interface ApmPluginSetupDeps {
|
||||
alerting?: AlertingPluginPublicSetup;
|
||||
data: DataPublicPluginSetup;
|
||||
home: HomePublicPluginSetup;
|
||||
licensing: LicensingPluginSetup;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue