@cccsaurora/howler-ui 2.19.0-dev.1181 → 2.19.0-dev.1264
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/analytic/index.d.ts +2 -3
- package/api/analytic/index.js +1 -2
- package/api/index.d.ts +4 -0
- package/api/index.js +10 -2
- package/api/search/case.d.ts +4 -0
- package/api/search/case.js +8 -0
- package/api/search/facet/hit.d.ts +1 -3
- package/api/search/facet/index.d.ts +3 -1
- package/api/search/index.d.ts +3 -1
- package/api/search/index.js +2 -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/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/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/components/app/App.js +49 -11
- package/components/app/hooks/useMatchers.d.ts +1 -1
- package/components/app/hooks/useMatchers.js +23 -11
- package/components/app/hooks/useMatchers.test.js +22 -22
- package/components/app/hooks/useTitle.js +5 -5
- package/components/app/providers/FavouritesProvider.js +2 -2
- package/components/app/providers/GridColumnsProvider.js +2 -2
- package/components/app/providers/GridColumnsProvider.test.js +3 -3
- package/components/app/providers/ModalProvider.d.ts +1 -0
- 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} +46 -42
- package/components/app/providers/{HitSearchProvider.d.ts → RecordSearchProvider.d.ts} +6 -6
- package/components/app/providers/{HitSearchProvider.js → RecordSearchProvider.js} +13 -19
- package/components/app/providers/{HitSearchProvider.test.js → RecordSearchProvider.test.js} +52 -71
- package/components/app/providers/SearchResponseProvider.d.ts +4 -4
- package/components/app/providers/SearchResponseProvider.js +1 -1
- package/components/app/providers/SocketProvider.d.ts +11 -2
- package/components/app/providers/SocketProvider.js +18 -5
- package/components/app/providers/UserListProvider.js +28 -8
- package/components/app/providers/UserListProvider.test.js +150 -0
- package/components/elements/ContextMenu.d.ts +56 -0
- package/components/elements/ContextMenu.js +109 -0
- package/components/elements/ContextMenu.test.d.ts +1 -0
- package/components/elements/ContextMenu.test.js +215 -0
- 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 +33 -16
- package/components/elements/UserList.test.d.ts +1 -0
- package/components/elements/UserList.test.js +122 -0
- package/components/elements/addons/lists/TuiListElement.d.ts +1 -1
- package/components/elements/addons/lists/TuiListElement.js +0 -1
- package/components/elements/addons/search/SearchTotal.js +1 -1
- package/components/elements/addons/search/SearchTotal.test.js +2 -2
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- 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/ChipPopper.d.ts +1 -1
- package/components/elements/display/ChipPopper.js +6 -5
- 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/HowlerCard.js +1 -1
- package/components/elements/display/HowlerCard.test.js +5 -9
- package/components/elements/display/ItemManager.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/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.js +4 -4
- package/components/elements/hit/HitBanner.d.ts +1 -0
- package/components/elements/hit/HitBanner.js +31 -49
- package/components/elements/hit/HitCard.d.ts +4 -0
- package/components/elements/hit/HitCard.js +7 -7
- package/components/elements/hit/HitLabels.js +2 -2
- package/components/elements/hit/HitLabels.test.js +2 -2
- package/components/elements/hit/HitOutline.d.ts +1 -0
- package/components/elements/hit/HitOutline.js +3 -3
- package/components/elements/hit/{HitQuickSearch.d.ts → HitPreview.d.ts} +3 -3
- package/components/elements/hit/{HitQuickSearch.js → HitPreview.js} +10 -4
- package/components/elements/hit/HitSummary.d.ts +2 -1
- package/components/elements/hit/HitSummary.js +6 -5
- package/components/elements/hit/aggregate/HitGraph.js +8 -8
- 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} +3 -4
- package/components/elements/hit/elements/Assigned.js +36 -0
- package/components/elements/hit/elements/Assigned.test.d.ts +1 -0
- package/components/elements/hit/elements/Assigned.test.js +65 -0
- package/components/elements/hit/grid/AddColumnModal.js +5 -4
- package/components/elements/hit/grid/EnhancedCell.d.ts +2 -1
- package/components/elements/hit/grid/EnhancedCell.js +2 -2
- package/components/elements/hit/grid/{HitRow.d.ts → RecordRow.d.ts} +3 -2
- package/components/elements/hit/grid/{HitRow.js → RecordRow.js} +11 -9
- package/components/elements/hit/grid/{HitTable.d.ts → RecordTable.d.ts} +5 -4
- package/components/elements/hit/grid/{HitTable.js → RecordTable.js} +13 -11
- package/components/elements/hit/outlines/DefaultOutline.js +1 -1
- 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} +29 -28
- package/components/elements/{hit/HitContextMenu.d.ts → 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/elements/{hit/HitContextMenu.test.js → record/RecordContextMenu.test.js} +98 -43
- 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} +15 -13
- 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/ViewTitle.d.ts +1 -0
- package/components/elements/view/ViewTitle.js +9 -2
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +4 -4
- package/components/hooks/useMyPreferences.js +10 -1
- package/components/hooks/useMySearch.js +2 -2
- package/components/hooks/useMySitemap.js +4 -1
- package/components/hooks/useMyTheme.js +9 -2
- 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/routes/action/edit/ActionEditor.js +2 -2
- package/components/routes/action/view/ActionSearch.js +1 -1
- package/components/routes/advanced/QueryBuilder.js +4 -27
- package/components/routes/advanced/QueryEditor.js +3 -3
- package/components/routes/advanced/historyCompletionProvider.js +3 -3
- package/components/routes/analytics/AnalyticDetails.js +6 -54
- package/components/routes/analytics/AnalyticSearch.js +9 -18
- 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 +133 -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 +33 -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 +142 -0
- package/components/routes/cases/detail/CaseObservables.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseObservables.test.js +169 -0
- package/components/routes/cases/detail/CaseOverview.d.ts +7 -0
- package/components/routes/cases/detail/CaseOverview.js +43 -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 +106 -0
- package/components/routes/cases/detail/CaseTimeline.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseTimeline.test.js +320 -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 +284 -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 +13 -0
- package/components/routes/cases/detail/observables/Observable.test.d.ts +1 -0
- package/components/routes/cases/detail/observables/Observable.test.js +72 -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 +85 -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 +24 -0
- package/components/routes/cases/detail/utils.d.ts +29 -0
- package/components/routes/cases/detail/utils.js +114 -0
- package/components/routes/cases/detail/utils.test.d.ts +1 -0
- package/components/routes/cases/detail/utils.test.js +144 -0
- package/components/routes/cases/hooks/useCase.d.ts +13 -0
- package/components/routes/cases/hooks/useCase.js +69 -0
- package/components/routes/cases/hooks/useCase.test.d.ts +1 -0
- package/components/routes/cases/hooks/useCase.test.js +141 -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 +2 -2
- package/components/routes/dossiers/DossierEditor.test.js +1 -1
- package/components/routes/events/EventViewer.d.ts +7 -0
- package/components/routes/events/EventViewer.js +24 -0
- package/components/routes/help/ApiDocumentation.js +1 -1
- package/components/routes/help/HitBannerDocumentation.js +1 -0
- package/components/routes/help/HitDocumentation.js +1 -3
- package/components/routes/help/OverviewDocumentation.d.ts +1 -1
- package/components/routes/help/OverviewDocumentation.js +0 -1
- package/components/routes/hits/search/InformationPane.d.ts +1 -0
- package/components/routes/hits/search/InformationPane.js +51 -64
- package/components/routes/hits/search/QuerySettings.js +2 -1
- package/components/routes/hits/search/QuerySettings.test.js +14 -9
- package/components/routes/hits/search/{HitBrowser.js → RecordBrowser.js} +11 -11
- 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 +24 -46
- package/components/routes/hits/search/ViewLink.js +4 -4
- 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/{HitGrid.js → RecordGrid.js} +15 -15
- package/components/routes/hits/search/shared/CustomSpan.test.js +3 -4
- 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 +3 -3
- package/components/routes/hits/search/shared/SearchActionMenu.js +3 -9
- package/components/routes/hits/view/HitViewer.js +13 -14
- package/components/routes/home/ViewCard.js +47 -41
- package/components/routes/overviews/OverviewViewer.js +4 -4
- package/components/routes/views/ViewComposer.js +49 -23
- package/locales/en/translation.json +171 -27
- package/locales/fr/translation.json +169 -25
- 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/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/Howler.d.ts +0 -5
- 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/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 +115 -94
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/index.d.ts +1 -1
- package/plugins/clue/index.js +0 -1
- package/plugins/clue/utils.d.ts +2 -1
- 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/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/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/typeUtils.d.ts +7 -0
- package/utils/typeUtils.js +27 -0
- package/utils/viewUtils.js +3 -0
- package/api/analytic/rules.d.ts +0 -4
- 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/HitContextMenu.js +0 -239
- 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/BundleScroller.d.ts +0 -2
- package/components/routes/hits/search/BundleScroller.js +0 -6
- package/components/routes/hits/search/grid/HitGrid.d.ts +0 -3
- package/components/routes/hits/search/shared/BundleParentMenu.d.ts +0 -6
- package/components/routes/hits/search/shared/BundleParentMenu.js +0 -32
- 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/{elements/hit/HitContextMenu.test.d.ts → app/providers/RecordSearchProvider.test.d.ts} +0 -0
- /package/{utils/hitFunctions.test.d.ts → components/app/providers/UserListProvider.test.d.ts} +0 -0
- /package/components/{routes/overviews/OverviewEditor.d.ts → elements/MarkdownEditor.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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { act, 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 act(async () => {
|
|
74
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
75
|
+
});
|
|
76
|
+
expect(screen.getByTestId('rule-submit-button')).toBeDisabled();
|
|
77
|
+
});
|
|
78
|
+
it('enables submit when query, destination are filled and search has been run', async () => {
|
|
79
|
+
const user = userEvent.setup();
|
|
80
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 5, offset: 0, rows: 0 });
|
|
81
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
82
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
83
|
+
await act(async () => {
|
|
84
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
85
|
+
});
|
|
86
|
+
await act(async () => {
|
|
87
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
88
|
+
});
|
|
89
|
+
await act(async () => {
|
|
90
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
91
|
+
});
|
|
92
|
+
await waitFor(() => {
|
|
93
|
+
expect(screen.getByTestId('rule-submit-button')).not.toBeDisabled();
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
it('calls onSubmit with rule data when submitted', async () => {
|
|
97
|
+
const user = userEvent.setup();
|
|
98
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
99
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
100
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
101
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
102
|
+
await act(async () => {
|
|
103
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
104
|
+
});
|
|
105
|
+
await act(async () => {
|
|
106
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
107
|
+
});
|
|
108
|
+
await act(async () => {
|
|
109
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
110
|
+
});
|
|
111
|
+
await act(async () => {
|
|
112
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
113
|
+
});
|
|
114
|
+
await waitFor(() => {
|
|
115
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
116
|
+
query: 'event.kind:alert',
|
|
117
|
+
destination: 'alerts/incoming',
|
|
118
|
+
indexes: ['hit']
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
it('calls onClose when cancel is clicked', async () => {
|
|
123
|
+
const user = userEvent.setup();
|
|
124
|
+
const onClose = vi.fn();
|
|
125
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onClose: onClose }));
|
|
126
|
+
await act(async () => {
|
|
127
|
+
await user.click(screen.getByText('cancel'));
|
|
128
|
+
});
|
|
129
|
+
expect(onClose).toHaveBeenCalled();
|
|
130
|
+
});
|
|
131
|
+
it('shows search results after triggering search', async () => {
|
|
132
|
+
const user = userEvent.setup();
|
|
133
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 42, offset: 0, rows: 0 });
|
|
134
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
135
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
136
|
+
await act(async () => {
|
|
137
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
138
|
+
});
|
|
139
|
+
await act(async () => {
|
|
140
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
141
|
+
});
|
|
142
|
+
await waitFor(() => {
|
|
143
|
+
expect(screen.getByTestId('query-result-text')).toBeInTheDocument();
|
|
144
|
+
expect(screen.getByText(/42 results/)).toBeInTheDocument();
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
it('shows prompt text before search is triggered', () => {
|
|
148
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
149
|
+
expect(screen.getByText('hit.search.prompt')).toBeInTheDocument();
|
|
150
|
+
expect(screen.queryByTestId('query-result-text')).not.toBeInTheDocument();
|
|
151
|
+
});
|
|
152
|
+
it('includes timeframe as number when expiry is enabled', async () => {
|
|
153
|
+
const user = userEvent.setup();
|
|
154
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
155
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
156
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
157
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
158
|
+
await act(async () => {
|
|
159
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
160
|
+
});
|
|
161
|
+
await act(async () => {
|
|
162
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
163
|
+
});
|
|
164
|
+
await act(async () => {
|
|
165
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
166
|
+
});
|
|
167
|
+
await act(async () => {
|
|
168
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
169
|
+
});
|
|
170
|
+
await waitFor(() => {
|
|
171
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
172
|
+
timeframe: 14
|
|
173
|
+
}));
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
it('omits timeframe when no expiry is checked', async () => {
|
|
177
|
+
const user = userEvent.setup();
|
|
178
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
179
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
180
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
181
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
182
|
+
await act(async () => {
|
|
183
|
+
await user.click(screen.getByTestId('rule-no-expiry-checkbox'));
|
|
184
|
+
});
|
|
185
|
+
await act(async () => {
|
|
186
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
187
|
+
});
|
|
188
|
+
await act(async () => {
|
|
189
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
190
|
+
});
|
|
191
|
+
await act(async () => {
|
|
192
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
193
|
+
});
|
|
194
|
+
await act(async () => {
|
|
195
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
196
|
+
});
|
|
197
|
+
await waitFor(() => {
|
|
198
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
199
|
+
query: 'event.kind:alert',
|
|
200
|
+
destination: 'alerts/incoming',
|
|
201
|
+
timeframe: null
|
|
202
|
+
}));
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
it('includes expire_after_resolved when checkbox is checked', async () => {
|
|
206
|
+
const user = userEvent.setup();
|
|
207
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
208
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
209
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
210
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
211
|
+
await act(async () => {
|
|
212
|
+
await user.click(screen.getByTestId('rule-expire-after-resolved'));
|
|
213
|
+
});
|
|
214
|
+
await act(async () => {
|
|
215
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
216
|
+
});
|
|
217
|
+
await act(async () => {
|
|
218
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
219
|
+
});
|
|
220
|
+
await act(async () => {
|
|
221
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
222
|
+
});
|
|
223
|
+
await act(async () => {
|
|
224
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
225
|
+
});
|
|
226
|
+
await waitFor(() => {
|
|
227
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
228
|
+
timeframe: 14,
|
|
229
|
+
expire_after_resolved: true
|
|
230
|
+
}));
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
it('defaults to hit index checked', () => {
|
|
234
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
235
|
+
// With 'hit' selected by default, its chip appears in the Autocomplete input area
|
|
236
|
+
expect(screen.getAllByText('hit.search.index.hit').length).toBeGreaterThan(0);
|
|
237
|
+
// 'event' is not selected, so its chip should not appear
|
|
238
|
+
expect(screen.queryByText('hit.search.index.event')).not.toBeInTheDocument();
|
|
239
|
+
});
|
|
240
|
+
it('includes both indexes when both are selected', async () => {
|
|
241
|
+
const user = userEvent.setup();
|
|
242
|
+
const onSubmit = vi.fn().mockResolvedValue(undefined);
|
|
243
|
+
mockDispatchApi.mockResolvedValueOnce({ items: [], total: 1, offset: 0, rows: 0 });
|
|
244
|
+
api.search.hit.post.mockReturnValue('search-request');
|
|
245
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps, onSubmit: onSubmit }));
|
|
246
|
+
// Open the index Autocomplete and select 'event'
|
|
247
|
+
await act(async () => {
|
|
248
|
+
await user.click(screen.getByRole('combobox'));
|
|
249
|
+
});
|
|
250
|
+
await act(async () => {
|
|
251
|
+
await user.click(screen.getByRole('option', { name: 'hit.search.index.event' }));
|
|
252
|
+
});
|
|
253
|
+
await act(async () => {
|
|
254
|
+
await user.type(screen.getByTestId('rule-query-editor'), 'event.kind:alert');
|
|
255
|
+
});
|
|
256
|
+
await act(async () => {
|
|
257
|
+
await user.click(screen.getByTestId('rule-search-button'));
|
|
258
|
+
});
|
|
259
|
+
await act(async () => {
|
|
260
|
+
await user.type(screen.getByTestId('rule-destination-input'), 'alerts/incoming');
|
|
261
|
+
});
|
|
262
|
+
await act(async () => {
|
|
263
|
+
await user.click(screen.getByTestId('rule-submit-button'));
|
|
264
|
+
});
|
|
265
|
+
await waitFor(() => {
|
|
266
|
+
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
|
267
|
+
indexes: expect.arrayContaining(['hit', 'event'])
|
|
268
|
+
}));
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
it('prevents deselecting the last index', async () => {
|
|
272
|
+
const user = userEvent.setup();
|
|
273
|
+
render(_jsx(CreateRuleDialog, { ...defaultProps }));
|
|
274
|
+
// 'hit' is selected by default; open the dropdown and try to deselect it
|
|
275
|
+
await act(async () => {
|
|
276
|
+
await user.click(screen.getByRole('combobox'));
|
|
277
|
+
});
|
|
278
|
+
await act(async () => {
|
|
279
|
+
await user.click(screen.getByRole('option', { name: 'hit.search.index.hit' }));
|
|
280
|
+
});
|
|
281
|
+
// 'hit' should still be selected because deselecting the last index is prevented
|
|
282
|
+
expect(screen.getAllByText('hit.search.index.hit').length).toBeGreaterThan(0);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
@@ -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
|
+
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 {};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import { setupReactRouterMock } from '@cccsaurora/howler-ui/tests/mocks';
|
|
5
|
+
import { createMockCase } from '@cccsaurora/howler-ui/tests/utils';
|
|
6
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
7
|
+
const mockDispatchApi = vi.hoisted(() => vi.fn());
|
|
8
|
+
const mockApiGet = vi.hoisted(() => vi.fn());
|
|
9
|
+
vi.mock('components/hooks/useMyApi', () => ({
|
|
10
|
+
default: () => ({ dispatchApi: mockDispatchApi })
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('api', () => ({
|
|
13
|
+
default: {
|
|
14
|
+
v2: {
|
|
15
|
+
case: {
|
|
16
|
+
get: mockApiGet
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('components/routes/404', () => ({
|
|
22
|
+
default: () => _jsx("div", { id: "not-found", children: "Not Found" })
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('components/routes/hits/search/InformationPane', () => ({
|
|
25
|
+
default: ({ selected }) => _jsx("div", { id: "information-pane", children: selected })
|
|
26
|
+
}));
|
|
27
|
+
vi.mock('./CaseDashboard', () => ({
|
|
28
|
+
default: ({ caseId }) => _jsx("div", { id: "case-dashboard", children: caseId })
|
|
29
|
+
}));
|
|
30
|
+
vi.mock('./MarkdownPage', () => ({
|
|
31
|
+
default: ({ item }) => _jsx("div", { id: "markdown-page", children: item?.value })
|
|
32
|
+
}));
|
|
33
|
+
vi.mock('../hooks/useCase', () => ({
|
|
34
|
+
default: () => ({ case: undefined, loading: false, missing: false })
|
|
35
|
+
}));
|
|
36
|
+
const { mockParams } = setupReactRouterMock();
|
|
37
|
+
const { default: ItemPage } = await import('./ItemPage');
|
|
38
|
+
describe('ItemPage', () => {
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
vi.clearAllMocks();
|
|
41
|
+
// Default to no wildcard path unless a test sets it
|
|
42
|
+
mockParams['*'] = '';
|
|
43
|
+
});
|
|
44
|
+
it('renders NotFoundPage when no subPath is provided', async () => {
|
|
45
|
+
const _case = createMockCase({ case_id: 'case-1', items: [] });
|
|
46
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
47
|
+
await waitFor(() => {
|
|
48
|
+
expect(screen.getByTestId('not-found')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it('renders MarkdownPage when a markdown item path is resolved', async () => {
|
|
52
|
+
const markdownItem = {
|
|
53
|
+
id: 'item-1',
|
|
54
|
+
parent: null,
|
|
55
|
+
type: 'markdown',
|
|
56
|
+
name: 'Notes',
|
|
57
|
+
value: 'Initial markdown',
|
|
58
|
+
classification: 'TLP:CLEAR'
|
|
59
|
+
};
|
|
60
|
+
const _case = createMockCase({ case_id: 'case-1', items: [markdownItem] });
|
|
61
|
+
mockParams['*'] = 'Notes';
|
|
62
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
63
|
+
await waitFor(() => {
|
|
64
|
+
expect(screen.getByTestId('markdown-page')).toHaveTextContent('Initial markdown');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it('normalizes leading/trailing slashes in subPath', async () => {
|
|
68
|
+
const markdownItem = {
|
|
69
|
+
id: 'item-1',
|
|
70
|
+
parent: null,
|
|
71
|
+
type: 'markdown',
|
|
72
|
+
name: 'Notes',
|
|
73
|
+
value: 'Normalized markdown',
|
|
74
|
+
classification: 'TLP:CLEAR'
|
|
75
|
+
};
|
|
76
|
+
const _case = createMockCase({ case_id: 'case-1', items: [markdownItem] });
|
|
77
|
+
mockParams['*'] = '/Notes/';
|
|
78
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
79
|
+
await waitFor(() => {
|
|
80
|
+
expect(screen.getByTestId('markdown-page')).toHaveTextContent('Normalized markdown');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
it('renders InformationPane for hit item paths', async () => {
|
|
84
|
+
const hitItem = {
|
|
85
|
+
id: 'hit-1',
|
|
86
|
+
parent: null,
|
|
87
|
+
type: 'hit',
|
|
88
|
+
name: 'Alert',
|
|
89
|
+
value: 'selected-hit-id'
|
|
90
|
+
};
|
|
91
|
+
const _case = createMockCase({ case_id: 'case-1', items: [hitItem] });
|
|
92
|
+
mockParams['*'] = 'Alert';
|
|
93
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
94
|
+
await waitFor(() => {
|
|
95
|
+
expect(screen.getByTestId('information-pane')).toHaveTextContent('selected-hit-id');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
it('resolves nested case segments and renders downstream item', async () => {
|
|
99
|
+
const nestedMarkdown = {
|
|
100
|
+
id: 'n-md-1',
|
|
101
|
+
parent: null,
|
|
102
|
+
type: 'markdown',
|
|
103
|
+
name: 'NestedNotes',
|
|
104
|
+
value: 'Nested markdown content'
|
|
105
|
+
};
|
|
106
|
+
const childCase = createMockCase({ case_id: 'child-case-123', items: [nestedMarkdown] });
|
|
107
|
+
const caseLink = {
|
|
108
|
+
id: 'case-link-1',
|
|
109
|
+
parent: null,
|
|
110
|
+
type: 'case',
|
|
111
|
+
name: 'Child',
|
|
112
|
+
value: 'child-case-123'
|
|
113
|
+
};
|
|
114
|
+
const _case = createMockCase({ case_id: 'root-case', items: [caseLink] });
|
|
115
|
+
mockDispatchApi.mockResolvedValueOnce(childCase);
|
|
116
|
+
mockParams['*'] = 'Child/NestedNotes';
|
|
117
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
118
|
+
await waitFor(() => {
|
|
119
|
+
expect(mockDispatchApi).toHaveBeenCalledOnce();
|
|
120
|
+
expect(screen.getByTestId('markdown-page')).toHaveTextContent('Nested markdown content');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
it('returns NotFound when nested case has no value', async () => {
|
|
124
|
+
const caseLink = {
|
|
125
|
+
id: 'case-link-1',
|
|
126
|
+
parent: null,
|
|
127
|
+
type: 'case',
|
|
128
|
+
name: 'Child',
|
|
129
|
+
value: undefined
|
|
130
|
+
};
|
|
131
|
+
const _case = createMockCase({ case_id: 'root-case', items: [caseLink] });
|
|
132
|
+
mockParams['*'] = 'Child/Anything';
|
|
133
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
134
|
+
await waitFor(() => {
|
|
135
|
+
expect(screen.getByTestId('not-found')).toBeInTheDocument();
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
it('returns NotFound when nested case cannot be fetched', async () => {
|
|
139
|
+
const caseLink = {
|
|
140
|
+
id: 'case-link-1',
|
|
141
|
+
parent: null,
|
|
142
|
+
type: 'case',
|
|
143
|
+
name: 'Child',
|
|
144
|
+
value: 'child-case-123'
|
|
145
|
+
};
|
|
146
|
+
const _case = createMockCase({ case_id: 'root-case', items: [caseLink] });
|
|
147
|
+
mockDispatchApi.mockResolvedValueOnce(null);
|
|
148
|
+
mockParams['*'] = 'Child/NestedNotes';
|
|
149
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
150
|
+
await waitFor(() => {
|
|
151
|
+
expect(mockDispatchApi).toHaveBeenCalledOnce();
|
|
152
|
+
expect(screen.getByTestId('not-found')).toBeInTheDocument();
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
it('renders CaseDashboard when path equals nested case id', async () => {
|
|
156
|
+
const caseLink = {
|
|
157
|
+
id: 'Child/NestedCase',
|
|
158
|
+
parent: null,
|
|
159
|
+
type: 'case',
|
|
160
|
+
name: 'Child',
|
|
161
|
+
value: 'child-case-123'
|
|
162
|
+
};
|
|
163
|
+
const _case = createMockCase({ case_id: 'root-case', items: [caseLink] });
|
|
164
|
+
mockParams['*'] = 'Child/NestedCase';
|
|
165
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
166
|
+
await waitFor(() => {
|
|
167
|
+
expect(mockDispatchApi).not.toHaveBeenCalled();
|
|
168
|
+
expect(screen.getByTestId('case-dashboard')).toHaveTextContent('child-case-123');
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
it('resolves hierarchical non-case parent via buildPathFromID', async () => {
|
|
172
|
+
const folder = {
|
|
173
|
+
id: 'folder-1',
|
|
174
|
+
parent: null,
|
|
175
|
+
type: 'markdown',
|
|
176
|
+
name: 'Folder'
|
|
177
|
+
};
|
|
178
|
+
const doc = {
|
|
179
|
+
id: 'doc-1',
|
|
180
|
+
parent: 'folder-1',
|
|
181
|
+
type: 'markdown',
|
|
182
|
+
name: 'Doc',
|
|
183
|
+
value: 'Child content'
|
|
184
|
+
};
|
|
185
|
+
const _case = createMockCase({ case_id: 'case-1', items: [folder, doc] });
|
|
186
|
+
mockParams['*'] = 'Folder/Doc';
|
|
187
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
188
|
+
await waitFor(() => {
|
|
189
|
+
expect(screen.getByTestId('markdown-page')).toHaveTextContent('Child content');
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
it('renders InformationPane for event item paths', async () => {
|
|
193
|
+
const eventItem = {
|
|
194
|
+
id: 'event-1',
|
|
195
|
+
parent: null,
|
|
196
|
+
type: 'event',
|
|
197
|
+
name: 'Incident',
|
|
198
|
+
value: 'selected-event-id'
|
|
199
|
+
};
|
|
200
|
+
const _case = createMockCase({ case_id: 'case-1', items: [eventItem] });
|
|
201
|
+
mockParams['*'] = 'Incident';
|
|
202
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
203
|
+
await waitFor(() => {
|
|
204
|
+
expect(screen.getByTestId('information-pane')).toHaveTextContent('selected-event-id');
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
it('falls back to JSON render for unknown item types', async () => {
|
|
208
|
+
const otherItem = {
|
|
209
|
+
id: 'other-1',
|
|
210
|
+
parent: null,
|
|
211
|
+
type: 'other',
|
|
212
|
+
name: 'Other',
|
|
213
|
+
value: 'misc'
|
|
214
|
+
};
|
|
215
|
+
const _case = createMockCase({ case_id: 'case-1', items: [otherItem] });
|
|
216
|
+
mockParams['*'] = 'Other';
|
|
217
|
+
const { container } = render(_jsx(ItemPage, { case: _case }));
|
|
218
|
+
await waitFor(() => {
|
|
219
|
+
expect(container.querySelector('h1')).toBeTruthy();
|
|
220
|
+
expect(container.querySelector('h1')?.textContent).toContain('other-1');
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
it('renders NotFoundPage when no item matches the given path', async () => {
|
|
224
|
+
const otherItem = {
|
|
225
|
+
id: 'item-2',
|
|
226
|
+
parent: null,
|
|
227
|
+
type: 'markdown',
|
|
228
|
+
name: 'Other',
|
|
229
|
+
value: 'Other content'
|
|
230
|
+
};
|
|
231
|
+
const _case = createMockCase({ case_id: 'case-1', items: [otherItem] });
|
|
232
|
+
mockParams['*'] = 'UnknownPath';
|
|
233
|
+
render(_jsx(ItemPage, { case: _case }));
|
|
234
|
+
await waitFor(() => {
|
|
235
|
+
expect(screen.getByTestId('not-found')).toBeInTheDocument();
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
|
|
2
|
+
import type { Item } from '@cccsaurora/howler-ui/models/entities/generated/Item';
|
|
3
|
+
import { type FC } from 'react';
|
|
4
|
+
declare const MarkdownPage: FC<{
|
|
5
|
+
case: Case;
|
|
6
|
+
item: Item;
|
|
7
|
+
}>;
|
|
8
|
+
export default MarkdownPage;
|