@cccsaurora/howler-ui 2.19.0-cases.862 → 2.19.0-dev.1000
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/index.d.ts +0 -4
- package/api/index.js +2 -10
- package/api/search/facet/hit.d.ts +3 -1
- package/api/search/facet/index.d.ts +1 -3
- package/api/search/index.d.ts +1 -2
- package/api/search/index.js +1 -2
- package/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/components/app/App.d.ts +1 -0
- package/components/app/App.js +20 -42
- package/components/app/hooks/useMatchers.d.ts +1 -1
- package/components/app/hooks/useMatchers.js +11 -23
- package/components/app/hooks/useMatchers.test.js +22 -22
- package/components/app/hooks/useTitle.js +5 -5
- package/components/app/providers/FavouritesProvider.js +2 -6
- package/components/app/providers/HitProvider.d.ts +22 -0
- package/components/app/providers/{RecordProvider.js → HitProvider.js} +42 -42
- package/components/app/providers/{RecordSearchProvider.d.ts → HitSearchProvider.d.ts} +6 -6
- package/components/app/providers/{RecordSearchProvider.js → HitSearchProvider.js} +17 -12
- package/components/app/providers/{RecordSearchProvider.test.js → HitSearchProvider.test.js} +71 -52
- package/components/app/providers/ModalProvider.d.ts +1 -1
- package/components/app/providers/ModalProvider.js +5 -1
- package/components/app/providers/ParameterProvider.d.ts +2 -9
- package/components/app/providers/ParameterProvider.js +240 -165
- package/components/app/providers/ParameterProvider.test.js +94 -346
- package/components/app/providers/SocketProvider.d.ts +2 -11
- package/components/app/providers/SocketProvider.js +5 -18
- package/components/app/providers/UserListProvider.js +8 -28
- package/components/elements/PluginTypography.d.ts +1 -2
- package/components/elements/PluginTypography.js +2 -3
- package/components/elements/UserList.d.ts +2 -5
- package/components/elements/UserList.js +8 -18
- package/components/elements/addons/buttons/CustomButton.test.js +106 -0
- package/components/elements/addons/layout/FlexOne.test.js +30 -0
- package/components/elements/addons/lists/TuiListBase.js +4 -0
- package/components/elements/addons/lists/TuiListElement.js +6 -3
- package/components/elements/addons/lists/index.d.ts +1 -0
- package/components/elements/addons/search/SearchPagination.test.js +80 -0
- package/components/elements/addons/search/SearchTotal.test.js +45 -0
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- package/components/elements/display/ChipPopper.d.ts +1 -1
- package/components/elements/display/ChipPopper.js +5 -5
- package/components/elements/display/DocumentationButton.test.js +84 -0
- package/components/elements/display/DynamicTabs.test.js +93 -0
- package/components/elements/display/HowlerAvatar.js +2 -1
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/HowlerCard.test.js +55 -0
- package/components/elements/display/Image.test.js +79 -0
- package/components/elements/display/Markdown.js +9 -2
- package/components/elements/display/Modal.js +0 -2
- package/components/elements/display/QueryResultText.test.js +48 -0
- package/components/elements/display/TextDivider.test.js +43 -0
- package/components/elements/display/TypingIndicator.test.js +33 -0
- package/components/elements/display/icons/BundleButton.d.ts +6 -0
- package/components/elements/display/icons/BundleButton.js +32 -0
- package/components/elements/display/modals/ConfirmDeleteModal.d.ts +4 -0
- package/components/elements/display/modals/ConfirmDeleteModal.js +4 -2
- package/components/elements/hit/HitActions.js +4 -4
- package/components/elements/hit/HitBanner.d.ts +0 -1
- package/components/elements/hit/HitBanner.js +49 -31
- package/components/elements/hit/HitCard.d.ts +0 -2
- package/components/elements/hit/HitCard.js +7 -7
- package/components/elements/{record/RecordComments.d.ts → hit/HitComments.d.ts} +4 -5
- package/components/elements/{record/RecordComments.js → hit/HitComments.js} +28 -29
- package/components/elements/{ObjectDetails.js → hit/HitDetails.js} +17 -17
- package/components/elements/hit/HitLabels.js +2 -2
- package/components/elements/hit/HitOutline.d.ts +0 -1
- package/components/elements/hit/HitOutline.js +3 -3
- package/components/elements/hit/{HitPreview.d.ts → HitQuickSearch.d.ts} +3 -3
- package/components/elements/hit/{HitPreview.js → HitQuickSearch.js} +4 -10
- package/components/elements/hit/HitRelated.d.ts +6 -0
- package/components/elements/hit/HitRelated.js +7 -0
- package/components/elements/hit/HitSummary.d.ts +1 -2
- package/components/elements/hit/HitSummary.js +8 -8
- package/components/elements/{record/RecordWorklog.d.ts → hit/HitWorklog.d.ts} +3 -4
- package/components/elements/{record/RecordWorklog.js → hit/HitWorklog.js} +13 -15
- package/components/elements/hit/aggregate/HitGraph.js +8 -8
- package/components/elements/hit/elements/{Assigned.d.ts → HitUsers.d.ts} +5 -2
- package/components/elements/hit/elements/HitUsers.js +33 -0
- package/components/elements/hit/outlines/DefaultOutline.js +1 -1
- package/components/elements/view/ViewTitle.d.ts +0 -1
- package/components/elements/view/ViewTitle.js +2 -9
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +4 -4
- package/components/hooks/{useRecordSelection.d.ts → useHitSelection.d.ts} +2 -2
- package/components/hooks/{useRecordSelection.js → useHitSelection.js} +33 -12
- package/components/hooks/useMyPreferences.js +3 -11
- package/components/hooks/useMySearch.js +2 -2
- package/components/hooks/useMySitemap.js +1 -4
- package/components/hooks/useMyTheme.js +2 -9
- package/components/routes/403.test.js +27 -0
- package/components/routes/404.test.js +26 -0
- package/components/routes/ErrorBoundary.test.js +43 -0
- package/components/routes/ErrorOccured.test.js +35 -0
- package/components/routes/Logout.test.js +59 -0
- package/components/routes/action/edit/ActionEditor.js +2 -2
- package/components/routes/action/view/ActionDetails.js +4 -2
- package/components/routes/action/view/ActionSearch.js +12 -7
- package/components/routes/advanced/QueryBuilder.js +1 -1
- package/components/routes/advanced/QueryEditor.js +3 -3
- package/components/routes/advanced/historyCompletionProvider.js +3 -3
- package/components/routes/analytics/AnalyticDetails.js +12 -8
- package/components/routes/analytics/AnalyticSearch.js +1 -1
- package/components/routes/dossiers/DossierEditor.js +2 -2
- package/components/routes/dossiers/DossierEditor.test.js +1 -1
- package/components/routes/dossiers/Dossiers.js +15 -11
- package/components/routes/help/ApiDocumentation.js +1 -1
- package/components/routes/help/BundleDocumentation.d.ts +3 -0
- package/components/routes/help/BundleDocumentation.js +12 -0
- package/components/routes/help/HitBannerDocumentation.js +0 -1
- package/components/routes/help/HitDocumentation.js +3 -1
- package/components/routes/help/markdown/en/bundles.md.js +1 -0
- package/components/routes/help/markdown/en/client.md.js +1 -1
- package/components/routes/help/markdown/fr/bundles.md.js +1 -0
- package/components/routes/help/markdown/fr/client.md.js +1 -1
- package/components/routes/hits/search/BundleParentMenu.d.ts +6 -0
- package/components/routes/hits/search/BundleParentMenu.js +32 -0
- package/components/routes/hits/search/BundleScroller.d.ts +2 -0
- package/components/routes/hits/search/BundleScroller.js +6 -0
- package/components/routes/hits/search/{RecordBrowser.js → HitBrowser.js} +9 -9
- package/components/{elements/record/RecordContextMenu.d.ts → routes/hits/search/HitContextMenu.d.ts} +3 -3
- package/components/routes/hits/search/HitContextMenu.js +239 -0
- package/components/{elements/record/RecordContextMenu.test.js → routes/hits/search/HitContextMenu.test.js} +43 -98
- package/components/routes/hits/search/{RecordQuery.d.ts → HitQuery.d.ts} +2 -2
- package/components/routes/hits/search/{RecordQuery.js → HitQuery.js} +6 -6
- package/components/routes/hits/search/InformationPane.d.ts +0 -1
- package/components/routes/hits/search/InformationPane.js +63 -50
- package/components/routes/hits/search/LayoutSettings.js +3 -3
- package/components/routes/hits/search/QuerySettings.js +1 -2
- package/components/routes/hits/search/QuerySettings.test.js +9 -14
- package/components/routes/hits/search/SearchPane.js +49 -26
- package/components/routes/hits/search/ViewLink.js +3 -3
- package/components/routes/hits/search/ViewLink.test.js +8 -8
- package/components/routes/hits/search/grid/AddColumnModal.js +4 -5
- package/components/routes/hits/search/grid/EnhancedCell.d.ts +1 -2
- package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
- package/components/routes/hits/search/grid/HitGrid.js +18 -20
- package/components/routes/hits/search/grid/{RecordRow.d.ts → HitRow.d.ts} +2 -3
- package/components/routes/hits/search/grid/{RecordRow.js → HitRow.js} +9 -11
- package/components/routes/hits/search/shared/CustomSpan.js +7 -7
- package/components/routes/hits/search/shared/CustomSpan.test.js +170 -0
- package/components/routes/hits/view/HitViewer.js +13 -12
- package/components/routes/home/AddNewCard.test.js +68 -0
- package/components/routes/home/ViewCard.js +41 -47
- package/components/routes/home/ViewRefresh.test.js +79 -0
- package/components/routes/overviews/OverviewCard.test.js +108 -0
- package/components/{elements/MarkdownEditor.js → routes/overviews/OverviewEditor.js} +3 -3
- package/components/routes/overviews/OverviewViewer.js +14 -10
- package/components/routes/overviews/Overviews.js +15 -11
- package/components/routes/settings/LocalSection.js +2 -1
- package/components/routes/settings/SettingsSection.test.js +19 -0
- package/components/routes/templates/TemplateCard.d.ts +3 -1
- package/components/routes/templates/TemplateCard.js +8 -4
- package/components/routes/templates/TemplateCard.test.d.ts +1 -0
- package/components/routes/templates/TemplateCard.test.js +115 -0
- package/components/routes/templates/TemplateViewer.js +57 -16
- package/components/routes/templates/Templates.js +23 -6
- package/components/routes/views/ViewComposer.js +19 -46
- package/components/routes/views/Views.js +8 -4
- package/locales/en/translation.json +17 -117
- package/locales/fr/translation.json +19 -119
- package/models/WithMetadata.d.ts +1 -2
- package/models/entities/generated/{ThreatEnrichment.d.ts → Enrichment.d.ts} +1 -1
- package/models/entities/generated/Hit.d.ts +1 -1
- package/models/entities/generated/Howler.d.ts +6 -0
- package/models/entities/generated/Rule.d.ts +9 -6
- package/models/entities/generated/Threat.d.ts +2 -2
- package/models/entities/generated/UserUser.d.ts +2 -0
- package/models/entities/generated/View.d.ts +0 -1
- package/package.json +112 -132
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/utils.d.ts +1 -2
- package/rest/FetchClient.test.d.ts +1 -0
- package/rest/FetchClient.test.js +81 -0
- package/setupTests.js +5 -0
- package/tests/mocks.d.ts +1 -11
- package/tests/mocks.js +7 -12
- package/tests/server-handlers.js +1 -6
- package/tests/utils.d.ts +0 -4
- package/tests/utils.js +0 -20
- package/utils/Throttler.test.d.ts +1 -0
- package/utils/Throttler.test.js +135 -0
- package/utils/actionUtils.test.d.ts +1 -0
- package/utils/actionUtils.test.js +140 -0
- package/utils/constants.d.ts +4 -4
- package/utils/constants.js +1 -6
- package/utils/hitFunctions.d.ts +1 -2
- package/utils/hitFunctions.js +4 -4
- package/utils/hitFunctions.test.d.ts +1 -0
- package/utils/hitFunctions.test.js +52 -0
- package/utils/localStorage.test.d.ts +1 -0
- package/utils/localStorage.test.js +96 -0
- package/utils/menuUtils.test.d.ts +1 -0
- package/utils/menuUtils.test.js +198 -0
- package/utils/sessionStorage.test.d.ts +1 -0
- package/utils/sessionStorage.test.js +81 -0
- package/utils/socketUtils.d.ts +0 -14
- package/utils/socketUtils.js +1 -17
- package/utils/socketUtils.test.js +16 -49
- package/utils/stringUtils.test.d.ts +1 -0
- package/utils/stringUtils.test.js +159 -0
- package/utils/utils.test.d.ts +1 -0
- package/utils/utils.test.js +292 -0
- package/utils/viewUtils.js +0 -3
- package/utils/viewUtils.test.d.ts +1 -0
- package/utils/viewUtils.test.js +45 -0
- package/utils/xsrf.test.d.ts +1 -0
- package/utils/xsrf.test.js +41 -0
- package/api/search/case.d.ts +0 -4
- package/api/search/case.js +0 -8
- package/api/socket/index.d.ts +0 -3
- package/api/socket/index.js +0 -6
- package/api/socket/viewers.d.ts +0 -2
- package/api/socket/viewers.js +0 -8
- package/api/socket/viewers.test.js +0 -44
- package/api/v2/case/index.d.ts +0 -9
- package/api/v2/case/index.js +0 -21
- package/api/v2/case/items.d.ts +0 -6
- package/api/v2/case/items.js +0 -18
- package/api/v2/case/rules.d.ts +0 -6
- package/api/v2/case/rules.js +0 -18
- package/api/v2/index.d.ts +0 -4
- package/api/v2/index.js +0 -6
- package/api/v2/search/facet.d.ts +0 -3
- package/api/v2/search/facet.js +0 -12
- package/api/v2/search/index.d.ts +0 -5
- package/api/v2/search/index.js +0 -24
- package/components/app/providers/RecordProvider.d.ts +0 -23
- package/components/elements/ContextMenu.d.ts +0 -56
- package/components/elements/ContextMenu.js +0 -109
- package/components/elements/ContextMenu.test.js +0 -215
- package/components/elements/ObjectDetails.d.ts +0 -6
- package/components/elements/case/CaseCard.d.ts +0 -12
- package/components/elements/case/CaseCard.js +0 -42
- package/components/elements/case/CasePreview.d.ts +0 -6
- package/components/elements/case/CasePreview.js +0 -17
- package/components/elements/case/StatusIcon.d.ts +0 -5
- package/components/elements/case/StatusIcon.js +0 -13
- package/components/elements/hit/elements/AnalyticLink.d.ts +0 -9
- package/components/elements/hit/elements/AnalyticLink.js +0 -22
- package/components/elements/hit/elements/Assigned.js +0 -34
- package/components/elements/hit/elements/Assigned.test.js +0 -65
- package/components/elements/hit/related/RelatedRecords.js +0 -63
- package/components/elements/observable/ObservableCard.d.ts +0 -6
- package/components/elements/observable/ObservableCard.js +0 -22
- package/components/elements/observable/ObservablePreview.d.ts +0 -6
- package/components/elements/observable/ObservablePreview.js +0 -12
- package/components/elements/record/RecordContextMenu.js +0 -268
- package/components/elements/record/RecordRelated.d.ts +0 -7
- package/components/elements/record/RecordRelated.js +0 -34
- package/components/hooks/useRelatedRecords.d.ts +0 -13
- package/components/hooks/useRelatedRecords.js +0 -32
- package/components/routes/cases/CaseViewer.d.ts +0 -2
- package/components/routes/cases/CaseViewer.js +0 -44
- package/components/routes/cases/CaseViewer.test.js +0 -133
- package/components/routes/cases/Cases.d.ts +0 -2
- package/components/routes/cases/Cases.js +0 -148
- package/components/routes/cases/constants.d.ts +0 -6
- package/components/routes/cases/constants.js +0 -6
- package/components/routes/cases/detail/AlertPanel.d.ts +0 -6
- package/components/routes/cases/detail/AlertPanel.js +0 -33
- package/components/routes/cases/detail/CaseAssets.d.ts +0 -11
- package/components/routes/cases/detail/CaseAssets.js +0 -104
- package/components/routes/cases/detail/CaseAssets.test.js +0 -167
- package/components/routes/cases/detail/CaseDashboard.d.ts +0 -7
- package/components/routes/cases/detail/CaseDashboard.js +0 -66
- package/components/routes/cases/detail/CaseDetails.d.ts +0 -6
- package/components/routes/cases/detail/CaseDetails.js +0 -70
- package/components/routes/cases/detail/CaseOverview.d.ts +0 -7
- package/components/routes/cases/detail/CaseOverview.js +0 -43
- package/components/routes/cases/detail/CaseRules.d.ts +0 -7
- package/components/routes/cases/detail/CaseRules.js +0 -57
- package/components/routes/cases/detail/CaseRules.test.js +0 -221
- package/components/routes/cases/detail/CaseSidebar.d.ts +0 -8
- package/components/routes/cases/detail/CaseSidebar.js +0 -107
- package/components/routes/cases/detail/CaseSidebar.test.js +0 -266
- package/components/routes/cases/detail/CaseTask.d.ts +0 -11
- package/components/routes/cases/detail/CaseTask.js +0 -66
- package/components/routes/cases/detail/CaseTimeline.d.ts +0 -12
- package/components/routes/cases/detail/CaseTimeline.js +0 -106
- package/components/routes/cases/detail/CaseTimeline.test.js +0 -320
- package/components/routes/cases/detail/CreateRuleDialog.d.ts +0 -9
- package/components/routes/cases/detail/CreateRuleDialog.js +0 -163
- package/components/routes/cases/detail/CreateRuleDialog.test.js +0 -259
- package/components/routes/cases/detail/ItemPage.d.ts +0 -6
- package/components/routes/cases/detail/ItemPage.js +0 -95
- package/components/routes/cases/detail/RelatedCasePanel.d.ts +0 -6
- package/components/routes/cases/detail/RelatedCasePanel.js +0 -34
- package/components/routes/cases/detail/TaskPanel.d.ts +0 -7
- package/components/routes/cases/detail/TaskPanel.js +0 -52
- package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +0 -11
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +0 -24
- package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +0 -6
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +0 -26
- package/components/routes/cases/detail/assets/Asset.d.ts +0 -14
- package/components/routes/cases/detail/assets/Asset.js +0 -12
- package/components/routes/cases/detail/assets/Asset.test.js +0 -72
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +0 -20
- package/components/routes/cases/detail/sidebar/CaseFolder.js +0 -83
- package/components/routes/cases/detail/sidebar/CaseFolder.test.js +0 -295
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +0 -34
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +0 -103
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +0 -363
- package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +0 -25
- package/components/routes/cases/detail/sidebar/FolderEntry.js +0 -88
- package/components/routes/cases/detail/sidebar/FolderEntry.test.js +0 -206
- package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +0 -5
- package/components/routes/cases/detail/sidebar/RootDropZone.js +0 -33
- package/components/routes/cases/detail/sidebar/types.d.ts +0 -9
- package/components/routes/cases/detail/sidebar/utils.d.ts +0 -3
- package/components/routes/cases/detail/sidebar/utils.js +0 -29
- package/components/routes/cases/detail/sidebar/utils.test.js +0 -82
- package/components/routes/cases/hooks/useCase.d.ts +0 -13
- package/components/routes/cases/hooks/useCase.js +0 -69
- package/components/routes/cases/hooks/useCase.test.js +0 -141
- package/components/routes/cases/modals/AddToCaseModal.d.ts +0 -7
- package/components/routes/cases/modals/AddToCaseModal.js +0 -59
- package/components/routes/cases/modals/AddToCaseModal.test.js +0 -313
- package/components/routes/cases/modals/CaseRecordRow.d.ts +0 -9
- package/components/routes/cases/modals/CaseRecordRow.js +0 -15
- package/components/routes/cases/modals/CreateCaseModal.d.ts +0 -7
- package/components/routes/cases/modals/CreateCaseModal.js +0 -55
- package/components/routes/cases/modals/CreateCaseModal.test.js +0 -358
- package/components/routes/cases/modals/RenameItemModal.d.ts +0 -9
- package/components/routes/cases/modals/RenameItemModal.js +0 -48
- package/components/routes/cases/modals/ResolveModal.d.ts +0 -7
- package/components/routes/cases/modals/ResolveModal.js +0 -115
- package/components/routes/cases/modals/ResolveModal.test.js +0 -394
- package/components/routes/cases/modals/hooks.d.ts +0 -7
- package/components/routes/cases/modals/hooks.js +0 -44
- package/components/routes/cases/modals/types.d.ts +0 -5
- package/components/routes/cases/search/CaseAssigneeFilter.d.ts +0 -6
- package/components/routes/cases/search/CaseAssigneeFilter.js +0 -33
- package/components/routes/cases/search/CaseAssigneeFilter.test.js +0 -127
- package/components/routes/cases/search/CaseDateFilter.d.ts +0 -13
- package/components/routes/cases/search/CaseDateFilter.js +0 -26
- package/components/routes/cases/search/CaseDateFilter.test.js +0 -115
- package/components/routes/cases/search/CaseStatusFilter.d.ts +0 -6
- package/components/routes/cases/search/CaseStatusFilter.js +0 -13
- package/components/routes/cases/search/CaseStatusFilter.test.js +0 -86
- package/components/routes/hits/search/shared/IndexPicker.d.ts +0 -2
- package/components/routes/hits/search/shared/IndexPicker.js +0 -20
- package/components/routes/observables/ObservableViewer.d.ts +0 -7
- package/components/routes/observables/ObservableViewer.js +0 -27
- package/models/entities/generated/AttachmentsFile.d.ts +0 -12
- package/models/entities/generated/Case.d.ts +0 -28
- package/models/entities/generated/DestinationOriginal.d.ts +0 -19
- package/models/entities/generated/EmailAttachment.d.ts +0 -8
- package/models/entities/generated/EmailParent.d.ts +0 -19
- package/models/entities/generated/Enrichments.d.ts +0 -7
- package/models/entities/generated/EnrichmentsIndicator.d.ts +0 -21
- package/models/entities/generated/HttpResponse.d.ts +0 -11
- package/models/entities/generated/Item.d.ts +0 -9
- package/models/entities/generated/Observable.d.ts +0 -85
- package/models/entities/generated/ObservableCloud.d.ts +0 -20
- package/models/entities/generated/ObservableDestination.d.ts +0 -23
- package/models/entities/generated/ObservableEmail.d.ts +0 -30
- package/models/entities/generated/ObservableFile.d.ts +0 -36
- package/models/entities/generated/ObservableHowler.d.ts +0 -42
- package/models/entities/generated/ObservableHttp.d.ts +0 -11
- package/models/entities/generated/ObservableObserver.d.ts +0 -21
- package/models/entities/generated/ObservableOrganization.d.ts +0 -7
- package/models/entities/generated/ObservableProcess.d.ts +0 -34
- package/models/entities/generated/ObservableSource.d.ts +0 -23
- package/models/entities/generated/ObservableThreat.d.ts +0 -21
- package/models/entities/generated/ObservableTls.d.ts +0 -12
- package/models/entities/generated/ObserverIngress.d.ts +0 -9
- package/models/entities/generated/Task.d.ts +0 -10
- package/models/socket/CaseUpdate.d.ts +0 -5
- package/models/socket/ViewersUpdate.d.ts +0 -4
- package/utils/typeUtils.d.ts +0 -7
- package/utils/typeUtils.js +0 -27
- /package/{api/socket/viewers.test.d.ts → components/app/providers/HitSearchProvider.test.d.ts} +0 -0
- /package/components/{app/providers/RecordSearchProvider.test.d.ts → elements/addons/buttons/CustomButton.test.d.ts} +0 -0
- /package/components/elements/{ContextMenu.test.d.ts → addons/layout/FlexOne.test.d.ts} +0 -0
- /package/components/elements/{hit/elements/Assigned.test.d.ts → addons/search/SearchPagination.test.d.ts} +0 -0
- /package/components/elements/{record/RecordContextMenu.test.d.ts → addons/search/SearchTotal.test.d.ts} +0 -0
- /package/components/{routes/cases/CaseViewer.test.d.ts → elements/display/DocumentationButton.test.d.ts} +0 -0
- /package/components/{routes/cases/detail/CaseAssets.test.d.ts → elements/display/DynamicTabs.test.d.ts} +0 -0
- /package/components/{routes/cases/detail/CaseRules.test.d.ts → elements/display/HowlerCard.test.d.ts} +0 -0
- /package/components/{routes/cases/detail/CaseSidebar.test.d.ts → elements/display/Image.test.d.ts} +0 -0
- /package/components/{routes/cases/detail/CaseTimeline.test.d.ts → elements/display/QueryResultText.test.d.ts} +0 -0
- /package/components/{routes/cases/detail/CreateRuleDialog.test.d.ts → elements/display/TextDivider.test.d.ts} +0 -0
- /package/components/{routes/cases/detail/assets/Asset.test.d.ts → elements/display/TypingIndicator.test.d.ts} +0 -0
- /package/components/elements/hit/{related/RelatedRecords.d.ts → HitDetails.d.ts} +0 -0
- /package/components/routes/{cases/detail/sidebar/CaseFolder.test.d.ts → 403.test.d.ts} +0 -0
- /package/components/routes/{cases/detail/sidebar/CaseFolderContextMenu.test.d.ts → 404.test.d.ts} +0 -0
- /package/components/routes/{cases/detail/sidebar/FolderEntry.test.d.ts → ErrorBoundary.test.d.ts} +0 -0
- /package/components/routes/{cases/detail/sidebar/utils.test.d.ts → ErrorOccured.test.d.ts} +0 -0
- /package/components/routes/{cases/hooks/useCase.test.d.ts → Logout.test.d.ts} +0 -0
- /package/components/routes/hits/search/{RecordBrowser.d.ts → HitBrowser.d.ts} +0 -0
- /package/components/routes/{cases/modals/AddToCaseModal.test.d.ts → hits/search/HitContextMenu.test.d.ts} +0 -0
- /package/components/routes/{cases/modals/CreateCaseModal.test.d.ts → hits/search/shared/CustomSpan.test.d.ts} +0 -0
- /package/components/routes/{cases/modals/ResolveModal.test.d.ts → home/AddNewCard.test.d.ts} +0 -0
- /package/components/routes/{cases/search/CaseAssigneeFilter.test.d.ts → home/ViewRefresh.test.d.ts} +0 -0
- /package/components/routes/{cases/search/CaseDateFilter.test.d.ts → overviews/OverviewCard.test.d.ts} +0 -0
- /package/components/{elements/MarkdownEditor.d.ts → routes/overviews/OverviewEditor.d.ts} +0 -0
- /package/components/routes/{cases/search/CaseStatusFilter.test.d.ts → settings/SettingsSection.test.d.ts} +0 -0
|
@@ -5,9 +5,9 @@ import { cloneDeep } from 'lodash-es';
|
|
|
5
5
|
import { setupContextSelectorMock, setupLocalStorageMock } from '@cccsaurora/howler-ui/tests/mocks';
|
|
6
6
|
import { useContextSelector } from 'use-context-selector';
|
|
7
7
|
import { DEFAULT_QUERY, MY_LOCAL_STORAGE_PREFIX, StorageKey } from '@cccsaurora/howler-ui/utils/constants';
|
|
8
|
+
import { HitContext } from './HitProvider';
|
|
9
|
+
import HitSearchProvider, { HitSearchContext } from './HitSearchProvider';
|
|
8
10
|
import { ParameterContext } from './ParameterProvider';
|
|
9
|
-
import { RecordContext } from './RecordProvider';
|
|
10
|
-
import RecordSearchProvider, { RecordSearchContext } from './RecordSearchProvider';
|
|
11
11
|
import { ViewContext } from './ViewProvider';
|
|
12
12
|
vi.mock('api', { spy: true });
|
|
13
13
|
setupContextSelectorMock();
|
|
@@ -30,21 +30,20 @@ let mockParameterContext = {
|
|
|
30
30
|
mockParameterContext.offset = parseInt(offset);
|
|
31
31
|
},
|
|
32
32
|
views: [],
|
|
33
|
-
indexes: ['hit'],
|
|
34
33
|
addView: vi.fn()
|
|
35
34
|
};
|
|
36
35
|
const originalMockParameterContext = cloneDeep(mockParameterContext);
|
|
37
36
|
const mockHitContext = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
mockHitContext.
|
|
41
|
-
...mockHitContext.
|
|
37
|
+
hits: {},
|
|
38
|
+
loadHits: hits => {
|
|
39
|
+
mockHitContext.hits = {
|
|
40
|
+
...mockHitContext.hits,
|
|
42
41
|
...Object.fromEntries(hits.map(hit => [hit.howler.id, hit]))
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
45
|
const Wrapper = ({ children }) => {
|
|
47
|
-
return (_jsx(ViewContext.Provider, { value: mockViewContext, children: _jsx(ParameterContext.Provider, { value: mockParameterContext, children: _jsx(
|
|
46
|
+
return (_jsx(ViewContext.Provider, { value: mockViewContext, children: _jsx(ParameterContext.Provider, { value: mockParameterContext, children: _jsx(HitContext.Provider, { value: mockHitContext, children: _jsx(HitSearchProvider, { children: children }) }) }) }));
|
|
48
47
|
};
|
|
49
48
|
beforeEach(() => {
|
|
50
49
|
mockParameterContext = cloneDeep(originalMockParameterContext);
|
|
@@ -58,32 +57,38 @@ beforeEach(() => {
|
|
|
58
57
|
let mockSearchParams = new URLSearchParams();
|
|
59
58
|
vi.mocked(useSearchParams).mockReturnValue([mockSearchParams, mockSetParams]);
|
|
60
59
|
});
|
|
61
|
-
describe('
|
|
60
|
+
describe('HitSearchContext', () => {
|
|
62
61
|
it('should initialize with default values', async () => {
|
|
63
|
-
const hook = renderHook(() => useContextSelector(
|
|
62
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
64
63
|
displayType: ctx.displayType,
|
|
65
64
|
searching: ctx.searching,
|
|
66
65
|
error: ctx.error,
|
|
67
66
|
response: ctx.response,
|
|
67
|
+
bundleId: ctx.bundleId,
|
|
68
68
|
fzfSearch: ctx.fzfSearch
|
|
69
69
|
})), { wrapper: Wrapper });
|
|
70
70
|
expect(hook.result.current.displayType).toBe('list');
|
|
71
71
|
expect(hook.result.current.searching).toBe(false);
|
|
72
72
|
expect(hook.result.current.error).toBeNull();
|
|
73
73
|
expect(hook.result.current.response).toBeNull();
|
|
74
|
+
expect(hook.result.current.bundleId).toBeNull();
|
|
74
75
|
expect(hook.result.current.fzfSearch).toBe(false);
|
|
75
76
|
});
|
|
77
|
+
it('should set bundleId when on bundles route', () => {
|
|
78
|
+
mockLocation.pathname = '/bundles/test_bundle_id';
|
|
79
|
+
mockParams.mockReturnValue({ id: 'test_bundle_id' });
|
|
80
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.bundleId), { wrapper: Wrapper });
|
|
81
|
+
expect(hook.result.current).toBe('test_bundle_id');
|
|
82
|
+
});
|
|
76
83
|
it('should initialize queryHistory from localStorage', () => {
|
|
77
84
|
const mockHistory = { 'test:query': new Date().toISOString() };
|
|
78
85
|
mockLocalStorage.setItem(`${MY_LOCAL_STORAGE_PREFIX}.${StorageKey.QUERY_HISTORY}`, JSON.stringify(mockHistory));
|
|
79
|
-
const hook = renderHook(() => useContextSelector(
|
|
80
|
-
wrapper: Wrapper
|
|
81
|
-
});
|
|
86
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.queryHistory), { wrapper: Wrapper });
|
|
82
87
|
expect(hook.result.current).toEqual(mockHistory);
|
|
83
88
|
});
|
|
84
89
|
describe('setDisplayType', () => {
|
|
85
90
|
it('should update display type', () => {
|
|
86
|
-
const hook = renderHook(() => useContextSelector(
|
|
91
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
87
92
|
displayType: ctx.displayType,
|
|
88
93
|
setDisplayType: ctx.setDisplayType
|
|
89
94
|
})), { wrapper: Wrapper });
|
|
@@ -96,7 +101,7 @@ describe('RecordSearchContext', () => {
|
|
|
96
101
|
});
|
|
97
102
|
describe('setFzfSearch', () => {
|
|
98
103
|
it('should update fzfSearch state', () => {
|
|
99
|
-
const hook = renderHook(() => useContextSelector(
|
|
104
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
100
105
|
fzfSearch: ctx.fzfSearch,
|
|
101
106
|
setFzfSearch: ctx.setFzfSearch
|
|
102
107
|
})), { wrapper: Wrapper });
|
|
@@ -109,7 +114,7 @@ describe('RecordSearchContext', () => {
|
|
|
109
114
|
});
|
|
110
115
|
describe('setQueryHistory', () => {
|
|
111
116
|
it('should update query history', () => {
|
|
112
|
-
const hook = renderHook(() => useContextSelector(
|
|
117
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
113
118
|
queryHistory: ctx.queryHistory,
|
|
114
119
|
setQueryHistory: ctx.setQueryHistory
|
|
115
120
|
})), { wrapper: Wrapper });
|
|
@@ -122,7 +127,7 @@ describe('RecordSearchContext', () => {
|
|
|
122
127
|
});
|
|
123
128
|
describe('search', () => {
|
|
124
129
|
it('should perform a search and update response', async () => {
|
|
125
|
-
const hook = renderHook(() => useContextSelector(
|
|
130
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
126
131
|
search: ctx.search,
|
|
127
132
|
searching: ctx.searching,
|
|
128
133
|
response: ctx.response,
|
|
@@ -132,13 +137,13 @@ describe('RecordSearchContext', () => {
|
|
|
132
137
|
hook.result.current.search('test query');
|
|
133
138
|
});
|
|
134
139
|
await waitFor(() => {
|
|
135
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
140
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
136
141
|
query: expect.stringContaining('test query')
|
|
137
142
|
}));
|
|
138
143
|
});
|
|
139
144
|
});
|
|
140
145
|
it('should set searching state during search', async () => {
|
|
141
|
-
const hook = renderHook(() => useContextSelector(
|
|
146
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
142
147
|
search: ctx.search,
|
|
143
148
|
searching: ctx.searching
|
|
144
149
|
})), { wrapper: Wrapper });
|
|
@@ -167,7 +172,7 @@ describe('RecordSearchContext', () => {
|
|
|
167
172
|
});
|
|
168
173
|
it('should handle search errors', async () => {
|
|
169
174
|
vi.mocked(hpost).mockRejectedValueOnce(new Error('Search failed'));
|
|
170
|
-
const hook = renderHook(() => useContextSelector(
|
|
175
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
171
176
|
search: ctx.search,
|
|
172
177
|
error: ctx.error,
|
|
173
178
|
searching: ctx.searching
|
|
@@ -188,7 +193,7 @@ describe('RecordSearchContext', () => {
|
|
|
188
193
|
total: 10
|
|
189
194
|
};
|
|
190
195
|
vi.mocked(hpost).mockResolvedValueOnce(mockResponse);
|
|
191
|
-
const hook = renderHook(() => useContextSelector(
|
|
196
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
192
197
|
search: ctx.search,
|
|
193
198
|
response: ctx.response
|
|
194
199
|
})), { wrapper: Wrapper });
|
|
@@ -224,7 +229,7 @@ describe('RecordSearchContext', () => {
|
|
|
224
229
|
total: 10
|
|
225
230
|
};
|
|
226
231
|
vi.mocked(hpost).mockResolvedValueOnce(mockResponse);
|
|
227
|
-
const hook = renderHook(() => useContextSelector(
|
|
232
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
228
233
|
search: ctx.search,
|
|
229
234
|
response: ctx.response
|
|
230
235
|
})), { wrapper: Wrapper });
|
|
@@ -238,13 +243,27 @@ describe('RecordSearchContext', () => {
|
|
|
238
243
|
expect(hook.result.current.response?.items[0].howler.id).toBe('hit1');
|
|
239
244
|
});
|
|
240
245
|
});
|
|
246
|
+
it('should include bundle filter when on bundles route', async () => {
|
|
247
|
+
mockLocation.pathname = '/bundles/test_bundle_id';
|
|
248
|
+
mockParams.mockReturnValue({ id: 'test_bundle_id' });
|
|
249
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
250
|
+
act(() => {
|
|
251
|
+
hook.result.current('test query');
|
|
252
|
+
});
|
|
253
|
+
await waitFor(() => {
|
|
254
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
255
|
+
query: 'test query',
|
|
256
|
+
filters: ['event.created:[now-1w TO now]', 'howler.bundles:test_bundle_id']
|
|
257
|
+
}));
|
|
258
|
+
});
|
|
259
|
+
});
|
|
241
260
|
it('should apply date range filter from span', async () => {
|
|
242
|
-
const hook = renderHook(() => useContextSelector(
|
|
261
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
243
262
|
act(() => {
|
|
244
263
|
hook.result.current('test query');
|
|
245
264
|
});
|
|
246
265
|
await waitFor(() => {
|
|
247
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
266
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
248
267
|
filters: expect.arrayContaining([expect.stringContaining('event.created:')])
|
|
249
268
|
}));
|
|
250
269
|
});
|
|
@@ -253,24 +272,24 @@ describe('RecordSearchContext', () => {
|
|
|
253
272
|
mockParameterContext.span = 'date.range.custom';
|
|
254
273
|
mockParameterContext.startDate = '2025-01-01';
|
|
255
274
|
mockParameterContext.endDate = '2025-12-31';
|
|
256
|
-
const hook = renderHook(() => useContextSelector(
|
|
275
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
257
276
|
act(() => {
|
|
258
277
|
hook.result.current('test query');
|
|
259
278
|
});
|
|
260
279
|
await waitFor(() => {
|
|
261
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
280
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
262
281
|
filters: expect.arrayContaining([expect.stringContaining('event.created:')])
|
|
263
282
|
}));
|
|
264
283
|
});
|
|
265
284
|
});
|
|
266
285
|
it('should exclude filters ending with * from search', async () => {
|
|
267
286
|
mockParameterContext.filters = ['status:open', 'howler.escalation:*'];
|
|
268
|
-
const hook = renderHook(() => useContextSelector(
|
|
287
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
269
288
|
act(() => {
|
|
270
289
|
hook.result.current('test query');
|
|
271
290
|
});
|
|
272
291
|
await waitFor(() => {
|
|
273
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
292
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
274
293
|
filters: expect.not.arrayContaining([expect.stringContaining('howler.escalation:*')])
|
|
275
294
|
}));
|
|
276
295
|
});
|
|
@@ -283,7 +302,7 @@ describe('RecordSearchContext', () => {
|
|
|
283
302
|
rows: 0,
|
|
284
303
|
total: 50
|
|
285
304
|
});
|
|
286
|
-
const hook = renderHook(() => useContextSelector(
|
|
305
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
287
306
|
search: ctx.search
|
|
288
307
|
})), { wrapper: Wrapper });
|
|
289
308
|
act(() => {
|
|
@@ -297,7 +316,7 @@ describe('RecordSearchContext', () => {
|
|
|
297
316
|
it('should not search when sort or span is null', async () => {
|
|
298
317
|
mockParameterContext.sort = null;
|
|
299
318
|
mockParameterContext.span = null;
|
|
300
|
-
const hook = renderHook(() => useContextSelector(
|
|
319
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
301
320
|
act(() => {
|
|
302
321
|
hook.result.current('test query');
|
|
303
322
|
});
|
|
@@ -309,7 +328,7 @@ describe('RecordSearchContext', () => {
|
|
|
309
328
|
});
|
|
310
329
|
describe('automatic search on parameter changes', () => {
|
|
311
330
|
it('should trigger search when filters change', async () => {
|
|
312
|
-
const hook = renderHook(() => useContextSelector(
|
|
331
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
313
332
|
response: ctx.response
|
|
314
333
|
})), { wrapper: Wrapper });
|
|
315
334
|
await waitFor(() => {
|
|
@@ -323,23 +342,23 @@ describe('RecordSearchContext', () => {
|
|
|
323
342
|
expect(hpost).toHaveBeenCalled();
|
|
324
343
|
}, { timeout: 2000 });
|
|
325
344
|
});
|
|
326
|
-
it('should not trigger search when query is DEFAULT_QUERY', async () => {
|
|
345
|
+
it('should not trigger search when query is DEFAULT_QUERY and no bundleId', async () => {
|
|
327
346
|
mockParameterContext.query = DEFAULT_QUERY;
|
|
328
|
-
renderHook(() => useContextSelector(
|
|
347
|
+
renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.response), { wrapper: Wrapper });
|
|
329
348
|
await waitFor(() => {
|
|
330
349
|
expect(hpost).not.toHaveBeenCalled();
|
|
331
350
|
});
|
|
332
351
|
});
|
|
333
352
|
it('should not trigger search when span is custom but dates are missing', async () => {
|
|
334
|
-
renderHook(() => useContextSelector(
|
|
353
|
+
renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.response), { wrapper: Wrapper });
|
|
335
354
|
await waitFor(() => {
|
|
336
355
|
expect(hpost).not.toHaveBeenCalled();
|
|
337
356
|
});
|
|
338
357
|
});
|
|
339
358
|
});
|
|
340
|
-
describe('
|
|
359
|
+
describe('useHitSearchContextSelector', () => {
|
|
341
360
|
it('should allow selecting specific values from context', async () => {
|
|
342
|
-
const hook = renderHook(() => useContextSelector(
|
|
361
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ({
|
|
343
362
|
searching: ctx.searching,
|
|
344
363
|
error: ctx.error
|
|
345
364
|
})), { wrapper: Wrapper });
|
|
@@ -349,7 +368,7 @@ describe('RecordSearchContext', () => {
|
|
|
349
368
|
});
|
|
350
369
|
describe('edge cases', () => {
|
|
351
370
|
it('should handle concurrent search calls with throttling', async () => {
|
|
352
|
-
const hook = renderHook(() => useContextSelector(
|
|
371
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
353
372
|
// Make multiple rapid calls
|
|
354
373
|
act(() => {
|
|
355
374
|
hook.result.current('query1');
|
|
@@ -361,8 +380,8 @@ describe('RecordSearchContext', () => {
|
|
|
361
380
|
expect(hpost).toHaveBeenCalledTimes(1);
|
|
362
381
|
}, { timeout: 2000 });
|
|
363
382
|
});
|
|
364
|
-
it('should clear response when query becomes DEFAULT_QUERY without viewId', async () => {
|
|
365
|
-
const hook = renderHook(() => useContextSelector(
|
|
383
|
+
it('should clear response when query becomes DEFAULT_QUERY without viewId or bundleId', async () => {
|
|
384
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.response), { wrapper: Wrapper });
|
|
366
385
|
await waitFor(() => {
|
|
367
386
|
expect(hook.result.current).toBeDefined();
|
|
368
387
|
}, { timeout: 2000 });
|
|
@@ -382,12 +401,12 @@ describe('RecordSearchContext', () => {
|
|
|
382
401
|
{ view_id: 'view_1', query: 'howler.status:open' },
|
|
383
402
|
{ view_id: 'view_2', query: 'howler.priority:high' }
|
|
384
403
|
]);
|
|
385
|
-
const hook = renderHook(() => useContextSelector(
|
|
404
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
386
405
|
act(() => {
|
|
387
406
|
hook.result.current('test query');
|
|
388
407
|
});
|
|
389
408
|
await waitFor(() => {
|
|
390
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
409
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
391
410
|
query: 'test query',
|
|
392
411
|
filters: expect.arrayContaining(['howler.status:open', 'howler.priority:high'])
|
|
393
412
|
}));
|
|
@@ -400,12 +419,12 @@ describe('RecordSearchContext', () => {
|
|
|
400
419
|
{ view_id: 'view_2', query: 'howler.priority:high' },
|
|
401
420
|
{ view_id: 'view_3', query: 'howler.analytic:sigma' }
|
|
402
421
|
]);
|
|
403
|
-
const hook = renderHook(() => useContextSelector(
|
|
422
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
404
423
|
act(() => {
|
|
405
424
|
hook.result.current('test query');
|
|
406
425
|
});
|
|
407
426
|
await waitFor(() => {
|
|
408
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
427
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
409
428
|
query: 'test query',
|
|
410
429
|
filters: [
|
|
411
430
|
'event.created:[now-1w TO now]',
|
|
@@ -424,7 +443,7 @@ describe('RecordSearchContext', () => {
|
|
|
424
443
|
mockParameterContext.views = [];
|
|
425
444
|
const mockSearchParams = new URLSearchParams();
|
|
426
445
|
vi.mocked(useSearchParams).mockReturnValue([mockSearchParams, mockSetParams]);
|
|
427
|
-
renderHook(() => useContextSelector(
|
|
446
|
+
renderHook(() => useContextSelector(HitSearchContext, () => { }), { wrapper: Wrapper });
|
|
428
447
|
await waitFor(() => {
|
|
429
448
|
expect(mockParameterContext.addView).toBeCalledWith('default_view_id');
|
|
430
449
|
});
|
|
@@ -436,7 +455,7 @@ describe('RecordSearchContext', () => {
|
|
|
436
455
|
const mockSearchParams = new URLSearchParams();
|
|
437
456
|
mockSearchParams.append('view', 'existing_view');
|
|
438
457
|
vi.mocked(useSearchParams).mockReturnValue([mockSearchParams, mockSetParams]);
|
|
439
|
-
renderHook(() => useContextSelector(
|
|
458
|
+
renderHook(() => useContextSelector(HitSearchContext, () => { }), { wrapper: Wrapper });
|
|
440
459
|
await waitFor(() => {
|
|
441
460
|
expect(mockParameterContext.addView).not.toBeCalled();
|
|
442
461
|
});
|
|
@@ -447,7 +466,7 @@ describe('RecordSearchContext', () => {
|
|
|
447
466
|
mockParameterContext.views = [];
|
|
448
467
|
const mockSearchParams = new URLSearchParams();
|
|
449
468
|
vi.mocked(useSearchParams).mockReturnValue([mockSearchParams, mockSetParams]);
|
|
450
|
-
renderHook(() => useContextSelector(
|
|
469
|
+
renderHook(() => useContextSelector(HitSearchContext, () => { }), { wrapper: Wrapper });
|
|
451
470
|
await waitFor(() => {
|
|
452
471
|
expect(mockSetParams).not.toHaveBeenCalled();
|
|
453
472
|
});
|
|
@@ -457,12 +476,12 @@ describe('RecordSearchContext', () => {
|
|
|
457
476
|
it('should not break when view ID does not exist', async () => {
|
|
458
477
|
mockParameterContext.views = ['non_existent_view'];
|
|
459
478
|
mockViewContext.getCurrentViews = vi.fn(() => Promise.resolve([null]));
|
|
460
|
-
const hook = renderHook(() => useContextSelector(
|
|
479
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
461
480
|
act(() => {
|
|
462
481
|
hook.result.current('test query');
|
|
463
482
|
});
|
|
464
483
|
await waitFor(() => {
|
|
465
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
484
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
466
485
|
query: expect.stringContaining('test query'),
|
|
467
486
|
filters: ['event.created:[now-1w TO now]']
|
|
468
487
|
}));
|
|
@@ -474,12 +493,12 @@ describe('RecordSearchContext', () => {
|
|
|
474
493
|
{ view_id: 'view_1', query: 'howler.status:open' },
|
|
475
494
|
{ view_id: 'view_2', query: 'howler.priority:high' }
|
|
476
495
|
]);
|
|
477
|
-
const hook = renderHook(() => useContextSelector(
|
|
496
|
+
const hook = renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.search), { wrapper: Wrapper });
|
|
478
497
|
act(() => {
|
|
479
498
|
hook.result.current('test query');
|
|
480
499
|
});
|
|
481
500
|
await waitFor(() => {
|
|
482
|
-
expect(hpost).toHaveBeenCalledWith('/api/
|
|
501
|
+
expect(hpost).toHaveBeenCalledWith('/api/v1/search/hit', expect.objectContaining({
|
|
483
502
|
query: 'test query',
|
|
484
503
|
filters: ['event.created:[now-1w TO now]', 'howler.status:open', 'howler.priority:high']
|
|
485
504
|
}));
|
|
@@ -490,7 +509,7 @@ describe('RecordSearchContext', () => {
|
|
|
490
509
|
it('should not trigger search when views is empty and query is DEFAULT_QUERY', async () => {
|
|
491
510
|
mockParameterContext.query = DEFAULT_QUERY;
|
|
492
511
|
mockParameterContext.views = [];
|
|
493
|
-
renderHook(() => useContextSelector(
|
|
512
|
+
renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.response), { wrapper: Wrapper });
|
|
494
513
|
await waitFor(() => {
|
|
495
514
|
expect(hpost).not.toHaveBeenCalled();
|
|
496
515
|
});
|
|
@@ -498,7 +517,7 @@ describe('RecordSearchContext', () => {
|
|
|
498
517
|
it('should trigger search when views.length > 0 even with DEFAULT_QUERY', async () => {
|
|
499
518
|
mockParameterContext.query = DEFAULT_QUERY;
|
|
500
519
|
mockParameterContext.views = ['view_1'];
|
|
501
|
-
renderHook(() => useContextSelector(
|
|
520
|
+
renderHook(() => useContextSelector(HitSearchContext, ctx => ctx.response), { wrapper: Wrapper });
|
|
502
521
|
await waitFor(() => {
|
|
503
522
|
expect(hpost).toHaveBeenCalled();
|
|
504
523
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
export interface ModalOptions {
|
|
3
3
|
disableClose?: boolean;
|
|
4
|
-
height?: number | string | null;
|
|
5
4
|
maxWidth?: string;
|
|
6
5
|
maxHeight?: string;
|
|
7
6
|
}
|
|
8
7
|
interface ModalContextType {
|
|
9
8
|
showModal: (children: ReactNode, options?: ModalOptions) => () => void;
|
|
9
|
+
withConfirmDeleteModal: (onConfirm: () => void, preferDelete?: boolean, preferCancel?: boolean) => () => void;
|
|
10
10
|
content?: ReactNode;
|
|
11
11
|
setContent: (children: ReactNode) => void;
|
|
12
12
|
options?: ModalOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ConfirmDeleteModal from '@cccsaurora/howler-ui/components/elements/display/modals/ConfirmDeleteModal';
|
|
2
3
|
import { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
4
|
const defaultOptions = {
|
|
4
5
|
disableClose: false
|
|
@@ -23,6 +24,9 @@ const ModalProvider = ({ children }) => {
|
|
|
23
24
|
return () => setContent(null);
|
|
24
25
|
}, [options]);
|
|
25
26
|
const close = useCallback(() => setContent(null), []);
|
|
26
|
-
|
|
27
|
+
const withConfirmDeleteModal = useCallback((onConfirm, preferDelete, preferCancel) => {
|
|
28
|
+
return showModal(_jsx(ConfirmDeleteModal, { onConfirm: onConfirm, preferDelete: preferDelete, preferCancel: preferCancel }));
|
|
29
|
+
}, [showModal]);
|
|
30
|
+
return (_jsx(ModalContext.Provider, { value: { showModal, withConfirmDeleteModal, content, setContent, options, close }, children: children }));
|
|
27
31
|
};
|
|
28
32
|
export default ModalProvider;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
-
export type SearchIndex = 'hit' | 'observable' | 'case';
|
|
3
2
|
export interface ParameterContextType {
|
|
4
3
|
selected?: string;
|
|
5
4
|
query?: string;
|
|
@@ -7,7 +6,6 @@ export interface ParameterContextType {
|
|
|
7
6
|
trackTotalHits: boolean;
|
|
8
7
|
sort?: string;
|
|
9
8
|
span?: string;
|
|
10
|
-
indexes?: SearchIndex[];
|
|
11
9
|
filters?: string[];
|
|
12
10
|
startDate?: string;
|
|
13
11
|
endDate?: string;
|
|
@@ -21,16 +19,11 @@ export interface ParameterContextType {
|
|
|
21
19
|
addFilter: (filter: string) => void;
|
|
22
20
|
removeFilter: (filter: string) => void;
|
|
23
21
|
setFilter: (index: number, filter: string) => void;
|
|
24
|
-
|
|
25
|
-
addIndex: (index: SearchIndex) => void;
|
|
26
|
-
removeIndex: (index: SearchIndex) => void;
|
|
27
|
-
setIndex: (position: number, index: SearchIndex) => void;
|
|
28
|
-
setIndexes: (indexes: SearchIndex[]) => void;
|
|
29
|
-
resetIndexes: () => void;
|
|
22
|
+
clearFilters: () => void;
|
|
30
23
|
addView: (view: string) => void;
|
|
31
24
|
removeView: (view: string) => void;
|
|
32
25
|
setView: (index: number, view: string) => void;
|
|
33
|
-
|
|
26
|
+
clearViews: () => void;
|
|
34
27
|
}
|
|
35
28
|
export declare const ParameterContext: import("use-context-selector").Context<ParameterContextType>;
|
|
36
29
|
/**
|