@cccsaurora/howler-ui 3.1.0-dev.1493 → 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 +8 -8
- 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/view/HitViewer.js +21 -11
- package/components/routes/hits/view/HitViewer.test.js +2 -2
- 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 -118
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { View } from '@cccsaurora/howler-ui/models/entities/generated/View';
|
|
2
2
|
import { type FC, type PropsWithChildren } from 'react';
|
|
3
3
|
export interface ViewContextType {
|
|
4
|
-
defaultView
|
|
5
|
-
setDefaultView: (viewId
|
|
4
|
+
defaultView?: string;
|
|
5
|
+
setDefaultView: (viewId?: string) => void;
|
|
6
6
|
views: {
|
|
7
7
|
[viewId: string]: View;
|
|
8
8
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAppUser } from '@tui/core';
|
|
2
3
|
import api from '@cccsaurora/howler-ui/api';
|
|
3
|
-
import { useAppUser } from '@cccsaurora/howler-ui/commons/components/app/hooks';
|
|
4
4
|
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
5
5
|
import { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
|
|
6
6
|
import { has, omit, uniq } from 'lodash-es';
|
|
7
7
|
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
-
import { useSearchParams } from 'react-router
|
|
8
|
+
import { useSearchParams } from 'react-router';
|
|
9
9
|
import { createContext, useContextSelector } from 'use-context-selector';
|
|
10
10
|
import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
|
|
11
11
|
export const ViewContext = createContext(null);
|
|
@@ -26,7 +26,7 @@ const ViewProvider = ({ children }) => {
|
|
|
26
26
|
}
|
|
27
27
|
const missingIds = ids.filter(_id => !!_id && !has(views, _id));
|
|
28
28
|
if (missingIds.length < 1) {
|
|
29
|
-
return ids.map(id => views[id]);
|
|
29
|
+
return ids.map(id => views[id]).filter(view => !!view);
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
const response = await dispatchApi(api.search.view.post({
|
|
@@ -34,13 +34,15 @@ const ViewProvider = ({ children }) => {
|
|
|
34
34
|
rows: missingIds.length,
|
|
35
35
|
sort: 'title asc'
|
|
36
36
|
}));
|
|
37
|
+
if (!response) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
37
40
|
const newViews = Object.fromEntries(response.items.map(_view => [_view.view_id, _view]));
|
|
38
41
|
setViews(_views => ({
|
|
39
42
|
..._views,
|
|
40
|
-
...Object.fromEntries(missingIds.map(_view_id => [_view_id, null])),
|
|
41
43
|
...newViews
|
|
42
44
|
}));
|
|
43
|
-
return ids.map(id => views[id] ?? newViews[id]);
|
|
45
|
+
return ids.map(id => views[id] ?? newViews[id]).filter(view => !!view);
|
|
44
46
|
}
|
|
45
47
|
catch (e) {
|
|
46
48
|
// eslint-disable-next-line no-console
|
|
@@ -68,7 +70,10 @@ const ViewProvider = ({ children }) => {
|
|
|
68
70
|
const missing = [];
|
|
69
71
|
currentViews.forEach(_view => {
|
|
70
72
|
if (has(views, _view)) {
|
|
71
|
-
|
|
73
|
+
const view = views[_view];
|
|
74
|
+
if (view) {
|
|
75
|
+
results.push(view);
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
else if (!lazy) {
|
|
74
79
|
missing.push(_view);
|
|
@@ -78,6 +83,9 @@ const ViewProvider = ({ children }) => {
|
|
|
78
83
|
}, [fetchViews, searchParams, views]);
|
|
79
84
|
const editView = useCallback(async (id, partialView) => {
|
|
80
85
|
const result = await dispatchApi(api.view.put(id, partialView));
|
|
86
|
+
if (!result) {
|
|
87
|
+
throw new Error(`Unable to update view ${id}.`);
|
|
88
|
+
}
|
|
81
89
|
setViews(_views => ({
|
|
82
90
|
..._views,
|
|
83
91
|
[id]: { ..._views[id], ...partialView }
|
|
@@ -88,29 +96,31 @@ const ViewProvider = ({ children }) => {
|
|
|
88
96
|
await dispatchApi(api.view.favourite.post(id));
|
|
89
97
|
appUser.setUser({
|
|
90
98
|
...appUser.user,
|
|
91
|
-
favourite_views: [...appUser.user.favourite_views, id]
|
|
99
|
+
favourite_views: [...(appUser.user.favourite_views ?? []), id]
|
|
92
100
|
});
|
|
93
101
|
}, [appUser, dispatchApi]);
|
|
94
102
|
const addView = useCallback(async (view) => {
|
|
95
103
|
const newView = await dispatchApi(api.view.post(view));
|
|
104
|
+
if (!newView) {
|
|
105
|
+
throw new Error('Unable to create view.');
|
|
106
|
+
}
|
|
96
107
|
setViews(_views => ({ ..._views, [newView.view_id]: newView }));
|
|
97
|
-
|
|
108
|
+
await addFavourite(newView.view_id);
|
|
98
109
|
return newView;
|
|
99
110
|
}, [addFavourite, dispatchApi]);
|
|
100
111
|
const removeFavourite = useCallback(async (id) => {
|
|
101
112
|
await dispatchApi(api.view.favourite.del(id));
|
|
102
113
|
appUser.setUser({
|
|
103
114
|
...appUser.user,
|
|
104
|
-
favourite_views: appUser.user.favourite_views.filter(v => v !== id)
|
|
115
|
+
favourite_views: (appUser.user.favourite_views ?? []).filter(v => v !== id)
|
|
105
116
|
});
|
|
106
117
|
}, [appUser, dispatchApi]);
|
|
107
118
|
const removeView = useCallback(async (id) => {
|
|
108
|
-
if (appUser.user?.favourite_views
|
|
119
|
+
if (appUser.user?.favourite_views?.includes(id)) {
|
|
109
120
|
await removeFavourite(id);
|
|
110
121
|
}
|
|
111
|
-
|
|
122
|
+
await dispatchApi(api.view.del(id));
|
|
112
123
|
setViews(_views => omit(_views, id));
|
|
113
|
-
return result;
|
|
114
124
|
}, [appUser.user?.favourite_views, dispatchApi, removeFavourite]);
|
|
115
125
|
return (_jsx(ViewContext.Provider, { value: {
|
|
116
126
|
views,
|
|
@@ -11,10 +11,10 @@ let mockUser = {
|
|
|
11
11
|
};
|
|
12
12
|
setupReactRouterMock();
|
|
13
13
|
const mockLocalStorage = setupLocalStorageMock();
|
|
14
|
-
import { useSearchParams } from 'react-router
|
|
14
|
+
import { useSearchParams } from 'react-router';
|
|
15
15
|
vi.mocked(useSearchParams).mockReturnValue([new URLSearchParams('?view=searched_view_id')]);
|
|
16
16
|
vi.mock('api', { spy: true });
|
|
17
|
-
vi.mock('
|
|
17
|
+
vi.mock('@tui/core', () => ({
|
|
18
18
|
useAppUser: () => ({
|
|
19
19
|
user: mockUser,
|
|
20
20
|
setUser: _user => (mockUser = _user)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const missingContext: (contextName: string) => never;
|
|
@@ -6,7 +6,7 @@ declare const _default: import("react").NamedExoticComponent<{
|
|
|
6
6
|
comment: HowlerComment | AnalyticComment;
|
|
7
7
|
handleDelete?: () => Promise<void>;
|
|
8
8
|
handleEdit?: (value: string) => Promise<void>;
|
|
9
|
-
handleReact?: (type: string) => Promise<void>;
|
|
9
|
+
handleReact?: (type: string | null) => Promise<void>;
|
|
10
10
|
handleQuote?: () => void;
|
|
11
11
|
onClick?: () => void;
|
|
12
12
|
users: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Celebration, Check, Clear, Delete, Edit, Favorite, FireTruck, FormatQuote, Mood, MoreHoriz, RocketLaunch, ThumbDown, ThumbUp } from '@mui/icons-material';
|
|
3
3
|
import { CardActions, CardContent, Chip, CircularProgress, Collapse, Fade, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Stack, TextField, Tooltip, Typography } from '@mui/material';
|
|
4
|
-
import { useAppUser } from '@
|
|
4
|
+
import { useAppUser } from '@tui/core';
|
|
5
5
|
import FlexOne from '@cccsaurora/howler-ui/components/elements/addons/layout/FlexOne';
|
|
6
6
|
import useMyUtils from '@cccsaurora/howler-ui/components/hooks/useMyUtils';
|
|
7
7
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
@@ -28,13 +28,13 @@ const Comment = ({ comment, handleDelete, handleEdit, handleQuote, handleReact,
|
|
|
28
28
|
const [editing, setEditing] = useState(false);
|
|
29
29
|
const [loading, setLoading] = useState(false);
|
|
30
30
|
const [showInteractions, setShowInteractions] = useState(false);
|
|
31
|
-
const [editValue, setEditValue] = useState(comment.value);
|
|
31
|
+
const [editValue, setEditValue] = useState(comment.value ?? '');
|
|
32
32
|
const handleOpen = useCallback((event) => setAnchorEl(event.currentTarget), []);
|
|
33
33
|
const handleClose = useCallback(() => setAnchorEl(null), []);
|
|
34
34
|
const onDelete = useCallback(async () => {
|
|
35
35
|
setLoading(true);
|
|
36
36
|
try {
|
|
37
|
-
await handleDelete();
|
|
37
|
+
await handleDelete?.();
|
|
38
38
|
}
|
|
39
39
|
finally {
|
|
40
40
|
setLoading(false);
|
|
@@ -48,7 +48,7 @@ const Comment = ({ comment, handleDelete, handleEdit, handleQuote, handleReact,
|
|
|
48
48
|
}
|
|
49
49
|
try {
|
|
50
50
|
setLoading(true);
|
|
51
|
-
await handleEdit(editValue);
|
|
51
|
+
await handleEdit?.(editValue);
|
|
52
52
|
setEdited(true);
|
|
53
53
|
}
|
|
54
54
|
finally {
|
|
@@ -66,14 +66,14 @@ const Comment = ({ comment, handleDelete, handleEdit, handleQuote, handleReact,
|
|
|
66
66
|
}
|
|
67
67
|
}, [loading, onEdit]);
|
|
68
68
|
const onQuote = useCallback(() => {
|
|
69
|
-
handleQuote();
|
|
69
|
+
handleQuote?.();
|
|
70
70
|
handleClose();
|
|
71
71
|
}, [handleClose, handleQuote]);
|
|
72
72
|
const reactions = useMemo(() => {
|
|
73
73
|
return Object.keys(REACTION_ICONS).map(type => {
|
|
74
74
|
const quantity = Object.values(comment?.reactions ?? {}).filter(r => r === type).length;
|
|
75
75
|
const Icon = REACTION_ICONS[type];
|
|
76
|
-
return !!quantity || (showInteractions && handleReact) ? (_jsx(Fade, { in: true, children: _jsx(Chip, { size: "small", variant: "outlined", color: comment.reactions?.[user.username] === type ? 'primary' : 'default', icon: _jsx(Icon, {}), onClick: handleReact ? () => handleReact(comment.reactions?.[user.username] !== type ? type : null) :
|
|
76
|
+
return !!quantity || (showInteractions && handleReact) ? (_jsx(Fade, { in: true, children: _jsx(Chip, { size: "small", variant: "outlined", color: comment.reactions?.[user.username] === type ? 'primary' : 'default', icon: _jsx(Icon, {}), onClick: handleReact ? () => handleReact(comment.reactions?.[user.username] !== type ? type : null) : undefined, sx: [
|
|
77
77
|
!quantity && {
|
|
78
78
|
'& svg': { mr: '-14px !important' }
|
|
79
79
|
}
|
|
@@ -82,8 +82,8 @@ const Comment = ({ comment, handleDelete, handleEdit, handleQuote, handleReact,
|
|
|
82
82
|
}, [comment.reactions, handleReact, showInteractions, user.username]);
|
|
83
83
|
return (_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(HowlerAvatar, { userId: comment.user }), _jsxs(HowlerCard, { onClick: onClick, onMouseEnter: () => setShowInteractions(true), onMouseLeave: () => setShowInteractions(false), sx: [
|
|
84
84
|
{ p: 2, pb: 0, pt: 1, border: 'thin solid transparent' },
|
|
85
|
-
editing
|
|
86
|
-
onClick
|
|
85
|
+
editing ? { flex: 1 } : {},
|
|
86
|
+
onClick ? { '&:hover': { cursor: 'pointer', borderColor: 'primary.main' } } : {}
|
|
87
87
|
], children: [_jsxs(CardContent, { sx: { p: 0 }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 2, children: [_jsx(Typography, { variant: "body1", children: users[comment.user]?.name ?? comment.user }), wasEdited && (_jsx(Typography, { variant: "caption", sx: theme => ({
|
|
88
88
|
marginRight: `${theme.spacing(1)} !important`,
|
|
89
89
|
color: shiftColor(theme.palette.text.primary, 0.25)
|
|
@@ -109,6 +109,8 @@ const Comment = ({ comment, handleDelete, handleEdit, handleQuote, handleReact,
|
|
|
109
109
|
'& > :last-child': {
|
|
110
110
|
marginBottom: 0
|
|
111
111
|
}
|
|
112
|
-
}, children: _jsx(Markdown, { md: comment.value }) })) : (_jsx(TextField, { sx: { mt: 1 }, inputProps: { sx: (theme) => ({ fontSize: theme.typography.body2.fontSize }) }, inputRef: (ref) =>
|
|
112
|
+
}, children: _jsx(Markdown, { md: comment.value ?? '' }) })) : (_jsx(TextField, { sx: { mt: 1 }, inputProps: { sx: (theme) => ({ fontSize: theme.typography.body2.fontSize }) }, inputRef: (ref) => {
|
|
113
|
+
setTimeout(() => ref?.current?.focus(), 100);
|
|
114
|
+
}, defaultValue: comment.value, onChange: e => setEditValue(e.target.value), onKeyDown: checkForActions, fullWidth: true, multiline: true }))] }), _jsx(CardActions, { sx: { px: 0 }, children: _jsx(Collapse, { in: editing || showInteractions || Object.values(comment?.reactions ?? {}).length > 0, sx: { width: '100%' }, children: _jsxs(Stack, { direction: "row", sx: { width: '100%' }, spacing: 0.5, children: [reactions, _jsx(FlexOne, {}), editing && (_jsxs(_Fragment, { children: [_jsx(IconButton, { size: "small", onClick: () => setEditing(false), disabled: loading, children: _jsx(Clear, { fontSize: "small" }) }), _jsx(IconButton, { size: "small", onClick: onEdit, disabled: loading, children: _jsx(Check, { fontSize: "small" }) })] }))] }) }) })] }, comment.timestamp)] }, comment.id));
|
|
113
115
|
};
|
|
114
116
|
export default memo(Comment);
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { KeyboardArrowRight } from '@mui/icons-material';
|
|
3
3
|
import { Box, Divider, Fade, ListItemIcon, ListItemText, Menu, MenuItem, MenuList, Paper, useTheme } from '@mui/material';
|
|
4
4
|
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
-
import { Link } from 'react-router
|
|
5
|
+
import { Link } from 'react-router';
|
|
6
6
|
/**
|
|
7
7
|
* The margin at the bottom of the screen by which a submenu should be inverted.
|
|
8
8
|
* If hovering within this many pixels of the bottom, the submenu renders upward.
|
|
@@ -3,8 +3,8 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
|
3
3
|
import { omit } from 'lodash-es';
|
|
4
4
|
import { act } from 'react';
|
|
5
5
|
import { vi } from 'vitest';
|
|
6
|
-
// Mock react-router
|
|
7
|
-
vi.mock('react-router
|
|
6
|
+
// Mock react-router Link
|
|
7
|
+
vi.mock('react-router', () => ({
|
|
8
8
|
Link: ({ to, children, ...props }) => (_jsx("a", { href: to, ...props, children: children }))
|
|
9
9
|
}));
|
|
10
10
|
// Stub MUI components to simple HTML equivalents
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { type SliderProps } from '@mui/material';
|
|
2
|
-
type
|
|
2
|
+
type EditRowBase<T extends string | number | boolean> = {
|
|
3
3
|
titleKey: string;
|
|
4
4
|
descriptionKey?: string;
|
|
5
5
|
value: T;
|
|
6
|
-
onEdit?: (value: string) => Promise<void>;
|
|
7
6
|
validate?: (value: T) => boolean;
|
|
8
7
|
failOnValidate?: boolean;
|
|
9
8
|
type?: 'password' | 'number' | 'text' | 'checkbox' | 'range';
|
|
10
9
|
min?: number;
|
|
11
10
|
max?: number;
|
|
12
11
|
step?: number;
|
|
13
|
-
optional?: boolean;
|
|
14
12
|
valueLabelFormat?: SliderProps['valueLabelFormat'];
|
|
15
13
|
};
|
|
16
|
-
|
|
14
|
+
type EditRowTypes<T extends string | number | boolean> = (EditRowBase<T> & {
|
|
15
|
+
optional?: false;
|
|
16
|
+
onEdit?: (value: string) => Promise<void>;
|
|
17
|
+
}) | (EditRowBase<T> & {
|
|
18
|
+
optional: true;
|
|
19
|
+
onEdit?: (value: string | undefined) => Promise<void>;
|
|
20
|
+
});
|
|
21
|
+
declare const EditRow: <T extends string | number | boolean>({ titleKey, descriptionKey, value, validate, failOnValidate, type, min, max, step, valueLabelFormat, onEdit, optional }: EditRowTypes<T>) => import("react").JSX.Element;
|
|
17
22
|
export default EditRow;
|
|
@@ -5,7 +5,8 @@ import useMySnackbar from '@cccsaurora/howler-ui/components/hooks/useMySnackbar'
|
|
|
5
5
|
import { isNil, isNull, isUndefined } from 'lodash-es';
|
|
6
6
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
|
-
|
|
8
|
+
import { notNil } from '@cccsaurora/howler-ui/utils/utils';
|
|
9
|
+
const EditRow = ({ titleKey, descriptionKey, value, validate, failOnValidate = false, type = 'text', min, max, step, valueLabelFormat, onEdit, optional }) => {
|
|
9
10
|
const { t } = useTranslation();
|
|
10
11
|
const { showErrorMessage } = useMySnackbar();
|
|
11
12
|
const [editing, setEditing] = useState(false);
|
|
@@ -14,7 +15,7 @@ const EditRow = ({ titleKey, descriptionKey, value, onEdit, validate, failOnVali
|
|
|
14
15
|
const [editValue, setEditValue] = useState(type === 'password' ? '' : value);
|
|
15
16
|
const [confirmPassword, setConfirmPassword] = useState('');
|
|
16
17
|
useEffect(() => {
|
|
17
|
-
if ((editValue
|
|
18
|
+
if (isNil(editValue) && value) {
|
|
18
19
|
setEditValue(value);
|
|
19
20
|
}
|
|
20
21
|
}, [editValue, value]);
|
|
@@ -109,7 +110,7 @@ const EditRow = ({ titleKey, descriptionKey, value, onEdit, validate, failOnVali
|
|
|
109
110
|
endAdornment: loading && _jsx(CircularProgress, { size: 24 })
|
|
110
111
|
} }))] }), _jsx(IconButton, { onClick: onSubmit, disabled: loading, children: _jsx(Check, { fontSize: "small" }) }), _jsx(IconButton, { onClick: () => setEditing(false), disabled: loading, children: _jsx(Close, { fontSize: "small" }) }), optional && (_jsx(IconButton, { onClick: () => {
|
|
111
112
|
setEditing(false);
|
|
112
|
-
void onEdit(
|
|
113
|
-
}, disabled: loading, children: _jsx(Delete, { fontSize: "small" }) }))] }) })) : (_jsx(TableCell, { sx: cellSx, width: "100%", children: type === 'checkbox' ? (_jsx(Checkbox, { onChange: ev => onChange(ev.target.checked), checked: value.toString() === 'true' })) : type === 'range' &&
|
|
113
|
+
void onEdit?.(undefined);
|
|
114
|
+
}, disabled: loading, children: _jsx(Delete, { fontSize: "small" }) }))] }) })) : (_jsx(TableCell, { sx: cellSx, width: "100%", children: type === 'checkbox' ? (_jsx(Checkbox, { onChange: ev => onChange(ev.target.checked), checked: value.toString() === 'true' })) : type === 'range' && notNil(value) ? (typeof valueLabelFormat === 'function' ? (valueLabelFormat(Number(value), 0)) : (`${value}px`)) : ((value ?? t('none'))) })), onEdit && !editing && type !== 'checkbox' && (_jsx(TableCell, { sx: cellSx, align: "right", children: _jsx(IconButton, { onClick: () => setEditing(true), children: _jsx(Edit, { fontSize: "small" }) }) }))] }), descriptionKey && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 3, sx: { paddingTop: '0 !important' }, children: _jsx(Typography, { variant: "caption", color: "text.secondary", children: t(descriptionKey) }) }) }))] }));
|
|
114
115
|
};
|
|
115
116
|
export default EditRow;
|
|
@@ -51,6 +51,6 @@ const MarkdownEditor = ({ content, setContent, onMount, fontSize = 16, height =
|
|
|
51
51
|
},
|
|
52
52
|
...editorOptions
|
|
53
53
|
}), [fontSize, editorOptions]);
|
|
54
|
-
return (_jsx(ThemedEditor, { height: height, width: width, theme: theme.palette.mode === 'light' ? 'howler' : 'howler-dark', value: content, onChange: value => setContent(value), beforeMount: beforeEditorMount, onMount: onMount, options: options }));
|
|
54
|
+
return (_jsx(ThemedEditor, { height: height, width: width, theme: theme.palette.mode === 'light' ? 'howler' : 'howler-dark', value: content, onChange: value => setContent(value ?? ''), beforeMount: beforeEditorMount, onMount: onMount, options: options }));
|
|
55
55
|
};
|
|
56
56
|
export default memo(MarkdownEditor);
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { UserListContext } from '@cccsaurora/howler-ui/components/app/providers/UserListProvider';
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { MembershipManagement } from './membership/MembershipManagement';
|
|
7
|
+
const { appUserMock, dispatchApiMock, permissionDeleteMock, permissionPutMock, searchUsersMock, showErrorMessageMock, showSuccessMessageMock } = vi.hoisted(() => ({
|
|
8
|
+
appUserMock: vi.fn(),
|
|
9
|
+
dispatchApiMock: vi.fn(),
|
|
10
|
+
permissionDeleteMock: vi.fn(),
|
|
11
|
+
permissionPutMock: vi.fn(),
|
|
12
|
+
searchUsersMock: vi.fn(),
|
|
13
|
+
showErrorMessageMock: vi.fn(),
|
|
14
|
+
showSuccessMessageMock: vi.fn()
|
|
15
|
+
}));
|
|
16
|
+
vi.mock('@tui/core', () => ({
|
|
17
|
+
useAppUser: appUserMock
|
|
18
|
+
}));
|
|
19
|
+
vi.mock('react-i18next', () => ({
|
|
20
|
+
useTranslation: () => ({
|
|
21
|
+
t: (key) => key
|
|
22
|
+
})
|
|
23
|
+
}));
|
|
24
|
+
vi.mock('api', () => ({
|
|
25
|
+
default: {
|
|
26
|
+
action: {
|
|
27
|
+
permission: {
|
|
28
|
+
delete: permissionDeleteMock,
|
|
29
|
+
put: permissionPutMock
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
vi.mock('components/hooks/useMyApi', () => ({
|
|
35
|
+
default: () => ({
|
|
36
|
+
dispatchApi: dispatchApiMock
|
|
37
|
+
})
|
|
38
|
+
}));
|
|
39
|
+
vi.mock('components/hooks/useMySnackbar', () => ({
|
|
40
|
+
default: () => ({
|
|
41
|
+
showErrorMessage: showErrorMessageMock,
|
|
42
|
+
showSuccessMessage: showSuccessMessageMock,
|
|
43
|
+
showWarningMessage: vi.fn()
|
|
44
|
+
})
|
|
45
|
+
}));
|
|
46
|
+
vi.mock('react-router', () => ({
|
|
47
|
+
useLocation: () => ({ pathname: '/action/action-id' }),
|
|
48
|
+
useParams: () => ({ id: 'action-id' })
|
|
49
|
+
}));
|
|
50
|
+
vi.mock('./display/HowlerAvatar', () => ({
|
|
51
|
+
default: ({ userId }) => _jsx("span", { children: userId })
|
|
52
|
+
}));
|
|
53
|
+
vi.mock('./UserList', () => ({
|
|
54
|
+
default: ({ onChange }) => (_jsx("button", { onClick: () => onChange(['analyst']), children: "Select analyst" }))
|
|
55
|
+
}));
|
|
56
|
+
describe('MembershipManagement', () => {
|
|
57
|
+
const entity = {
|
|
58
|
+
owner: 'owner',
|
|
59
|
+
admins: [],
|
|
60
|
+
members: []
|
|
61
|
+
};
|
|
62
|
+
const renderMembershipManagement = (overrides = {}, onChange = vi.fn()) => {
|
|
63
|
+
render(_jsx(UserListContext.Provider, { value: {
|
|
64
|
+
users: {
|
|
65
|
+
analyst: {
|
|
66
|
+
email: 'analyst@example.com',
|
|
67
|
+
name: 'Analyst',
|
|
68
|
+
type: [],
|
|
69
|
+
username: 'analyst'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
fetchUsers: vi.fn(),
|
|
73
|
+
searchUsers: searchUsersMock
|
|
74
|
+
}, children: _jsx(MembershipManagement, { type: "action", entity: { ...entity, ...overrides }, onChange: onChange }) }));
|
|
75
|
+
return onChange;
|
|
76
|
+
};
|
|
77
|
+
beforeEach(() => {
|
|
78
|
+
appUserMock.mockReturnValue({
|
|
79
|
+
user: {
|
|
80
|
+
username: 'owner',
|
|
81
|
+
roles: ['admin']
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
permissionPutMock.mockReset();
|
|
85
|
+
permissionDeleteMock.mockReset();
|
|
86
|
+
dispatchApiMock.mockReset();
|
|
87
|
+
searchUsersMock.mockReset();
|
|
88
|
+
showErrorMessageMock.mockReset();
|
|
89
|
+
showSuccessMessageMock.mockReset();
|
|
90
|
+
permissionPutMock.mockImplementation((_id, data) => ({ request: 'grant-permission', data }));
|
|
91
|
+
permissionDeleteMock.mockImplementation((_id, data) => ({ request: 'remove-permission', data }));
|
|
92
|
+
dispatchApiMock.mockImplementation(async (request) => {
|
|
93
|
+
if (request.request === 'grant-permission') {
|
|
94
|
+
return {
|
|
95
|
+
owner: 'owner',
|
|
96
|
+
admins: [],
|
|
97
|
+
members: ['analyst']
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (request.request === 'remove-permission') {
|
|
101
|
+
return {
|
|
102
|
+
owner: 'owner',
|
|
103
|
+
admins: [],
|
|
104
|
+
members: []
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
it('grants a selected member with the batched permission payload', async () => {
|
|
110
|
+
const user = userEvent.setup();
|
|
111
|
+
const onChange = renderMembershipManagement();
|
|
112
|
+
await user.click(screen.getByRole('button', { name: 'membership.manage' }));
|
|
113
|
+
await user.click(screen.getByRole('button', { name: 'Select analyst' }));
|
|
114
|
+
await user.click(screen.getByRole('button', { name: 'add' }));
|
|
115
|
+
expect(permissionPutMock).toHaveBeenCalledWith('action-id', {
|
|
116
|
+
privilege: 'members',
|
|
117
|
+
user_ids: ['analyst']
|
|
118
|
+
});
|
|
119
|
+
await waitFor(() => expect(onChange).toHaveBeenCalledWith({ owner: 'owner', admins: [], members: ['analyst'] }));
|
|
120
|
+
expect(showSuccessMessageMock).toHaveBeenCalledWith('membership.message.success');
|
|
121
|
+
});
|
|
122
|
+
it('removes the privilege represented by the selected member row', async () => {
|
|
123
|
+
const user = userEvent.setup();
|
|
124
|
+
const onChange = renderMembershipManagement({ admins: ['analyst'] });
|
|
125
|
+
await user.click(screen.getByRole('button', { name: 'membership.manage' }));
|
|
126
|
+
const analystRow = screen.getByText('Analyst').closest('li');
|
|
127
|
+
expect(analystRow).not.toBeNull();
|
|
128
|
+
await user.click(within(analystRow).getByRole('button'));
|
|
129
|
+
expect(permissionDeleteMock).toHaveBeenCalledWith('action-id', {
|
|
130
|
+
privilege: 'admins',
|
|
131
|
+
user_ids: ['analyst']
|
|
132
|
+
});
|
|
133
|
+
expect(dispatchApiMock).toHaveBeenCalledWith({
|
|
134
|
+
request: 'remove-permission',
|
|
135
|
+
data: { privilege: 'admins', user_ids: ['analyst'] }
|
|
136
|
+
}, { throwError: false });
|
|
137
|
+
await waitFor(() => expect(onChange).toHaveBeenCalledWith({ owner: 'owner', admins: [], members: [] }));
|
|
138
|
+
expect(showSuccessMessageMock).toHaveBeenCalledWith('membership.message.success');
|
|
139
|
+
});
|
|
140
|
+
it('offers owner transfer only to the owner or a global admin', async () => {
|
|
141
|
+
const user = userEvent.setup();
|
|
142
|
+
renderMembershipManagement();
|
|
143
|
+
await user.click(screen.getByRole('button', { name: 'membership.manage' }));
|
|
144
|
+
expect(screen.getByRole('button', { name: 'membership.privilege.owner' })).toBeInTheDocument();
|
|
145
|
+
});
|
|
146
|
+
it('does not offer owner transfer to a local admin', async () => {
|
|
147
|
+
const user = userEvent.setup();
|
|
148
|
+
appUserMock.mockReturnValue({
|
|
149
|
+
user: {
|
|
150
|
+
username: 'admin',
|
|
151
|
+
roles: []
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
renderMembershipManagement({ admins: ['admin'] });
|
|
155
|
+
await user.click(screen.getByRole('button', { name: 'membership.manage' }));
|
|
156
|
+
expect(screen.queryByRole('button', { name: 'membership.privilege.owner' })).not.toBeInTheDocument();
|
|
157
|
+
});
|
|
158
|
+
it('does not render membership controls for an unrelated user', () => {
|
|
159
|
+
appUserMock.mockReturnValue({
|
|
160
|
+
user: {
|
|
161
|
+
username: 'analyst',
|
|
162
|
+
roles: []
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
renderMembershipManagement();
|
|
166
|
+
expect(screen.queryByRole('button', { name: 'membership.manage' })).not.toBeInTheDocument();
|
|
167
|
+
});
|
|
168
|
+
it('shows an error when adding a member fails', async () => {
|
|
169
|
+
const user = userEvent.setup();
|
|
170
|
+
dispatchApiMock.mockRejectedValueOnce(new Error('request failed'));
|
|
171
|
+
renderMembershipManagement();
|
|
172
|
+
await user.click(screen.getByRole('button', { name: 'membership.manage' }));
|
|
173
|
+
await user.click(screen.getByRole('button', { name: 'Select analyst' }));
|
|
174
|
+
await user.click(screen.getByRole('button', { name: 'add' }));
|
|
175
|
+
await waitFor(() => expect(showErrorMessageMock).toHaveBeenCalledWith('membership.message.error'));
|
|
176
|
+
expect(showSuccessMessageMock).not.toHaveBeenCalled();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
@@ -10,7 +10,7 @@ import { memo, useEffect, useMemo, useState } from 'react';
|
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import Throttler from '@cccsaurora/howler-ui/utils/Throttler';
|
|
12
12
|
import PluginTypography from './PluginTypography';
|
|
13
|
-
const ListRenderer = memo(({ obj, objKey: key, entries, maxKeyLength }) => {
|
|
13
|
+
const ListRenderer = memo(({ obj, objKey: key = '', entries, maxKeyLength }) => {
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const allPrimitives = useMemo(() => entries.every(entry => !isObject(entry)), [entries]);
|
|
@@ -36,13 +36,13 @@ const ListRenderer = memo(({ obj, objKey: key, entries, maxKeyLength }) => {
|
|
|
36
36
|
marginBottom: allPrimitives ? 0 : theme.spacing(1)
|
|
37
37
|
}, children: allPrimitives ? key.padStart(maxKeyLength ?? key.length) : key }) }), _jsxs(Grid, { container: true, spacing: allPrimitives ? 1 : 4, ml: allPrimitives ? -1 : -4, overflow: "hidden", maxWidth: "100%", children: [uniqueEntries.map((entry, index) => {
|
|
38
38
|
if (Array.isArray(entry)) {
|
|
39
|
-
return (_jsx(Grid, {
|
|
39
|
+
return (_jsx(Grid, { size: 'auto', maxWidth: "100%", children: _jsx(ListRenderer, { obj: obj, objKey: `${key}.${index}`, entries: entry }) }, index));
|
|
40
40
|
}
|
|
41
41
|
if (isPlainObject(entry)) {
|
|
42
|
-
return (_jsx(Grid, {
|
|
42
|
+
return (_jsx(Grid, { size: 'auto', maxWidth: "100%", minWidth: "350px", children: _jsx(ObjectRenderer, { parentKey: `${key}.${index}`, indent: true, data: entry }) }, index));
|
|
43
43
|
}
|
|
44
|
-
return (_jsxs(Grid, {
|
|
45
|
-
}), omittedDuplicates && (_jsx(Grid, {
|
|
44
|
+
return (_jsxs(Grid, { maxWidth: "100%", className: `${key}_${index}`.replace(/\./g, '_'), component: "code", display: "flex", flexDirection: "row", children: [_jsx(PluginTypography, { context: "details", component: "code", style: { maxWidth: '100%', font: 'inherit' }, value: entry, field: key.replace(/\.[0-9]+/g, ''), obj: obj, children: entry }), allPrimitives && index < uniqueEntries.length - 1 && _jsx("span", { children: "," })] }, entry));
|
|
45
|
+
}), omittedDuplicates && (_jsx(Grid, { display: "flex", alignItems: "center", children: _jsx(Tooltip, { title: t('duplicates.omitted'), children: _jsx(InfoOutlined, { sx: { fontSize: '20px', ml: 1 }, color: "disabled" }) }) }))] })] }));
|
|
46
46
|
});
|
|
47
47
|
const ObjectRenderer = memo(({ obj, data, parentKey, indent = false }) => {
|
|
48
48
|
const theme = useTheme();
|
|
@@ -96,7 +96,7 @@ const Collapsible = memo(({ obj, title, data, query }) => {
|
|
|
96
96
|
}
|
|
97
97
|
throttler.debounce(() => {
|
|
98
98
|
const fuseResults = fuse.search(query);
|
|
99
|
-
setScores(fuseResults.map(result => [result.item.key, result.score]));
|
|
99
|
+
setScores(fuseResults.map(result => [result.item.key, result.score ?? 0]));
|
|
100
100
|
setResults(fuseResults.reduce((acc, entry) => ({ ...acc, [entry.item.key]: entry.item.value }), {}));
|
|
101
101
|
});
|
|
102
102
|
}, [data, fuse, query, throttler]);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Editor, useMonaco } from '@monaco-editor/react';
|
|
3
3
|
import { useTheme } from '@mui/material';
|
|
4
|
-
import
|
|
5
|
-
import useMyTheme from '@cccsaurora/howler-ui/components/hooks/useMyTheme';
|
|
4
|
+
import { useAppTheme, useAppThemeBuilder } from '@tui/core';
|
|
6
5
|
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
7
6
|
const ThemedEditor = ({ beforeMount, options = {}, id, ...otherProps }) => {
|
|
8
|
-
const
|
|
9
|
-
const themeBuilder =
|
|
7
|
+
const { current: currentTheme, optionsOverride } = useAppTheme();
|
|
8
|
+
const themeBuilder = useAppThemeBuilder();
|
|
9
|
+
const { lightTheme, darkTheme } = useMemo(() => themeBuilder(currentTheme, optionsOverride), [themeBuilder, currentTheme, optionsOverride]);
|
|
10
10
|
const theme = useTheme();
|
|
11
11
|
const monaco = useMonaco();
|
|
12
12
|
const _beforeMount = useCallback((_monaco) => {
|
|
13
|
-
let lightBackground =
|
|
13
|
+
let lightBackground = lightTheme.palette.background.paper;
|
|
14
14
|
// monaco doesn't like colours in the form #fff, with only three digits.
|
|
15
15
|
if (lightBackground.startsWith('#') && lightBackground.length < 7) {
|
|
16
16
|
lightBackground = lightBackground.replace(/(\w)/g, '$1$1');
|
|
@@ -21,30 +21,30 @@ const ThemedEditor = ({ beforeMount, options = {}, id, ...otherProps }) => {
|
|
|
21
21
|
rules: [
|
|
22
22
|
{
|
|
23
23
|
token: 'handlebars',
|
|
24
|
-
foreground:
|
|
24
|
+
foreground: lightTheme.palette.warning.dark.toUpperCase().replaceAll('#', '')
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
token: 'operator',
|
|
28
|
-
foreground:
|
|
28
|
+
foreground: lightTheme.palette.warning.light.toUpperCase().replaceAll('#', '')
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
token: 'string.invalid',
|
|
32
|
-
foreground:
|
|
32
|
+
foreground: lightTheme.palette.error.main.toUpperCase().replaceAll('#', '')
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
token: 'invalid',
|
|
36
|
-
foreground:
|
|
36
|
+
foreground: lightTheme.palette.error.main.toUpperCase().replaceAll('#', '')
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
token: 'boolean',
|
|
40
|
-
foreground:
|
|
40
|
+
foreground: lightTheme.palette.success.main.toUpperCase().replaceAll('#', '')
|
|
41
41
|
}
|
|
42
42
|
],
|
|
43
43
|
colors: {
|
|
44
44
|
'editor.background': lightBackground
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
let darkBackground =
|
|
47
|
+
let darkBackground = darkTheme.palette.background.paper;
|
|
48
48
|
// monaco doesn't like colours in the form #fff, with only three digits.
|
|
49
49
|
if (darkBackground.startsWith('#') && darkBackground.length < 7) {
|
|
50
50
|
darkBackground = darkBackground.replace(/(\w)/g, '$1$1');
|
|
@@ -55,23 +55,23 @@ const ThemedEditor = ({ beforeMount, options = {}, id, ...otherProps }) => {
|
|
|
55
55
|
rules: [
|
|
56
56
|
{
|
|
57
57
|
token: 'handlebars',
|
|
58
|
-
foreground:
|
|
58
|
+
foreground: darkTheme.palette.warning.dark.toUpperCase().replaceAll('#', '')
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
token: 'operator',
|
|
62
|
-
foreground:
|
|
62
|
+
foreground: darkTheme.palette.warning.light.toUpperCase().replaceAll('#', '')
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
token: 'string.invalid',
|
|
66
|
-
foreground:
|
|
66
|
+
foreground: darkTheme.palette.error.main.toUpperCase().replaceAll('#', '')
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
token: 'invalid',
|
|
70
|
-
foreground:
|
|
70
|
+
foreground: darkTheme.palette.error.main.toUpperCase().replaceAll('#', '')
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
token: 'boolean',
|
|
74
|
-
foreground:
|
|
74
|
+
foreground: darkTheme.palette.success.main.toUpperCase().replaceAll('#', '')
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
77
|
colors: {
|
|
@@ -81,7 +81,7 @@ const ThemedEditor = ({ beforeMount, options = {}, id, ...otherProps }) => {
|
|
|
81
81
|
_monaco.languages.register({ id: 'lucene' });
|
|
82
82
|
_monaco.languages.register({ id: 'eql' });
|
|
83
83
|
beforeMount?.(_monaco);
|
|
84
|
-
}, [beforeMount,
|
|
84
|
+
}, [beforeMount, lightTheme, darkTheme]);
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
if (!monaco) {
|
|
87
87
|
return;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { SxProps, Theme } from '@mui/material';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
declare const UserList: FC<{
|
|
4
|
+
variant?: 'compact' | 'list';
|
|
4
5
|
buttonSx?: SxProps<Theme>;
|
|
5
6
|
userIds: string[];
|
|
7
|
+
except?: string[];
|
|
6
8
|
onChange: (userIds: string[]) => void;
|
|
7
9
|
i18nLabel: string;
|
|
8
10
|
avatarHeight?: number;
|