mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[SecuritySolution] Render the security solution's default empty page when no index is available (#225282)
Render the EmptyPrompt from the priv mon page if no index is available.
This commit is contained in:
parent
33a0f44c8d
commit
6a791fa179
1 changed files with 42 additions and 20 deletions
|
@ -4,7 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import React, { useCallback, useEffect, useReducer } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo, useReducer } from 'react';
|
||||
import {
|
||||
EuiButtonEmpty,
|
||||
EuiEmptyPrompt,
|
||||
|
@ -37,6 +37,8 @@ import { HeaderPage } from '../../common/components/header_page';
|
|||
import { useEntityAnalyticsRoutes } from '../api/api';
|
||||
import { usePrivilegedMonitoringEngineStatus } from '../api/hooks/use_privileged_monitoring_engine_status';
|
||||
import { PrivilegedUserMonitoringManageDataSources } from '../components/privileged_user_monitoring_manage_data_sources';
|
||||
import { EmptyPrompt } from '../../common/components/empty_prompt';
|
||||
import { useDataView } from '../../data_view_manager/hooks/use_data_view';
|
||||
|
||||
type PageState =
|
||||
| { type: 'fetchingEngineStatus' }
|
||||
|
@ -100,11 +102,26 @@ export const EntityAnalyticsPrivilegedUserMonitoringPage = () => {
|
|||
const { initPrivilegedMonitoringEngine } = useEntityAnalyticsRoutes();
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
|
||||
const { sourcererDataView: oldSourcererDataView } = useSourcererDataView();
|
||||
const {
|
||||
indicesExist: oldIndicesExist,
|
||||
loading: oldIsSourcererLoading,
|
||||
sourcererDataView: oldSourcererDataViewSpec,
|
||||
} = useSourcererDataView();
|
||||
const newDataViewPickerEnabled = useIsExperimentalFeatureEnabled('newDataViewPickerEnabled');
|
||||
const { dataView, status } = useDataView();
|
||||
const { dataViewSpec } = useDataViewSpec();
|
||||
|
||||
const sourcererDataView = newDataViewPickerEnabled ? dataViewSpec : oldSourcererDataView;
|
||||
const isSourcererLoading = useMemo(
|
||||
() => (newDataViewPickerEnabled ? status !== 'ready' : oldIsSourcererLoading),
|
||||
[newDataViewPickerEnabled, oldIsSourcererLoading, status]
|
||||
);
|
||||
|
||||
const indicesExist = useMemo(
|
||||
() => (newDataViewPickerEnabled ? !!dataView?.matchedIndices?.length : oldIndicesExist),
|
||||
[dataView?.matchedIndices?.length, newDataViewPickerEnabled, oldIndicesExist]
|
||||
);
|
||||
|
||||
const sourcererDataView = newDataViewPickerEnabled ? dataViewSpec : oldSourcererDataViewSpec;
|
||||
const engineStatus = usePrivilegedMonitoringEngineStatus();
|
||||
const initEngineCallBack = useCallback(
|
||||
async (userCount: number) => {
|
||||
|
@ -163,6 +180,10 @@ export const EntityAnalyticsPrivilegedUserMonitoringPage = () => {
|
|||
min-height: calc(100vh - 240px);
|
||||
`;
|
||||
|
||||
if (!indicesExist) {
|
||||
return <EmptyPrompt />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{state.type === 'dashboard' && (
|
||||
|
@ -172,23 +193,24 @@ export const EntityAnalyticsPrivilegedUserMonitoringPage = () => {
|
|||
)}
|
||||
|
||||
<SecuritySolutionPageWrapper>
|
||||
{state.type === 'fetchingEngineStatus' && (
|
||||
<>
|
||||
<HeaderPage
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.entityAnalytics.privilegedUserMonitoring.dashboards.pageTitle"
|
||||
defaultMessage="Privileged user monitoring"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<EuiFlexGroup alignItems="center" justifyContent="center" css={fullHeightCSS}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiLoadingLogo logo="logoSecurity" size="xl" />
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</>
|
||||
)}
|
||||
{state.type === 'fetchingEngineStatus' ||
|
||||
(isSourcererLoading && (
|
||||
<>
|
||||
<HeaderPage
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.entityAnalytics.privilegedUserMonitoring.dashboards.pageTitle"
|
||||
defaultMessage="Privileged user monitoring"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<EuiFlexGroup alignItems="center" justifyContent="center" css={fullHeightCSS}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiLoadingLogo logo="logoSecurity" size="xl" />
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</>
|
||||
))}
|
||||
|
||||
{state.type === 'onboarding' && (
|
||||
<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue