Skip to content

Commit

Permalink
[Fit&Finish] Security analytics overview page (opensearch-project#1175)
Browse files Browse the repository at this point in the history
* fit&finish

Signed-off-by: Hailong Cui <[email protected]>

* add width for recent threat alerts card

Signed-off-by: Hailong Cui <[email protected]>

* fix typo

Signed-off-by: Hailong Cui <[email protected]>

---------

Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am authored Oct 9, 2024
1 parent 9c0c2f4 commit 076d1ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
12 changes: 8 additions & 4 deletions public/pages/Overview/containers/Overview/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ import { OverviewProps, OverviewState, OverviewViewModel } from '../../../../../
import { setBreadcrumbs } from '../../../../utils/helpers';
import { PageHeader } from '../../../../components/PageHeader/PageHeader';
import { getOverviewStatsProps, getOverviewsCardsProps } from '../../utils/constants';
import { getUseUpdatedUx } from '../../../../services/utils/constants';
import { getChrome, getUseUpdatedUx } from '../../../../services/utils/constants';
import { RecentThreatIntelFindingsWidget } from '../../components/Widgets/RecentThreatIntelFindingsWidget';
import { useObservable } from 'react-use';
import { SECURITY_ANALYTICS_USE_CASE_ID } from '../../../../../../../src/core/public';

export const Overview: React.FC<OverviewProps> = (props) => {
const {
Expand Down Expand Up @@ -101,15 +103,17 @@ export const Overview: React.FC<OverviewProps> = (props) => {
() => new OverviewViewModelActor(saContext?.services, context?.notifications!),
[saContext?.services, context]
);
const currentNavGroup = useObservable(getChrome().navGroup.getCurrentNavGroup$());
const isSecurityAnalyticsUseCase = currentNavGroup?.id === SECURITY_ANALYTICS_USE_CASE_ID;

useEffect(() => {
setBreadcrumbs([BREADCRUMBS.OVERVIEW]);
setBreadcrumbs(isSecurityAnalyticsUseCase ? [ BREADCRUMBS.OVERVIEW] : [{...BREADCRUMBS.OVERVIEW, text: 'Security Analytics overview'}]);
overviewViewModelActor.registerRefreshHandler(updateState, true /* allowPartialResults */);
overviewViewModelActor.registerRefreshHandler(
onLoadingComplete,
false /* allowPartialResults */
);
}, []);
}, [isSecurityAnalyticsUseCase]);

useEffect(() => {
const abortController = new AbortController();
Expand Down Expand Up @@ -269,7 +273,7 @@ export const Overview: React.FC<OverviewProps> = (props) => {
<EuiFlexGroup gutterSize="m">
{getOverviewsCardsProps().map((p, idx) => (
<EuiFlexItem key={idx}>
<EuiCard {...p} layout="vertical" textAlign="left" />
<EuiCard {...p} layout="vertical" textAlign="left" titleElement='h4' titleSize='s'/>
</EuiFlexItem>
))}
</EuiFlexGroup>
Expand Down
2 changes: 2 additions & 0 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
setNavigationUI,
setApplication,
setBreadCrumbsSetter,
setChrome,
setContentManagement,
setDataSourceManagementPlugin,
setNotifications,
Expand Down Expand Up @@ -261,6 +262,7 @@ export class SecurityAnalyticsPlugin
setNavigationUI(navigation.ui);
setApplication(core.application);
setBreadCrumbsSetter(core.chrome.setBreadcrumbs);
setChrome(core.chrome);
setContentManagement(contentManagement);
setNotifications(core.notifications);
setSavedObjectsClient(core.savedObjects.client);
Expand Down
4 changes: 4 additions & 0 deletions public/services/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export const [getBreadCrumbsSetter, setBreadCrumbsSetter] = createGetterSetter<
CoreStart['chrome']['setBreadcrumbs']
>('breadCrumbSetter');

export const [getChrome, setChrome] = createGetterSetter<
CoreStart['chrome']
>('chrome');

export const [getContentManagement, setContentManagement] = createGetterSetter<
ContentManagementPluginStart
>('contentManagement');
Expand Down
1 change: 1 addition & 0 deletions public/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ export function registerThreatAlertsCard() {
detectorService={getBrowserServices().detectorsService}
/>
),
width: 16,
}),
});
}
Expand Down

0 comments on commit 076d1ef

Please sign in to comment.