@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
package/utils/menuUtils.js
CHANGED
|
@@ -1,239 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
items;
|
|
5
|
-
indexMap;
|
|
6
|
-
constructor(defaultMenu) {
|
|
7
|
-
this.items = defaultMenu;
|
|
8
|
-
this.updateMenuMap();
|
|
1
|
+
const hasId = (menu, id) => {
|
|
2
|
+
if (menu.id === id) {
|
|
3
|
+
return true;
|
|
9
4
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
applyOperations(operations) {
|
|
16
|
-
for (const operation of operations) {
|
|
17
|
-
switch (operation.operation) {
|
|
18
|
-
case MainMenuInsertOperation.Insert:
|
|
19
|
-
// Inserts at end or adds to sub-elements
|
|
20
|
-
this.insert(operation.targetId, operation.item);
|
|
21
|
-
break;
|
|
22
|
-
case MainMenuInsertOperation.InsertBefore:
|
|
23
|
-
// Inserts before target element
|
|
24
|
-
this.insertBefore(operation.targetId, operation.item);
|
|
25
|
-
break;
|
|
26
|
-
case MainMenuInsertOperation.InsertAfter:
|
|
27
|
-
// Inserts after target element
|
|
28
|
-
this.insertAfter(operation.targetId, operation.item);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
this.updateMenuMap();
|
|
32
|
-
}
|
|
5
|
+
return menu.items.some(item => item.id === id || (item.type === 'menu' && hasId(item, id)));
|
|
6
|
+
};
|
|
7
|
+
const updateMenu = (menu, menuId, updater) => {
|
|
8
|
+
if (menu.id === menuId) {
|
|
9
|
+
return updater(menu);
|
|
33
10
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return this.items;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Insert provided menu item at the menu object identified by targetId.
|
|
42
|
-
*
|
|
43
|
-
* If the target menu is a group then item will be placed at end of sub items
|
|
44
|
-
*
|
|
45
|
-
* If the target menu is a standard item then group will be created and new item added, warning this removes
|
|
46
|
-
* the route from the new group parent item, be sure to add it back.
|
|
47
|
-
*
|
|
48
|
-
* If the target is 'root' then item will be added to end of root menu
|
|
49
|
-
*
|
|
50
|
-
* @param targetId Identifier of menu to insert to
|
|
51
|
-
* @param item Menu Item to insert
|
|
52
|
-
*/
|
|
53
|
-
insert(targetId, item) {
|
|
54
|
-
const menuLocation = this.indexOfMenuId(targetId);
|
|
55
|
-
const target = this.menuFromIndex(menuLocation.index, menuLocation.subIndex);
|
|
56
|
-
if (!Array.isArray(target) && this.isGroupElement(target)) {
|
|
57
|
-
if (item.type === 'divider') {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const group = target.element;
|
|
61
|
-
const newItem = { ...item.element, nested: true };
|
|
62
|
-
group.items = [...group.items, newItem];
|
|
63
|
-
return;
|
|
11
|
+
let updated = false;
|
|
12
|
+
const items = menu.items.map(item => {
|
|
13
|
+
if (item.type !== 'menu') {
|
|
14
|
+
return item;
|
|
64
15
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (menuLocation.index !== -1 && isNil(menuLocation.subIndex)) {
|
|
70
|
-
if (item.type === 'divider') {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (!this.isItemElement(target)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const header = target.element;
|
|
77
|
-
const inserted = { ...item.element, nested: true };
|
|
78
|
-
const newGroup = {
|
|
79
|
-
type: 'group',
|
|
80
|
-
element: {
|
|
81
|
-
id: header.id,
|
|
82
|
-
open: true,
|
|
83
|
-
i18nKey: header.i18nKey,
|
|
84
|
-
title: header.text,
|
|
85
|
-
userPropValidators: header.userPropValidators,
|
|
86
|
-
icon: header.icon,
|
|
87
|
-
items: [inserted]
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
this.items[menuLocation.index] = newGroup;
|
|
91
|
-
return;
|
|
16
|
+
const next = updateMenu(item, menuId, updater);
|
|
17
|
+
if (!next) {
|
|
18
|
+
return item;
|
|
92
19
|
}
|
|
20
|
+
updated = true;
|
|
21
|
+
return next;
|
|
22
|
+
});
|
|
23
|
+
return updated ? { ...menu, items } : null;
|
|
24
|
+
};
|
|
25
|
+
const insertRelative = (menu, anchorId, item, position) => {
|
|
26
|
+
const index = menu.items.findIndex(current => current.id === anchorId);
|
|
27
|
+
if (index >= 0) {
|
|
28
|
+
const insertionIndex = position === 'before' ? index : index + 1;
|
|
29
|
+
return {
|
|
30
|
+
...menu,
|
|
31
|
+
items: [...menu.items.slice(0, insertionIndex), item, ...menu.items.slice(insertionIndex)]
|
|
32
|
+
};
|
|
93
33
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* @param item Menu Item to insert
|
|
99
|
-
*/
|
|
100
|
-
insertBefore(targetId, item) {
|
|
101
|
-
const menuLocation = this.indexOfMenuId(targetId);
|
|
102
|
-
if (!isNil(menuLocation.subIndex)) {
|
|
103
|
-
if (item.type === 'divider') {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const parentElement = this.menuFromIndex(menuLocation.index);
|
|
107
|
-
if (!Array.isArray(parentElement) && this.isGroupElement(parentElement)) {
|
|
108
|
-
const group = parentElement.element;
|
|
109
|
-
const newItem = { ...item.element, nested: true };
|
|
110
|
-
group.items = [
|
|
111
|
-
...group.items.slice(0, menuLocation.subIndex),
|
|
112
|
-
newItem,
|
|
113
|
-
...group.items.slice(menuLocation.subIndex)
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
return;
|
|
34
|
+
let updated = false;
|
|
35
|
+
const items = menu.items.map(current => {
|
|
36
|
+
if (current.type !== 'menu') {
|
|
37
|
+
return current;
|
|
117
38
|
}
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
39
|
+
const next = insertRelative(current, anchorId, item, position);
|
|
40
|
+
if (!next) {
|
|
41
|
+
return current;
|
|
121
42
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (!Array.isArray(parentElement) && this.isGroupElement(parentElement)) {
|
|
138
|
-
const group = parentElement.element;
|
|
139
|
-
const newItem = { ...item.element, nested: true };
|
|
140
|
-
group.items = [
|
|
141
|
-
...group.items.slice(0, menuLocation.subIndex + 1),
|
|
142
|
-
newItem,
|
|
143
|
-
...group.items.slice(menuLocation.subIndex + 1)
|
|
144
|
-
];
|
|
145
|
-
}
|
|
146
|
-
return;
|
|
43
|
+
updated = true;
|
|
44
|
+
return next;
|
|
45
|
+
});
|
|
46
|
+
return updated ? { ...menu, items } : null;
|
|
47
|
+
};
|
|
48
|
+
const removeItem = (menu, targetId) => ({
|
|
49
|
+
...menu,
|
|
50
|
+
items: menu.items
|
|
51
|
+
.filter(item => item.id !== targetId)
|
|
52
|
+
.map(item => (item.type === 'menu' ? removeItem(item, targetId) : item))
|
|
53
|
+
});
|
|
54
|
+
export const applyMainMenuOperations = (root, operations) => {
|
|
55
|
+
return operations.reduce((menu, operation) => {
|
|
56
|
+
if (operation.type === 'remove') {
|
|
57
|
+
return removeItem(menu, operation.targetId);
|
|
147
58
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
menuLocation.index = this.items.length;
|
|
59
|
+
if (hasId(menu, operation.item.id)) {
|
|
60
|
+
throw new Error(`Menu item with id '${operation.item.id}' already exists.`);
|
|
151
61
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*/
|
|
160
|
-
indexOfMenuId(id) {
|
|
161
|
-
if (id === 'root') {
|
|
162
|
-
// Root item so return entire menu
|
|
163
|
-
return { index: -1 };
|
|
164
|
-
}
|
|
165
|
-
else if (id in this.indexMap) {
|
|
166
|
-
// Item exists, check if it's a subitem
|
|
167
|
-
if ('parent' in this.indexMap[id]) {
|
|
168
|
-
return { index: this.indexMap[id].parent, subIndex: this.indexMap[id].index };
|
|
62
|
+
if (operation.type === 'append') {
|
|
63
|
+
const next = updateMenu(menu, operation.parentId, current => ({
|
|
64
|
+
...current,
|
|
65
|
+
items: [...current.items, operation.item]
|
|
66
|
+
}));
|
|
67
|
+
if (next) {
|
|
68
|
+
return next;
|
|
169
69
|
}
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
throw new Error(`Menu element with id of '${id}' not found.`);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Grabs a menu by indexes, helper function to account for an index of -1
|
|
178
|
-
* to represent the root menu
|
|
179
|
-
*
|
|
180
|
-
* @param index First level index
|
|
181
|
-
* @param subIndex Second level index
|
|
182
|
-
* @return {} Menu item
|
|
183
|
-
*/
|
|
184
|
-
menuFromIndex(index, subIndex) {
|
|
185
|
-
if (index === -1) {
|
|
186
|
-
return this.items;
|
|
187
|
-
}
|
|
188
|
-
if (isNil(subIndex)) {
|
|
189
|
-
return this.items[index];
|
|
190
|
-
}
|
|
191
|
-
const menuItem = this.items[index];
|
|
192
|
-
if (menuItem.type === 'group') {
|
|
193
|
-
return menuItem.element.items[subIndex];
|
|
70
|
+
throw new Error(`Menu '${operation.parentId}' does not exist or is not a menu.`);
|
|
194
71
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
* Determine if provided element is a group element
|
|
199
|
-
*
|
|
200
|
-
* @param elem Element to check
|
|
201
|
-
* @private
|
|
202
|
-
*/
|
|
203
|
-
isGroupElement(elem) {
|
|
204
|
-
return !!elem && typeof elem === 'object' && elem.type === 'group';
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Determine if provided element is an item element
|
|
208
|
-
*
|
|
209
|
-
* @param elem Element to check
|
|
210
|
-
* @private
|
|
211
|
-
*/
|
|
212
|
-
isItemElement(elem) {
|
|
213
|
-
return !!elem && typeof elem === 'object' && elem.type === 'item';
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Creates a flat list of menu items and subitems by menu id
|
|
217
|
-
* for quick lookup.
|
|
218
|
-
*
|
|
219
|
-
* @private
|
|
220
|
-
*/
|
|
221
|
-
updateMenuMap() {
|
|
222
|
-
const indexMap = {};
|
|
223
|
-
for (let index = 0; index < this.items.length; index++) {
|
|
224
|
-
const menuItem = this.items[index];
|
|
225
|
-
if (menuItem.type === 'divider') {
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
indexMap[menuItem.element.id] = { index };
|
|
229
|
-
if (menuItem.type === 'group') {
|
|
230
|
-
for (let subIndex = 0; subIndex < menuItem.element.items.length; subIndex++) {
|
|
231
|
-
const subMenuItem = menuItem.element.items[subIndex];
|
|
232
|
-
indexMap[subMenuItem.id] = { index: subIndex, parent: index };
|
|
233
|
-
}
|
|
234
|
-
}
|
|
72
|
+
const next = insertRelative(menu, operation.anchorId, operation.item, operation.position);
|
|
73
|
+
if (next) {
|
|
74
|
+
return next;
|
|
235
75
|
}
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
export default AppMenuBuilder;
|
|
76
|
+
throw new Error(`Menu item '${operation.anchorId}' does not exist.`);
|
|
77
|
+
}, root);
|
|
78
|
+
};
|
package/utils/menuUtils.test.js
CHANGED
|
@@ -1,198 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
// Avoid pulling in react-pluggable (and its transitive React deps) by mocking the store module.
|
|
4
|
-
// vi.mock is hoisted by Vitest before any imports, so the mock is applied even though this call appears below the imports.
|
|
5
|
-
vi.mock('plugins/store', () => ({
|
|
6
|
-
MainMenuInsertOperation: {
|
|
7
|
-
Insert: 'INSERT',
|
|
8
|
-
InsertAfter: 'AFTER',
|
|
9
|
-
InsertBefore: 'BEFORE'
|
|
10
|
-
}
|
|
11
|
-
}));
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { applyMainMenuOperations } from './menuUtils';
|
|
12
3
|
// ---------------------------------------------------------------------------
|
|
13
4
|
// Helpers
|
|
14
5
|
// ---------------------------------------------------------------------------
|
|
15
6
|
const makeItem = (id, overrides = {}) => ({
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
id,
|
|
8
|
+
type: 'route',
|
|
9
|
+
i18nKey: `key.${id}`,
|
|
10
|
+
route: `/${id}`,
|
|
11
|
+
...overrides
|
|
18
12
|
});
|
|
19
13
|
const makeGroup = (id, items = []) => ({
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
id,
|
|
15
|
+
type: 'menu',
|
|
16
|
+
i18nKey: `key.${id}`,
|
|
17
|
+
items
|
|
22
18
|
});
|
|
23
|
-
const makeDivider = () => ({ type: 'divider', element: null });
|
|
24
19
|
// ---------------------------------------------------------------------------
|
|
25
20
|
// Tests
|
|
26
21
|
// ---------------------------------------------------------------------------
|
|
27
|
-
describe('
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
describe('applyMainMenuOperations', () => {
|
|
23
|
+
const root = () => makeGroup('root', [makeItem('home'), makeItem('search'), makeGroup('tools', [makeItem('view')])]);
|
|
24
|
+
it('appends an item to the explicit root menu without mutating it', () => {
|
|
25
|
+
const initial = root();
|
|
26
|
+
const result = applyMainMenuOperations(initial, [{ type: 'append', parentId: 'root', item: makeItem('new') }]);
|
|
27
|
+
expect(result.items.map(item => item.id)).toEqual(['home', 'search', 'tools', 'new']);
|
|
28
|
+
expect(initial.items.map(item => item.id)).toEqual(['home', 'search', 'tools']);
|
|
33
29
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
it('returns the initial menu unchanged when no operations are applied', () => {
|
|
39
|
-
expect(builder.menu).toHaveLength(3);
|
|
40
|
-
});
|
|
30
|
+
it('appends an item to a nested menu', () => {
|
|
31
|
+
const result = applyMainMenuOperations(root(), [{ type: 'append', parentId: 'tools', item: makeItem('extra') }]);
|
|
32
|
+
const tools = result.items.find(item => item.id === 'tools');
|
|
33
|
+
expect(tools.items.map(item => item.id)).toEqual(['view', 'extra']);
|
|
41
34
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
expect(builder.indexOfMenuId('home')).toEqual({ index: 0 });
|
|
51
|
-
});
|
|
52
|
-
it('returns both index and subIndex for a nested item', () => {
|
|
53
|
-
expect(builder.indexOfMenuId('view')).toEqual({ index: 2, subIndex: 0 });
|
|
54
|
-
});
|
|
55
|
-
it('throws for an unknown id', () => {
|
|
56
|
-
expect(() => builder.indexOfMenuId('unknown-id')).toThrow();
|
|
57
|
-
});
|
|
35
|
+
it('inserts relative to an item at any depth', () => {
|
|
36
|
+
const result = applyMainMenuOperations(root(), [
|
|
37
|
+
{ type: 'insertRelative', anchorId: 'view', position: 'before', item: makeItem('before-view') },
|
|
38
|
+
{ type: 'insertRelative', anchorId: 'search', position: 'after', item: makeItem('after-search') }
|
|
39
|
+
]);
|
|
40
|
+
const tools = result.items.find(item => item.id === 'tools');
|
|
41
|
+
expect(result.items.map(item => item.id)).toEqual(['home', 'search', 'after-search', 'tools']);
|
|
42
|
+
expect(tools.items.map(item => item.id)).toEqual(['before-view', 'view']);
|
|
58
43
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
it('appends a new item to an existing group', () => {
|
|
69
|
-
builder.insert('tools', makeItem('extra'));
|
|
70
|
-
const group = builder.menu.find(el => el.type === 'group');
|
|
71
|
-
expect(group.element.items).toHaveLength(2);
|
|
72
|
-
expect(group.element.items[1].id).toBe('extra');
|
|
73
|
-
});
|
|
74
|
-
it('converts a root-level item into a group when inserting into it', () => {
|
|
75
|
-
builder.insert('home', makeItem('sub-home'));
|
|
76
|
-
const converted = builder.menu.find(el => el.type === 'group');
|
|
77
|
-
// The first group found should be the newly converted one.
|
|
78
|
-
expect(converted).toBeDefined();
|
|
79
|
-
expect(converted.element.items.some((i) => i.id === 'sub-home')).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
it('marks nested items added to a group as nested:true', () => {
|
|
82
|
-
builder.insert('tools', makeItem('nested-item'));
|
|
83
|
-
const group = builder.menu.find(el => el.type === 'group');
|
|
84
|
-
const last = group.element.items[group.element.items.length - 1];
|
|
85
|
-
expect(last.nested).toBe(true);
|
|
86
|
-
});
|
|
87
|
-
it('does not insert a divider into a group (logs warning and returns)', () => {
|
|
88
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
89
|
-
const before = builder.menu.find(el => el.type === 'group').element.items.length;
|
|
90
|
-
builder.insert('tools', makeDivider());
|
|
91
|
-
const after = builder.menu.find(el => el.type === 'group').element.items.length;
|
|
92
|
-
expect(after).toBe(before);
|
|
93
|
-
warnSpy.mockRestore();
|
|
94
|
-
});
|
|
44
|
+
it('removes items at any depth', () => {
|
|
45
|
+
const result = applyMainMenuOperations(root(), [
|
|
46
|
+
{ type: 'remove', targetId: 'search' },
|
|
47
|
+
{ type: 'remove', targetId: 'view' }
|
|
48
|
+
]);
|
|
49
|
+
const tools = result.items.find(item => item.id === 'tools');
|
|
50
|
+
expect(result.items.map(item => item.id)).toEqual(['home', 'tools']);
|
|
51
|
+
expect(tools.items).toHaveLength(0);
|
|
95
52
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// -------------------------------------------------------------------------
|
|
99
|
-
describe('insertBefore', () => {
|
|
100
|
-
it('inserts a new root-level item before the target', () => {
|
|
101
|
-
builder.insertBefore('search', makeItem('before-search'));
|
|
102
|
-
// 'search' was at index 1; the new item should now be at index 1.
|
|
103
|
-
expect(builder.menu[1].element.id).toBe('before-search');
|
|
104
|
-
expect(builder.menu[2].element.id).toBe('search');
|
|
105
|
-
});
|
|
106
|
-
it('inserts before the first root item (index 0)', () => {
|
|
107
|
-
builder.insertBefore('home', makeItem('new-first'));
|
|
108
|
-
expect(builder.menu[0].element.id).toBe('new-first');
|
|
109
|
-
});
|
|
110
|
-
it('inserts a new nested item before a sub-item within its group', () => {
|
|
111
|
-
builder.insertBefore('view', makeItem('before-view'));
|
|
112
|
-
const group = builder.menu.find(el => el.type === 'group');
|
|
113
|
-
expect(group.element.items[0].id).toBe('before-view');
|
|
114
|
-
expect(group.element.items[1].id).toBe('view');
|
|
115
|
-
});
|
|
116
|
-
it('marks items inserted into a group as nested:true', () => {
|
|
117
|
-
builder.insertBefore('view', makeItem('nested-before'));
|
|
118
|
-
const group = builder.menu.find(el => el.type === 'group');
|
|
119
|
-
expect(group.element.items[0].nested).toBe(true);
|
|
120
|
-
});
|
|
121
|
-
it('does not insert a divider before a sub-item (logs warning)', () => {
|
|
122
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
123
|
-
const before = builder.menu.find(el => el.type === 'group').element.items.length;
|
|
124
|
-
builder.insertBefore('view', makeDivider());
|
|
125
|
-
const after = builder.menu.find(el => el.type === 'group').element.items.length;
|
|
126
|
-
expect(after).toBe(before);
|
|
127
|
-
warnSpy.mockRestore();
|
|
128
|
-
});
|
|
53
|
+
it('rejects appending to a route instead of converting it into a menu', () => {
|
|
54
|
+
expect(() => applyMainMenuOperations(root(), [{ type: 'append', parentId: 'home', item: makeItem('child') }])).toThrow("Menu 'home' does not exist or is not a menu.");
|
|
129
55
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
builder.insertAfter('home', makeItem('after-home'));
|
|
136
|
-
expect(builder.menu[1].element.id).toBe('after-home');
|
|
137
|
-
expect(builder.menu[2].element.id).toBe('search');
|
|
138
|
-
});
|
|
139
|
-
it('inserts after the last root item', () => {
|
|
140
|
-
builder.insertAfter('tools', makeItem('very-last'));
|
|
141
|
-
expect(builder.menu[builder.menu.length - 1].element.id).toBe('very-last');
|
|
142
|
-
});
|
|
143
|
-
it('inserts a new nested item after a sub-item within its group', () => {
|
|
144
|
-
builder.insertAfter('view', makeItem('after-view'));
|
|
145
|
-
const group = builder.menu.find(el => el.type === 'group');
|
|
146
|
-
expect(group.element.items[0].id).toBe('view');
|
|
147
|
-
expect(group.element.items[1].id).toBe('after-view');
|
|
148
|
-
});
|
|
149
|
-
it('marks items inserted into a group as nested:true', () => {
|
|
150
|
-
builder.insertAfter('view', makeItem('nested-after'));
|
|
151
|
-
const group = builder.menu.find(el => el.type === 'group');
|
|
152
|
-
expect(group.element.items[1].nested).toBe(true);
|
|
153
|
-
});
|
|
154
|
-
it('does not insert a divider after a sub-item (logs warning)', () => {
|
|
155
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
156
|
-
const before = builder.menu.find(el => el.type === 'group').element.items.length;
|
|
157
|
-
builder.insertAfter('view', makeDivider());
|
|
158
|
-
const after = builder.menu.find(el => el.type === 'group').element.items.length;
|
|
159
|
-
expect(after).toBe(before);
|
|
160
|
-
warnSpy.mockRestore();
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
// -------------------------------------------------------------------------
|
|
164
|
-
// applyOperations
|
|
165
|
-
// -------------------------------------------------------------------------
|
|
166
|
-
describe('applyOperations', () => {
|
|
167
|
-
it('applies an INSERT operation to the root', () => {
|
|
168
|
-
builder.applyOperations([{ operation: 'INSERT', targetId: 'root', item: makeItem('op-item') }]);
|
|
169
|
-
expect(builder.menu.some((el) => el.element?.id === 'op-item')).toBe(true);
|
|
170
|
-
});
|
|
171
|
-
it('applies a BEFORE operation', () => {
|
|
172
|
-
builder.applyOperations([{ operation: 'BEFORE', targetId: 'search', item: makeItem('before-op') }]);
|
|
173
|
-
const idx = builder.menu.findIndex((el) => el.element?.id === 'before-op');
|
|
174
|
-
const searchIdx = builder.menu.findIndex((el) => el.element?.id === 'search');
|
|
175
|
-
expect(idx).toBeLessThan(searchIdx);
|
|
176
|
-
});
|
|
177
|
-
it('applies an AFTER operation', () => {
|
|
178
|
-
builder.applyOperations([{ operation: 'AFTER', targetId: 'home', item: makeItem('after-op') }]);
|
|
179
|
-
const homeIdx = builder.menu.findIndex((el) => el.element?.id === 'home');
|
|
180
|
-
const afterIdx = builder.menu.findIndex((el) => el.element?.id === 'after-op');
|
|
181
|
-
expect(afterIdx).toBe(homeIdx + 1);
|
|
182
|
-
});
|
|
183
|
-
it('applies multiple operations in order', () => {
|
|
184
|
-
builder.applyOperations([
|
|
185
|
-
{ operation: 'INSERT', targetId: 'root', item: makeItem('first') },
|
|
186
|
-
{ operation: 'INSERT', targetId: 'root', item: makeItem('second') }
|
|
187
|
-
]);
|
|
188
|
-
const ids = builder.menu.map((el) => el.element?.id).filter(Boolean);
|
|
189
|
-
expect(ids).toContain('first');
|
|
190
|
-
expect(ids).toContain('second');
|
|
191
|
-
});
|
|
192
|
-
it('ignores operations with unknown operation strings', () => {
|
|
193
|
-
const lenBefore = builder.menu.length;
|
|
194
|
-
builder.applyOperations([{ operation: 'UNKNOWN', targetId: 'root', item: makeItem('x') }]);
|
|
195
|
-
expect(builder.menu.length).toBe(lenBefore);
|
|
196
|
-
});
|
|
56
|
+
it('rejects duplicate item ids', () => {
|
|
57
|
+
const operations = [
|
|
58
|
+
{ type: 'insertRelative', anchorId: 'home', position: 'after', item: makeItem('home') }
|
|
59
|
+
];
|
|
60
|
+
expect(() => applyMainMenuOperations(root(), operations)).toThrow("Menu item with id 'home' already exists.");
|
|
197
61
|
});
|
|
198
62
|
});
|
package/utils/sessionStorage.js
CHANGED
|
@@ -8,7 +8,7 @@ const { _getStored: getStored, _removeStored: removeStored, _setStored: setStore
|
|
|
8
8
|
let changes = {};
|
|
9
9
|
const _getStored = (name) => {
|
|
10
10
|
return {
|
|
11
|
-
...JSON.parse(sessionStorage.getItem(buildName(name))),
|
|
11
|
+
...JSON.parse(sessionStorage.getItem(buildName(name)) ?? '{}'),
|
|
12
12
|
...changes[buildName(name)]
|
|
13
13
|
};
|
|
14
14
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="vitest" />
|
|
2
|
+
// @ts-nocheck
|
|
2
3
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
4
|
import { StorageKey } from './constants';
|
|
4
5
|
import { getAxiosCache, getStored, removeStored, setAxiosCache, setStored } from './sessionStorage';
|
package/utils/stringUtils.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare const sanitizeLuceneQuery: (query: string) => string;
|
|
|
6
6
|
export declare const safeStringPropertyCompare: (propertyPath: string) => (a: unknown, b: unknown) => any;
|
|
7
7
|
export declare const sanitizeMultilineLucene: (query: string) => string;
|
|
8
8
|
export declare const validateRegex: (regex: string) => boolean;
|
|
9
|
-
export declare const parsePixelSizeStringToInt: (size: string) => number;
|
|
9
|
+
export declare const parsePixelSizeStringToInt: (size: string) => number | null;
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,25 +1,46 @@
|
|
|
1
|
+
import type { Theme } from '@mui/material';
|
|
2
|
+
import type { PluginStore } from 'react-pluggable';
|
|
1
3
|
export declare const bytesToSize: (bytes: number | null) => string;
|
|
2
4
|
export declare const humanReadableNumber: (num: number | null) => string;
|
|
3
|
-
export declare const getProvider: () => string;
|
|
5
|
+
export declare const getProvider: () => string | null;
|
|
4
6
|
export declare const searchResultsDisplay: (count: number, max?: number) => string;
|
|
5
7
|
export declare const formatDate: (date: number | string | Date) => string;
|
|
6
8
|
export declare const compareTimestamp: (a: string, b: string) => number;
|
|
7
9
|
export declare const twitterShort: (date: string | Date | number) => string;
|
|
8
10
|
export declare const hashCode: (s: string) => number;
|
|
9
11
|
export declare const stringToColor: (string: string) => string;
|
|
12
|
+
type GetColor<T> = {
|
|
13
|
+
<D = 'default'>(status: string | undefined, _default?: D): T | D;
|
|
14
|
+
(status: string | undefined, _default: string, theme: Theme): string;
|
|
15
|
+
};
|
|
16
|
+
export declare const getProviderColor: (name: string | null | undefined) => string;
|
|
17
|
+
declare const STATUS_COLORS: {
|
|
18
|
+
readonly open: 'primary';
|
|
19
|
+
readonly 'in-progress': 'warning';
|
|
20
|
+
readonly resolved: 'success';
|
|
21
|
+
};
|
|
22
|
+
type StatusColor = (typeof STATUS_COLORS)[keyof typeof STATUS_COLORS] | 'default';
|
|
23
|
+
export declare const getStatusColor: GetColor<StatusColor>;
|
|
24
|
+
declare const ESCALATION_COLORS: {
|
|
25
|
+
alert: 'warning';
|
|
26
|
+
evidence: 'error';
|
|
27
|
+
hit: 'primary';
|
|
28
|
+
};
|
|
29
|
+
type EscalationColor = (typeof ESCALATION_COLORS)[keyof typeof ESCALATION_COLORS];
|
|
30
|
+
export declare const getEscalationColor: GetColor<EscalationColor>;
|
|
10
31
|
export declare const delay: (ms: number, rejectOnCancel?: boolean) => {
|
|
11
32
|
cancel: () => void;
|
|
12
|
-
then<TResult1 = void, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1
|
|
13
|
-
catch<TResult = never>(onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<void | TResult>;
|
|
33
|
+
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
34
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<void | TResult>;
|
|
14
35
|
readonly [Symbol.toStringTag]: string;
|
|
15
|
-
finally(onfinally?: () => void): Promise<void>;
|
|
36
|
+
finally(onfinally?: (() => void) | undefined | null): Promise<void>;
|
|
16
37
|
};
|
|
17
38
|
type Timestamp = {
|
|
18
39
|
timestamp?: string;
|
|
19
40
|
};
|
|
20
41
|
export declare const sortByTimestamp: <T extends Timestamp>(arr: T[]) => T[];
|
|
21
42
|
export declare const getTimeRange: (arr: string[]) => [string, string];
|
|
22
|
-
export declare const removeEmpty: (obj:
|
|
43
|
+
export declare const removeEmpty: (obj: unknown, aggressive?: boolean) => unknown;
|
|
23
44
|
export declare const searchObject: (o: any, query: string, returnFlat?: boolean) => any;
|
|
24
45
|
export declare const convertDateToLucene: (date: string) => string;
|
|
25
46
|
export declare const convertCustomDateRangeToLucene: (startDate: string, endDate: string) => string;
|
|
@@ -30,5 +51,8 @@ export declare const flattenDeep: (data: {
|
|
|
30
51
|
}) => {
|
|
31
52
|
[index: string]: any;
|
|
32
53
|
};
|
|
33
|
-
export declare const modifyDocumentation: (original: string, howlerPluginStore:
|
|
54
|
+
export declare const modifyDocumentation: (original: string, howlerPluginStore: {
|
|
55
|
+
plugins: string[];
|
|
56
|
+
}, pluginStore: PluginStore) => string;
|
|
57
|
+
export declare const notNil: <T>(val: T | null | undefined) => val is T;
|
|
34
58
|
export {};
|