Skip to content

Commit

Permalink
adjusting overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Jun 29, 2023
1 parent 3a7eae1 commit 82a51a7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AnalyticsPanel } from './analytics_panel';
import { AnomalyTimelineService } from '../../services/anomaly_timeline_service';
import { mlResultsServiceProvider } from '../../services/results_service';
import { useMlKibana } from '../../contexts/kibana';
import { usePermissionCheck } from '../../capabilities/check_capabilities';

interface Props {
createAnomalyDetectionJobDisabled: boolean;
Expand All @@ -32,6 +33,8 @@ export const OverviewContent: FC<Props> = ({
},
} = useMlKibana();

const [isADEnabled, isDFAEnabled] = usePermissionCheck(['isADEnabled', 'isDFAEnabled']);

const timefilter = useTimefilter();

const [anomalyTimelineService, setAnomalyTimelineService] = useState<AnomalyTimelineService>();
Expand All @@ -49,12 +52,17 @@ export const OverviewContent: FC<Props> = ({

return (
<>
<AnomalyDetectionPanel
anomalyTimelineService={anomalyTimelineService}
setLazyJobCount={setAdLazyJobCount}
/>
<EuiSpacer size="m" />
<AnalyticsPanel setLazyJobCount={setDfaLazyJobCount} />
{isADEnabled ? (
<>
<AnomalyDetectionPanel
anomalyTimelineService={anomalyTimelineService}
setLazyJobCount={setAdLazyJobCount}
/>
<EuiSpacer size="m" />
</>
) : null}

{isDFAEnabled ? <AnalyticsPanel setLazyJobCount={setDfaLazyJobCount} /> : null}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const overviewRouteFactory = (
});

const PageWrapper: FC<PageProps> = () => {
const { context } = useRouteResolver('full', ['canGetJobs'], {
const { context } = useRouteResolver('full', ['canGetMlInfo'], {
getMlNodeCount,
loadMlServerInfo,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function applyEnabledFeatures(mlCaps: MlCapabilities, enabledFeatures: MlFeature
mlCaps.isDFAEnabled = enabledFeatures.dfa;
mlCaps.isNLPEnabled = enabledFeatures.nlp;

mlCaps.canViewMlNodes = mlCaps.isADEnabled && mlCaps.isDFAEnabled && mlCaps.isNLPEnabled;

if (enabledFeatures.ad === false) {
featureCapabilities.ad.forEach((c) => (mlCaps[c] = false));
}
Expand Down

0 comments on commit 82a51a7

Please sign in to comment.