@cccsaurora/howler-ui 2.19.0-dev.999 → 2.20.0-dev.1352
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,145 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMonaco } from '@monaco-editor/react';
|
|
3
|
+
import { CheckCircleOutline, FilterList, RadioButtonUnchecked, Search } from '@mui/icons-material';
|
|
4
|
+
import { Autocomplete, Box, Button, Card, Chip, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Stack, TextField, Tooltip, Typography } from '@mui/material';
|
|
5
|
+
import api from '@cccsaurora/howler-ui/api';
|
|
6
|
+
import ChipPopper from '@cccsaurora/howler-ui/components/elements/display/ChipPopper';
|
|
7
|
+
import QueryResultText from '@cccsaurora/howler-ui/components/elements/display/QueryResultText';
|
|
8
|
+
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
9
|
+
import QueryEditor from '@cccsaurora/howler-ui/components/routes/advanced/QueryEditor';
|
|
10
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
|
+
const DEFAULT_TIMEFRAME_DAYS = 14;
|
|
13
|
+
const PROMPT_CONTEXT = 'isRecordQuery && !suggestWidgetVisible && !renameInputVisible && !inSnippetMode && !quickFixWidgetVisible';
|
|
14
|
+
const OPTIONS = {
|
|
15
|
+
fontSize: 17,
|
|
16
|
+
lineHeight: 19,
|
|
17
|
+
lineNumbers: 'off',
|
|
18
|
+
lineDecorationsWidth: 0,
|
|
19
|
+
lineNumbersMinChars: 0,
|
|
20
|
+
showFoldingControls: 'never',
|
|
21
|
+
scrollBeyondLastLine: false,
|
|
22
|
+
glyphMargin: false,
|
|
23
|
+
renderLineHighlight: 'none',
|
|
24
|
+
overviewRulerLanes: 0
|
|
25
|
+
};
|
|
26
|
+
const INDEX_OPTIONS = ['hit', 'event'];
|
|
27
|
+
const Subtitle = ({ i18nKey }) => {
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
return (_jsx(Typography, { sx: theme => ({
|
|
30
|
+
color: theme.palette.text.secondary,
|
|
31
|
+
fontSize: '0.9em',
|
|
32
|
+
fontStyle: 'italic'
|
|
33
|
+
}), variant: "body2", children: t(i18nKey) }));
|
|
34
|
+
};
|
|
35
|
+
const CreateRuleDialog = ({ open, onClose, onSubmit }) => {
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
const { dispatchApi } = useMyApi();
|
|
38
|
+
const monaco = useMonaco();
|
|
39
|
+
const [query, setQuery] = useState('');
|
|
40
|
+
const [destination, setDestination] = useState('');
|
|
41
|
+
const [indexes, setIndexes] = useState(['hit']);
|
|
42
|
+
const [timeframeDays, setTimeframeDays] = useState(DEFAULT_TIMEFRAME_DAYS);
|
|
43
|
+
const [hasExpiry, setHasExpiry] = useState(true);
|
|
44
|
+
const [expireAfterResolved, setExpireAfterResolved] = useState(false);
|
|
45
|
+
const [loading, setLoading] = useState(false);
|
|
46
|
+
const [searching, setSearching] = useState(false);
|
|
47
|
+
const [response, setResponse] = useState(null);
|
|
48
|
+
const handleOpen = useCallback(() => {
|
|
49
|
+
setQuery('');
|
|
50
|
+
setDestination('');
|
|
51
|
+
setIndexes(['hit']);
|
|
52
|
+
setTimeframeDays(DEFAULT_TIMEFRAME_DAYS);
|
|
53
|
+
setHasExpiry(true);
|
|
54
|
+
setExpireAfterResolved(false);
|
|
55
|
+
setResponse(null);
|
|
56
|
+
}, []);
|
|
57
|
+
const handleSearch = useCallback(async () => {
|
|
58
|
+
setSearching(true);
|
|
59
|
+
try {
|
|
60
|
+
const result = await dispatchApi(api.search.hit.post({
|
|
61
|
+
query,
|
|
62
|
+
rows: 0,
|
|
63
|
+
track_total_hits: true
|
|
64
|
+
}));
|
|
65
|
+
setResponse(result);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
setSearching(false);
|
|
69
|
+
}
|
|
70
|
+
}, [dispatchApi, query]);
|
|
71
|
+
const handleQueryChange = useCallback((q) => {
|
|
72
|
+
setQuery(q);
|
|
73
|
+
setResponse(null);
|
|
74
|
+
}, []);
|
|
75
|
+
const handleSubmit = useCallback(async () => {
|
|
76
|
+
if (!query.trim() || !destination.trim()) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setLoading(true);
|
|
80
|
+
try {
|
|
81
|
+
await onSubmit({
|
|
82
|
+
query: query.trim(),
|
|
83
|
+
destination: destination.trim(),
|
|
84
|
+
timeframe: hasExpiry ? timeframeDays : null,
|
|
85
|
+
expire_after_resolved: hasExpiry ? expireAfterResolved : false,
|
|
86
|
+
indexes
|
|
87
|
+
});
|
|
88
|
+
onClose();
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
setLoading(false);
|
|
92
|
+
}
|
|
93
|
+
}, [query, destination, hasExpiry, timeframeDays, expireAfterResolved, indexes, onSubmit, onClose]);
|
|
94
|
+
const onMount = useCallback((ed) => {
|
|
95
|
+
ed.createContextKey('isRecordQuery', true);
|
|
96
|
+
}, []);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!monaco) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const executeDisposable = monaco.editor.addEditorAction({
|
|
102
|
+
id: 'execute-query',
|
|
103
|
+
label: t('route.advanced.execute.query'),
|
|
104
|
+
contextMenuGroupId: 'howler',
|
|
105
|
+
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],
|
|
106
|
+
run: handleSearch
|
|
107
|
+
});
|
|
108
|
+
return () => {
|
|
109
|
+
executeDisposable.dispose();
|
|
110
|
+
};
|
|
111
|
+
}, [monaco, t, handleSearch]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (!monaco) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
let disposable;
|
|
117
|
+
disposable = monaco.editor.addKeybindingRule({
|
|
118
|
+
command: 'execute-query',
|
|
119
|
+
keybinding: monaco.KeyCode.Enter,
|
|
120
|
+
when: PROMPT_CONTEXT
|
|
121
|
+
});
|
|
122
|
+
return () => {
|
|
123
|
+
disposable.dispose();
|
|
124
|
+
};
|
|
125
|
+
}, [monaco, handleSearch]);
|
|
126
|
+
return (_jsxs(Dialog, { open: open, onClose: onClose, maxWidth: "md", fullWidth: true, id: "create-rule-dialog", TransitionProps: { onEnter: handleOpen }, PaperProps: {
|
|
127
|
+
elevation: 0
|
|
128
|
+
}, children: [_jsx(DialogTitle, { children: t('page.cases.rules.create') }), _jsx(DialogContent, { children: _jsxs(Stack, { spacing: 3, sx: { mt: 1 }, children: [_jsxs(Box, { children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [_jsx(Typography, { variant: "subtitle2", gutterBottom: true, children: t('page.cases.rules.query') }), _jsx(ChipPopper, { icon: _jsx(FilterList, { fontSize: "small" }), label: indexes.map(opt => t(`hit.search.index.${opt}`)).join(', '), minWidth: "225px", slotProps: { chip: { size: 'small' } }, children: _jsx(Autocomplete, { size: "small", multiple: true, options: INDEX_OPTIONS, value: indexes, onChange: (_ev, values) => values.length > 0 && setIndexes(values), getOptionLabel: opt => t(`hit.search.index.${opt}`), renderInput: params => _jsx(TextField, { ...params }) }) })] }), _jsx(Stack, { direction: "row", alignItems: "center", spacing: 1, children: _jsx(Box, { sx: { border: 1, borderColor: 'divider', borderRadius: 1, flex: 1 }, children: _jsxs(Card, { variant: "outlined", sx: theme => ({
|
|
129
|
+
width: '100%',
|
|
130
|
+
height: theme.spacing(5),
|
|
131
|
+
py: 1,
|
|
132
|
+
pl: 1,
|
|
133
|
+
pr: 0.5,
|
|
134
|
+
position: 'relative',
|
|
135
|
+
overflow: 'visible',
|
|
136
|
+
display: 'flex',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
justifyContent: 'space-between',
|
|
139
|
+
'& .monaco-editor': {
|
|
140
|
+
position: 'absolute !important'
|
|
141
|
+
},
|
|
142
|
+
transition: theme.transitions.create('border-color')
|
|
143
|
+
}), onKeyDown: e => e.stopPropagation(), children: [_jsx(QueryEditor, { query: query, setQuery: handleQueryChange, language: "lucene", id: "rule-query-editor", height: "20px", editorOptions: OPTIONS, onMount: onMount }), _jsx(Tooltip, { title: t('route.search'), children: _jsx("span", { children: _jsx(IconButton, { size: "small", id: "rule-search-button", onClick: handleSearch, disabled: searching || !query.trim(), children: _jsx(Search, {}) }) }) })] }) }) }), response ? (_jsx(QueryResultText, { count: response.total, query: query, mb: 0 })) : (_jsx(Subtitle, { i18nKey: "hit.search.prompt" }))] }), _jsxs(Box, { children: [_jsx(TextField, { id: "rule-destination-input", label: t('page.cases.rules.destination'), value: destination, onChange: e => setDestination(e.target.value), fullWidth: true, placeholder: "alerts/{{howler.analytic}}", size: "small" }), _jsx(Subtitle, { i18nKey: "page.cases.rules.destination.help" })] }), _jsxs(Stack, { children: [_jsx(TextField, { id: "rule-timeframe-input", type: "number", label: t('page.cases.rules.timeframe'), value: timeframeDays, onChange: e => setTimeframeDays(Math.max(1, parseInt(e.target.value, 10) || 1)), size: "small", disabled: !hasExpiry, sx: { flex: 1 }, InputProps: { inputProps: { min: 1 } } }), _jsx(Subtitle, { i18nKey: "page.cases.rules.timeframe.help" })] }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", children: [_jsx(Chip, { id: "rule-no-expiry-checkbox", label: t('page.cases.rules.no_expiry'), icon: !hasExpiry ? _jsx(CheckCircleOutline, {}) : _jsx(RadioButtonUnchecked, {}), variant: "filled", color: !hasExpiry ? 'primary' : 'default', clickable: true, disabled: expireAfterResolved, onClick: () => setHasExpiry(prev => !prev) }), _jsx(Chip, { id: "rule-expire-after-resolved", label: t('page.cases.rules.expire_after_resolved'), icon: expireAfterResolved ? _jsx(CheckCircleOutline, {}) : _jsx(RadioButtonUnchecked, {}), variant: "filled", color: expireAfterResolved ? 'primary' : 'default', clickable: hasExpiry, onClick: () => setExpireAfterResolved(prev => !prev), disabled: !hasExpiry })] })] }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: onClose, children: t('cancel') }), _jsx(Button, { id: "rule-submit-button", variant: "contained", onClick: handleSubmit, disabled: !response || loading || !query.trim() || !destination.trim() || indexes.length === 0, children: t('page.cases.rules.create') })] })] }));
|
|
144
|
+
};
|
|
145
|
+
export default CreateRuleDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
6
|
+
const mockDispatchApi = vi.hoisted(() => vi.fn());
|
|
7
|
+
vi.mock('react-i18next', () => ({
|
|
8
|
+
useTranslation: () => ({ t: (key) => key, i18n: { language: 'en' } })
|
|
9
|
+
}));
|
|
10
|
+
vi.mock('components/hooks/useMyApi', () => ({
|
|
11
|
+
default: () => ({ dispatchApi: mockDispatchApi })
|
|
12
|
+
}));
|
|
13
|
+
vi.mock('api', () => ({
|
|
14
|
+
default: {
|
|
15
|
+
search: {
|
|
16
|
+
hit: {
|
|
17
|
+
post: vi.fn()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
vi.mock('components/routes/advanced/QueryEditor', () => ({
|
|
23
|
+
default: ({ query, setQuery, id }) => (_jsx("textarea", { id: id ?? 'query-editor', value: query, onChange: e => setQuery(e.target.value) }))
|
|
24
|
+
}));
|
|
25
|
+
vi.mock('components/elements/display/QueryResultText', () => ({
|
|
26
|
+
default: ({ count, query }) => (_jsxs("div", { id: "query-result-text", children: [count, " results for ", query] }))
|
|
27
|
+
}));
|
|
28
|
+
vi.mock('@monaco-editor/react', () => ({
|
|
29
|
+
useMonaco: () => null
|
|
30
|
+
}));
|
|
31
|
+
vi.mock('@mui/x-date-pickers', () => ({
|
|
32
|
+
LocalizationProvider: ({ children }) => _jsx(_Fragment, { children: children })
|
|
33
|
+
}));
|
|
34
|
+
vi.mock('@mui/x-date-pickers/AdapterDayjs', () => ({
|
|
35
|
+
AdapterDayjs: class {
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
vi.mock('components/elements/display/ChipPopper', () => ({
|
|
39
|
+
default: ({ children }) => _jsx(_Fragment, { children: children })
|
|
40
|
+
}));
|
|
41
|
+
import api from '@cccsaurora/howler-ui/api';
|
|
42
|
+
import CreateRuleDialog from './CreateRuleDialog';
|
|
43
|
+
describe('CreateRuleDialog', () => {
|
|
44
|
+
const defaultProps = {
|
|
45
|
+
open: true,
|
|
46
|
+
onClose: vi.fn(),
|
|
47
|
+
onSubmit: vi.fn().mockResolvedValue(undefined)
|
|
48
|
+
};
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
vi.clearAllMocks();
|
|
51
|
+
});
|
|
52
|
+
it('renders nothing when closed', () => {
|
|
53
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, open: false }));
|
|
54
|
+
expect(screen.queryByTestId('create-rule-dialog')).not.toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
it('renders dialog fields when open', () => {
|
|
57
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
58
|
+
expect(screen.getByTestId('create-rule-dialog')).toBeInTheDocument();
|
|
59
|
+
expect(screen.getByTestId('rule-query-editor')).toBeInTheDocument();
|
|
60
|
+
expect(screen.getByTestId('rule-destination-input')).toBeInTheDocument();
|
|
61
|
+
expect(screen.getByTestId('rule-timeframe-input')).toBeInTheDocument();
|
|
62
|
+
expect(screen.getByTestId('rule-no-expiry-checkbox')).toBeInTheDocument();
|
|
63
|
+
expect(screen.getByTestId('rule-expire-after-resolved')).toBeInTheDocument();
|
|
64
|
+
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
it('disables submit when query is empty', () => {
|
|
67
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
68
|
+
expect(screen.getByTestId('rule-submit-button')).toBeDisabled();
|
|
69
|
+
});
|
|
70
|
+
it('disables submit when destination is empty', async () => {
|
|
71
|
+
const user = userEvent.setup();
|
|
72
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
73
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
74
|
+
expect(screen.getByTestId('rule-submit-button')).toBeDisabled();
|
|
75
|
+
});
|
|
76
|
+
it('enables submit when query, destination are filled and search has been run', async () => {
|
|
77
|
+
const user = userEvent.setup();
|
|
78
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 5, offset: 0, rows: 0 });
|
|
79
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
80
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
81
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
82
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
83
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
84
|
+
await waitFor(() => {
|
|
85
|
+
expect(screen.getByTestId('rule-submit-button')).not.toBeDisabled();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
it('calls onSubmit with rule data when submitted', async () => {
|
|
89
|
+
const user = userEvent.setup();
|
|
90
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
91
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
92
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
93
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
94
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
95
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
96
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
97
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
98
|
+
await waitFor(() => {
|
|
99
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
100
|
+
query: 'event.kind:alert',
|
|
101
|
+
destination: 'alerts/incoming',
|
|
102
|
+
indexes: ['hit']
|
|
103
|
+
}));
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
it('calls onClose when cancel is clicked', async () => {
|
|
107
|
+
const user = userEvent.setup();
|
|
108
|
+
const onClose = vi.fn();
|
|
109
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onClose: onClose }));
|
|
110
|
+
await user.click(screen.getByText('cancel'));
|
|
111
|
+
expect(onClose).toHaveBeenCalled();
|
|
112
|
+
});
|
|
113
|
+
it('shows search results after triggering search', async () => {
|
|
114
|
+
const user = userEvent.setup();
|
|
115
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 42, offset: 0, rows: 0 });
|
|
116
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
117
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
118
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
119
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
120
|
+
await waitFor(() => {
|
|
121
|
+
expect(screen.getByTestId('query-result-text')).toBeInTheDocument();
|
|
122
|
+
expect(screen.getByText(/42 results/)).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
it('shows prompt text before search is triggered', () => {
|
|
126
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
127
|
+
expect(screen.getByText('hit.search.prompt')).toBeInTheDocument();
|
|
128
|
+
expect(screen.queryByTestId('query-result-text')).not.toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
it('includes timeframe as number when expiry is enabled', async () => {
|
|
131
|
+
const user = userEvent.setup();
|
|
132
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
133
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
134
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
135
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
136
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
137
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
138
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
139
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
140
|
+
await waitFor(() => {
|
|
141
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
142
|
+
timeframe: 14
|
|
143
|
+
}));
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
it('omits timeframe when no expiry is checked', async () => {
|
|
147
|
+
const user = userEvent.setup();
|
|
148
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
149
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
150
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
151
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
152
|
+
await user.click(screen.getByTestId('rule-no-expiry-checkbox'));
|
|
153
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
154
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
155
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
156
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
157
|
+
await waitFor(() => {
|
|
158
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
159
|
+
query: 'event.kind:alert',
|
|
160
|
+
destination: 'alerts/incoming',
|
|
161
|
+
timeframe: null
|
|
162
|
+
}));
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
it('includes expire_after_resolved when checkbox is checked', async () => {
|
|
166
|
+
const user = userEvent.setup();
|
|
167
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
168
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
169
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
170
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
171
|
+
await user.click(screen.getByTestId('rule-expire-after-resolved'));
|
|
172
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
173
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
174
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
175
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
176
|
+
await waitFor(() => {
|
|
177
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
178
|
+
timeframe: 14,
|
|
179
|
+
expire_after_resolved: true
|
|
180
|
+
}));
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
it('defaults to hit index checked', () => {
|
|
184
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
185
|
+
// With 'hit' selected by default, its chip appears in the Autocomplete input area
|
|
186
|
+
expect(screen.getAllByText('hit.search.index.hit').length).toBeGreaterThan(0);
|
|
187
|
+
// 'event' is not selected, so its chip should not appear
|
|
188
|
+
expect(screen.queryByText('hit.search.index.event')).not.toBeInTheDocument();
|
|
189
|
+
});
|
|
190
|
+
it('includes both indexes when both are selected', async () => {
|
|
191
|
+
const user = userEvent.setup();
|
|
192
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
193
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
194
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
195
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
196
|
+
// Open the index Autocomplete and select 'event'
|
|
197
|
+
await user.click(screen.getByRole('combobox'));
|
|
198
|
+
await user.click(screen.getByRole('option', { name: 'hit.search.index.event' }));
|
|
199
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
200
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
201
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
202
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
203
|
+
await waitFor(() => {
|
|
204
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
205
|
+
indexes: expect.arrayContaining(['hit', 'event'])
|
|
206
|
+
}));
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
it('prevents deselecting the last index', async () => {
|
|
210
|
+
const user = userEvent.setup();
|
|
211
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
212
|
+
// 'hit' is selected by default; open the dropdown and try to deselect it
|
|
213
|
+
await user.click(screen.getByRole('combobox'));
|
|
214
|
+
await user.click(screen.getByRole('option', { name: 'hit.search.index.hit' }));
|
|
215
|
+
// 'hit' should still be selected because deselecting the last index is prevented
|
|
216
|
+
expect(screen.getAllByText('hit.search.index.hit').length).toBeGreaterThan(0);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import api from '@cccsaurora/howler-ui/api';
|
|
3
|
+
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
4
|
+
import NotFoundPage from '@cccsaurora/howler-ui/components/routes/404';
|
|
5
|
+
import InformationPane from '@cccsaurora/howler-ui/components/routes/hits/search/InformationPane';
|
|
6
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { useOutletContext, useParams } from 'react-router-dom';
|
|
8
|
+
import useCase from '../hooks/useCase';
|
|
9
|
+
import { buildPathFromID } from '../utils';
|
|
10
|
+
import CaseDashboard from './CaseDashboard';
|
|
11
|
+
import MarkdownPage from './MarkdownPage';
|
|
12
|
+
const ItemPage = ({ case: providedCase }) => {
|
|
13
|
+
const params = useParams();
|
|
14
|
+
const routeCase = useOutletContext();
|
|
15
|
+
const { case: fetchedCase } = useCase({ caseId: !providedCase && !routeCase ? params.id : undefined });
|
|
16
|
+
const _case = providedCase ?? routeCase ?? fetchedCase;
|
|
17
|
+
const { dispatchApi } = useMyApi();
|
|
18
|
+
const [item, setItem] = useState(null);
|
|
19
|
+
const [loading, setLoading] = useState(true);
|
|
20
|
+
// When rendered as a child route, the wildcard segment is in params['*'].
|
|
21
|
+
// When rendered directly with a case prop, fall back to parsing the pathname.
|
|
22
|
+
const subPath = params['*'] ?? '';
|
|
23
|
+
const normalizedSubPath = useMemo(() => subPath.replace(/^\/+|\/+$/g, ''), [subPath]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
let cancelled = false;
|
|
26
|
+
const resolveItem = async () => {
|
|
27
|
+
setLoading(true);
|
|
28
|
+
if (!normalizedSubPath) {
|
|
29
|
+
if (!cancelled) {
|
|
30
|
+
setItem(null);
|
|
31
|
+
setLoading(false);
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let currentCase = _case;
|
|
36
|
+
let remainingPath = normalizedSubPath;
|
|
37
|
+
while (currentCase && remainingPath) {
|
|
38
|
+
const currentRemainingPath = remainingPath;
|
|
39
|
+
const matchedNestedCase = currentCase.items
|
|
40
|
+
.filter(Boolean)
|
|
41
|
+
.find(_item => _item.type === 'case' && currentRemainingPath.startsWith(`${_item.name}/`));
|
|
42
|
+
if (!matchedNestedCase) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
if (currentRemainingPath === matchedNestedCase.id) {
|
|
46
|
+
if (!cancelled) {
|
|
47
|
+
setItem(matchedNestedCase);
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!matchedNestedCase.value) {
|
|
53
|
+
if (!cancelled) {
|
|
54
|
+
setItem(null);
|
|
55
|
+
setLoading(false);
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const nextCase = await dispatchApi(api.v2.case.get(matchedNestedCase.value), { throwError: false });
|
|
60
|
+
if (!nextCase) {
|
|
61
|
+
if (!cancelled) {
|
|
62
|
+
setItem(null);
|
|
63
|
+
setLoading(false);
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
remainingPath = currentRemainingPath.replace(`${matchedNestedCase.name}/`, '');
|
|
68
|
+
currentCase = nextCase;
|
|
69
|
+
}
|
|
70
|
+
const resolvedItem = currentCase.items.find(_item => buildPathFromID(currentCase, _item.id) === remainingPath);
|
|
71
|
+
if (!cancelled) {
|
|
72
|
+
setItem(resolvedItem || null);
|
|
73
|
+
setLoading(false);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
if (_case) {
|
|
77
|
+
void resolveItem();
|
|
78
|
+
}
|
|
79
|
+
return () => {
|
|
80
|
+
cancelled = true;
|
|
81
|
+
};
|
|
82
|
+
}, [_case, dispatchApi, normalizedSubPath]);
|
|
83
|
+
if (loading) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (!item) {
|
|
87
|
+
return _jsx(NotFoundPage, {});
|
|
88
|
+
}
|
|
89
|
+
if (item.type === 'hit' || item.type === 'event') {
|
|
90
|
+
return _jsx(InformationPane, { selected: item.value });
|
|
91
|
+
}
|
|
92
|
+
if (item.type === 'case') {
|
|
93
|
+
return _jsx(CaseDashboard, { caseId: item.value });
|
|
94
|
+
}
|
|
95
|
+
if (item.type === 'markdown') {
|
|
96
|
+
return _jsx(MarkdownPage, { case: _case, item: item });
|
|
97
|
+
}
|
|
98
|
+
return _jsx("h1", { children: JSON.stringify(item) });
|
|
99
|
+
};
|
|
100
|
+
export default ItemPage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|