import React from 'react' ; import { Cases } from './cases' ; import { CaseFeatureNoPermissions } from './feature_no_permissions' ; import { useGetUserCasesPermissions } from '../../hooks/use_get_user_cases_permissions' ; import { usePluginContext } from '../../hooks/use_plugin_context' ; import { useHasData } from '../../hooks/use_has_data' ; import { LoadingObservability } from '../overview/loading_observability' ; import { getNoDataConfig } from '../../utils/no_data_config' ; export const CasesPage = React . memo ( ( ) => { const userPermissions = useGetUserCasesPermissions ( ) ; const { core , ObservabilityPageTemplate } = usePluginContext ( ) ; const { hasAnyData , isAllRequestsComplete } = useHasData ( ) ; if ( ! hasAnyData && ! isAllRequestsComplete ) { return < LoadingObservability />; } const hasData = hasAnyData === true || ( isAllRequestsComplete === false ? undefined : false ) ; const noDataConfig = getNoDataConfig ( { hasData , basePath : core . http . basePath , docsLink : core . docLinks . links . observability . guide , } ) ; return userPermissions == null || userPermissions ?. read ? ( < ObservabilityPageTemplate data - test - subj = { noDataConfig ? 'noDataPage' : undefined } noDataConfig = { noDataConfig } > < Cases userCanCrud = { userPermissions ?. crud ?? false } /> < /ObservabilityPageTemplate>) : (<CaseFeatureNoPermissions / > ) ; } ) ; CasesPage . displayName = 'CasesPage' ;