@cccsaurora/howler-ui 2.19.0-dev.999 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/action/index.d.ts +5 -4
- package/api/action/index.js +8 -8
- package/api/analytic/index.d.ts +5 -5
- package/api/analytic/index.js +5 -6
- package/api/analytic/owner.d.ts +2 -1
- package/api/analytic/owner.js +2 -2
- package/api/dossier/index.d.ts +4 -3
- package/api/dossier/index.js +6 -6
- package/api/hit/index.d.ts +3 -2
- package/api/hit/index.js +4 -4
- package/api/hit/labels.d.ts +3 -2
- package/api/hit/labels.js +4 -4
- package/api/hit/overwrite.d.ts +2 -1
- package/api/hit/overwrite.js +2 -2
- package/api/hit/transition.d.ts +2 -1
- package/api/hit/transition.js +2 -2
- package/api/index.d.ts +10 -5
- package/api/index.js +18 -10
- package/api/overview/index.d.ts +4 -3
- package/api/overview/index.js +6 -6
- package/api/search/action.js +1 -1
- package/api/search/analytic.js +1 -1
- package/api/search/case.d.ts +4 -0
- package/api/search/case.js +8 -0
- package/api/search/count/hit.js +1 -1
- package/api/search/dossier.js +1 -1
- package/api/search/eql/hit.js +1 -1
- package/api/search/explain/hit.js +1 -1
- package/api/search/facet/hit.d.ts +1 -3
- package/api/search/facet/hit.js +1 -1
- package/api/search/facet/index.d.ts +3 -1
- package/api/search/grouped/hit.js +1 -1
- package/api/search/grouped/user.js +1 -1
- package/api/search/histogram/hit.js +1 -1
- package/api/search/hit.js +1 -1
- package/api/search/index.d.ts +3 -1
- package/api/search/index.js +2 -1
- package/api/search/overview.d.ts +2 -2
- package/api/search/overview.js +1 -1
- package/api/search/sigma/hit.js +1 -1
- package/api/search/template.js +1 -1
- package/api/search/user.js +1 -1
- package/api/search/view.js +1 -1
- package/api/socket/index.d.ts +3 -0
- package/api/socket/index.js +6 -0
- package/api/socket/viewers.d.ts +2 -0
- package/api/socket/viewers.js +8 -0
- package/api/socket/viewers.test.js +44 -0
- package/api/template/index.d.ts +4 -3
- package/api/template/index.js +6 -6
- package/api/user/index.d.ts +2 -1
- package/api/user/index.js +2 -2
- package/api/v2/case/index.d.ts +9 -0
- package/api/v2/case/index.js +21 -0
- package/api/v2/case/items.d.ts +9 -0
- package/api/v2/case/items.js +19 -0
- package/api/v2/case/rules.d.ts +6 -0
- package/api/v2/case/rules.js +18 -0
- package/api/v2/fuzzy.d.ts +17 -0
- package/api/v2/fuzzy.js +11 -0
- package/api/v2/index.d.ts +5 -0
- package/api/v2/index.js +7 -0
- package/api/v2/search/facet.d.ts +3 -0
- package/api/v2/search/facet.js +12 -0
- package/api/v2/search/index.d.ts +6 -0
- package/api/v2/search/index.js +24 -0
- package/api/view/index.d.ts +4 -3
- package/api/view/index.js +6 -6
- package/branding/AppBrand.d.ts +2 -2
- package/commons/components/app/AppSkeleton.js +1 -1
- package/commons/components/app/hooks/useAppConfigs.d.ts +2 -2
- package/commons/components/app/hooks/useAppSitemap.d.ts +5 -2
- package/commons/components/breadcrumbs/BreadcrumbIcon.js +1 -1
- package/commons/components/breadcrumbs/Breadcrumbs.d.ts +3 -2
- package/commons/components/display/AppToc.d.ts +2 -1
- package/commons/components/display/AppToc.js +1 -1
- package/commons/components/display/hooks/useAppColor.d.ts +1 -1
- package/commons/components/leftnav/LeftNavDrawer.d.ts +2 -1
- package/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/commons/components/leftnav/LeftNavGroup.d.ts +2 -1
- package/commons/components/leftnav/LeftNavItem.d.ts +2 -1
- package/commons/components/leftnav/LeftNavItem.js +1 -1
- package/commons/components/notification/Notification.js +1 -1
- package/commons/components/notification/elements/NotificationHeader.js +1 -1
- package/commons/components/notification/elements/NotificationItems.js +1 -1
- package/commons/components/notification/elements/item/NotificationItemAuthor.js +1 -1
- package/commons/components/pages/PageCenter.d.ts +2 -1
- package/commons/components/pages/PageContent.d.ts +2 -1
- package/commons/components/pages/PageFullScreen.d.ts +2 -1
- package/commons/components/search/AppSearch.js +1 -1
- package/commons/components/search/AppSearchInput.d.ts +2 -1
- package/commons/components/search/AppSearchResult.d.ts +2 -1
- package/commons/components/topnav/AppBar.d.ts +2 -1
- package/commons/components/topnav/AppName.d.ts +3 -2
- package/commons/components/topnav/AppSwitcher.d.ts +2 -1
- package/commons/components/topnav/ThemeSelection.d.ts +2 -1
- package/commons/components/topnav/ThemeSelection.js +1 -1
- package/commons/components/topnav/UserProfile.d.ts +2 -1
- package/commons/components/topnav/UserProfile.js +1 -1
- package/commons/components/utils/hooks/useThemeBuilder.d.ts +1 -1
- package/components/app/App.js +52 -12
- package/components/app/drawers/ApiKeyDrawer.js +1 -1
- package/components/app/hooks/useMatchers.d.ts +1 -1
- package/components/app/hooks/useMatchers.js +27 -15
- package/components/app/hooks/useMatchers.test.js +22 -22
- package/components/app/hooks/useTitle.js +6 -6
- package/components/app/providers/AnalyticProvider.js +1 -1
- package/components/app/providers/AvatarProvider.js +1 -1
- package/components/app/providers/FavouritesProvider.js +3 -3
- package/components/app/providers/GridColumnsProvider.d.ts +52 -0
- package/components/app/providers/GridColumnsProvider.js +177 -0
- package/components/app/providers/GridColumnsProvider.test.js +255 -0
- package/components/app/providers/ModalProvider.d.ts +1 -0
- package/components/app/providers/OverviewProvider.js +1 -1
- package/components/app/providers/ParameterProvider.d.ts +25 -3
- package/components/app/providers/ParameterProvider.js +163 -226
- package/components/app/providers/ParameterProvider.test.js +358 -94
- package/components/app/providers/RecordProvider.d.ts +23 -0
- package/components/app/providers/{HitProvider.js → RecordProvider.js} +47 -43
- package/components/app/providers/{HitSearchProvider.d.ts → RecordSearchProvider.d.ts} +6 -6
- package/components/app/providers/{HitSearchProvider.js → RecordSearchProvider.js} +24 -37
- package/components/app/providers/{HitSearchProvider.test.js → RecordSearchProvider.test.js} +52 -71
- package/components/app/providers/SearchResponseProvider.d.ts +21 -0
- package/components/app/providers/SearchResponseProvider.js +81 -0
- package/components/app/providers/SearchResponseProvider.test.d.ts +1 -0
- package/components/app/providers/SearchResponseProvider.test.js +406 -0
- package/components/app/providers/SocketProvider.d.ts +11 -2
- package/components/app/providers/SocketProvider.js +21 -8
- package/components/app/providers/UserListProvider.js +28 -8
- package/components/app/providers/UserListProvider.test.d.ts +1 -0
- package/components/app/providers/UserListProvider.test.js +150 -0
- package/components/app/providers/ViewProvider.js +3 -3
- package/components/app/providers/ViewProvider.test.js +4 -1
- package/components/elements/Comment.js +2 -2
- package/components/elements/ContextMenu.d.ts +56 -0
- package/components/elements/ContextMenu.js +113 -0
- package/components/elements/ContextMenu.test.d.ts +1 -0
- package/components/elements/ContextMenu.test.js +215 -0
- package/components/elements/EditRow.js +4 -4
- package/components/{routes/overviews/OverviewEditor.js → elements/MarkdownEditor.js} +3 -3
- package/components/elements/ObjectDetails.d.ts +6 -0
- package/components/elements/{hit/HitDetails.js → ObjectDetails.js} +17 -17
- package/components/elements/PluginChip.d.ts +1 -1
- package/components/elements/PluginChip.js +0 -1
- package/components/elements/PluginTypography.d.ts +2 -1
- package/components/elements/PluginTypography.js +3 -2
- package/components/elements/UserList.d.ts +5 -2
- package/components/elements/UserList.js +34 -17
- package/components/elements/UserList.test.d.ts +1 -0
- package/components/elements/UserList.test.js +122 -0
- package/components/elements/addons/buttons/CustomIconButton.test.d.ts +1 -0
- package/components/elements/addons/buttons/CustomIconButton.test.js +81 -0
- package/components/elements/addons/buttons/index.d.ts +1 -1
- package/components/elements/addons/layout/FlexOne.d.ts +3 -2
- package/components/elements/addons/layout/FlexPort.d.ts +2 -1
- package/components/elements/addons/layout/FlexVertical.d.ts +2 -1
- package/components/elements/addons/layout/FlexVertical.test.d.ts +1 -0
- package/components/elements/addons/layout/FlexVertical.test.js +32 -0
- package/components/elements/addons/layout/vsbox/VSBoxContent.test.d.ts +1 -0
- package/components/elements/addons/layout/vsbox/VSBoxContent.test.js +26 -0
- package/components/elements/addons/layout/vsbox/VSBoxElement.d.ts +2 -1
- package/components/elements/addons/lists/TuiList.d.ts +2 -1
- package/components/elements/addons/lists/TuiListBase.d.ts +2 -1
- package/components/elements/addons/lists/TuiListElement.d.ts +3 -2
- package/components/elements/addons/lists/TuiListElement.js +0 -1
- package/components/elements/addons/lists/TuiListMenu.d.ts +2 -1
- package/components/elements/addons/lists/TuiListMenu.js +1 -1
- package/components/elements/addons/lists/table/TuiTableHeader.d.ts +3 -2
- package/components/elements/addons/lists/table/index.d.ts +1 -1
- package/components/elements/addons/search/SearchPagination.d.ts +2 -1
- package/components/elements/addons/search/SearchPagination.js +4 -4
- package/components/elements/addons/search/SearchTotal.js +1 -1
- package/components/elements/addons/search/SearchTotal.test.js +5 -3
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- package/components/elements/addons/search/phrase/WordLexer.test.d.ts +1 -0
- package/components/elements/addons/search/phrase/WordLexer.test.js +55 -0
- package/components/elements/case/CaseCard.d.ts +12 -0
- package/components/elements/case/CaseCard.js +43 -0
- package/components/elements/case/CasePreview.d.ts +6 -0
- package/components/elements/case/CasePreview.js +17 -0
- package/components/elements/case/StatusIcon.d.ts +5 -0
- package/components/elements/case/StatusIcon.js +13 -0
- package/components/elements/display/ActionButton.js +1 -1
- package/components/elements/display/ChipPopper.d.ts +1 -1
- package/components/elements/display/ChipPopper.js +7 -6
- package/components/elements/display/Classification.js +1 -1
- package/components/elements/display/ClassificationChip.d.ts +14 -0
- package/components/elements/display/ClassificationChip.js +36 -0
- package/components/elements/display/HandlebarsMarkdown.js +38 -3
- package/components/elements/display/HowlerAvatar.js +2 -2
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/HowlerCard.test.js +5 -9
- package/components/elements/display/Image.js +3 -3
- package/components/elements/display/ItemManager.d.ts +2 -2
- package/components/elements/display/ItemManager.js +3 -3
- package/components/elements/display/Markdown.js +2 -2
- package/components/elements/display/Modal.js +2 -0
- package/components/elements/display/QueryResultText.d.ts +1 -0
- package/components/elements/display/QueryResultText.js +2 -2
- package/components/elements/display/handlebars/helpers.d.ts +4 -0
- package/components/elements/display/handlebars/helpers.js +134 -35
- package/components/elements/display/json/JSONViewer.js +2 -2
- package/components/elements/display/modals/RationaleModal.js +2 -2
- package/components/elements/display/modals/RationaleModal.test.js +1 -1
- package/components/elements/event/EventCard.d.ts +6 -0
- package/components/elements/event/EventCard.js +22 -0
- package/components/elements/event/EventPreview.d.ts +6 -0
- package/components/elements/event/EventPreview.js +12 -0
- package/components/elements/hit/HitActions.d.ts +1 -1
- package/components/elements/hit/HitActions.js +5 -5
- package/components/elements/hit/HitBanner.d.ts +1 -0
- package/components/elements/hit/HitBanner.js +32 -50
- package/components/elements/hit/HitCard.d.ts +4 -0
- package/components/elements/hit/HitCard.js +7 -7
- package/components/elements/hit/HitLabels.js +3 -3
- package/components/elements/hit/HitLabels.test.d.ts +1 -0
- package/components/elements/hit/HitLabels.test.js +77 -0
- package/components/elements/hit/HitLinks.d.ts +5 -4
- package/components/elements/hit/HitLinks.js +28 -10
- package/components/elements/hit/HitNotebooks.js +32 -31
- package/components/elements/hit/HitOutline.d.ts +1 -0
- package/components/elements/hit/HitOutline.js +4 -4
- package/components/elements/hit/HitOverview.js +2 -2
- package/components/elements/hit/{HitQuickSearch.d.ts → HitPreview.d.ts} +3 -3
- package/components/elements/hit/{HitQuickSearch.js → HitPreview.js} +11 -5
- package/components/elements/hit/HitSummary.d.ts +2 -1
- package/components/elements/hit/HitSummary.js +8 -7
- package/components/elements/hit/NotebookTooltip.d.ts +3 -0
- package/components/elements/hit/NotebookTooltip.js +8 -0
- package/components/elements/hit/PivotTooltip.d.ts +7 -0
- package/components/elements/hit/PivotTooltip.js +9 -0
- package/components/elements/hit/RelatedLinkTooltip.d.ts +6 -0
- package/components/elements/hit/RelatedLinkTooltip.js +8 -0
- package/components/elements/hit/ResolvePivotUrl.d.ts +4 -0
- package/components/elements/hit/ResolvePivotUrl.js +22 -0
- package/components/elements/hit/actions/ButtonActions.js +1 -3
- package/components/elements/hit/aggregate/HitGraph.js +9 -9
- package/components/elements/hit/elements/AnalyticLink.d.ts +9 -0
- package/components/elements/hit/elements/AnalyticLink.js +22 -0
- package/components/elements/hit/elements/{HitUsers.d.ts → Assigned.d.ts} +2 -4
- package/components/elements/hit/elements/Assigned.js +35 -0
- package/components/elements/hit/elements/Assigned.test.d.ts +1 -0
- package/components/elements/hit/elements/Assigned.test.js +65 -0
- package/components/{routes/hits/search → elements/hit}/grid/AddColumnModal.js +6 -5
- package/components/{routes/hits/search → elements/hit}/grid/ColumnHeader.d.ts +2 -1
- package/components/{routes/hits/search → elements/hit}/grid/ColumnHeader.js +3 -3
- package/components/{routes/hits/search → elements/hit}/grid/EnhancedCell.d.ts +2 -1
- package/components/{routes/hits/search → elements/hit}/grid/EnhancedCell.js +2 -2
- package/components/{routes/hits/search/grid/HitRow.d.ts → elements/hit/grid/RecordRow.d.ts} +4 -3
- package/components/{routes/hits/search/grid/HitRow.js → elements/hit/grid/RecordRow.js} +12 -10
- package/components/elements/hit/grid/RecordTable.d.ts +13 -0
- package/components/elements/hit/grid/RecordTable.js +84 -0
- package/components/elements/hit/outlines/DefaultOutline.js +2 -4
- package/components/elements/hit/related/PivotLink.d.ts +3 -0
- package/components/elements/hit/related/PivotLink.js +6 -3
- package/components/elements/hit/related/RelatedLink.d.ts +1 -0
- package/components/elements/hit/related/RelatedLink.js +18 -15
- package/components/elements/hit/related/RelatedRecords.js +63 -0
- package/components/elements/{hit/HitComments.d.ts → record/RecordComments.d.ts} +5 -4
- package/components/elements/{hit/HitComments.js → record/RecordComments.js} +33 -34
- package/components/{routes/hits/search/HitContextMenu.d.ts → elements/record/RecordContextMenu.d.ts} +3 -3
- package/components/elements/record/RecordContextMenu.js +268 -0
- package/components/elements/record/RecordContextMenu.test.d.ts +1 -0
- package/components/{routes/hits/search/HitContextMenu.test.js → elements/record/RecordContextMenu.test.js} +143 -49
- package/components/elements/record/RecordRelated.d.ts +7 -0
- package/components/elements/record/RecordRelated.js +34 -0
- package/components/elements/{hit/HitWorklog.d.ts → record/RecordWorklog.d.ts} +4 -3
- package/components/elements/{hit/HitWorklog.js → record/RecordWorklog.js} +16 -14
- package/components/elements/search/FuzzySearchBar.d.ts +7 -0
- package/components/elements/search/FuzzySearchBar.js +33 -0
- package/components/elements/search/FuzzySearchBar.test.d.ts +1 -0
- package/components/elements/search/FuzzySearchBar.test.js +87 -0
- package/components/elements/view/LayoutToggle.d.ts +8 -0
- package/components/elements/view/LayoutToggle.js +12 -0
- package/components/elements/view/ViewTitle.d.ts +4 -0
- package/components/elements/view/ViewTitle.js +13 -3
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +5 -5
- package/components/hooks/useLocalStorage.js +1 -1
- package/components/hooks/useLocalStorageItem.test.js +2 -2
- package/components/hooks/useMyApi.d.ts +1 -1
- package/components/hooks/useMyChart.d.ts +23 -23
- package/components/hooks/useMyPreferences.js +10 -1
- package/components/hooks/useMySearch.js +2 -2
- package/components/hooks/useMySitemap.js +3 -1
- package/components/hooks/useMySnackbar.js +1 -1
- package/components/hooks/useMyTheme.js +9 -2
- package/components/hooks/useMyTheme.test.d.ts +1 -0
- package/components/hooks/useMyTheme.test.js +35 -0
- package/components/hooks/useMyUserFunctions.d.ts +21 -21
- package/components/hooks/{useHitSelection.d.ts → useRecordSelection.d.ts} +2 -2
- package/components/hooks/{useHitSelection.js → useRecordSelection.js} +12 -33
- package/components/hooks/useRelatedRecords.d.ts +13 -0
- package/components/hooks/useRelatedRecords.js +32 -0
- package/components/logins/Login.js +1 -1
- package/components/logins/auth/OAuthLogin.js +1 -1
- package/components/logins/hooks/useLogin.js +2 -2
- package/components/routes/ErrorBoundary.d.ts +2 -13
- package/components/routes/ErrorBoundary.js +12 -1
- package/components/routes/ErrorBoundary.test.js +27 -4
- package/components/routes/action/edit/ActionEditor.js +6 -6
- package/components/routes/action/shared/OperationEntry.js +1 -1
- package/components/routes/action/shared/OperationStep.js +1 -1
- package/components/routes/action/useMyActionFunctions.js +6 -3
- package/components/routes/action/view/ActionDetails.js +9 -3
- package/components/routes/action/view/ActionSearch.js +25 -19
- package/components/routes/admin/users/UserEditor.js +1 -1
- package/components/routes/admin/users/UserSearch.js +5 -5
- package/components/routes/advanced/QueryBuilder.js +6 -29
- package/components/routes/advanced/QueryEditor.js +3 -3
- package/components/routes/advanced/eqlTokenProvider.test.d.ts +1 -0
- package/components/routes/advanced/eqlTokenProvider.test.js +34 -0
- package/components/routes/advanced/historyCompletionProvider.js +3 -3
- package/components/routes/advanced/luceneCompletionProvider.js +1 -1
- package/components/routes/advanced/luceneTokenProvider.test.d.ts +1 -0
- package/components/routes/advanced/luceneTokenProvider.test.js +34 -0
- package/components/routes/analytics/AnalyticComments.js +3 -5
- package/components/routes/analytics/AnalyticDetails.js +8 -56
- package/components/routes/analytics/AnalyticHitComments.js +1 -1
- package/components/routes/analytics/AnalyticHitComments.test.js +1 -1
- package/components/routes/analytics/AnalyticOverview.js +2 -2
- package/components/routes/analytics/AnalyticOverviews.js +1 -1
- package/components/routes/analytics/AnalyticSearch.js +16 -25
- package/components/routes/analytics/AnalyticTemplates.js +1 -1
- package/components/routes/analytics/TriageSettings.js +2 -2
- package/components/routes/analytics/widgets/Assessment.js +1 -1
- package/components/routes/analytics/widgets/Created.js +1 -1
- package/components/routes/analytics/widgets/Escalation.js +1 -1
- package/components/routes/analytics/widgets/Stacked.js +1 -1
- package/components/routes/cases/CaseViewer.d.ts +2 -0
- package/components/routes/cases/CaseViewer.js +44 -0
- package/components/routes/cases/CaseViewer.test.d.ts +1 -0
- package/components/routes/cases/CaseViewer.test.js +156 -0
- package/components/routes/cases/Cases.d.ts +2 -0
- package/components/routes/cases/Cases.js +140 -0
- package/components/routes/cases/constants.d.ts +6 -0
- package/components/routes/cases/constants.js +6 -0
- package/components/routes/cases/detail/AlertPanel.d.ts +6 -0
- package/components/routes/cases/detail/AlertPanel.js +34 -0
- package/components/routes/cases/detail/AlertPanel.test.d.ts +1 -0
- package/components/routes/cases/detail/AlertPanel.test.js +107 -0
- package/components/routes/cases/detail/CaseDashboard.d.ts +7 -0
- package/components/routes/cases/detail/CaseDashboard.js +66 -0
- package/components/routes/cases/detail/CaseDashboard.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseDashboard.test.js +218 -0
- package/components/routes/cases/detail/CaseDetails.d.ts +6 -0
- package/components/routes/cases/detail/CaseDetails.js +79 -0
- package/components/routes/cases/detail/CaseDetails.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseDetails.test.js +145 -0
- package/components/routes/cases/detail/CaseObservables.d.ts +6 -0
- package/components/routes/cases/detail/CaseObservables.js +127 -0
- package/components/routes/cases/detail/CaseObservables.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseObservables.test.js +167 -0
- package/components/routes/cases/detail/CaseOverview.d.ts +7 -0
- package/components/routes/cases/detail/CaseOverview.js +40 -0
- package/components/routes/cases/detail/CaseRules.d.ts +7 -0
- package/components/routes/cases/detail/CaseRules.js +55 -0
- package/components/routes/cases/detail/CaseRules.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseRules.test.js +238 -0
- package/components/routes/cases/detail/CaseSearch.d.ts +3 -0
- package/components/routes/cases/detail/CaseSearch.js +78 -0
- package/components/routes/cases/detail/CaseSearch.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseSearch.test.js +154 -0
- package/components/routes/cases/detail/CaseSidebar.d.ts +8 -0
- package/components/routes/cases/detail/CaseSidebar.js +147 -0
- package/components/routes/cases/detail/CaseSidebar.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseSidebar.test.js +155 -0
- package/components/routes/cases/detail/CaseTask.d.ts +14 -0
- package/components/routes/cases/detail/CaseTask.js +71 -0
- package/components/routes/cases/detail/CaseTask.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseTask.test.js +143 -0
- package/components/routes/cases/detail/CaseTimeline.d.ts +12 -0
- package/components/routes/cases/detail/CaseTimeline.js +120 -0
- package/components/routes/cases/detail/CaseTimeline.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseTimeline.test.js +319 -0
- package/components/routes/cases/detail/CreateRuleDialog.d.ts +9 -0
- package/components/routes/cases/detail/CreateRuleDialog.js +145 -0
- package/components/routes/cases/detail/CreateRuleDialog.test.d.ts +1 -0
- package/components/routes/cases/detail/CreateRuleDialog.test.js +218 -0
- package/components/routes/cases/detail/ItemPage.d.ts +6 -0
- package/components/routes/cases/detail/ItemPage.js +100 -0
- package/components/routes/cases/detail/ItemPage.test.d.ts +1 -0
- package/components/routes/cases/detail/ItemPage.test.js +238 -0
- package/components/routes/cases/detail/MarkdownPage.d.ts +8 -0
- package/components/routes/cases/detail/MarkdownPage.js +63 -0
- package/components/routes/cases/detail/MarkdownPage.test.d.ts +1 -0
- package/components/routes/cases/detail/MarkdownPage.test.js +116 -0
- package/components/routes/cases/detail/RelatedCasePanel.d.ts +6 -0
- package/components/routes/cases/detail/RelatedCasePanel.js +34 -0
- package/components/routes/cases/detail/RelatedCasePanel.test.d.ts +1 -0
- package/components/routes/cases/detail/RelatedCasePanel.test.js +115 -0
- package/components/routes/cases/detail/TaskPanel.d.ts +7 -0
- package/components/routes/cases/detail/TaskPanel.js +95 -0
- package/components/routes/cases/detail/TaskPanel.test.d.ts +1 -0
- package/components/routes/cases/detail/TaskPanel.test.js +145 -0
- package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +11 -0
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +24 -0
- package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +6 -0
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +26 -0
- package/components/routes/cases/detail/observables/Observable.d.ts +8 -0
- package/components/routes/cases/detail/observables/Observable.js +14 -0
- package/components/routes/cases/detail/observables/Observable.test.d.ts +1 -0
- package/components/routes/cases/detail/observables/Observable.test.js +80 -0
- package/components/routes/cases/detail/observables/ObservableTable.d.ts +7 -0
- package/components/routes/cases/detail/observables/ObservableTable.js +61 -0
- package/components/routes/cases/detail/observables/ObservableTable.test.d.ts +1 -0
- package/components/routes/cases/detail/observables/ObservableTable.test.js +97 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +22 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.js +105 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.test.js +98 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +32 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +99 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +117 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +25 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.js +89 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.test.js +81 -0
- package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +5 -0
- package/components/routes/cases/detail/sidebar/RootDropZone.js +33 -0
- package/components/routes/cases/detail/sidebar/types.d.ts +9 -0
- package/components/routes/cases/detail/sidebar/utils.d.ts +10 -0
- package/components/routes/cases/detail/sidebar/utils.js +51 -0
- package/components/routes/cases/detail/sidebar/utils.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/utils.test.js +82 -0
- package/components/routes/cases/detail/types.d.ts +22 -0
- package/components/routes/cases/detail/utils.d.ts +28 -0
- package/components/routes/cases/detail/utils.js +117 -0
- package/components/routes/cases/detail/utils.test.d.ts +1 -0
- package/components/routes/cases/detail/utils.test.js +166 -0
- package/components/routes/cases/hooks/useCase.d.ts +13 -0
- package/components/routes/cases/hooks/useCase.js +67 -0
- package/components/routes/cases/hooks/useCase.test.d.ts +1 -0
- package/components/routes/cases/hooks/useCase.test.js +170 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.d.ts +7 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.js +57 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.test.d.ts +1 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.test.js +309 -0
- package/components/routes/cases/modals/AddToCaseModal.d.ts +9 -0
- package/components/routes/cases/modals/AddToCaseModal.js +72 -0
- package/components/routes/cases/modals/CaseRecordRow.d.ts +9 -0
- package/components/routes/cases/modals/CaseRecordRow.js +14 -0
- package/components/routes/cases/modals/CreateCaseModal.d.ts +7 -0
- package/components/routes/cases/modals/CreateCaseModal.js +53 -0
- package/components/routes/cases/modals/CreateCaseModal.test.d.ts +1 -0
- package/components/routes/cases/modals/CreateCaseModal.test.js +319 -0
- package/components/routes/cases/modals/RenameItemModal.d.ts +9 -0
- package/components/routes/cases/modals/RenameItemModal.js +44 -0
- package/components/routes/cases/modals/ResolveModal.d.ts +7 -0
- package/components/routes/cases/modals/ResolveModal.js +120 -0
- package/components/routes/cases/modals/ResolveModal.test.d.ts +1 -0
- package/components/routes/cases/modals/ResolveModal.test.js +520 -0
- package/components/routes/cases/modals/hooks.d.ts +7 -0
- package/components/routes/cases/modals/hooks.js +40 -0
- package/components/routes/cases/modals/types.d.ts +13 -0
- package/components/routes/cases/search/CaseAssigneeFilter.d.ts +6 -0
- package/components/routes/cases/search/CaseAssigneeFilter.js +33 -0
- package/components/routes/cases/search/CaseAssigneeFilter.test.d.ts +1 -0
- package/components/routes/cases/search/CaseAssigneeFilter.test.js +127 -0
- package/components/routes/cases/search/CaseDateFilter.d.ts +13 -0
- package/components/routes/cases/search/CaseDateFilter.js +26 -0
- package/components/routes/cases/search/CaseDateFilter.test.d.ts +1 -0
- package/components/routes/cases/search/CaseDateFilter.test.js +115 -0
- package/components/routes/cases/search/CaseStatusFilter.d.ts +6 -0
- package/components/routes/cases/search/CaseStatusFilter.js +13 -0
- package/components/routes/cases/search/CaseStatusFilter.test.d.ts +1 -0
- package/components/routes/cases/search/CaseStatusFilter.test.js +86 -0
- package/components/routes/cases/utils.d.ts +3 -0
- package/components/routes/cases/utils.js +21 -0
- package/components/routes/dossiers/DossierEditor.js +4 -4
- package/components/routes/dossiers/DossierEditor.test.js +2 -2
- package/components/routes/dossiers/Dossiers.js +16 -14
- package/components/routes/dossiers/PivotForm.js +2 -4
- package/components/routes/events/EventViewer.d.ts +7 -0
- package/components/routes/events/EventViewer.js +24 -0
- package/components/routes/help/ApiDocumentation.js +2 -2
- package/components/routes/help/HitBannerDocumentation.js +2 -1
- package/components/routes/help/HitDocumentation.js +1 -3
- package/components/routes/help/HitSchemaDocumentation.js +1 -1
- package/components/routes/help/OverviewDocumentation.d.ts +1 -1
- package/components/routes/help/OverviewDocumentation.js +0 -1
- package/components/routes/help/RetentionDocumentation.js +2 -2
- package/components/routes/help/SearchDocumentation.js +1 -1
- package/components/routes/help/markdown/en/client.md.js +1 -1
- package/components/routes/help/markdown/fr/client.md.js +1 -1
- package/components/routes/hits/search/InformationPane.d.ts +1 -0
- package/components/routes/hits/search/InformationPane.js +52 -65
- package/components/routes/hits/search/QuerySettings.js +2 -1
- package/components/routes/hits/search/QuerySettings.test.js +19 -17
- package/components/routes/hits/search/{HitBrowser.js → RecordBrowser.js} +13 -12
- package/components/routes/hits/search/{HitQuery.d.ts → RecordQuery.d.ts} +2 -2
- package/components/routes/hits/search/{HitQuery.js → RecordQuery.js} +6 -6
- package/components/routes/hits/search/SearchPane.js +28 -50
- package/components/routes/hits/search/ViewLink.js +7 -6
- package/components/routes/hits/search/ViewLink.test.js +8 -9
- package/components/routes/hits/search/grid/RecordGrid.d.ts +3 -0
- package/components/routes/hits/search/grid/RecordGrid.js +64 -0
- package/components/routes/hits/search/shared/CustomSort.js +1 -1
- package/components/routes/hits/search/shared/CustomSpan.test.js +3 -4
- package/components/routes/hits/search/shared/HitFilter.d.ts +1 -1
- package/components/routes/hits/search/shared/HitSort.d.ts +1 -1
- package/components/routes/hits/search/shared/HitSort.js +2 -1
- package/components/routes/hits/search/shared/IndexPicker.d.ts +8 -0
- package/components/routes/hits/search/shared/IndexPicker.js +21 -0
- package/components/routes/hits/search/shared/LayoutSettings.js +25 -0
- package/components/routes/hits/search/shared/SearchActionMenu.d.ts +4 -0
- package/components/routes/hits/search/shared/SearchActionMenu.js +11 -0
- package/components/routes/hits/search/shared/SearchSpan.d.ts +1 -1
- package/components/routes/hits/search/shared/SearchSpan.js +1 -1
- package/components/routes/hits/view/HitViewer.js +16 -17
- package/components/routes/home/AddNewCard.js +2 -2
- package/components/routes/home/AddNewCard.test.js +20 -2
- package/components/routes/home/AnalyticCard.js +1 -1
- package/components/routes/home/EntryWrapper.js +1 -1
- package/components/routes/home/HomeSettings.js +1 -1
- package/components/routes/home/HomeSettings.test.d.ts +1 -0
- package/components/routes/home/HomeSettings.test.js +44 -0
- package/components/routes/home/ViewCard.js +52 -46
- package/components/routes/home/ViewRefresh.test.js +1 -1
- package/components/routes/home/index.js +2 -2
- package/components/routes/overviews/OverviewCard.js +1 -1
- package/components/routes/overviews/OverviewViewer.js +13 -10
- package/components/routes/overviews/Overviews.js +16 -14
- package/components/routes/overviews/markdownExtendedTokenProvider.js +15 -15
- package/components/routes/overviews/markdownExtendedTokenProvider.test.d.ts +1 -0
- package/components/routes/overviews/markdownExtendedTokenProvider.test.js +50 -0
- package/components/routes/settings/ProfileSection.js +2 -2
- package/components/routes/templates/TemplateEditor.d.ts +3 -2
- package/components/routes/templates/TemplateEditor.js +1 -1
- package/components/routes/templates/TemplateViewer.js +10 -5
- package/components/routes/templates/Templates.js +19 -14
- package/components/routes/views/ViewComposer.js +78 -26
- package/components/routes/views/Views.js +17 -14
- package/i18n.js +1 -1
- package/index.css +4 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/locales/en/translation.json +188 -34
- package/locales/fr/translation.json +186 -32
- package/models/WithMetadata.d.ts +2 -1
- package/models/entities/generated/Analytic.d.ts +0 -3
- package/models/entities/generated/ApiType.d.ts +3 -1
- package/models/entities/generated/AttachmentsFile.d.ts +12 -0
- package/models/entities/generated/Case.d.ts +29 -0
- package/models/entities/generated/Column.d.ts +7 -0
- package/models/entities/generated/DestinationOriginal.d.ts +19 -0
- package/models/entities/generated/ECSEvent.d.ts +31 -0
- package/models/entities/generated/EmailAttachment.d.ts +8 -0
- package/models/entities/generated/EmailParent.d.ts +19 -0
- package/models/entities/generated/Enrichments.d.ts +7 -0
- package/models/entities/generated/EnrichmentsIndicator.d.ts +21 -0
- package/models/entities/generated/Event.d.ts +80 -26
- package/models/entities/generated/EventCloud.d.ts +20 -0
- package/models/entities/generated/EventDestination.d.ts +23 -0
- package/models/entities/generated/EventEmail.d.ts +30 -0
- package/models/entities/generated/EventFile.d.ts +36 -0
- package/models/entities/generated/EventHowler.d.ts +42 -0
- package/models/entities/generated/EventHttp.d.ts +11 -0
- package/models/entities/generated/EventObserver.d.ts +21 -0
- package/models/entities/generated/EventOrganization.d.ts +7 -0
- package/models/entities/generated/EventProcess.d.ts +34 -0
- package/models/entities/generated/EventSource.d.ts +23 -0
- package/models/entities/generated/EventThreat.d.ts +21 -0
- package/models/entities/generated/EventTls.d.ts +12 -0
- package/models/entities/generated/Hit.d.ts +3 -2
- package/models/entities/generated/Host.d.ts +1 -0
- package/models/entities/generated/Howler.d.ts +1 -6
- package/models/entities/generated/HttpResponse.d.ts +11 -0
- package/models/entities/generated/Item.d.ts +12 -0
- package/models/entities/generated/ObserverIngress.d.ts +9 -0
- package/models/entities/generated/Rule.d.ts +8 -9
- package/models/entities/generated/Settings.d.ts +4 -0
- package/models/entities/generated/Task.d.ts +10 -0
- package/models/entities/generated/Threat.d.ts +2 -2
- package/models/entities/generated/{Enrichment.d.ts → ThreatEnrichment.d.ts} +1 -1
- package/models/entities/generated/View.d.ts +1 -0
- package/models/socket/CaseUpdate.d.ts +5 -0
- package/models/socket/ViewersUpdate.d.ts +4 -0
- package/package.json +156 -137
- package/plugins/clue/components/ClueLeadForm.js +1 -1
- package/plugins/clue/components/CluePivotForm.js +2 -2
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/helpers.js +4 -4
- package/plugins/clue/index.d.ts +3 -2
- package/plugins/clue/index.js +0 -1
- package/plugins/clue/utils.d.ts +2 -1
- package/rest/AxiosClient.test.d.ts +1 -0
- package/rest/AxiosClient.test.js +185 -0
- package/tests/mocks.d.ts +11 -1
- package/tests/mocks.js +12 -7
- package/tests/server-handlers.js +11 -1
- package/tests/utils.d.ts +4 -0
- package/tests/utils.js +21 -0
- package/utils/Throttler.test.js +2 -2
- package/utils/actionUtils.d.ts +3 -3
- package/utils/classificationParser.d.ts +195 -0
- package/utils/classificationParser.js +680 -0
- package/utils/constants.d.ts +4 -3
- package/utils/constants.js +6 -0
- package/utils/localStorage.js +1 -1
- package/utils/menuUtils.js +0 -4
- package/utils/recordFunctions.d.ts +3 -0
- package/utils/recordFunctions.js +8 -0
- package/utils/recordFunctions.test.d.ts +1 -0
- package/utils/{hitFunctions.test.js → recordFunctions.test.js} +1 -1
- package/utils/socketUtils.d.ts +14 -0
- package/utils/socketUtils.js +17 -1
- package/utils/socketUtils.test.js +49 -16
- package/utils/stringUtils.d.ts +1 -0
- package/utils/stringUtils.js +7 -0
- package/utils/stringUtils.test.js +22 -2
- package/utils/typeUtils.d.ts +7 -0
- package/utils/typeUtils.js +27 -0
- package/utils/utils.d.ts +1 -1
- package/utils/utils.js +2 -2
- package/utils/utils.test.js +119 -2
- package/utils/viewUtils.js +3 -0
- package/utils/xsrf.js +1 -1
- package/api/analytic/rules.d.ts +0 -3
- package/api/analytic/rules.js +0 -8
- package/components/app/providers/HitProvider.d.ts +0 -22
- package/components/elements/display/icons/BundleButton.d.ts +0 -6
- package/components/elements/display/icons/BundleButton.js +0 -32
- package/components/elements/hit/HitRelated.d.ts +0 -6
- package/components/elements/hit/HitRelated.js +0 -7
- package/components/elements/hit/elements/HitUsers.js +0 -33
- package/components/routes/advanced/RuleModal.d.ts +0 -7
- package/components/routes/advanced/RuleModal.js +0 -83
- package/components/routes/analytics/RuleView.d.ts +0 -8
- package/components/routes/analytics/RuleView.js +0 -48
- package/components/routes/help/BundleDocumentation.d.ts +0 -3
- package/components/routes/help/BundleDocumentation.js +0 -12
- package/components/routes/help/markdown/en/bundles.md.js +0 -1
- package/components/routes/help/markdown/fr/bundles.md.js +0 -1
- package/components/routes/hits/search/BundleParentMenu.d.ts +0 -6
- package/components/routes/hits/search/BundleParentMenu.js +0 -32
- package/components/routes/hits/search/BundleScroller.d.ts +0 -2
- package/components/routes/hits/search/BundleScroller.js +0 -6
- package/components/routes/hits/search/HitContextMenu.js +0 -239
- package/components/routes/hits/search/LayoutSettings.js +0 -24
- package/components/routes/hits/search/grid/HitGrid.d.ts +0 -3
- package/components/routes/hits/search/grid/HitGrid.js +0 -132
- package/utils/hitFunctions.d.ts +0 -2
- package/utils/hitFunctions.js +0 -8
- /package/{components/app/providers/HitSearchProvider.test.d.ts → api/socket/viewers.test.d.ts} +0 -0
- /package/components/{routes/hits/search/HitContextMenu.test.d.ts → app/providers/GridColumnsProvider.test.d.ts} +0 -0
- /package/{utils/hitFunctions.test.d.ts → components/app/providers/RecordSearchProvider.test.d.ts} +0 -0
- /package/components/{routes/overviews/OverviewEditor.d.ts → elements/MarkdownEditor.d.ts} +0 -0
- /package/components/{routes/hits/search → elements/hit}/grid/AddColumnModal.d.ts +0 -0
- /package/components/elements/hit/{HitDetails.d.ts → related/RelatedRecords.d.ts} +0 -0
- /package/components/routes/hits/search/{HitBrowser.d.ts → RecordBrowser.d.ts} +0 -0
- /package/components/routes/hits/search/{LayoutSettings.d.ts → shared/LayoutSettings.d.ts} +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
+
import { createMockCase } from '@cccsaurora/howler-ui/tests/utils';
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Hoisted mocks
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
const mockHitCardProps = vi.hoisted(() => ({ current: [] }));
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Module mocks
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
vi.mock('components/elements/hit/HitCard', () => ({
|
|
14
|
+
default: (props) => {
|
|
15
|
+
mockHitCardProps.current.push(props);
|
|
16
|
+
return _jsx("div", { id: `hit-card-${String(props.id)}` });
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
vi.mock('react-i18next', () => ({
|
|
20
|
+
useTranslation: () => ({
|
|
21
|
+
t: (key) => key
|
|
22
|
+
})
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('react-router-dom', async () => {
|
|
25
|
+
const actual = await vi.importActual('react-router-dom');
|
|
26
|
+
return {
|
|
27
|
+
...actual,
|
|
28
|
+
Link: ({ to, children, ...props }) => (_jsx("a", { href: to, ...props, children: children }))
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Imports after mocks
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
import AlertPanel from './AlertPanel';
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Helpers
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
const renderPanel = (caseValue) => {
|
|
39
|
+
return render(_jsx(MemoryRouter, { children: _jsx(AlertPanel, { case: caseValue }) }));
|
|
40
|
+
};
|
|
41
|
+
const makeHitItem = (value, id = value) => ({
|
|
42
|
+
type: 'hit',
|
|
43
|
+
value,
|
|
44
|
+
id,
|
|
45
|
+
name: null,
|
|
46
|
+
parent: null
|
|
47
|
+
});
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Setup
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
mockHitCardProps.current = [];
|
|
53
|
+
});
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Tests
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
describe('AlertPanel', () => {
|
|
58
|
+
it('renders a skeleton when the case is null', () => {
|
|
59
|
+
const { container } = renderPanel(null);
|
|
60
|
+
expect(container.querySelector('.MuiSkeleton-root')).toBeTruthy();
|
|
61
|
+
});
|
|
62
|
+
it('renders the translated heading key', () => {
|
|
63
|
+
const _case = createMockCase({ case_id: 'case-1', items: [] });
|
|
64
|
+
renderPanel(_case);
|
|
65
|
+
expect(screen.getByText('page.cases.dashboard.alerts')).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
it('renders HitCard only for unique hit items on the current page', () => {
|
|
68
|
+
const duplicate = makeHitItem('hit-1', '/cases/test/path-a');
|
|
69
|
+
const _case = createMockCase({
|
|
70
|
+
case_id: 'case-2',
|
|
71
|
+
items: [duplicate, duplicate, makeHitItem('hit-2', '/cases/test/path-b'), { type: 'event', value: 'event-1' }]
|
|
72
|
+
});
|
|
73
|
+
renderPanel(_case);
|
|
74
|
+
expect(screen.getByTestId('hit-card-hit-1')).toBeInTheDocument();
|
|
75
|
+
expect(screen.getByTestId('hit-card-hit-2')).toBeInTheDocument();
|
|
76
|
+
expect(screen.queryByTestId('hit-card-event-1')).not.toBeInTheDocument();
|
|
77
|
+
expect(mockHitCardProps.current).toHaveLength(2);
|
|
78
|
+
expect(mockHitCardProps.current[0]).toEqual(expect.objectContaining({
|
|
79
|
+
id: 'hit-1',
|
|
80
|
+
lazy: true,
|
|
81
|
+
layout: 'dense'
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
it('renders overlay links that target each hit path', () => {
|
|
85
|
+
const _case = createMockCase({
|
|
86
|
+
case_id: 'case-3',
|
|
87
|
+
items: [makeHitItem('hit-1', '/cases/case-3/path-one'), makeHitItem('hit-2', '/cases/case-3/path-two')]
|
|
88
|
+
});
|
|
89
|
+
const { container } = renderPanel(_case);
|
|
90
|
+
const links = Array.from(container.querySelectorAll('a'));
|
|
91
|
+
expect(links).toHaveLength(2);
|
|
92
|
+
expect(links[0]).toHaveAttribute('href', '/cases/case-3/hit-1');
|
|
93
|
+
expect(links[1]).toHaveAttribute('href', '/cases/case-3/hit-2');
|
|
94
|
+
});
|
|
95
|
+
it('shows pagination with multiple pages and switches to page 2 items', () => {
|
|
96
|
+
const items = Array.from({ length: 6 }, (_, idx) => makeHitItem(`hit-${idx + 1}`, `/cases/test/hit-${idx + 1}`));
|
|
97
|
+
const _case = createMockCase({ case_id: 'case-4', items });
|
|
98
|
+
renderPanel(_case);
|
|
99
|
+
expect(screen.getByTestId('hit-card-hit-1')).toBeInTheDocument();
|
|
100
|
+
expect(screen.getByTestId('hit-card-hit-5')).toBeInTheDocument();
|
|
101
|
+
expect(screen.queryByTestId('hit-card-hit-6')).not.toBeInTheDocument();
|
|
102
|
+
const pageTwoButton = screen.getByRole('button', { name: 'Go to page 2' });
|
|
103
|
+
fireEvent.click(pageTwoButton);
|
|
104
|
+
expect(screen.getByTestId('hit-card-hit-6')).toBeInTheDocument();
|
|
105
|
+
expect(screen.queryByTestId('hit-card-hit-1')).not.toBeInTheDocument();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, useTheme } from '@mui/material';
|
|
3
|
+
import api from '@cccsaurora/howler-ui/api';
|
|
4
|
+
import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
|
|
5
|
+
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import { difference, get, isNil } from 'lodash-es';
|
|
8
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
import { useOutletContext } from 'react-router-dom';
|
|
11
|
+
import { useContextSelector } from 'use-context-selector';
|
|
12
|
+
import useCase from '../hooks/useCase';
|
|
13
|
+
import CaseAggregate from './aggregates/CaseAggregate';
|
|
14
|
+
import AlertPanel from './AlertPanel';
|
|
15
|
+
import CaseOverview from './CaseOverview';
|
|
16
|
+
import RelatedCasePanel from './RelatedCasePanel';
|
|
17
|
+
import TaskPanel from './TaskPanel';
|
|
18
|
+
const AGGREGATE_FIELDS = [
|
|
19
|
+
['howler.outline.threat', 'material-symbols:warning-rounded', 'warning.main', 'page.cases.dashboard.threat'],
|
|
20
|
+
['howler.outline.target', 'material-symbols:group', 'primary.main', 'page.cases.dashboard.target'],
|
|
21
|
+
['howler.outline.indicators', 'fluent:number-symbol-24-filled', null, 'page.cases.dashboard.indicators']
|
|
22
|
+
];
|
|
23
|
+
const getDuration = (case_) => {
|
|
24
|
+
if (case_?.start) {
|
|
25
|
+
return dayjs
|
|
26
|
+
.duration(dayjs(case_?.end ?? new Date()).diff(dayjs(case_.start), 'minute'), 'minute')
|
|
27
|
+
.format('HH[h] mm[m]');
|
|
28
|
+
}
|
|
29
|
+
return '--';
|
|
30
|
+
};
|
|
31
|
+
const CaseDashboard = ({ case: providedCase, caseId }) => {
|
|
32
|
+
const { t } = useTranslation();
|
|
33
|
+
const { dispatchApi } = useMyApi();
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const routeCase = useOutletContext();
|
|
36
|
+
const { case: _case, update: updateCase } = useCase({ case: providedCase ?? routeCase, caseId });
|
|
37
|
+
const [invalidIds, setInvalidIds] = useState([]);
|
|
38
|
+
const ids = useMemo(() => (_case?.items ?? [])
|
|
39
|
+
.filter(item => ['hit', 'event'].includes(item.type))
|
|
40
|
+
.map(item => item.value)
|
|
41
|
+
.filter(val => !!val), [_case?.items]);
|
|
42
|
+
const records = useContextSelector(RecordContext, ctx => ctx.records);
|
|
43
|
+
const loadRecords = useContextSelector(RecordContext, ctx => ctx.loadRecords);
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
const caseRecords = useMemo(() => Object.fromEntries(ids.map(id => [id, records[id]])), [ids, records]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const missingIds = Object.entries(caseRecords)
|
|
48
|
+
.filter(([id, record]) => !invalidIds.includes(id) && isNil(record))
|
|
49
|
+
.map(([id]) => id);
|
|
50
|
+
if (missingIds.length < 1) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
void dispatchApi(api.v2.search.post(['hit', 'event'], {
|
|
54
|
+
query: `howler.id:(${missingIds.join(' OR ')})`,
|
|
55
|
+
metadata: ['template', 'analytic']
|
|
56
|
+
})).then(response => {
|
|
57
|
+
loadRecords(response.items);
|
|
58
|
+
setInvalidIds(difference(missingIds, response.items.map(record => record.howler.id)));
|
|
59
|
+
});
|
|
60
|
+
}, [caseRecords, dispatchApi, ids, invalidIds, loadRecords]);
|
|
61
|
+
if (!_case) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return (_jsxs(Grid, { container: true, spacing: 5, width: "100%", px: 2, children: [_jsx(Grid, { item: true, xs: 12, children: _jsx(CaseOverview, { case: _case, updateCase: updateCase }) }), AGGREGATE_FIELDS.map(([field, icon, iconColor, subtitle]) => (_jsx(Grid, { item: true, xs: 12, md: 6, xl: 3, children: _jsx(CaseAggregate, { icon: icon, iconColor: iconColor && get(theme.palette, iconColor), field: field, records: Object.values(caseRecords), subtitle: t(subtitle) }) }, field))), _jsx(Grid, { item: true, xs: 12, md: 6, xl: 3, children: _jsx(CaseAggregate, { icon: "mingcute:heartbeat-line", iconColor: theme.palette.error.light, title: getDuration(_case), subtitle: t('page.cases.dashboard.duration') }) }), _jsx(Grid, { item: true, xs: 12, children: _jsx(TaskPanel, { case: _case, updateCase: updateCase }) }), _jsx(Grid, { item: true, xs: 12, children: _jsx(AlertPanel, { case: _case }) }), _jsx(Grid, { item: true, xs: 12, children: _jsx(RelatedCasePanel, { case: _case }) })] }));
|
|
65
|
+
};
|
|
66
|
+
export default CaseDashboard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, waitFor } from '@testing-library/react';
|
|
3
|
+
import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { createMockCase, createMockEvent, createMockHit } from '@cccsaurora/howler-ui/tests/utils';
|
|
6
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Hoisted mocks
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
const mockDispatchApi = vi.hoisted(() => vi.fn());
|
|
11
|
+
const mockSearchPost = vi.hoisted(() => vi.fn());
|
|
12
|
+
const mockUpdateCase = vi.hoisted(() => vi.fn());
|
|
13
|
+
const mockUseCaseState = vi.hoisted(() => ({ case: null }));
|
|
14
|
+
const mockAggregateProps = vi.hoisted(() => ({
|
|
15
|
+
current: []
|
|
16
|
+
}));
|
|
17
|
+
const mockCaseOverviewProps = vi.hoisted(() => ({ current: [] }));
|
|
18
|
+
const mockTaskPanelProps = vi.hoisted(() => ({ current: [] }));
|
|
19
|
+
const mockAlertPanelProps = vi.hoisted(() => ({ current: [] }));
|
|
20
|
+
const mockRelatedCasePanelProps = vi.hoisted(() => ({ current: [] }));
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Module mocks
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
vi.mock('use-context-selector', async () => {
|
|
25
|
+
const react = (await vi.importActual('react'));
|
|
26
|
+
return {
|
|
27
|
+
createContext: react.createContext,
|
|
28
|
+
useContextSelector: (context, selector) => {
|
|
29
|
+
return selector(react.useContext(context));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
vi.mock('components/hooks/useMyApi', () => ({
|
|
34
|
+
default: () => ({ dispatchApi: mockDispatchApi })
|
|
35
|
+
}));
|
|
36
|
+
vi.mock('api', () => ({
|
|
37
|
+
default: {
|
|
38
|
+
v2: {
|
|
39
|
+
search: {
|
|
40
|
+
post: (...args) => mockSearchPost(...args)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
vi.mock('../hooks/useCase', () => ({
|
|
46
|
+
default: () => ({
|
|
47
|
+
case: mockUseCaseState.case,
|
|
48
|
+
update: mockUpdateCase
|
|
49
|
+
})
|
|
50
|
+
}));
|
|
51
|
+
vi.mock('react-i18next', () => ({
|
|
52
|
+
useTranslation: () => ({
|
|
53
|
+
t: (key) => key
|
|
54
|
+
})
|
|
55
|
+
}));
|
|
56
|
+
vi.mock('react-router-dom', async () => {
|
|
57
|
+
const actual = await vi.importActual('react-router-dom');
|
|
58
|
+
return {
|
|
59
|
+
...actual,
|
|
60
|
+
useOutletContext: () => createMockCase({ case_id: 'route-case-id', items: [] })
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
vi.mock('./aggregates/CaseAggregate', () => ({
|
|
64
|
+
default: (props) => {
|
|
65
|
+
mockAggregateProps.current.push(props);
|
|
66
|
+
return _jsx("div", { id: `aggregate-${String(mockAggregateProps.current.length)}` });
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
vi.mock('./CaseOverview', () => ({
|
|
70
|
+
default: (props) => {
|
|
71
|
+
mockCaseOverviewProps.current.push(props);
|
|
72
|
+
return _jsx("div", { id: "case-overview" });
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
vi.mock('./TaskPanel', () => ({
|
|
76
|
+
default: (props) => {
|
|
77
|
+
mockTaskPanelProps.current.push(props);
|
|
78
|
+
return _jsx("div", { id: "task-panel" });
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
vi.mock('./AlertPanel', () => ({
|
|
82
|
+
default: (props) => {
|
|
83
|
+
mockAlertPanelProps.current.push(props);
|
|
84
|
+
return _jsx("div", { id: "alert-panel" });
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
vi.mock('./RelatedCasePanel', () => ({
|
|
88
|
+
default: (props) => {
|
|
89
|
+
mockRelatedCasePanelProps.current.push(props);
|
|
90
|
+
return _jsx("div", { id: "related-case-panel" });
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// Imports after mocks
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
import CaseDashboard from './CaseDashboard';
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Helpers
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
const makeRecordContextValue = (records, loadRecords) => ({
|
|
101
|
+
records,
|
|
102
|
+
selectedRecords: [],
|
|
103
|
+
addRecordToSelection: vi.fn(),
|
|
104
|
+
removeRecordFromSelection: vi.fn(),
|
|
105
|
+
clearSelectedRecords: vi.fn(),
|
|
106
|
+
loadRecords,
|
|
107
|
+
updateRecord: vi.fn(),
|
|
108
|
+
getRecord: vi.fn()
|
|
109
|
+
});
|
|
110
|
+
const renderDashboard = ({ dashboardCase, initialRecords = {}, onLoadRecords }) => {
|
|
111
|
+
const Wrapper = ({ children }) => {
|
|
112
|
+
const [records, setRecords] = useState(initialRecords);
|
|
113
|
+
const loadRecords = items => {
|
|
114
|
+
onLoadRecords?.(items);
|
|
115
|
+
const mapped = Object.fromEntries(items.map(item => [item.howler.id, item]));
|
|
116
|
+
setRecords(prev => ({ ...prev, ...mapped }));
|
|
117
|
+
};
|
|
118
|
+
return (_jsx(RecordContext.Provider, { value: makeRecordContextValue(records, loadRecords), children: children }));
|
|
119
|
+
};
|
|
120
|
+
return render(_jsx(CaseDashboard, { case: dashboardCase }), { wrapper: Wrapper });
|
|
121
|
+
};
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
// Setup
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
beforeEach(() => {
|
|
126
|
+
mockDispatchApi.mockReset();
|
|
127
|
+
mockSearchPost.mockReset();
|
|
128
|
+
mockUpdateCase.mockReset();
|
|
129
|
+
mockAggregateProps.current = [];
|
|
130
|
+
mockCaseOverviewProps.current = [];
|
|
131
|
+
mockTaskPanelProps.current = [];
|
|
132
|
+
mockAlertPanelProps.current = [];
|
|
133
|
+
mockRelatedCasePanelProps.current = [];
|
|
134
|
+
mockUseCaseState.case = null;
|
|
135
|
+
});
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// Tests
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
describe('CaseDashboard', () => {
|
|
140
|
+
it('renders nothing when useCase does not return a case', () => {
|
|
141
|
+
const baseCase = createMockCase({ case_id: 'case-1', items: [] });
|
|
142
|
+
mockUseCaseState.case = null;
|
|
143
|
+
const { container } = renderDashboard({ dashboardCase: baseCase });
|
|
144
|
+
expect(container).toBeEmptyDOMElement();
|
|
145
|
+
});
|
|
146
|
+
it('renders overview, panels and aggregate cards with translated subtitles', () => {
|
|
147
|
+
const dashboardCase = createMockCase({
|
|
148
|
+
case_id: 'case-2',
|
|
149
|
+
items: [
|
|
150
|
+
{ type: 'hit', value: 'hit-1' },
|
|
151
|
+
{ type: 'event', value: 'event-1' }
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
mockUseCaseState.case = dashboardCase;
|
|
155
|
+
renderDashboard({
|
|
156
|
+
dashboardCase,
|
|
157
|
+
initialRecords: {
|
|
158
|
+
'hit-1': createMockHit({ howler: { id: 'hit-1', outline: { threat: 'threat-a', target: 'target-a' } } }),
|
|
159
|
+
'event-1': createMockEvent({ howler: { id: 'event-1', outline: { indicators: ['ioc-a'] } } })
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
expect(mockCaseOverviewProps.current).toHaveLength(1);
|
|
163
|
+
expect(mockTaskPanelProps.current).toHaveLength(1);
|
|
164
|
+
expect(mockAlertPanelProps.current).toHaveLength(1);
|
|
165
|
+
expect(mockRelatedCasePanelProps.current).toHaveLength(1);
|
|
166
|
+
expect(mockAggregateProps.current).toHaveLength(4);
|
|
167
|
+
expect(mockAggregateProps.current[0]).toEqual(expect.objectContaining({
|
|
168
|
+
field: 'howler.outline.threat',
|
|
169
|
+
subtitle: 'page.cases.dashboard.threat'
|
|
170
|
+
}));
|
|
171
|
+
expect(mockAggregateProps.current[1]).toEqual(expect.objectContaining({
|
|
172
|
+
field: 'howler.outline.target',
|
|
173
|
+
subtitle: 'page.cases.dashboard.target'
|
|
174
|
+
}));
|
|
175
|
+
expect(mockAggregateProps.current[2]).toEqual(expect.objectContaining({
|
|
176
|
+
field: 'howler.outline.indicators',
|
|
177
|
+
subtitle: 'page.cases.dashboard.indicators'
|
|
178
|
+
}));
|
|
179
|
+
expect(mockAggregateProps.current[3]).toEqual(expect.objectContaining({
|
|
180
|
+
subtitle: 'page.cases.dashboard.duration',
|
|
181
|
+
title: '--'
|
|
182
|
+
}));
|
|
183
|
+
});
|
|
184
|
+
it('loads missing hit and event records and sends expected search query', async () => {
|
|
185
|
+
const dashboardCase = createMockCase({
|
|
186
|
+
case_id: 'case-3',
|
|
187
|
+
items: [
|
|
188
|
+
{ type: 'hit', value: 'hit-1' },
|
|
189
|
+
{ type: 'event', value: 'event-1' },
|
|
190
|
+
{ type: 'hit', value: 'hit-2' },
|
|
191
|
+
{ type: 'case', value: 'case-child' }
|
|
192
|
+
]
|
|
193
|
+
});
|
|
194
|
+
mockUseCaseState.case = dashboardCase;
|
|
195
|
+
const loadedEvent = createMockEvent({ howler: { id: 'event-1' } });
|
|
196
|
+
const loadedHit = createMockHit({ howler: { id: 'hit-2' } });
|
|
197
|
+
mockSearchPost.mockReturnValue({ endpoint: 'search' });
|
|
198
|
+
mockDispatchApi.mockResolvedValue({
|
|
199
|
+
items: [loadedEvent, loadedHit]
|
|
200
|
+
});
|
|
201
|
+
const onLoadRecords = vi.fn();
|
|
202
|
+
renderDashboard({
|
|
203
|
+
dashboardCase,
|
|
204
|
+
initialRecords: {
|
|
205
|
+
'hit-1': createMockHit({ howler: { id: 'hit-1' } })
|
|
206
|
+
},
|
|
207
|
+
onLoadRecords
|
|
208
|
+
});
|
|
209
|
+
await waitFor(() => {
|
|
210
|
+
expect(mockSearchPost).toHaveBeenCalledWith(['hit', 'event'], {
|
|
211
|
+
query: 'howler.id:(event-1 OR hit-2)',
|
|
212
|
+
metadata: ['template', 'analytic']
|
|
213
|
+
});
|
|
214
|
+
expect(mockDispatchApi).toHaveBeenCalledTimes(1);
|
|
215
|
+
expect(onLoadRecords).toHaveBeenCalledWith([loadedEvent, loadedHit]);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, FormatListBulleted, HourglassBottom, Pause, People, TrendingUp, WarningRounded } from '@mui/icons-material';
|
|
3
|
+
import { Autocomplete, AvatarGroup, Card, Divider, LinearProgress, Skeleton, Stack, Table, TableBody, TableCell, TableRow, TextField, Typography } from '@mui/material';
|
|
4
|
+
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
5
|
+
import { ModalContext } from '@cccsaurora/howler-ui/components/app/providers/ModalProvider';
|
|
6
|
+
import { SocketContext } from '@cccsaurora/howler-ui/components/app/providers/SocketProvider';
|
|
7
|
+
import HowlerAvatar from '@cccsaurora/howler-ui/components/elements/display/HowlerAvatar';
|
|
8
|
+
import SocketBadge from '@cccsaurora/howler-ui/components/elements/display/icons/SocketBadge';
|
|
9
|
+
import UserList from '@cccsaurora/howler-ui/components/elements/UserList';
|
|
10
|
+
import dayjs from 'dayjs';
|
|
11
|
+
import { useContext, useState } from 'react';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import { ESCALATION_COLOR_MAP } from '../constants';
|
|
14
|
+
import useCase from '../hooks/useCase';
|
|
15
|
+
import ResolveModal from '../modals/ResolveModal';
|
|
16
|
+
import SourceAggregate from './aggregates/SourceAggregate';
|
|
17
|
+
const CaseDetails = ({ case: providedCase }) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const { case: _case, update: updateCase } = useCase({ case: providedCase });
|
|
20
|
+
const { showModal } = useContext(ModalContext);
|
|
21
|
+
const { viewers } = useContext(SocketContext);
|
|
22
|
+
const { config } = useContext(ApiConfigContext);
|
|
23
|
+
const [loading, setLoading] = useState(false);
|
|
24
|
+
const caseViewers = _case?.case_id ? (viewers[_case.case_id] ?? []) : [];
|
|
25
|
+
const wrappedUpdate = async (subset) => {
|
|
26
|
+
try {
|
|
27
|
+
setLoading(true);
|
|
28
|
+
await updateCase(subset);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
setLoading(false);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const handleStatus = (status) => {
|
|
35
|
+
if (status === 'resolved') {
|
|
36
|
+
const onConfirm = () => wrappedUpdate({ status });
|
|
37
|
+
showModal(_jsx(ResolveModal, { case: _case, onConfirm: onConfirm }), { maxHeight: '80vh' });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
void wrappedUpdate({ status });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
if (!_case) {
|
|
44
|
+
return (_jsx(Card, { sx: {
|
|
45
|
+
borderRadius: 0,
|
|
46
|
+
width: '300px',
|
|
47
|
+
maxHeight: 'calc(100vh - 64px)',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
p: 1
|
|
51
|
+
}, children: _jsx(Skeleton, { variant: "rounded", height: 50 }) }));
|
|
52
|
+
}
|
|
53
|
+
return (_jsxs(Card, { elevation: 1, sx: {
|
|
54
|
+
borderRadius: 0,
|
|
55
|
+
width: '300px',
|
|
56
|
+
maxHeight: 'calc(100vh - 64px)',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
p: 1,
|
|
60
|
+
position: 'relative'
|
|
61
|
+
}, children: [_jsx(LinearProgress, { sx: { opacity: +loading, position: 'absolute', top: 0, left: 0, right: 0 } }), _jsxs(Stack, { spacing: 2, children: [_jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [{
|
|
62
|
+
'in-progress': _jsx(HourglassBottom, { color: "warning" }),
|
|
63
|
+
'on-hold': _jsx(Pause, { color: "disabled" }),
|
|
64
|
+
resolved: _jsx(Check, { color: "success" })
|
|
65
|
+
}[_case.status] ?? _jsx(WarningRounded, { fontSize: "small" }), _jsx(Typography, { variant: "body1", children: t('page.cases.detail.status') })] }), _jsx(Autocomplete, { size: "small", disabled: loading, disableClearable: true, value: _case.status, options: config.lookups['howler.status'], renderInput: params => _jsx(TextField, { ...params, size: "small" }), onChange: (_ev, status) => {
|
|
66
|
+
if (status) {
|
|
67
|
+
handleStatus(status);
|
|
68
|
+
}
|
|
69
|
+
} }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(TrendingUp, { color: ESCALATION_COLOR_MAP[_case.escalation] }), _jsx(Typography, { variant: "body1", children: t('page.cases.detail.escalation') })] }), _jsx(Autocomplete, { size: "small", disabled: loading, disableClearable: true, value: _case.escalation ?? null, options: config.lookups['case.escalation'], renderInput: params => _jsx(TextField, { ...params, size: "small" }), onChange: (_ev, escalation) => {
|
|
70
|
+
if (escalation) {
|
|
71
|
+
void wrappedUpdate({ escalation });
|
|
72
|
+
}
|
|
73
|
+
} })] }), _jsx(Divider, {}), _jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(People, {}), _jsx(Typography, { variant: "body1", children: t('page.cases.detail.participants') })] }), _jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [_jsx(UserList, { buttonSx: { alignSelf: 'start' }, multiple: true, i18nLabel: "page.cases.detail.assignment", userIds: _case.participants ?? [], onChange: participants => wrappedUpdate({ participants }), disabled: loading }), _jsx("div", { style: { flex: 1 } })] }), caseViewers.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs(Stack, { direction: "row", alignItems: "center", children: [_jsx(SocketBadge, { size: "medium" }), _jsx(Typography, { variant: "body1", children: t('page.cases.detail.viewers') })] }), _jsx(AvatarGroup, { max: 4, sx: { alignSelf: 'start' }, componentsProps: {
|
|
74
|
+
additionalAvatar: {
|
|
75
|
+
sx: { height: 32, width: 32, fontSize: '12px' }
|
|
76
|
+
}
|
|
77
|
+
}, children: caseViewers.map(viewer => (_jsx(HowlerAvatar, { userId: viewer, sx: { height: 32, width: 32 } }, viewer))) })] }))] }), _jsx(Divider, {}), _jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(FormatListBulleted, {}), _jsx(Typography, { variant: "body1", children: t('page.cases.detail.properties') })] }), _jsx(Table, { sx: { '& td': { p: 1 } }, children: _jsxs(TableBody, { children: [_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Typography, { variant: "caption", children: t('page.cases.created') }) }), _jsx(TableCell, { children: _jsx(Typography, { variant: "caption", children: dayjs(_case.created).toString() }) })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Typography, { variant: "caption", children: t('page.cases.updated') }) }), _jsx(TableCell, { children: _jsx(Typography, { variant: "caption", children: dayjs(_case.updated).toString() }) })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Typography, { variant: "caption", children: t('page.cases.sources') }) }), _jsx(TableCell, { children: _jsx(Typography, { variant: "caption", children: _jsx(SourceAggregate, { case: _case }) }) })] })] }) })] })] })] }));
|
|
78
|
+
};
|
|
79
|
+
export default CaseDetails;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import userEvent, {} from '@testing-library/user-event';
|
|
5
|
+
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
6
|
+
import { SocketContext } from '@cccsaurora/howler-ui/components/app/providers/SocketProvider';
|
|
7
|
+
import { createMockCase } from '@cccsaurora/howler-ui/tests/utils';
|
|
8
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
9
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Hoisted stubs
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
const mockUpdate = vi.hoisted(() => vi.fn().mockResolvedValue(undefined));
|
|
14
|
+
const mockShowModal = vi.hoisted(() => vi.fn());
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Module mocks (registered before the dynamic import below)
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
vi.mock('../hooks/useCase', () => ({
|
|
19
|
+
default: ({ case: c }) => ({
|
|
20
|
+
case: c,
|
|
21
|
+
update: mockUpdate,
|
|
22
|
+
loading: false,
|
|
23
|
+
missing: false
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
vi.mock('components/app/providers/ModalProvider', async () => {
|
|
27
|
+
const { createContext } = await import('react');
|
|
28
|
+
return {
|
|
29
|
+
ModalContext: createContext({
|
|
30
|
+
showModal: mockShowModal,
|
|
31
|
+
close: vi.fn(),
|
|
32
|
+
setContent: vi.fn(),
|
|
33
|
+
withConfirmDeleteModal: vi.fn()
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
vi.mock('components/elements/UserList', () => ({
|
|
38
|
+
default: () => _jsx("div", { id: "user-list" })
|
|
39
|
+
}));
|
|
40
|
+
vi.mock('components/elements/display/HowlerAvatar', () => ({
|
|
41
|
+
default: ({ userId }) => _jsx("div", { children: userId })
|
|
42
|
+
}));
|
|
43
|
+
vi.mock('components/elements/display/icons/SocketBadge', () => ({
|
|
44
|
+
default: () => _jsx("span", {})
|
|
45
|
+
}));
|
|
46
|
+
vi.mock('./aggregates/SourceAggregate', () => ({
|
|
47
|
+
default: () => _jsx("span", {})
|
|
48
|
+
}));
|
|
49
|
+
vi.mock('../modals/ResolveModal', () => ({
|
|
50
|
+
default: () => null
|
|
51
|
+
}));
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Shared provider config
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
const mockConfig = {
|
|
56
|
+
lookups: {
|
|
57
|
+
'howler.status': ['open', 'in-progress', 'on-hold', 'resolved'],
|
|
58
|
+
'case.escalation': ['normal', 'focus', 'crisis'],
|
|
59
|
+
'howler.escalation': ['miss', 'hit', 'alert', 'evidence']
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const mockViewers = {};
|
|
63
|
+
const Wrapper = ({ children }) => (_jsx(ApiConfigContext.Provider, { value: { config: mockConfig, setConfig: vi.fn() }, children: _jsx(SocketContext.Provider, { value: {
|
|
64
|
+
emit: vi.fn(),
|
|
65
|
+
open: true,
|
|
66
|
+
fetchViewers: vi.fn(),
|
|
67
|
+
addListener: vi.fn(),
|
|
68
|
+
removeListener: vi.fn(),
|
|
69
|
+
status: 1,
|
|
70
|
+
reconnect: vi.fn(),
|
|
71
|
+
viewers: { ...mockViewers }
|
|
72
|
+
}, children: children }) }));
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Import after mocks
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
const { default: CaseDetails } = await import('./CaseDetails');
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Tests
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
describe('CaseDetails', () => {
|
|
81
|
+
let user;
|
|
82
|
+
let testCase;
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
user = userEvent.setup();
|
|
85
|
+
vi.clearAllMocks();
|
|
86
|
+
mockUpdate.mockResolvedValue(undefined);
|
|
87
|
+
testCase = createMockCase({ case_id: 'test-case-id', status: 'open', escalation: 'normal' });
|
|
88
|
+
Object.keys(mockViewers).forEach(k => delete mockViewers[k]);
|
|
89
|
+
});
|
|
90
|
+
it('renders a skeleton and no controls when the case is null', () => {
|
|
91
|
+
render(_jsx(CaseDetails, { case: null }), { wrapper: Wrapper });
|
|
92
|
+
expect(document.querySelector('.MuiSkeleton-root')).toBeTruthy();
|
|
93
|
+
expect(screen.queryByRole('combobox')).toBeNull();
|
|
94
|
+
});
|
|
95
|
+
it('renders the status label and current status value', () => {
|
|
96
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
97
|
+
expect(screen.getByText('page.cases.detail.status')).toBeInTheDocument();
|
|
98
|
+
expect(screen.getByDisplayValue('open')).toBeInTheDocument();
|
|
99
|
+
});
|
|
100
|
+
it('renders the escalation label and current escalation value', () => {
|
|
101
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
102
|
+
expect(screen.getByText('page.cases.detail.escalation')).toBeInTheDocument();
|
|
103
|
+
expect(screen.getByDisplayValue('normal')).toBeInTheDocument();
|
|
104
|
+
});
|
|
105
|
+
describe('status changes', () => {
|
|
106
|
+
it('calls update with the new status when a non-resolved option is selected', async () => {
|
|
107
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
108
|
+
await user.click(screen.getByDisplayValue('open'));
|
|
109
|
+
await user.click(await screen.findByRole('option', { name: 'in-progress' }));
|
|
110
|
+
await waitFor(() => {
|
|
111
|
+
expect(mockUpdate).toHaveBeenCalledWith({ status: 'in-progress' });
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
it('opens the resolve modal instead of calling update when "resolved" is selected', async () => {
|
|
115
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
116
|
+
await user.click(screen.getByDisplayValue('open'));
|
|
117
|
+
await user.click(await screen.findByRole('option', { name: 'resolved' }));
|
|
118
|
+
expect(mockShowModal).toHaveBeenCalledOnce();
|
|
119
|
+
expect(mockUpdate).not.toHaveBeenCalled();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
describe('escalation changes', () => {
|
|
123
|
+
it('calls update with the new escalation when an option is selected', async () => {
|
|
124
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
125
|
+
await user.click(screen.getByDisplayValue('normal'));
|
|
126
|
+
await user.click(await screen.findByRole('option', { name: 'focus' }));
|
|
127
|
+
await waitFor(() => {
|
|
128
|
+
expect(mockUpdate).toHaveBeenCalledWith({ escalation: 'focus' });
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe('viewers section', () => {
|
|
133
|
+
it('hides the viewers section when no viewers are active', () => {
|
|
134
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
135
|
+
expect(screen.queryByText('page.cases.detail.viewers')).toBeNull();
|
|
136
|
+
});
|
|
137
|
+
it('shows the viewers section and renders viewer avatars when active viewers are present', () => {
|
|
138
|
+
mockViewers['test-case-id'] = ['user-1', 'user-2'];
|
|
139
|
+
render(_jsx(CaseDetails, { case: testCase }), { wrapper: Wrapper });
|
|
140
|
+
expect(screen.getByText('page.cases.detail.viewers')).toBeInTheDocument();
|
|
141
|
+
expect(screen.getByText('user-1')).toBeInTheDocument();
|
|
142
|
+
expect(screen.getByText('user-2')).toBeInTheDocument();
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
});
|