Skip to content

Commit

Permalink
Only show UI hint if CCS is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
miltonhultgren committed Sep 15, 2022
1 parent 77dd26f commit 353ecb8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface ExternalConfig {
showCgroupMetricsLogstash: boolean;
renderReactApp: boolean;
staleStatusThresholdSeconds: number;
isCcsEnabled: boolean;
}

export const ExternalConfigContext = createContext({} as ExternalConfig);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { useState } from 'react';
import React, { useContext, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiPanel, EuiCallOut, EuiButton } from '@elastic/eui';
Expand All @@ -14,8 +14,10 @@ import { Redirect } from 'react-router-dom';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ComponentProps } from '../../route_init';
import { MonitoringStartPluginDependencies } from '../../../types';
import { ExternalConfigContext } from '../../contexts/external_config_context';

export const AccessDeniedPage: React.FC<ComponentProps> = () => {
const { isCcsEnabled } = useContext(ExternalConfigContext);
const { services } = useKibana<MonitoringStartPluginDependencies>();
const [hasAccess, setHasAccess] = useState<boolean>(false);

Expand Down Expand Up @@ -62,12 +64,14 @@ export const AccessDeniedPage: React.FC<ComponentProps> = () => {
the monitoring cluster."
/>
</p>
<p>
<FormattedMessage
id="xpack.monitoring.accessDenied.noRemoteClusterClientDescription"
defaultMessage="If the setting `monitoring.ui.ccs.enabled` is set to `true`, make sure your cluster has the `remote_cluster_client` role on at least one node."
/>
</p>
{isCcsEnabled && (
<p>
<FormattedMessage
id="xpack.monitoring.accessDenied.noRemoteClusterClientDescription"
defaultMessage="Since Cross Cluster Search is enabled (`monitoring.ui.ccs.enabled` is set to `true`), make sure your cluster has the `remote_cluster_client` role on at least one node."
/>
</p>
)}
<p>
<EuiButton href="../app/home">
<FormattedMessage
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/monitoring/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export class MonitoringPlugin
'staleStatusThresholdSeconds',
monitoring.ui.kibana.reporting.stale_status_threshold_seconds,
],
['isCcsEnabled', monitoring.ui.ccs.enabled],
];
}

Expand Down

0 comments on commit 353ecb8

Please sign in to comment.