@cccsaurora/howler-ui 3.1.0-dev.1466 → 3.1.0-dev.1602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/action/execute.d.ts +1 -1
- package/api/action/index.d.ts +10 -6
- package/api/action/index.js +5 -9
- package/api/action/operations.js +2 -2
- package/api/analytic/comments/index.d.ts +4 -6
- package/api/analytic/comments/react.d.ts +2 -2
- package/api/analytic/favourite.d.ts +2 -4
- package/api/analytic/index.d.ts +7 -4
- package/api/analytic/index.js +2 -2
- package/api/analytic/notebooks/index.d.ts +2 -4
- package/api/analytic/owner.d.ts +1 -1
- package/api/auth/apikey.d.ts +2 -2
- package/api/auth/login.d.ts +2 -2
- package/api/configs/index.d.ts +1 -1
- package/api/dossier.d.ts +16 -0
- package/api/{dossier/index.js → dossier.js} +6 -4
- package/api/help.d.ts +2 -2
- package/api/hit/assign.d.ts +6 -2
- package/api/hit/comments/index.d.ts +4 -6
- package/api/hit/comments/react.d.ts +2 -2
- package/api/hit/index.d.ts +3 -8
- package/api/hit/labels.d.ts +2 -2
- package/api/hit/overwrite.d.ts +1 -1
- package/api/hit/transition.d.ts +1 -1
- package/api/index.d.ts +6 -6
- package/api/index.js +7 -6
- package/api/notebook/environments.d.ts +1 -1
- package/api/notebook/index.d.ts +1 -1
- package/api/overview/index.d.ts +4 -4
- package/api/search/action.d.ts +1 -1
- package/api/search/analytic.d.ts +1 -1
- package/api/search/case.d.ts +1 -1
- package/api/search/count/hit.d.ts +1 -1
- package/api/search/dossier.d.ts +1 -1
- package/api/search/eql/hit.d.ts +1 -1
- package/api/search/explain/hit.d.ts +1 -1
- package/api/search/facet/hit.d.ts +1 -1
- package/api/search/fields/hit.js +1 -2
- package/api/search/fields/user.js +2 -4
- package/api/search/grouped/hit.d.ts +1 -1
- package/api/search/grouped/user.js +3 -0
- package/api/search/histogram/hit.d.ts +1 -1
- package/api/search/hit.d.ts +1 -1
- package/api/search/overview.d.ts +1 -1
- package/api/search/sigma/hit.d.ts +1 -1
- package/api/search/template.d.ts +1 -1
- package/api/search/user.d.ts +30 -2
- package/api/search/user.js +3 -0
- package/api/search/view.d.ts +1 -1
- package/api/socket/viewers.d.ts +1 -1
- package/api/socket/viewers.js +1 -1
- package/api/template/index.d.ts +3 -3
- package/api/template/index.js +2 -2
- package/api/user/avatar/index.d.ts +1 -1
- package/api/user/groups.d.ts +1 -1
- package/api/user/index.d.ts +2 -2
- package/api/user/whoami.d.ts +1 -1
- package/api/utils/createPermissionsApi.d.ts +10 -0
- package/api/utils/createPermissionsApi.js +10 -0
- package/api/v2/case/index.d.ts +4 -4
- package/api/v2/case/items.d.ts +3 -3
- package/api/v2/case/rules.d.ts +3 -3
- package/api/v2/fuzzy.d.ts +1 -1
- package/api/v2/search/facet.d.ts +1 -1
- package/api/v2/search/index.d.ts +1 -1
- package/api/view/favourite.d.ts +2 -4
- package/api/view/index.d.ts +9 -5
- package/api/view/index.js +3 -1
- package/branding/AppBrand.d.ts +2 -2
- package/branding/AppBrand.js +4 -6
- package/components/app/App.js +248 -51
- package/components/app/AppContainer.js +1 -1
- package/components/app/drawers/ApiKeyDrawer.js +13 -5
- package/components/app/drawers/AssignUserDrawer.js +11 -4
- package/components/app/hooks/useMatchers.d.ts +3 -3
- package/components/app/hooks/useMatchers.js +12 -12
- package/components/app/hooks/useMatchers.test.js +15 -14
- package/components/app/hooks/useTitle.js +8 -7
- package/components/app/providers/AnalyticProvider.d.ts +1 -1
- package/components/app/providers/AnalyticProvider.js +7 -4
- package/components/app/providers/ApiConfigProvider.d.ts +2 -1
- package/components/app/providers/ApiConfigProvider.js +12 -10
- package/components/app/providers/AppDrawerProvider.js +2 -2
- package/components/app/providers/AvatarProvider.js +18 -11
- package/components/app/providers/FavouritesProvider.js +56 -86
- package/components/app/providers/FieldProvider.js +1 -1
- package/components/app/providers/GridColumnsProvider.d.ts +1 -1
- package/components/app/providers/GridColumnsProvider.js +17 -4
- package/components/app/providers/GridColumnsProvider.test.js +2 -1
- package/components/app/providers/LocalStorageProvider.d.ts +2 -2
- package/components/app/providers/LocalStorageProvider.js +4 -3
- package/components/app/providers/ModalProvider.js +8 -1
- package/components/app/providers/OverviewProvider.js +10 -2
- package/components/app/providers/ParameterProvider.d.ts +7 -7
- package/components/app/providers/ParameterProvider.js +42 -5
- package/components/app/providers/ParameterProvider.test.js +1 -0
- package/components/app/providers/RecordProvider.js +7 -1
- package/components/app/providers/RecordSearchProvider.d.ts +1 -2
- package/components/app/providers/RecordSearchProvider.js +32 -23
- package/components/app/providers/RecordSearchProvider.test.js +2 -1
- package/components/app/providers/SearchResponseProvider.d.ts +9 -6
- package/components/app/providers/SearchResponseProvider.js +37 -19
- package/components/app/providers/SearchResponseProvider.test.js +37 -11
- package/components/app/providers/SocketProvider.js +6 -4
- package/components/app/providers/UserListProvider.d.ts +1 -1
- package/components/app/providers/ViewProvider.d.ts +2 -2
- package/components/app/providers/ViewProvider.js +22 -12
- package/components/app/providers/ViewProvider.test.js +2 -2
- package/components/app/providers/contextUtils.d.ts +1 -0
- package/components/app/providers/contextUtils.js +3 -0
- package/components/elements/Comment.d.ts +1 -1
- package/components/elements/Comment.js +11 -9
- package/components/elements/ContextMenu.js +1 -1
- package/components/elements/ContextMenu.test.js +2 -2
- package/components/elements/EditRow.d.ts +9 -4
- package/components/elements/EditRow.js +5 -4
- package/components/elements/MarkdownEditor.js +1 -1
- package/components/elements/MembershipManagement.test.js +178 -0
- package/components/elements/ObjectDetails.js +6 -6
- package/components/elements/ThemedEditor.js +17 -17
- package/components/elements/UserList.d.ts +2 -0
- package/components/elements/UserList.js +26 -18
- package/components/elements/UserList.test.js +24 -1
- package/components/elements/addons/buttons/CustomButton.d.ts +1 -1
- package/components/elements/addons/buttons/CustomButton.js +2 -2
- package/components/elements/addons/buttons/CustomIconButton.d.ts +1 -1
- package/components/elements/addons/buttons/CustomIconButton.js +3 -3
- package/components/elements/addons/buttons/index.d.ts +1 -1
- package/components/elements/addons/layout/FlexOne.d.ts +2 -2
- package/components/elements/addons/layout/FlexOne.test.js +1 -0
- package/components/elements/addons/layout/FlexPort.d.ts +1 -1
- package/components/elements/addons/layout/FlexPort.js +9 -2
- package/components/elements/addons/layout/FlexVertical.d.ts +2 -2
- package/components/elements/addons/layout/FlexVertical.js +1 -1
- package/components/elements/addons/layout/vsbox/VSBox.d.ts +2 -2
- package/components/elements/addons/layout/vsbox/VSBox.js +5 -4
- package/components/elements/addons/layout/vsbox/VSBoxElement.d.ts +1 -1
- package/components/elements/addons/layout/vsbox/VSBoxHeader.js +4 -3
- package/components/elements/addons/lists/TuiList.d.ts +2 -2
- package/components/elements/addons/lists/TuiList.js +1 -1
- package/components/elements/addons/lists/TuiListBase.d.ts +2 -2
- package/components/elements/addons/lists/TuiListBase.js +4 -4
- package/components/elements/addons/lists/TuiListElement.d.ts +2 -2
- package/components/elements/addons/lists/TuiListElement.js +2 -2
- package/components/elements/addons/lists/TuiListMenu.d.ts +13 -37
- package/components/elements/addons/lists/TuiListMenu.js +8 -8
- package/components/elements/addons/lists/TuiListProvider.d.ts +2 -2
- package/components/elements/addons/lists/TuiListProvider.js +4 -4
- package/components/elements/addons/lists/hooks/useTuiListKeyboard.js +1 -1
- package/components/elements/addons/lists/table/TuiTable.d.ts +1 -1
- package/components/elements/addons/lists/table/TuiTable.js +1 -1
- package/components/elements/addons/lists/table/TuiTableBody.d.ts +1 -1
- package/components/elements/addons/lists/table/TuiTableBody.js +1 -1
- package/components/elements/addons/lists/table/TuiTableHead.d.ts +1 -1
- package/components/elements/addons/lists/table/TuiTableHead.js +1 -1
- package/components/elements/addons/lists/table/TuiTableHeader.d.ts +1 -1
- package/components/elements/addons/lists/table/TuiTableLayout.js +1 -1
- package/components/elements/addons/search/SearchPagination.d.ts +1 -1
- package/components/elements/addons/search/SearchPagination.test.js +1 -1
- package/components/elements/addons/search/SearchTotal.d.ts +1 -1
- package/components/elements/addons/search/phrase/Phrase.d.ts +2 -2
- package/components/elements/addons/search/phrase/Phrase.js +7 -7
- package/components/elements/addons/search/phrase/PhraseConsumer.d.ts +2 -2
- package/components/elements/addons/search/phrase/PhraseLexer.d.ts +1 -1
- package/components/elements/addons/search/phrase/PhraseLexer.js +6 -6
- package/components/elements/addons/search/phrase/WordLexer.test.js +1 -0
- package/components/elements/addons/search/phrase/index.d.ts +2 -2
- package/components/elements/addons/search/phrase/index.js +3 -2
- package/components/elements/addons/search/phrase/word/consumers/WhitespaceConsumer.d.ts +1 -1
- package/components/elements/addons/search/phrase/word/consumers/WhitespaceConsumer.js +1 -1
- package/components/elements/addons/search/phrase/word/consumers/WordConsumer.d.ts +1 -1
- package/components/elements/case/CaseCard.js +10 -4
- package/components/elements/case/CasePreview.js +1 -1
- package/components/elements/display/ActionButton.js +3 -1
- package/components/elements/display/ChipPopper.js +1 -1
- package/components/elements/display/ChipPopper.test.js +1 -0
- package/components/elements/display/Classification.js +6 -5
- package/components/elements/display/ClassificationChip.d.ts +2 -4
- package/components/elements/display/ClassificationChip.js +5 -3
- package/components/elements/display/DocumentationButton.js +1 -1
- package/components/elements/display/DocumentationButton.test.js +1 -1
- package/components/elements/display/HandlebarsMarkdown.js +2 -2
- package/components/elements/display/HowlerAvatar.d.ts +1 -0
- package/components/elements/display/HowlerAvatar.js +5 -4
- package/components/elements/display/HowlerAvatarHeader.js +2 -2
- package/components/elements/display/Image.test.js +1 -0
- package/components/elements/display/ItemManager.d.ts +6 -6
- package/components/elements/display/ItemManager.js +1 -1
- package/components/elements/display/Markdown.js +9 -3
- package/components/elements/display/Modal.js +3 -3
- package/components/elements/display/QueryResultText.js +1 -1
- package/components/elements/display/TextDivider.test.js +1 -0
- package/components/elements/display/TypingIndicator.d.ts +1 -1
- package/components/elements/display/UserPageWrapper.js +2 -2
- package/components/elements/display/handlebars/helpers.js +1 -1
- package/components/elements/display/json/JSONViewer.js +2 -2
- package/components/elements/display/markdownPlugins/tabs.js +4 -0
- package/components/elements/display/modals/CreateActionModal.js +1 -1
- package/components/elements/display/modals/RationaleModal.js +1 -2
- package/components/elements/display/modals/RationaleModal.test.js +9 -5
- package/components/elements/event/EventPreview.js +1 -1
- package/components/elements/hit/HitActions.js +5 -7
- package/components/elements/hit/HitBanner.js +4 -16
- package/components/elements/hit/HitBanner.test.js +11 -20
- package/components/elements/hit/HitLabels.js +23 -13
- package/components/elements/hit/HitLinks.js +4 -4
- package/components/elements/hit/HitNotebooks.js +28 -10
- package/components/elements/hit/HitOutline.js +9 -15
- package/components/elements/hit/HitOutline.test.js +5 -5
- package/components/elements/hit/HitOverview.js +3 -3
- package/components/elements/hit/HitPreview.d.ts +1 -1
- package/components/elements/hit/HitPreview.js +6 -7
- package/components/elements/hit/HitSummary.js +8 -8
- package/components/elements/hit/PivotTooltip.js +1 -1
- package/components/elements/hit/actions/ButtonActions.js +2 -2
- package/components/elements/hit/actions/DropdownActions.js +4 -4
- package/components/elements/hit/aggregate/HitGraph.js +28 -11
- package/components/elements/hit/elements/AnalyticLink.js +2 -2
- package/components/elements/hit/elements/AnalyticLink.test.js +1 -1
- package/components/elements/hit/elements/Assigned.js +1 -1
- package/components/elements/hit/elements/Assigned.test.js +1 -1
- package/components/elements/hit/elements/EscalationChip.js +2 -2
- package/components/elements/hit/elements/HitTimestamp.js +2 -2
- package/components/elements/hit/grid/AddColumnModal.js +2 -2
- package/components/elements/hit/grid/ColumnHeader.js +1 -1
- package/components/elements/hit/grid/RecordRow.js +1 -1
- package/components/elements/hit/grid/RecordTable.d.ts +4 -3
- package/components/elements/hit/grid/RecordTable.js +6 -6
- package/components/elements/hit/related/PivotLink.js +2 -2
- package/components/elements/hit/related/RelatedIcon.js +2 -2
- package/components/elements/hit/related/RelatedLink.js +1 -1
- package/components/elements/hit/related/RelatedRecords.js +1 -1
- package/components/elements/membership/Members.d.ts +6 -0
- package/components/elements/membership/Members.js +14 -0
- package/components/elements/membership/MembershipManagement.d.ts +9 -0
- package/components/elements/membership/MembershipManagement.js +119 -0
- package/components/elements/membership/types.d.ts +7 -0
- package/components/elements/membership/utils.d.ts +2 -0
- package/components/elements/membership/utils.js +6 -0
- package/components/elements/record/RecordComments.js +16 -10
- package/components/elements/record/RecordContextMenu.d.ts +2 -2
- package/components/elements/record/RecordContextMenu.js +11 -5
- package/components/elements/record/RecordContextMenu.test.js +14 -6
- package/components/elements/record/RecordRelated.js +2 -2
- package/components/elements/search/FuzzySearchBar.js +1 -1
- package/components/elements/view/LayoutToggle.d.ts +1 -1
- package/components/elements/view/ViewTitle.js +3 -4
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +25 -15
- package/components/hooks/useLocalStorage.d.ts +1 -1
- package/components/hooks/useLocalStorage.js +1 -1
- package/components/hooks/useLocalStorageItem.d.ts +11 -1
- package/components/hooks/useLocalStorageItem.js +7 -5
- package/components/hooks/useLocalStorageItem.test.js +23 -0
- package/components/hooks/useMyAccessibility.d.ts +7 -0
- package/components/hooks/useMyAccessibility.js +21 -0
- package/components/hooks/useMyApi.d.ts +1 -1
- package/components/hooks/useMyApi.js +4 -4
- package/components/hooks/useMyChart.d.ts +46 -48
- package/components/hooks/useMyChart.js +30 -9
- package/components/hooks/useMyCookies.d.ts +3 -0
- package/components/hooks/useMyCookies.js +8 -0
- package/components/hooks/useMyLocalStorage.d.ts +8 -2
- package/components/hooks/useMyLocalStorage.js +1 -1
- package/components/hooks/useMyPreferences.d.ts +1 -1
- package/components/hooks/useMyPreferences.js +93 -127
- package/components/hooks/useMyRouter.d.ts +2 -0
- package/components/hooks/useMyRouter.js +24 -0
- package/components/hooks/useMySearch.d.ts +1 -1
- package/components/hooks/useMySearch.js +17 -7
- package/components/hooks/useMySnackbar.js +1 -1
- package/components/hooks/useMyTheme.d.ts +1 -1
- package/components/hooks/useMyTheme.js +13 -8
- package/components/hooks/useMyTheme.test.js +11 -6
- package/components/hooks/useMyUser.d.ts +1 -1
- package/components/hooks/useMyUser.js +6 -5
- package/components/hooks/useMyUserFunctions.d.ts +2 -2
- package/components/hooks/useMyUserFunctions.js +14 -10
- package/components/hooks/useMyUserList.d.ts +1 -1
- package/components/hooks/useMyUtils.js +1 -1
- package/components/hooks/useParamState.js +5 -3
- package/components/hooks/useParamState.test.js +1 -1
- package/components/hooks/useRecordSelection.d.ts +4 -3
- package/components/hooks/useRecordSelection.js +5 -5
- package/components/hooks/useScrollRestoration.js +3 -3
- package/components/logins/Login.d.ts +1 -1
- package/components/logins/Login.js +4 -6
- package/components/logins/auth/OAuthLogin.js +1 -1
- package/components/logins/auth/UserPassLogin.d.ts +1 -1
- package/components/logins/hooks/useLogin.js +10 -6
- package/components/routes/403.js +1 -1
- package/components/routes/403.test.js +7 -3
- package/components/routes/404.js +1 -1
- package/components/routes/404.test.js +7 -3
- package/components/routes/ErrorBoundary.d.ts +2 -2
- package/components/routes/ErrorBoundary.js +2 -2
- package/components/routes/ErrorBoundary.test.js +1 -4
- package/components/routes/ErrorOccured.js +1 -1
- package/components/routes/ErrorOccured.test.js +7 -3
- package/components/routes/Logout.js +3 -4
- package/components/routes/Logout.test.js +12 -11
- package/components/routes/action/edit/ActionEditor.js +38 -30
- package/components/routes/action/shared/ActionReportDisplay.js +1 -1
- package/components/routes/action/shared/OperationEntry.js +2 -2
- package/components/routes/action/shared/OperationStep.js +12 -10
- package/components/routes/action/useMyActionFunctions.d.ts +3 -3
- package/components/routes/action/useMyActionFunctions.js +13 -13
- package/components/routes/action/view/ActionDetails.d.ts +1 -1
- package/components/routes/action/view/ActionDetails.js +46 -26
- package/components/routes/action/view/ActionSearch.js +11 -10
- package/components/routes/action/view/Integrations.js +2 -2
- package/components/routes/action/view/markdown/integrations.en.md.js +1 -1
- package/components/routes/action/view/markdown/integrations.fr.md.js +1 -1
- package/components/routes/admin/users/UserEditor.js +21 -8
- package/components/routes/admin/users/UserSearch.js +10 -9
- package/components/routes/advanced/QueryBuilder.js +17 -11
- package/components/routes/advanced/luceneCompletionProvider.js +42 -21
- package/components/routes/analytics/AnalyticComments.js +19 -14
- package/components/routes/analytics/AnalyticDetails.d.ts +1 -1
- package/components/routes/analytics/AnalyticDetails.js +20 -16
- package/components/routes/analytics/AnalyticHitComments.js +13 -6
- package/components/routes/analytics/AnalyticHitComments.test.js +5 -4
- package/components/routes/analytics/AnalyticNotebooks.js +5 -5
- package/components/routes/analytics/AnalyticOverview.js +28 -15
- package/components/routes/analytics/AnalyticOverviews.js +2 -2
- package/components/routes/analytics/AnalyticSearch.js +11 -10
- package/components/routes/analytics/AnalyticTemplates.js +3 -3
- package/components/routes/analytics/TriageSettings.d.ts +1 -1
- package/components/routes/analytics/TriageSettings.js +1 -1
- package/components/routes/analytics/widgets/Assessment.js +1 -1
- package/components/routes/analytics/widgets/Created.js +9 -9
- package/components/routes/analytics/widgets/Escalation.js +3 -3
- package/components/routes/analytics/widgets/Stacked.js +5 -5
- package/components/routes/analytics/widgets/Status.js +2 -2
- package/components/routes/cases/CaseViewer.js +1 -1
- package/components/routes/cases/CaseViewer.test.js +2 -2
- package/components/routes/cases/Cases.d.ts +1 -1
- package/components/routes/cases/Cases.js +8 -7
- package/components/routes/cases/constants.d.ts +3 -3
- package/components/routes/cases/detail/AlertPanel.js +1 -1
- package/components/routes/cases/detail/AlertPanel.test.js +4 -6
- package/components/routes/cases/detail/CaseDashboard.js +8 -4
- package/components/routes/cases/detail/CaseDashboard.test.js +2 -2
- package/components/routes/cases/detail/CaseDetails.js +7 -2
- package/components/routes/cases/detail/CaseDetails.test.js +1 -1
- package/components/routes/cases/detail/CaseObservables.js +5 -4
- package/components/routes/cases/detail/CaseObservables.test.js +1 -1
- package/components/routes/cases/detail/CaseOverview.js +2 -2
- package/components/routes/cases/detail/CaseRules.js +10 -6
- package/components/routes/cases/detail/CaseRules.test.js +2 -2
- package/components/routes/cases/detail/CaseSearch.js +5 -5
- package/components/routes/cases/detail/CaseSearch.test.js +2 -2
- package/components/routes/cases/detail/CaseSidebar.js +12 -7
- package/components/routes/cases/detail/CaseSidebar.test.js +5 -6
- package/components/routes/cases/detail/CaseTask.js +27 -15
- package/components/routes/cases/detail/CaseTask.test.js +8 -1
- package/components/routes/cases/detail/CaseTimeline.js +8 -8
- package/components/routes/cases/detail/CaseTimeline.test.js +6 -6
- package/components/routes/cases/detail/CreateRuleDialog.js +4 -4
- package/components/routes/cases/detail/CreateRuleDialog.test.js +2 -2
- package/components/routes/cases/detail/ItemPage.js +3 -3
- package/components/routes/cases/detail/MarkdownPage.test.js +0 -4
- package/components/routes/cases/detail/RelatedCasePanel.js +1 -1
- package/components/routes/cases/detail/RelatedCasePanel.test.js +4 -6
- package/components/routes/cases/detail/TaskPanel.js +8 -8
- package/components/routes/cases/detail/TaskPanel.test.js +3 -3
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +1 -1
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +3 -3
- package/components/routes/cases/detail/observables/Observable.js +4 -5
- package/components/routes/cases/detail/observables/Observable.test.js +1 -1
- package/components/routes/cases/detail/observables/ObservableTable.js +3 -3
- package/components/routes/cases/detail/observables/ObservableTable.test.js +1 -1
- package/components/routes/cases/detail/sidebar/CaseFolder.js +24 -20
- package/components/routes/cases/detail/sidebar/CaseFolder.test.js +1 -1
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +4 -2
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +3 -2
- package/components/routes/cases/detail/sidebar/FolderEntry.js +3 -3
- package/components/routes/cases/detail/sidebar/FolderEntry.test.js +3 -3
- package/components/routes/cases/detail/sidebar/types.d.ts +1 -1
- package/components/routes/cases/detail/sidebar/utils.js +1 -1
- package/components/routes/cases/detail/sidebar/utils.test.js +8 -8
- package/components/routes/cases/detail/utils.d.ts +1 -1
- package/components/routes/cases/detail/utils.js +3 -2
- package/components/routes/cases/hooks/useCase.js +14 -2
- package/components/routes/cases/modals/AddRecordToCaseModal.test.js +1 -1
- package/components/routes/cases/modals/AddToCaseModal.d.ts +1 -1
- package/components/routes/cases/modals/AddToCaseModal.js +2 -2
- package/components/routes/cases/modals/CreateCaseModal.test.js +1 -1
- package/components/routes/cases/modals/ResolveModal.js +8 -5
- package/components/routes/cases/modals/ResolveModal.test.js +5 -5
- package/components/routes/cases/modals/hooks.js +1 -2
- package/components/routes/cases/modals/types.d.ts +1 -1
- package/components/routes/cases/search/CaseAssigneeFilter.js +1 -1
- package/components/routes/cases/search/CaseAssigneeFilter.test.js +8 -3
- package/components/routes/cases/search/CaseStatusFilter.test.js +1 -0
- package/components/routes/cases/utils.d.ts +0 -1
- package/components/routes/cases/utils.js +4 -13
- package/components/routes/dossiers/DossierCard.js +3 -3
- package/components/routes/dossiers/DossierCard.test.js +6 -6
- package/components/routes/dossiers/DossierEditor.js +61 -25
- package/components/routes/dossiers/DossierEditor.test.js +16 -9
- package/components/routes/dossiers/Dossiers.d.ts +1 -1
- package/components/routes/dossiers/Dossiers.js +6 -5
- package/components/routes/dossiers/LeadEditor.d.ts +1 -1
- package/components/routes/dossiers/LeadEditor.js +2 -2
- package/components/routes/dossiers/LeadForm.js +2 -2
- package/components/routes/dossiers/PivotForm.d.ts +1 -1
- package/components/routes/dossiers/PivotForm.js +10 -9
- package/components/routes/events/EventViewer.js +1 -1
- package/components/routes/help/ActionDocumentation.js +2 -2
- package/components/routes/help/ActionIntroductionDocumentation.js +2 -2
- package/components/routes/help/ApiDocumentation.js +3 -4
- package/components/routes/help/AuthDocumentation.js +1 -1
- package/components/routes/help/ClientDocumentation.js +1 -1
- package/components/routes/help/Help.d.ts +1 -1
- package/components/routes/help/Help.js +5 -4
- package/components/routes/help/HitDocumentation.js +3 -3
- package/components/routes/help/HitLabelsDocumentation.js +12 -12
- package/components/routes/help/HitLinksDocumentation.js +2 -2
- package/components/routes/help/HitSchemaDocumentation.js +14 -8
- package/components/routes/help/NotebookDocumentation.js +1 -1
- package/components/routes/help/OverviewDocumentation.js +1 -1
- package/components/routes/help/RetentionDocumentation.js +3 -3
- package/components/routes/help/SearchDocumentation.js +6 -4
- package/components/routes/help/TemplateDocumentation.js +2 -2
- package/components/routes/help/ViewDocumentation.js +1 -1
- package/components/routes/help/markdown/en/views.md.js +1 -1
- package/components/routes/help/markdown/fr/views.md.js +1 -1
- package/components/routes/hits/search/InformationPane.js +10 -20
- package/components/routes/hits/search/QuerySettings.js +1 -1
- package/components/routes/hits/search/QuerySettings.test.js +8 -4
- package/components/routes/hits/search/RecordBrowser.js +12 -9
- package/components/routes/hits/search/RecordQuery.js +13 -10
- package/components/routes/hits/search/SearchPane.js +2 -3
- package/components/routes/hits/search/ViewLink.js +4 -4
- package/components/routes/hits/search/ViewLink.test.js +1 -0
- package/components/routes/hits/search/grid/RecordGrid.js +1 -1
- package/components/routes/hits/search/shared/CustomSort.js +3 -2
- package/components/routes/hits/search/shared/CustomSpan.js +9 -1
- package/components/routes/hits/search/shared/HitFilter.js +8 -3
- package/components/routes/hits/search/shared/HitSort.js +8 -6
- package/components/routes/hits/search/shared/IndexPicker.js +1 -1
- package/components/routes/hits/search/shared/LayoutSettings.js +1 -1
- package/components/routes/hits/search/shared/SearchActionMenu.d.ts +1 -1
- package/components/routes/hits/search/shared/SearchActionMenu.js +1 -1
- package/components/routes/hits/search/shared/SearchSpan.js +1 -1
- package/components/routes/hits/shared/PluginViewing.d.ts +10 -0
- package/components/routes/hits/shared/PluginViewing.js +13 -0
- package/components/routes/hits/view/HitViewer.js +52 -52
- package/components/routes/hits/view/HitViewer.test.js +8 -6
- package/components/routes/home/AddNewCard.d.ts +2 -1
- package/components/routes/home/AddNewCard.js +7 -4
- package/components/routes/home/AnalyticCard.js +3 -3
- package/components/routes/home/EntryWrapper.js +1 -1
- package/components/routes/home/ViewCard.js +11 -7
- package/components/routes/home/ViewCard.test.js +3 -6
- package/components/routes/home/index.js +20 -17
- package/components/routes/overviews/OverviewCard.js +6 -2
- package/components/routes/overviews/OverviewViewer.d.ts +1 -1
- package/components/routes/overviews/OverviewViewer.js +48 -39
- package/components/routes/overviews/Overviews.d.ts +1 -1
- package/components/routes/overviews/Overviews.js +7 -6
- package/components/routes/overviews/markdownExtendedTokenProvider.test.js +1 -0
- package/components/routes/overviews/startingTemplate.js +1 -1
- package/components/routes/settings/ProfileSection.d.ts +1 -1
- package/components/routes/settings/ProfileSection.js +2 -2
- package/components/routes/settings/SecuritySection.d.ts +1 -1
- package/components/routes/settings/SecuritySection.js +2 -2
- package/components/routes/settings/Settings.js +6 -6
- package/components/routes/templates/TemplateCard.js +1 -1
- package/components/routes/templates/TemplateEditor.d.ts +1 -1
- package/components/routes/templates/TemplateEditor.js +3 -3
- package/components/routes/templates/TemplateViewer.d.ts +1 -1
- package/components/routes/templates/TemplateViewer.js +54 -52
- package/components/routes/templates/Templates.d.ts +1 -1
- package/components/routes/templates/Templates.js +10 -9
- package/components/routes/views/ViewComposer.js +38 -30
- package/components/routes/views/Views.d.ts +2 -1
- package/components/routes/views/Views.js +20 -14
- package/i18n.js +4 -0
- package/locales/en/translation.json +10 -0
- package/locales/fr/translation.json +10 -0
- package/models/entities/HowlerUser.d.ts +1 -1
- package/models/entities/generated/Action.d.ts +3 -1
- package/models/entities/generated/ApiType.d.ts +2 -3
- package/models/entities/generated/Dossier.d.ts +2 -0
- package/models/entities/generated/HowlerDossier.d.ts +2 -0
- package/models/entities/generated/Item.d.ts +2 -2
- package/models/entities/generated/Settings.d.ts +1 -1
- package/models/entities/generated/View.d.ts +2 -0
- package/package.json +102 -117
- package/plugins/HowlerPlugin.d.ts +9 -50
- package/plugins/HowlerPlugin.js +7 -113
- package/plugins/clue/Provider.js +1 -1
- package/plugins/clue/components/ClueLeadForm.js +2 -2
- package/plugins/clue/components/CluePivot.js +6 -7
- package/plugins/clue/components/CluePivotForm.js +26 -15
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/helpers.js +5 -5
- package/plugins/clue/index.d.ts +2 -2
- package/plugins/clue/index.js +1 -1
- package/plugins/clue/setup.js +1 -1
- package/plugins/clue/utils.d.ts +1 -1
- package/plugins/store.d.ts +26 -43
- package/plugins/store.js +2 -15
- package/rest/AxiosClient.js +3 -3
- package/rest/FetchClient.d.ts +1 -1
- package/rest/FetchClient.js +8 -5
- package/rest/FetchClient.test.js +7 -4
- package/rest/index.d.ts +4 -3
- package/setupTests.d.ts +3 -0
- package/tests/MockLocalStorage.js +2 -1
- package/tests/mocks.d.ts +2 -2
- package/tests/mocks.js +3 -3
- package/tests/server-handlers.js +1 -1
- package/utils/Throttler.js +1 -1
- package/utils/actionUtils.d.ts +1 -1
- package/utils/actionUtils.js +10 -6
- package/utils/classificationParser.js +56 -63
- package/utils/constants.d.ts +0 -17
- package/utils/constants.js +1 -18
- package/utils/exampleHit.d.ts +2 -0
- package/utils/exampleHit.js +18 -0
- package/utils/localStorage.d.ts +2 -2
- package/utils/localStorage.js +1 -1
- package/utils/menuUtils.d.ts +3 -89
- package/utils/menuUtils.js +66 -227
- package/utils/menuUtils.test.js +45 -181
- package/utils/sessionStorage.js +1 -1
- package/utils/sessionStorage.test.js +1 -0
- package/utils/stringUtils.d.ts +1 -1
- package/utils/utils.d.ts +30 -6
- package/utils/utils.js +66 -9
- package/utils/utils.test.js +1 -0
- package/utils/xsrf.d.ts +1 -1
- package/utils/xsrf.js +5 -10
- package/api/dossier/hit.d.ts +0 -2
- package/api/dossier/hit.js +0 -7
- package/api/dossier/index.d.ts +0 -9
- package/commons/components/app/AppConfigs.d.ts +0 -137
- package/commons/components/app/AppConstants.d.ts +0 -10
- package/commons/components/app/AppConstants.js +0 -10
- package/commons/components/app/AppContexts.d.ts +0 -105
- package/commons/components/app/AppContexts.js +0 -21
- package/commons/components/app/AppDefaults.d.ts +0 -6
- package/commons/components/app/AppDefaults.js +0 -40
- package/commons/components/app/AppNotificationService.d.ts +0 -6
- package/commons/components/app/AppNotificationService.js +0 -1
- package/commons/components/app/AppProvider.d.ts +0 -15
- package/commons/components/app/AppProvider.js +0 -41
- package/commons/components/app/AppSearchService.d.ts +0 -21
- package/commons/components/app/AppSearchService.js +0 -1
- package/commons/components/app/AppSkeleton.d.ts +0 -5
- package/commons/components/app/AppSkeleton.js +0 -152
- package/commons/components/app/AppUserService.d.ts +0 -17
- package/commons/components/app/AppUserService.js +0 -1
- package/commons/components/app/hooks/index.d.ts +0 -18
- package/commons/components/app/hooks/index.js +0 -18
- package/commons/components/app/hooks/useApp.d.ts +0 -1
- package/commons/components/app/hooks/useApp.js +0 -5
- package/commons/components/app/hooks/useAppBanner.d.ts +0 -1
- package/commons/components/app/hooks/useAppBanner.js +0 -6
- package/commons/components/app/hooks/useAppBar.d.ts +0 -1
- package/commons/components/app/hooks/useAppBar.js +0 -5
- package/commons/components/app/hooks/useAppBarHeight.d.ts +0 -2
- package/commons/components/app/hooks/useAppBarHeight.js +0 -22
- package/commons/components/app/hooks/useAppBarScrollTrigger.d.ts +0 -1
- package/commons/components/app/hooks/useAppBarScrollTrigger.js +0 -7
- package/commons/components/app/hooks/useAppBreadcrumbs.d.ts +0 -1
- package/commons/components/app/hooks/useAppBreadcrumbs.js +0 -5
- package/commons/components/app/hooks/useAppConfigs.d.ts +0 -59
- package/commons/components/app/hooks/useAppConfigs.js +0 -44
- package/commons/components/app/hooks/useAppLanguage.d.ts +0 -6
- package/commons/components/app/hooks/useAppLanguage.js +0 -17
- package/commons/components/app/hooks/useAppLayout.d.ts +0 -1
- package/commons/components/app/hooks/useAppLayout.js +0 -5
- package/commons/components/app/hooks/useAppLeftNav.d.ts +0 -1
- package/commons/components/app/hooks/useAppLeftNav.js +0 -5
- package/commons/components/app/hooks/useAppLogo.d.ts +0 -1
- package/commons/components/app/hooks/useAppLogo.js +0 -8
- package/commons/components/app/hooks/useAppNotification.d.ts +0 -1
- package/commons/components/app/hooks/useAppNotification.js +0 -5
- package/commons/components/app/hooks/useAppQuickSearch.d.ts +0 -1
- package/commons/components/app/hooks/useAppQuickSearch.js +0 -5
- package/commons/components/app/hooks/useAppSearchService.d.ts +0 -2
- package/commons/components/app/hooks/useAppSearchService.js +0 -5
- package/commons/components/app/hooks/useAppSitemap.d.ts +0 -16
- package/commons/components/app/hooks/useAppSitemap.js +0 -70
- package/commons/components/app/hooks/useAppSwitcher.d.ts +0 -1
- package/commons/components/app/hooks/useAppSwitcher.js +0 -5
- package/commons/components/app/hooks/useAppTheme.d.ts +0 -8
- package/commons/components/app/hooks/useAppTheme.js +0 -12
- package/commons/components/app/hooks/useAppUser.d.ts +0 -2
- package/commons/components/app/hooks/useAppUser.js +0 -5
- package/commons/components/app/providers/AppBarProvider.d.ts +0 -10
- package/commons/components/app/providers/AppBarProvider.js +0 -24
- package/commons/components/app/providers/AppBreadcrumbsProvider.d.ts +0 -6
- package/commons/components/app/providers/AppBreadcrumbsProvider.js +0 -43
- package/commons/components/app/providers/AppLayoutProvider.d.ts +0 -6
- package/commons/components/app/providers/AppLayoutProvider.js +0 -73
- package/commons/components/app/providers/AppLeftNavProvider.d.ts +0 -6
- package/commons/components/app/providers/AppLeftNavProvider.js +0 -22
- package/commons/components/app/providers/AppNotificationProvider.d.ts +0 -6
- package/commons/components/app/providers/AppNotificationProvider.js +0 -31
- package/commons/components/app/providers/AppQuickSearchProvider.d.ts +0 -8
- package/commons/components/app/providers/AppQuickSearchProvider.js +0 -19
- package/commons/components/app/providers/AppSearchServiceProvider.d.ts +0 -6
- package/commons/components/app/providers/AppSearchServiceProvider.js +0 -46
- package/commons/components/app/providers/AppSnackbarProvider.d.ts +0 -3
- package/commons/components/app/providers/AppSnackbarProvider.js +0 -15
- package/commons/components/app/providers/AppSwitcherProvider.d.ts +0 -6
- package/commons/components/app/providers/AppSwitcherProvider.js +0 -10
- package/commons/components/app/providers/AppUserProvider.d.ts +0 -8
- package/commons/components/app/providers/AppUserProvider.js +0 -12
- package/commons/components/breadcrumbs/BreadcrumbIcon.d.ts +0 -6
- package/commons/components/breadcrumbs/BreadcrumbIcon.js +0 -9
- package/commons/components/breadcrumbs/BreadcrumbLastItem.d.ts +0 -7
- package/commons/components/breadcrumbs/BreadcrumbLastItem.js +0 -19
- package/commons/components/breadcrumbs/BreadcrumbLinkItem.d.ts +0 -7
- package/commons/components/breadcrumbs/BreadcrumbLinkItem.js +0 -20
- package/commons/components/breadcrumbs/BreadcrumbList.d.ts +0 -11
- package/commons/components/breadcrumbs/BreadcrumbList.js +0 -44
- package/commons/components/breadcrumbs/Breadcrumbs.d.ts +0 -5
- package/commons/components/breadcrumbs/Breadcrumbs.js +0 -31
- package/commons/components/display/AppAvatar.d.ts +0 -8
- package/commons/components/display/AppAvatar.js +0 -18
- package/commons/components/display/AppInfoPanel.d.ts +0 -5
- package/commons/components/display/AppInfoPanel.js +0 -17
- package/commons/components/display/AppListEmpty.d.ts +0 -2
- package/commons/components/display/AppListEmpty.js +0 -5
- package/commons/components/display/AppToc.d.ts +0 -20
- package/commons/components/display/AppToc.js +0 -98
- package/commons/components/display/hooks/useAppColor.d.ts +0 -5
- package/commons/components/display/hooks/useAppColor.js +0 -10
- package/commons/components/leftnav/LeftNavDrawer.d.ts +0 -3
- package/commons/components/leftnav/LeftNavDrawer.js +0 -99
- package/commons/components/leftnav/LeftNavGroup.d.ts +0 -8
- package/commons/components/leftnav/LeftNavGroup.js +0 -55
- package/commons/components/leftnav/LeftNavItem.d.ts +0 -11
- package/commons/components/leftnav/LeftNavItem.js +0 -29
- package/commons/components/notification/FeedModels.d.ts +0 -64
- package/commons/components/notification/FeedModels.js +0 -94
- package/commons/components/notification/Notification.d.ts +0 -10
- package/commons/components/notification/Notification.js +0 -95
- package/commons/components/notification/elements/NotificationCloseButton.d.ts +0 -3
- package/commons/components/notification/elements/NotificationCloseButton.js +0 -6
- package/commons/components/notification/elements/NotificationContainer.d.ts +0 -16
- package/commons/components/notification/elements/NotificationContainer.js +0 -29
- package/commons/components/notification/elements/NotificationEndOfPage.d.ts +0 -5
- package/commons/components/notification/elements/NotificationEndOfPage.js +0 -36
- package/commons/components/notification/elements/NotificationError.d.ts +0 -2
- package/commons/components/notification/elements/NotificationError.js +0 -10
- package/commons/components/notification/elements/NotificationHeader.d.ts +0 -8
- package/commons/components/notification/elements/NotificationHeader.js +0 -18
- package/commons/components/notification/elements/NotificationItems.d.ts +0 -12
- package/commons/components/notification/elements/NotificationItems.js +0 -12
- package/commons/components/notification/elements/NotificationSkeleton.d.ts +0 -2
- package/commons/components/notification/elements/NotificationSkeleton.js +0 -12
- package/commons/components/notification/elements/NotificationTopNavButton.d.ts +0 -9
- package/commons/components/notification/elements/NotificationTopNavButton.js +0 -9
- package/commons/components/notification/elements/item/NotificationItem.d.ts +0 -5
- package/commons/components/notification/elements/item/NotificationItem.js +0 -25
- package/commons/components/notification/elements/item/NotificationItemAuthor.d.ts +0 -5
- package/commons/components/notification/elements/item/NotificationItemAuthor.js +0 -31
- package/commons/components/notification/elements/item/NotificationItemContent.d.ts +0 -3
- package/commons/components/notification/elements/item/NotificationItemContent.js +0 -9
- package/commons/components/notification/elements/item/NotificationItemDate.d.ts +0 -3
- package/commons/components/notification/elements/item/NotificationItemDate.js +0 -10
- package/commons/components/notification/elements/item/NotificationItemImage.d.ts +0 -4
- package/commons/components/notification/elements/item/NotificationItemImage.js +0 -8
- package/commons/components/notification/elements/item/NotificationItemTag.d.ts +0 -4
- package/commons/components/notification/elements/item/NotificationItemTag.js +0 -12
- package/commons/components/notification/elements/item/NotificationItemTitle.d.ts +0 -3
- package/commons/components/notification/elements/item/NotificationItemTitle.js +0 -15
- package/commons/components/notification/index.d.ts +0 -2
- package/commons/components/notification/index.js +0 -2
- package/commons/components/pages/PageCardCentered.d.ts +0 -5
- package/commons/components/pages/PageCardCentered.js +0 -30
- package/commons/components/pages/PageCenter.d.ts +0 -9
- package/commons/components/pages/PageCenter.js +0 -20
- package/commons/components/pages/PageContent.d.ts +0 -8
- package/commons/components/pages/PageContent.js +0 -8
- package/commons/components/pages/PageFullScreen.d.ts +0 -11
- package/commons/components/pages/PageFullScreen.js +0 -40
- package/commons/components/pages/PageFullWidth.d.ts +0 -11
- package/commons/components/pages/PageFullWidth.js +0 -7
- package/commons/components/pages/PageHeader.d.ts +0 -23
- package/commons/components/pages/PageHeader.js +0 -27
- package/commons/components/pages/hooks/usePageProps.d.ts +0 -24
- package/commons/components/pages/hooks/usePageProps.js +0 -19
- package/commons/components/search/AppSearch.d.ts +0 -1
- package/commons/components/search/AppSearch.js +0 -135
- package/commons/components/search/AppSearchInput.d.ts +0 -12
- package/commons/components/search/AppSearchInput.js +0 -35
- package/commons/components/search/AppSearchResult.d.ts +0 -5
- package/commons/components/search/AppSearchResult.js +0 -28
- package/commons/components/topnav/AppBar.d.ts +0 -6
- package/commons/components/topnav/AppBar.js +0 -80
- package/commons/components/topnav/AppName.d.ts +0 -5
- package/commons/components/topnav/AppName.js +0 -31
- package/commons/components/topnav/AppSwitcher.d.ts +0 -3
- package/commons/components/topnav/AppSwitcher.js +0 -44
- package/commons/components/topnav/Notifications.d.ts +0 -2
- package/commons/components/topnav/Notifications.js +0 -8
- package/commons/components/topnav/ThemeSelection.d.ts +0 -3
- package/commons/components/topnav/ThemeSelection.js +0 -33
- package/commons/components/topnav/ThemeSelectionIcon.d.ts +0 -2
- package/commons/components/topnav/ThemeSelectionIcon.js +0 -16
- package/commons/components/topnav/UserProfile.d.ts +0 -6
- package/commons/components/topnav/UserProfile.js +0 -71
- package/commons/components/utils/hooks/useClipboard.d.ts +0 -3
- package/commons/components/utils/hooks/useClipboard.js +0 -29
- package/commons/components/utils/hooks/useEnv.d.ts +0 -1
- package/commons/components/utils/hooks/useEnv.js +0 -11
- package/commons/components/utils/hooks/useFullscreenStatus.d.ts +0 -2
- package/commons/components/utils/hooks/useFullscreenStatus.js +0 -41
- package/commons/components/utils/hooks/useGravatar.d.ts +0 -2
- package/commons/components/utils/hooks/useGravatar.js +0 -9
- package/commons/components/utils/hooks/useLocalStorage.d.ts +0 -12
- package/commons/components/utils/hooks/useLocalStorage.js +0 -52
- package/commons/components/utils/hooks/useLocalStorageItem.d.ts +0 -14
- package/commons/components/utils/hooks/useLocalStorageItem.js +0 -39
- package/commons/components/utils/hooks/useThemeBuilder.d.ts +0 -7
- package/commons/components/utils/hooks/useThemeBuilder.js +0 -48
- package/commons/components/utils/keyboard.d.ts +0 -30
- package/commons/components/utils/keyboard.js +0 -50
- package/components/hooks/useMySitemap.d.ts +0 -3
- package/components/hooks/useMySitemap.js +0 -219
- /package/{commons/components/app/AppConfigs.js → components/elements/MembershipManagement.test.d.ts} +0 -0
|
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useContextSelector } from 'use-context-selector';
|
|
16
16
|
import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
|
|
17
17
|
import { isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
|
|
18
|
-
import { getTimeRange } from '@cccsaurora/howler-ui/utils/utils';
|
|
18
|
+
import { getTimeRange, notNil } from '@cccsaurora/howler-ui/utils/utils';
|
|
19
19
|
import PluginChip from '../PluginChip';
|
|
20
20
|
import HitGraph from './aggregate/HitGraph';
|
|
21
21
|
const HitSummary = ({ response, onStart, onComplete }) => {
|
|
@@ -100,7 +100,7 @@ const HitSummary = ({ response, onStart, onComplete }) => {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
catch (e) {
|
|
103
|
-
showErrorMessage(e);
|
|
103
|
+
showErrorMessage(e instanceof Error ? e.message : String(e));
|
|
104
104
|
setAggregateResults({});
|
|
105
105
|
}
|
|
106
106
|
finally {
|
|
@@ -117,26 +117,26 @@ const HitSummary = ({ response, onStart, onComplete }) => {
|
|
|
117
117
|
onComplete,
|
|
118
118
|
onStart,
|
|
119
119
|
pageCount,
|
|
120
|
-
query,
|
|
121
|
-
response?.items,
|
|
122
120
|
showErrorMessage,
|
|
123
|
-
t
|
|
121
|
+
t,
|
|
122
|
+
response?.items,
|
|
123
|
+
query
|
|
124
124
|
]);
|
|
125
125
|
const setSearch = useCallback((key, value) => {
|
|
126
126
|
setQuery(`${key}:${value}`);
|
|
127
127
|
}, [setQuery]);
|
|
128
128
|
useEffect(() => {
|
|
129
|
-
if ((!query && views?.length < 1) || searching || error) {
|
|
129
|
+
if ((!query && (views?.length ?? 0) < 1) || searching || error) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
void performAggregation();
|
|
133
133
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
134
|
}, [query, views, searching, error]);
|
|
135
|
-
return (_jsxs(Stack, { sx: { mx: 2, height: '100%' }, spacing: 1, children: [_jsx(Typography, { variant: "h6", children: t('hit.summary.aggregate.title') }), _jsx(Divider, { flexItem: true }), showHitSummaryGraph && (_jsxs(_Fragment, { children: [_jsx(HitGraph, {}), _jsx(Divider, { flexItem: true })] })), _jsxs(Stack, { sx: { overflow: 'auto', marginTop: '0 !important' }, pt: 1, spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 2, mb: 2, alignItems: "stretch", children: [_jsx(Autocomplete, { fullWidth: true, multiple: true, sx: { minWidth: '175px' }, size: "small", value: customKeys, options: hitFields.map(_field => _field.key), renderInput: _params => _jsx(TextField, { ..._params, label: t('hit.summary.adhoc') }), onChange: (_, value) => setCustomKeys(value) }), _jsx(Button, { variant: "outlined", startIcon: loading ? _jsx(CircularProgress, { size: 20, sx: { ml: 1 } }) : _jsx(Analytics, { sx: { ml: 1 } }), disabled: loading, onClick: () => performAggregation(), children: t('button.aggregate') })] }), isEmpty(aggregateResults) && (_jsxs(Alert, { severity: "info", variant: "outlined", children: [_jsx(AlertTitle, { children: t('hit.summary.aggregate.nokeys.title') }), t('hit.summary.aggregate.nokeys.description')] })), loading && _jsx(LinearProgress, { sx: { minHeight: '4px' } }), Object.keys(aggregateResults)
|
|
135
|
+
return (_jsxs(Stack, { sx: { mx: 2, height: '100%' }, spacing: 1, children: [_jsx(Typography, { variant: "h6", children: t('hit.summary.aggregate.title') }), _jsx(Divider, { flexItem: true }), showHitSummaryGraph && (_jsxs(_Fragment, { children: [_jsx(HitGraph, {}), _jsx(Divider, { flexItem: true })] })), _jsxs(Stack, { sx: { overflow: 'auto', marginTop: '0 !important' }, pt: 1, spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 2, mb: 2, alignItems: "stretch", children: [_jsx(Autocomplete, { fullWidth: true, multiple: true, sx: { minWidth: '175px' }, size: "small", value: customKeys, options: hitFields.map(_field => _field.key), renderInput: _params => _jsx(TextField, { ..._params, label: t('hit.summary.adhoc') }), onChange: (_, value) => setCustomKeys(value.filter(notNil)) }), _jsx(Button, { variant: "outlined", startIcon: loading ? _jsx(CircularProgress, { size: 20, sx: { ml: 1 } }) : _jsx(Analytics, { sx: { ml: 1 } }), disabled: loading, onClick: () => performAggregation(), children: t('button.aggregate') })] }), isEmpty(aggregateResults) && (_jsxs(Alert, { severity: "info", variant: "outlined", children: [_jsx(AlertTitle, { children: t('hit.summary.aggregate.nokeys.title') }), t('hit.summary.aggregate.nokeys.description')] })), loading && _jsx(LinearProgress, { sx: { minHeight: '4px' } }), Object.keys(aggregateResults)
|
|
136
136
|
.filter(key => !isEmpty(aggregateResults[key]))
|
|
137
137
|
.flatMap(key => [
|
|
138
138
|
_jsx(Fade, { in: true, children: _jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, children: [_jsx(Typography, { variant: "body1", children: key }, key + '-title'), keyCounts[key]?.count < 0 ? (_jsxs(Typography, { variant: "caption", color: "text.secondary", children: ["(", t('hit.summary.adhoc.custom'), ")"] })) : (_jsxs(Typography, { variant: "caption", color: "text.secondary", children: ["(", keyCounts[key]?.count ?? '?', " ", t('references'), ")"] })), _jsx(Tooltip, { title: _jsxs(Stack, { children: [_jsx(Typography, { variant: "caption", children: t('hit.summary.aggregate.sources') }), keyCounts[key]?.sources.map(source => (_jsx(Typography, { variant: "caption", children: source }, source))) ?? '?'] }), children: _jsx(InfoOutlined, { fontSize: "inherit" }) })] }) }, key + '-refs'),
|
|
139
|
-
_jsx(Fade, { in: true, children: hitFields.find(f => f.key === key)?.type !== 'date' ? (_jsx(Box, { sx: theme => ({ ml: `${theme.spacing(1)} !important`, alignSelf: 'start' }), children: _jsx(Grid, { container: true, sx: theme => ({ mr: 1, mt: theme.spacing(-1) }), spacing: 1, children: Object.keys(aggregateResults[key]).map(item => (_jsx(Grid, {
|
|
139
|
+
_jsx(Fade, { in: true, children: hitFields.find(f => f.key === key)?.type !== 'date' ? (_jsx(Box, { sx: theme => ({ ml: `${theme.spacing(1)} !important`, alignSelf: 'start' }), children: _jsx(Grid, { container: true, sx: theme => ({ mr: 1, mt: theme.spacing(-1) }), spacing: 1, children: Object.keys(aggregateResults[key]).map(item => (_jsx(Grid, { size: 'auto', children: _jsx(PluginChip, { context: "summary", size: "small", variant: "filled", value: item, label: `${item} (${aggregateResults[key][item]})`, onClick: () => setSearch(key, `"${item}"`), field: key }) }, item))) }, key + '-list') })) : (_jsx(Chip, { size: "small", sx: theme => ({ ml: `${theme.spacing(1)} !important`, alignSelf: 'start' }), label: getTimeRange(Object.keys(aggregateResults[key]))
|
|
140
140
|
.map(d => new Date(d).toLocaleString())
|
|
141
141
|
.join(' - '), onClick: () => setSearch(key, `[${getTimeRange(Object.keys(aggregateResults[key])).join(' TO ')}]`) })) }, key + '-results')
|
|
142
142
|
])] })] }));
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Link, Typography } from '@mui/material';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
const PivotTooltip = ({ dossier, resolvedUrl }) => {
|
|
5
|
-
const dossierUrl = `/dossiers/${dossier.dossier_id}/edit?tab=leads&query=${encodeURIComponent(dossier.query)}`;
|
|
5
|
+
const dossierUrl = `/dossiers/${dossier.dossier_id}/edit?tab=leads&query=${encodeURIComponent(dossier.query ?? '')}`;
|
|
6
6
|
const { t } = useTranslation();
|
|
7
7
|
return (_jsxs(Box, { sx: { maxWidth: 300 }, children: [_jsx(Typography, { variant: "subtitle2", children: dossier.title }), _jsx(Typography, { variant: "body2", color: "text.secondary", children: dossier.owner }), _jsx(Typography, { variant: "body2", sx: { mt: 2 }, children: dossier.leads?.[0]?.content?.slice(0, 120) ?? t('pivot.description.none') }), _jsxs(Box, { sx: { mt: 2, wordBreak: 'break-all' }, children: [_jsx(Typography, { variant: "caption", display: "block", children: t('pivot.url') }), _jsx(Link, { href: resolvedUrl, target: "_blank", rel: "noopener noreferrer", underline: "hover", children: resolvedUrl })] }), _jsx(Box, { sx: { mt: 2 }, children: _jsx(Link, { href: dossierUrl, target: "_blank", rel: "noopener noreferrer", underline: "hover", children: t('pivot.dossier.open') }) })] }));
|
|
8
8
|
};
|
|
@@ -42,8 +42,8 @@ const ButtonActions = ({ actions, loading, orientation, shortcuts, currentVote }
|
|
|
42
42
|
bottom.push(action);
|
|
43
43
|
}
|
|
44
44
|
return [top, bottom];
|
|
45
|
-
}, [[], []])
|
|
46
|
-
return (_jsxs(Stack, { direction: isHorizontal ? 'row' : 'column', spacing: 0.75, alignItems:
|
|
45
|
+
}, [[], []]), [actions]);
|
|
46
|
+
return (_jsxs(Stack, { direction: isHorizontal ? 'row' : 'column', spacing: 0.75, alignItems: isHorizontal ? undefined : 'start', py: 1, sx: { position: 'relative', flex: 1 }, justifyContent: "space-between", children: [_jsxs(FormControl, { disabled: loading, sx: [
|
|
47
47
|
{
|
|
48
48
|
display: 'grid',
|
|
49
49
|
justifyContent: 'stretch',
|
|
@@ -9,11 +9,11 @@ const DropdownActions = ({ actions, currentAssessment, currentStatus, currentVot
|
|
|
9
9
|
const config = useContext(ApiConfigContext);
|
|
10
10
|
const isHorizontal = useMemo(() => orientation === 'horizontal', [orientation]);
|
|
11
11
|
if (!config.config.lookups) {
|
|
12
|
-
return (_jsxs(Grid, { container: true, justifyContent: "end", spacing: 4, p: 2, children: [_jsx(Grid, {
|
|
12
|
+
return (_jsxs(Grid, { container: true, justifyContent: "end", spacing: 4, p: 2, children: [_jsx(Grid, { size: { sm: 'auto', xs: 12 }, children: _jsx(Skeleton, { variant: "rounded", width: "200px", height: orientation === 'horizontal' ? '40px' : '56px' }) }), _jsx(Grid, { size: { sm: 'auto', xs: 12 }, children: _jsx(Skeleton, { variant: "rounded", width: "200px", height: orientation === 'horizontal' ? '40px' : '56px' }) }), _jsx(Grid, { size: { sm: 'auto', xs: 12 }, children: _jsx(Skeleton, { variant: "rounded", width: "200px", height: orientation === 'horizontal' ? '40px' : '56px' }) })] }));
|
|
13
13
|
}
|
|
14
|
-
return (_jsxs(Grid, { container: true, justifyContent: "end", spacing: 2, p: 2, sx: [isHorizontal && { [`& .${formControlClasses.root}`]: { minWidth: '140px' } }], children: [_jsx(Grid, {
|
|
14
|
+
return (_jsxs(Grid, { container: true, justifyContent: "end", spacing: 2, p: 2, sx: [isHorizontal && { [`& .${formControlClasses.root}`]: { minWidth: '140px' } }], children: [_jsx(Grid, { size: { sm: !isHorizontal ? 'grow' : 'auto', xs: 12 }, children: _jsxs(FormControl, { disabled: loading, fullWidth: true, children: [_jsx(InputLabel, { id: "transition-label", htmlFor: "transition", children: t('hit.details.actions.action') }), _jsxs(Select, { labelId: "transition-label", id: "transition", size: isHorizontal ? 'small' : 'medium', label: t('hit.details.actions.action'), value: currentStatus, children: [_jsx(MenuItem, { value: currentStatus, sx: { display: 'none' }, children: currentStatus.replace(/-/g, ' ').replace(/^[a-z]/, val => val.toUpperCase()) }), actions
|
|
15
15
|
.filter(_action => _action.type === 'action')
|
|
16
|
-
.map(_action => (_jsx(MenuItem, { value: _action.name, onClick: _action.actionFunction, children: _action.i18nKey ? t(_action.i18nKey) : _action.name }, _action.name)))] })] }) }), _jsx(Grid, {
|
|
16
|
+
.map(_action => (_jsx(MenuItem, { value: _action.name, onClick: _action.actionFunction, children: _action.i18nKey ? t(_action.i18nKey) : _action.name }, _action.name)))] })] }) }), _jsx(Grid, { size: { sm: !isHorizontal ? 'grow' : 'auto', xs: 12 }, children: _jsxs(FormControl, { disabled: loading || !actions.some(action => action.type === 'assessment'), fullWidth: true, children: [_jsx(InputLabel, { id: "assess-label", htmlFor: "assess", children: t('hit.details.actions.assessment') }), _jsxs(Select, { labelId: "assess-label", id: "assess", size: isHorizontal ? 'small' : 'medium', label: t('hit.details.actions.assessment'), value: currentAssessment ?? 'no-assessment', MenuProps: {
|
|
17
17
|
anchorOrigin: { horizontal: 'left', vertical: 'bottom' },
|
|
18
18
|
transformOrigin: { horizontal: 'left', vertical: 'top' }
|
|
19
19
|
}, children: [_jsx(MenuItem, { value: "no-assessment", sx: { display: 'none' }, children: t('hit.details.actions.assessment.noassessment') }), actions
|
|
@@ -21,7 +21,7 @@ const DropdownActions = ({ actions, currentAssessment, currentStatus, currentVot
|
|
|
21
21
|
.map(a => (_jsx(MenuItem, { value: a.name, onClick: a.actionFunction, children: _jsxs(Stack, { direction: "column", children: [_jsx("span", { children: a.name
|
|
22
22
|
.split(/[ -]/)
|
|
23
23
|
.map(part => capitalize(part))
|
|
24
|
-
.join(' ') }), _jsx(Typography, { variant: "caption", color: "text.secondary", maxWidth: "250px", sx: { whiteSpace: 'wrap' }, children: t(`hit.details.asessments.${a.name}.description`) })] }) }, a.name)))] })] }) }), _jsx(Grid, {
|
|
24
|
+
.join(' ') }), _jsx(Typography, { variant: "caption", color: "text.secondary", maxWidth: "250px", sx: { whiteSpace: 'wrap' }, children: t(`hit.details.asessments.${a.name}.description`) })] }) }, a.name)))] })] }) }), _jsx(Grid, { size: { sm: !isHorizontal ? 'grow' : 'auto', xs: 12 }, children: _jsxs(FormControl, { disabled: loading || !actions.some(action => action.type === 'vote'), fullWidth: true, children: [_jsx(InputLabel, { id: "vote-label", htmlFor: "vote", children: t('hit.details.actions.vote') }), _jsxs(Select, { labelId: "vote-label", id: "vote", size: isHorizontal ? 'small' : 'medium', label: t('hit.details.actions.vote'), value: currentVote || 'no-vote', children: [_jsx(MenuItem, { value: "no-vote", sx: { display: 'none' }, children: t('hit.details.actions.vote.novote') }), actions
|
|
25
25
|
.filter(action => action.type === 'vote')
|
|
26
26
|
.map(action => (_jsx(MenuItem, { value: action.name.toLowerCase(), onClick: action.actionFunction, children: action.i18nKey ? t(action.i18nKey) : action.name }, action.name)))] })] }) })] }));
|
|
27
27
|
};
|
|
@@ -44,7 +44,7 @@ const HitGraph = () => {
|
|
|
44
44
|
const error = useContextSelector(RecordSearchContext, ctx => ctx.error);
|
|
45
45
|
const response = useContextSelector(RecordSearchContext, ctx => ctx.response);
|
|
46
46
|
const getFilters = useContextSelector(RecordSearchContext, ctx => ctx.getFilters);
|
|
47
|
-
const chartRef = useRef();
|
|
47
|
+
const chartRef = useRef(undefined);
|
|
48
48
|
const [loading, setLoading] = useState(false);
|
|
49
49
|
const [filterField, setFilterField] = useState(FILTER_FIELDS[0]);
|
|
50
50
|
const [data, setData] = useState([]);
|
|
@@ -61,10 +61,16 @@ const HitGraph = () => {
|
|
|
61
61
|
if (escalationFilter) {
|
|
62
62
|
filters.push(`howler.escalation:${escalationFilter}`);
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
query,
|
|
64
|
+
const countResult = await dispatchApi(api.search.count.hit.post({
|
|
65
|
+
query: query ?? DEFAULT_QUERY,
|
|
66
66
|
filters
|
|
67
|
-
}))
|
|
67
|
+
}));
|
|
68
|
+
if (!countResult) {
|
|
69
|
+
setData([]);
|
|
70
|
+
setDisabled(false);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const total = countResult.count;
|
|
68
74
|
if (total > MAX_QUERY_SIZE) {
|
|
69
75
|
setDisabled(true);
|
|
70
76
|
setSearchTotal(total);
|
|
@@ -73,7 +79,7 @@ const HitGraph = () => {
|
|
|
73
79
|
else {
|
|
74
80
|
setDisabled(false);
|
|
75
81
|
}
|
|
76
|
-
const
|
|
82
|
+
const groupedResult = await dispatchApi(api.search.grouped.hit.post(filterField, {
|
|
77
83
|
query: query || DEFAULT_QUERY,
|
|
78
84
|
fl: 'event.created,howler.assessment,howler.analytic,howler.detection,howler.outline.threat,howler.outline.target,howler.outline.summary,howler.id',
|
|
79
85
|
// We want a generally random sample across all date ranges, so we use hash.
|
|
@@ -84,10 +90,15 @@ const HitGraph = () => {
|
|
|
84
90
|
rows: override ? OVERRIDE_ROWS : MAX_ROWS,
|
|
85
91
|
filters
|
|
86
92
|
}));
|
|
87
|
-
if (
|
|
93
|
+
if (!groupedResult) {
|
|
94
|
+
setData([]);
|
|
95
|
+
setShowWarning(false);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (groupedResult.total > MAX_ROWS && !override) {
|
|
88
99
|
setShowWarning(true);
|
|
89
100
|
}
|
|
90
|
-
const processed =
|
|
101
|
+
const processed = groupedResult.items.map(category => {
|
|
91
102
|
const label = capitalize(category.value ?? 'None');
|
|
92
103
|
return {
|
|
93
104
|
label: `${label} (${category.total})`,
|
|
@@ -109,7 +120,7 @@ const HitGraph = () => {
|
|
|
109
120
|
}
|
|
110
121
|
}, [dispatchApi, escalationFilter, filterField, getFilters, override, query]);
|
|
111
122
|
useEffect(() => {
|
|
112
|
-
if ((!query && views?.length < 1) || error || !response) {
|
|
123
|
+
if ((!query && (views?.length ?? 0) < 1) || error || !response) {
|
|
113
124
|
return;
|
|
114
125
|
}
|
|
115
126
|
void performQuery();
|
|
@@ -144,7 +155,12 @@ const HitGraph = () => {
|
|
|
144
155
|
}
|
|
145
156
|
}
|
|
146
157
|
},
|
|
147
|
-
onHover: (event, chartElement) =>
|
|
158
|
+
onHover: (event, chartElement) => {
|
|
159
|
+
const target = event.native?.target;
|
|
160
|
+
if (target instanceof HTMLElement) {
|
|
161
|
+
target.style.cursor = chartElement[0] ? 'pointer' : 'default';
|
|
162
|
+
}
|
|
163
|
+
},
|
|
148
164
|
interaction: {
|
|
149
165
|
mode: 'nearest'
|
|
150
166
|
},
|
|
@@ -178,7 +194,8 @@ const HitGraph = () => {
|
|
|
178
194
|
},
|
|
179
195
|
ticks: {
|
|
180
196
|
callback: (value) => {
|
|
181
|
-
const
|
|
197
|
+
const numValue = typeof value === 'number' ? value : parseFloat(value);
|
|
198
|
+
const [hour, minute] = [Math.floor(numValue), Math.floor((numValue - Math.floor(numValue)) * 60)];
|
|
182
199
|
return dayjs().hour(hour).minute(minute).format('HH:mm');
|
|
183
200
|
}
|
|
184
201
|
}
|
|
@@ -213,7 +230,7 @@ const HitGraph = () => {
|
|
|
213
230
|
}, [selectedHits]);
|
|
214
231
|
return (_jsxs(Stack, { sx: { position: 'relative' }, spacing: 1, children: [_jsx(Scatter, { ref: chartRef, options: options, data: {
|
|
215
232
|
datasets: data
|
|
216
|
-
} }), _jsxs(Stack, { direction: "row", spacing: 1, sx: { pt: 2 }, children: [_jsx(Autocomplete, { sx: { flex: 1 }, options: FILTER_FIELDS, renderInput: params => _jsx(TextField, { ...params, label: t('hit.summary.filter.field'), size: "small" }), value: filterField, onChange: (__, option) => setFilterField(option) }), _jsx(Autocomplete, { sx: { flex: 1 }, options: config.lookups['howler.escalation'], renderInput: params => _jsx(TextField, { ...params, label: t('hit.summary.filter.escalation'), size: "small" }), value: escalationFilter, onChange: (__, option) => setEscalationFilter(option) })] }), showWarning && (_jsxs(Alert, { severity: "warning", variant: "outlined", action: _jsx(Button, { variant: "outlined", color: "warning", onClick: () => {
|
|
233
|
+
} }), _jsxs(Stack, { direction: "row", spacing: 1, sx: { pt: 2 }, children: [_jsx(Autocomplete, { sx: { flex: 1 }, options: FILTER_FIELDS, renderInput: params => _jsx(TextField, { ...params, label: t('hit.summary.filter.field'), size: "small" }), value: filterField, onChange: (__, option) => setFilterField(option) }), _jsx(Autocomplete, { sx: { flex: 1 }, options: config.lookups?.['howler.escalation'] ?? [], renderInput: params => _jsx(TextField, { ...params, label: t('hit.summary.filter.escalation'), size: "small" }), value: escalationFilter, onChange: (__, option) => setEscalationFilter(option) })] }), showWarning && (_jsxs(Alert, { severity: "warning", variant: "outlined", action: _jsx(Button, { variant: "outlined", color: "warning", onClick: () => {
|
|
217
234
|
setOverride(true);
|
|
218
235
|
setShowWarning(false);
|
|
219
236
|
}, children: t('hit.summary.render.limit.override') }), children: [_jsx(AlertTitle, { children: t('hit.summary.render.limit', { number: MAX_ROWS }) }), t(`hit.summary.render.limit.description`, { number: MAX_ROWS, max: OVERRIDE_ROWS })] })), disabled && (_jsx(Box, { sx: {
|
|
@@ -3,7 +3,7 @@ import { Link as LinkIcon } from '@mui/icons-material';
|
|
|
3
3
|
import { IconButton, Stack, Typography } from '@mui/material';
|
|
4
4
|
import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
|
-
import { Link } from 'react-router
|
|
6
|
+
import { Link } from 'react-router';
|
|
7
7
|
const AnalyticLink = ({ hit, lazy = false, compressed, alignSelf = 'start' }) => {
|
|
8
8
|
const { getMatchingAnalytic } = useMatchers(lazy);
|
|
9
9
|
const [analyticId, setAnalyticId] = useState();
|
|
@@ -18,6 +18,6 @@ const AnalyticLink = ({ hit, lazy = false, compressed, alignSelf = 'start' }) =>
|
|
|
18
18
|
e.stopPropagation();
|
|
19
19
|
}, onClick: e => {
|
|
20
20
|
e.stopPropagation();
|
|
21
|
-
}, disabled: !analyticId, to: `/analytics/${analyticId}`, target: "_blank", rel: "noopener noreferrer", children: _jsx(LinkIcon, { fontSize: "small" }) }), _jsxs(Typography, { variant: compressed ? 'body1' : 'h6', fontWeight: compressed
|
|
21
|
+
}, disabled: !analyticId, to: `/analytics/${analyticId}`, target: "_blank", rel: "noopener noreferrer", children: _jsx(LinkIcon, { fontSize: "small" }) }), _jsxs(Typography, { variant: compressed ? 'body1' : 'h6', fontWeight: compressed ? 'bold' : undefined, sx: { alignSelf, '& a': { color: 'text.primary' } }, children: [hit.howler.analytic, hit.howler.detection && ' > ', hit.howler.detection] })] }));
|
|
22
22
|
};
|
|
23
23
|
export default AnalyticLink;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import { BrowserRouter } from 'react-router
|
|
4
|
+
import { BrowserRouter } from 'react-router';
|
|
5
5
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
6
|
import AnalyticLink from './AnalyticLink';
|
|
7
7
|
const getMatchingAnalytic = vi.hoisted(() => vi.fn());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAppUser } from '@tui/core';
|
|
2
3
|
import { avatarClasses, AvatarGroup, Chip, Divider, Stack } from '@mui/material';
|
|
3
|
-
import { useAppUser } from '@cccsaurora/howler-ui/commons/components/app/hooks';
|
|
4
4
|
import { SocketContext } from '@cccsaurora/howler-ui/components/app/providers/SocketProvider';
|
|
5
5
|
import HowlerAvatar from '@cccsaurora/howler-ui/components/elements/display/HowlerAvatar';
|
|
6
6
|
import { uniq } from 'lodash-es';
|
|
@@ -6,7 +6,7 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
// Hoisted mocks
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('@tui/core', () => ({
|
|
10
10
|
useAppUser: () => ({ user: { username: 'current-user' } })
|
|
11
11
|
}));
|
|
12
12
|
vi.mock('components/elements/display/HowlerAvatar', () => ({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Chip, Tooltip } from '@mui/material';
|
|
3
|
-
import {
|
|
3
|
+
import { getEscalationColor } from '@cccsaurora/howler-ui/utils/utils';
|
|
4
4
|
import { HitLayout } from '../HitLayout';
|
|
5
5
|
const EscalationChip = ({ hit, layout, hideLabel = false }) => {
|
|
6
6
|
const label = ['evidence', 'miss'].includes(hit.howler.escalation) ? hit.howler.assessment : hit.howler.escalation;
|
|
7
|
-
const component = (_jsx(Chip, { sx: [{ width: 'fit-content', display: 'inline-flex' }, HitLayout.DENSE && { minWidth: '20px' }], label: hideLabel ? ' ' : label, size: layout !== HitLayout.COMFY ? 'small' : 'medium', color:
|
|
7
|
+
const component = (_jsx(Chip, { sx: [{ width: 'fit-content', display: 'inline-flex' }, HitLayout.DENSE && { minWidth: '20px' }], label: hideLabel ? ' ' : label, size: layout !== HitLayout.COMFY ? 'small' : 'medium', color: getEscalationColor(hit.howler.escalation) }));
|
|
8
8
|
return hideLabel ? _jsx(Tooltip, { title: label, children: component }) : component;
|
|
9
9
|
};
|
|
10
10
|
export default EscalationChip;
|
|
@@ -14,11 +14,11 @@ const TIMESTAMP_MESSAGES = {
|
|
|
14
14
|
const HitTimestamp = ({ hit, layout }) => {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const { config } = useContext(ApiConfigContext);
|
|
17
|
-
const threshold = useMemo(() => dayjs().subtract(config.configuration
|
|
17
|
+
const threshold = useMemo(() => dayjs().subtract(config.configuration?.system.retention?.limit_amount ?? 350, config.configuration?.system.retention?.limit_unit ?? 'days'), [config.configuration]);
|
|
18
18
|
const timestamp = useMemo(() => {
|
|
19
19
|
const validFieldValues = [hit.howler?.expiry, hit.event?.created, hit.timestamp];
|
|
20
20
|
const earliestDate = validFieldValues
|
|
21
|
-
.filter(entry => !!entry)
|
|
21
|
+
.filter((entry) => !!entry)
|
|
22
22
|
.reduce((earliest, current) => {
|
|
23
23
|
return dayjs(earliest).isBefore(current) ? earliest : current;
|
|
24
24
|
});
|
|
@@ -23,11 +23,11 @@ const AddColumnModal = ({ addColumn, columns }) => {
|
|
|
23
23
|
setSuggestions(uniq((await Promise.all((response?.items ?? []).filter(isHit).map(async (_hit) => (await getMatchingTemplate(_hit))?.keys ?? []))).flat()));
|
|
24
24
|
})();
|
|
25
25
|
}, [getMatchingTemplate, response?.items]);
|
|
26
|
-
return (_jsx(ChipPopper, { icon: _jsx(TableChart, {}), deleteIcon: _jsx(Settings, {}), toggleOnDelete: true, slotProps: { chip: { size: 'small' } }, children: _jsxs(Stack, { spacing: 1, p: 1, width: "500px", children: [_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Autocomplete, { sx: { flex: 1 }, size: "small", options: options, value: columnToAdd, renderInput: params => _jsx(TextField, { fullWidth: true, placeholder: t('hit.fields')
|
|
26
|
+
return (_jsx(ChipPopper, { icon: _jsx(TableChart, {}), deleteIcon: _jsx(Settings, {}), toggleOnDelete: true, slotProps: { chip: { size: 'small' } }, children: _jsxs(Stack, { spacing: 1, p: 1, width: "500px", children: [_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Autocomplete, { sx: { flex: 1 }, size: "small", options: options, value: columnToAdd, renderInput: params => _jsx(TextField, { ...params, fullWidth: true, placeholder: t('hit.fields') }), onChange: (_ev, value) => setColumnToAdd(value ?? null) }), _jsx(IconButton, { disabled: !columnToAdd, onClick: () => {
|
|
27
27
|
addColumn(columnToAdd);
|
|
28
28
|
setColumnToAdd(null);
|
|
29
29
|
}, children: _jsx(Add, {}) })] }), _jsx(Divider, { orientation: "horizontal" }), _jsx(Grid, { container: true, spacing: 1, children: sortBy(suggestions.map(key => ({ key, used: columns.includes(key) })), 'used').map(({ key, used }) => {
|
|
30
|
-
return (_jsx(Grid, {
|
|
30
|
+
return (_jsx(Grid, { children: _jsx(Chip, { size: "small", variant: "outlined", color: used ? 'success' : 'default', label: key, icon: used ? _jsx(Check, {}) : _jsx(Add, {}), onClick: () => addColumn(key), disabled: used }) }, key));
|
|
31
31
|
}) })] }) }));
|
|
32
32
|
};
|
|
33
33
|
export default memo(AddColumnModal);
|
|
@@ -15,7 +15,7 @@ const ColumnHeader = ({ col, width, colSource, setColumns, onMouseDown }) => {
|
|
|
15
15
|
borderRightColor: 'divider',
|
|
16
16
|
py: 0.5,
|
|
17
17
|
position: 'relative'
|
|
18
|
-
}, style: { transform: CSS.Translate.toString(transform), transition }, children: _jsxs(Stack, { className: `col-${col.replaceAll('.', '-')}`, direction: "row", spacing: 1, alignItems: "center", sx: [{ minWidth: '220px' }, width ? { width, maxWidth: width } : { maxWidth: '300px' }], children: [_jsx(Tooltip, { title: config.indexes
|
|
18
|
+
}, style: { transform: CSS.Translate.toString(transform), transition }, children: _jsxs(Stack, { className: `col-${col.replaceAll('.', '-')}`, direction: "row", spacing: 1, alignItems: "center", sx: [{ minWidth: '220px' }, width ? { width, maxWidth: width } : { maxWidth: '300px' }], children: [_jsx(Tooltip, { title: config.indexes?.hit[col]?.description, children: _jsx("span", { children: col }) }), (colSource?.length ?? 0) > 1 && (_jsx(Tooltip, { title: colSource.join(', '), children: _jsx(JoinFull, { fontSize: "small" }) })), _jsx(FlexOne, {}), _jsx(IconButton, { size: "small", sx: { fontSize: '1rem' }, onClick: () => setColumns(_columns => _columns.filter(_col => _col !== col)), children: _jsx(Remove, { fontSize: "inherit" }) }), _jsx(DragIndicator, { fontSize: "small", sx: { cursor: 'grab' }, ...attributes, ...listeners }), _jsx(Box, { sx: {
|
|
19
19
|
position: 'absolute',
|
|
20
20
|
top: theme.spacing(0.75),
|
|
21
21
|
bottom: theme.spacing(0.75),
|
|
@@ -11,7 +11,7 @@ import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayo
|
|
|
11
11
|
import { get } from 'lodash-es';
|
|
12
12
|
import { memo, useState } from 'react';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { Link } from 'react-router
|
|
14
|
+
import { Link } from 'react-router';
|
|
15
15
|
import { useContextSelector } from 'use-context-selector';
|
|
16
16
|
import { isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
|
|
17
17
|
import EnhancedCell from './EnhancedCell';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RecordContextMenuProps } from '@cccsaurora/howler-ui/components/elements/record/RecordContextMenu';
|
|
1
2
|
import type { Event } from '@cccsaurora/howler-ui/models/entities/generated/Event';
|
|
2
3
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
3
4
|
import type { WithMetadata } from '@cccsaurora/howler-ui/models/WithMetadata';
|
|
@@ -6,8 +7,8 @@ declare const RecordTable: ({ query, items, refreshItems, ContextMenu, contextMe
|
|
|
6
7
|
query: string;
|
|
7
8
|
items?: WithMetadata<Hit | Event>[];
|
|
8
9
|
refreshItems?: (query: string, append?: boolean) => void;
|
|
9
|
-
ContextMenu?: React.FC<PropsWithChildren<
|
|
10
|
-
contextMenuProps?:
|
|
10
|
+
ContextMenu?: React.FC<PropsWithChildren<RecordContextMenuProps>>;
|
|
11
|
+
contextMenuProps?: RecordContextMenuProps;
|
|
11
12
|
onItemClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>, record: Hit | Event) => void;
|
|
12
|
-
}) =>
|
|
13
|
+
}) => React.JSX.Element;
|
|
13
14
|
export default RecordTable;
|
|
@@ -17,7 +17,7 @@ const RecordTable = ({ query, items, refreshItems, ContextMenu, contextMenuProps
|
|
|
17
17
|
const [collapseMainColumn, setCollapseMainColumn] = useMyLocalStorageItem(StorageKey.GRID_COLLAPSE_COLUMN, false);
|
|
18
18
|
const [analyticIds, setAnalyticIds] = useState({});
|
|
19
19
|
const { columns, columnWidths, columnSources, setColumnWidth, setColumns, isReady } = useContext(GridColumnsContext);
|
|
20
|
-
const resizingCol = useRef();
|
|
20
|
+
const resizingCol = useRef(undefined);
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
items?.forEach(record => {
|
|
23
23
|
if (!isHit(record) || analyticIds[record.howler.analytic]) {
|
|
@@ -47,11 +47,11 @@ const RecordTable = ({ query, items, refreshItems, ContextMenu, contextMenuProps
|
|
|
47
47
|
if (isReady) {
|
|
48
48
|
setColumnWidth(col, Math.round(width));
|
|
49
49
|
}
|
|
50
|
-
element.style.width =
|
|
51
|
-
element.style.maxWidth =
|
|
50
|
+
element.style.width = '';
|
|
51
|
+
element.style.maxWidth = '';
|
|
52
52
|
document.querySelectorAll(`.col-${col.replaceAll('.', '-')}`).forEach(el => {
|
|
53
|
-
el.style.maxWidth =
|
|
54
|
-
el.style.width =
|
|
53
|
+
el.style.maxWidth = '';
|
|
54
|
+
el.style.width = '';
|
|
55
55
|
});
|
|
56
56
|
window.removeEventListener('mousemove', onMouseMove);
|
|
57
57
|
window.removeEventListener('mouseup', onMouseUp);
|
|
@@ -79,6 +79,6 @@ const RecordTable = ({ query, items, refreshItems, ContextMenu, contextMenuProps
|
|
|
79
79
|
return (_jsxs(Table, { sx: { '& td,th': { px: 1, py: 0.25, whiteSpace: 'nowrap' } }, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { sx: {
|
|
80
80
|
borderRight: 'thin solid',
|
|
81
81
|
borderRightColor: 'divider'
|
|
82
|
-
}, children: _jsx(IconButton, { onClick: () => setCollapseMainColumn(!collapseMainColumn), children: collapseMainColumn ? (_jsx(FormatIndentIncrease, { fontSize: "small" })) : (_jsx(FormatIndentDecrease, { fontSize: "small" })) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: pointerWithin, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: columns, children: columns.map(col => (_jsx(ColumnHeader, { col: col, width: columnWidths[col], colSource: columnSources[col], onMouseDown: onMouseDown, setColumns: isReady ? setColumns : () => null }, col))) }) }), _jsx(TableCell, { sx: { width: '100%' } })] }) }), ContextMenu ? (_jsx(ContextMenu, { ...contextMenuProps, children: tableContent })) : (_jsx(TableBody, { children: tableContent }))] }));
|
|
82
|
+
}, children: _jsx(IconButton, { onClick: () => setCollapseMainColumn(!collapseMainColumn), children: collapseMainColumn ? (_jsx(FormatIndentIncrease, { fontSize: "small" })) : (_jsx(FormatIndentDecrease, { fontSize: "small" })) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: pointerWithin, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: columns, children: columns.map(col => (_jsx(ColumnHeader, { col: col, width: columnWidths[col], colSource: columnSources[col], onMouseDown: onMouseDown, setColumns: isReady ? setColumns : () => null }, col))) }) }), _jsx(TableCell, { sx: { width: '100%' } })] }) }), ContextMenu && contextMenuProps ? (_jsx(ContextMenu, { ...contextMenuProps, children: tableContent })) : (_jsx(TableBody, { children: tableContent }))] }));
|
|
83
83
|
};
|
|
84
84
|
export default RecordTable;
|
|
@@ -41,7 +41,7 @@ const PivotLink = ({ pivot, hit, compact = false, dossier, resolvedUrl }) => {
|
|
|
41
41
|
handlebars.registerHelper(helper.keyword, (...args) => {
|
|
42
42
|
// eslint-disable-next-line no-console
|
|
43
43
|
console.debug(`Running helper ${helper.keyword}`);
|
|
44
|
-
return helper.callback(...args);
|
|
44
|
+
return helper.callback?.(...args);
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
try {
|
|
@@ -54,7 +54,7 @@ const PivotLink = ({ pivot, hit, compact = false, dossier, resolvedUrl }) => {
|
|
|
54
54
|
}
|
|
55
55
|
}, [flatHit, pivot, handlebars, helpers]);
|
|
56
56
|
if (href) {
|
|
57
|
-
return (_jsx(RelatedLink, { title: pivot.label[i18n.language], href: href, compact: compact, icon: pivot.icon, target: "_blank", rel: "noopener noreferrer", tooltip: _jsx(PivotTooltip, { dossier: dossier, resolvedUrl: resolvedUrl }) }));
|
|
57
|
+
return (_jsx(RelatedLink, { title: pivot.label?.[i18n.language] ?? '', href: href, compact: compact, icon: pivot.icon, target: "_blank", rel: "noopener noreferrer", tooltip: _jsx(PivotTooltip, { dossier: dossier, resolvedUrl: resolvedUrl }) }));
|
|
58
58
|
}
|
|
59
59
|
// Hide a relatively useless console error, we'll show a UI component instead
|
|
60
60
|
// eslint-disable-next-line no-console
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Icon } from '@iconify/react';
|
|
3
3
|
import Avatar from '@mui/material/Avatar';
|
|
4
|
-
import { useAppTheme } from '@
|
|
4
|
+
import { useAppTheme } from '@tui/core';
|
|
5
5
|
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
6
6
|
import { useContext } from 'react';
|
|
7
7
|
const RelatedIcon = ({ icon, title, href, compact = false }) => {
|
|
@@ -11,7 +11,7 @@ const RelatedIcon = ({ icon, title, href, compact = false }) => {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
let avatarImage = null;
|
|
14
|
-
const app = config.configuration
|
|
14
|
+
const app = config.configuration?.ui.apps.find(a => a.name.toLowerCase() === icon?.toLowerCase());
|
|
15
15
|
if (app) {
|
|
16
16
|
// use the image link for the configured related application instead
|
|
17
17
|
avatarImage = app[`img_${isDark ? 'd' : 'l'}`];
|
|
@@ -3,7 +3,7 @@ import { Stack, Tooltip, Typography } from '@mui/material';
|
|
|
3
3
|
import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
|
|
4
4
|
import RelatedLinkTooltip from '@cccsaurora/howler-ui/components/elements/hit/RelatedLinkTooltip';
|
|
5
5
|
import React, {} from 'react';
|
|
6
|
-
import { Link } from 'react-router
|
|
6
|
+
import { Link } from 'react-router';
|
|
7
7
|
import RelatedIcon from './RelatedIcon';
|
|
8
8
|
const RelatedLink = ({ icon, title, href, target, rel, compact = false, tooltip, children }) => {
|
|
9
9
|
const safeTitle = title ?? href ?? '';
|
|
@@ -8,7 +8,7 @@ import useRelatedRecords from '@cccsaurora/howler-ui/components/hooks/useRelated
|
|
|
8
8
|
import { identity, uniq } from 'lodash-es';
|
|
9
9
|
import { memo, useMemo, useState } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import { Link } from 'react-router
|
|
11
|
+
import { Link } from 'react-router';
|
|
12
12
|
import { isCase, isEvent, isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
|
|
13
13
|
import HitPreview from '../HitPreview';
|
|
14
14
|
const RecordLink = ({ to, ariaLabel, children }) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AvatarGroup } from '@mui/material';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import HowlerAvatar from '../display/HowlerAvatar';
|
|
5
|
+
import { getAllMembers } from './utils';
|
|
6
|
+
const Members = ({ item }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
return (_jsx(AvatarGroup, { max: 5, slotProps: {
|
|
9
|
+
surplus: {
|
|
10
|
+
sx: { height: 32, width: 32, fontSize: '12px' }
|
|
11
|
+
}
|
|
12
|
+
}, children: getAllMembers(item).map(([member, privilege]) => (_jsx(HowlerAvatar, { userId: member, label: t(`membership.privilege.${privilege}`) + ' - ' + member, sx: { height: 32, width: 32 } }, member))) }));
|
|
13
|
+
};
|
|
14
|
+
export default Members;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ButtonProps } from '@mui/material';
|
|
2
|
+
import type { Ownership } from './types';
|
|
3
|
+
export interface MembershipManagementProps<T extends Ownership> {
|
|
4
|
+
size?: ButtonProps['size'];
|
|
5
|
+
type: 'action' | 'view' | 'dossier';
|
|
6
|
+
entity?: T;
|
|
7
|
+
onChange: (entity: T) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const MembershipManagement: <T extends Ownership>({ type, entity, onChange, size }: MembershipManagementProps<T>) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Delete, PersonAdd } from '@mui/icons-material';
|
|
3
|
+
import { Box, Button, Dialog, DialogContent, DialogTitle, Divider, IconButton, List, ListItem, ListItemText, Stack, TextField, ToggleButton, ToggleButtonGroup } from '@mui/material';
|
|
4
|
+
import { useAppUser } from '@tui/core';
|
|
5
|
+
import api from '@cccsaurora/howler-ui/api';
|
|
6
|
+
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
7
|
+
import useMySnackbar from '@cccsaurora/howler-ui/components/hooks/useMySnackbar';
|
|
8
|
+
import useMyUserList from '@cccsaurora/howler-ui/components/hooks/useMyUserList';
|
|
9
|
+
import { isEqual } from 'lodash-es';
|
|
10
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
|
+
import { useParams } from 'react-router';
|
|
13
|
+
import CustomButton from '../addons/buttons/CustomButton';
|
|
14
|
+
import FlexOne from '../addons/layout/FlexOne';
|
|
15
|
+
import HowlerAvatar from '../display/HowlerAvatar';
|
|
16
|
+
import UserList from '../UserList';
|
|
17
|
+
import { getAllMembers } from './utils';
|
|
18
|
+
export const MembershipManagement = ({ type, entity, onChange, size }) => {
|
|
19
|
+
const params = useParams();
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const { dispatchApi } = useMyApi();
|
|
22
|
+
const { user } = useAppUser();
|
|
23
|
+
const { showSuccessMessage, showWarningMessage, showErrorMessage } = useMySnackbar();
|
|
24
|
+
const [selectedUserIds, setSelectedUserIds] = useState([]);
|
|
25
|
+
const [memberQuery, setMemberQuery] = useState('');
|
|
26
|
+
const [privilege, setPrivilege] = useState('members');
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const canManageMembership = entity &&
|
|
29
|
+
user &&
|
|
30
|
+
(entity.owner === user.username || entity.admins?.includes(user.username) || !!user.roles?.includes('admin'));
|
|
31
|
+
const members = getAllMembers(entity);
|
|
32
|
+
const users = useMyUserList(members.map(([member]) => member));
|
|
33
|
+
const handleAddMember = useCallback(async () => {
|
|
34
|
+
if (selectedUserIds.length === 0) {
|
|
35
|
+
showWarningMessage(t('membership.message.warning'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const updatedEntity = (await dispatchApi(api[type].permission.put(params.id, {
|
|
40
|
+
privilege,
|
|
41
|
+
user_ids: selectedUserIds
|
|
42
|
+
})));
|
|
43
|
+
if (!updatedEntity) {
|
|
44
|
+
throw new Error('Updated Entity was not returned.');
|
|
45
|
+
}
|
|
46
|
+
showSuccessMessage(t('membership.message.success'));
|
|
47
|
+
onChange(updatedEntity);
|
|
48
|
+
setSelectedUserIds([]);
|
|
49
|
+
setMemberQuery('');
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
showErrorMessage(t('membership.message.error'));
|
|
53
|
+
}
|
|
54
|
+
}, [
|
|
55
|
+
dispatchApi,
|
|
56
|
+
params.id,
|
|
57
|
+
selectedUserIds,
|
|
58
|
+
privilege,
|
|
59
|
+
t,
|
|
60
|
+
showSuccessMessage,
|
|
61
|
+
showErrorMessage,
|
|
62
|
+
showWarningMessage,
|
|
63
|
+
type,
|
|
64
|
+
onChange
|
|
65
|
+
]);
|
|
66
|
+
// Keep the targeted privilege explicit so we remove the intended permission entry.
|
|
67
|
+
const handleRemoveMember = useCallback(async (user_id, targetPrivilege) => {
|
|
68
|
+
try {
|
|
69
|
+
const updatedEntity = (await dispatchApi(api[type].permission.delete(params.id, {
|
|
70
|
+
privilege: targetPrivilege,
|
|
71
|
+
user_ids: [user_id]
|
|
72
|
+
}), {
|
|
73
|
+
throwError: false
|
|
74
|
+
}));
|
|
75
|
+
if (!updatedEntity) {
|
|
76
|
+
throw new Error('Updated Entity was not returned.');
|
|
77
|
+
}
|
|
78
|
+
showSuccessMessage(t('membership.message.success'));
|
|
79
|
+
onChange(updatedEntity);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
showErrorMessage(t('membership.message.error'));
|
|
83
|
+
}
|
|
84
|
+
}, [dispatchApi, params.id, type, onChange, showErrorMessage, t, showSuccessMessage]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (open) {
|
|
87
|
+
// Reset modal state each time it opens to avoid leaking stale UI state.
|
|
88
|
+
setSelectedUserIds([]);
|
|
89
|
+
setMemberQuery('');
|
|
90
|
+
setPrivilege('members');
|
|
91
|
+
}
|
|
92
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
93
|
+
}, [open]);
|
|
94
|
+
const canAssignOwner = !!user && (user.roles?.includes('admin') || members.some(member => isEqual(member, [user.username, 'owner'])));
|
|
95
|
+
const availablePrivileges = canAssignOwner ? ['owner', 'admins', 'members'] : ['admins', 'members'];
|
|
96
|
+
const getPrivilegeLabel = useCallback((privilege) => {
|
|
97
|
+
return t(`membership.privilege.${privilege}`);
|
|
98
|
+
}, [t]);
|
|
99
|
+
const filteredMembers = useMemo(() => members.filter(([member, privilege]) => {
|
|
100
|
+
const normalizedQuery = memberQuery.trim().toLowerCase();
|
|
101
|
+
if (!normalizedQuery) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
return (member.toLowerCase().includes(normalizedQuery) ||
|
|
105
|
+
privilege.toLowerCase().includes(normalizedQuery) ||
|
|
106
|
+
getPrivilegeLabel(privilege).toLowerCase().includes(normalizedQuery));
|
|
107
|
+
}), [members, getPrivilegeLabel, memberQuery]);
|
|
108
|
+
if (!canManageMembership) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
return (_jsxs(_Fragment, { children: [_jsx(CustomButton, { sx: { flexShrink: 0 }, variant: "outlined", startIcon: _jsx(PersonAdd, {}), onClick: () => setOpen(true), size: size, children: t('membership.manage') }), _jsxs(Dialog, { open: open, onClose: () => setOpen(false), slotProps: { paper: { sx: { maxWidth: '50vw' } } }, children: [_jsx(DialogTitle, { children: t('membership.manage') }), _jsx(DialogContent, { sx: { minHeight: '300px', maxWidth: '80vw', display: 'flex', flexDirection: 'column' }, children: _jsxs(Stack, { direction: "row", divider: _jsx(Divider, { orientation: "vertical", flexItem: true }), spacing: 1, flex: 1, alignItems: "stretch", pt: 0.5, children: [_jsxs(Stack, { spacing: 1, children: [_jsx(TextField, { fullWidth: true, size: "small", label: t('search'), value: memberQuery, onChange: event => setMemberQuery(event.target.value), sx: { minWidth: '300px' } }), _jsx(List, { children: filteredMembers.map(([m, privilege]) => (_jsx(ListItem, { children: _jsxs(Stack, { direction: "row", sx: { alignItems: 'center', width: '100%' }, spacing: 1, children: [_jsx(HowlerAvatar, { userId: m || 'Unknown' }), _jsx(ListItemText, { primary: users[m]?.name || m, secondary: users[m]?.email
|
|
112
|
+
? `${getPrivilegeLabel(privilege)} - ${users[m].email}`
|
|
113
|
+
: getPrivilegeLabel(privilege) }), _jsx(FlexOne, {}), privilege !== 'owner' && (_jsx(IconButton, { disabled: !params.id, onClick: () => handleRemoveMember(m, privilege), children: _jsx(Delete, { color: "error" }) }))] }) }, `${m}-${privilege}`))) })] }), _jsxs(Stack, { spacing: 1, children: [_jsx(ToggleButtonGroup, { exclusive: true, value: privilege, onChange: (_e, _privilege) => setPrivilege(_privilege), children: availablePrivileges.map(k => (_jsx(ToggleButton, { value: k, children: getPrivilegeLabel(k) }, k))) }), _jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: _jsx(UserList, { variant: "list", multiple: true, i18nLabel: t('page.login.username'), userIds: selectedUserIds, onChange: setSelectedUserIds, except: members
|
|
114
|
+
.filter(([_, _privilege]) => _privilege === 'owner' || privilege === _privilege)
|
|
115
|
+
.map(([member]) => member) }) }), _jsx(Button, { onClick: handleAddMember, sx: { mt: 3 }, variant: "contained", fullWidth: true, disabled: !params.id ||
|
|
116
|
+
selectedUserIds.length === 0 ||
|
|
117
|
+
!privilege ||
|
|
118
|
+
(privilege === 'owner' && selectedUserIds.length > 1), children: t('add') })] })] }) })] })] }));
|
|
119
|
+
};
|