@cccsaurora/howler-ui 2.14.0-dev.259 → 2.14.0-dev.264
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.ts +19 -0
- package/api/action/index.ts +36 -0
- package/api/action/operations.ts +11 -0
- package/api/analytic/comments/index.ts +27 -0
- package/api/analytic/comments/react.ts +14 -0
- package/api/analytic/favourite.ts +14 -0
- package/api/analytic/index.ts +27 -0
- package/api/analytic/notebooks/index.ts +15 -0
- package/api/analytic/owner.ts +11 -0
- package/api/analytic/rules.ts +13 -0
- package/api/auth/apikey.ts +20 -0
- package/api/auth/index.ts +9 -0
- package/api/auth/login.ts +35 -0
- package/api/configs/index.ts +10 -0
- package/api/dossier/hit.ts +10 -0
- package/api/dossier/index.ts +26 -0
- package/api/help.ts +71 -0
- package/api/hit/assign.ts +11 -0
- package/api/hit/comments/index.ts +27 -0
- package/api/hit/comments/react.ts +15 -0
- package/api/hit/index.ts +56 -0
- package/api/hit/labels.ts +16 -0
- package/api/hit/overwrite.ts +11 -0
- package/api/hit/transition.ts +12 -0
- package/api/index.ts +301 -0
- package/api/notebook/environments.ts +14 -0
- package/api/notebook/index.ts +20 -0
- package/api/overview/index.ts +22 -0
- package/api/search/action.ts +12 -0
- package/api/search/analytic.ts +12 -0
- package/api/search/count/hit.ts +11 -0
- package/api/search/count/index.ts +18 -0
- package/api/search/dossier.ts +12 -0
- package/api/search/eql/hit.ts +12 -0
- package/api/search/facet/hit.ts +11 -0
- package/api/search/facet/index.ts +19 -0
- package/api/search/fields/hit.ts +12 -0
- package/api/search/fields/index.ts +29 -0
- package/api/search/fields/user.ts +14 -0
- package/api/search/grouped/hit.ts +15 -0
- package/api/search/grouped/index.ts +34 -0
- package/api/search/grouped/user.ts +30 -0
- package/api/search/histogram/hit.ts +11 -0
- package/api/search/histogram/index.ts +20 -0
- package/api/search/hit.ts +17 -0
- package/api/search/index.ts +63 -0
- package/api/search/overview.ts +12 -0
- package/api/search/sigma/hit.ts +12 -0
- package/api/search/template.ts +12 -0
- package/api/search/user.ts +21 -0
- package/api/search/view.ts +12 -0
- package/api/template/index.ts +22 -0
- package/api/user/avatar/index.ts +10 -0
- package/api/user/groups.ts +12 -0
- package/api/user/index.ts +20 -0
- package/api/user/whoami.ts +11 -0
- package/api/view/favourite.ts +14 -0
- package/api/view/index.ts +25 -0
- package/branding/AppBrand.tsx +161 -0
- package/commons/components/app/AppConfigs.ts +179 -0
- package/commons/components/app/AppConstants.ts +11 -0
- package/commons/components/app/AppContexts.ts +142 -0
- package/commons/components/app/AppDefaults.ts +52 -0
- package/commons/components/app/AppNotificationService.ts +7 -0
- package/commons/components/app/AppProvider.tsx +86 -0
- package/commons/components/app/AppSearchService.ts +33 -0
- package/commons/components/app/AppSkeleton.tsx +321 -0
- package/commons/components/app/AppUserService.ts +21 -0
- package/commons/components/app/hooks/index.ts +18 -0
- package/commons/components/app/hooks/useApp.tsx +6 -0
- package/commons/components/app/hooks/useAppBanner.tsx +7 -0
- package/commons/components/app/hooks/useAppBar.tsx +6 -0
- package/commons/components/app/hooks/useAppBarHeight.tsx +27 -0
- package/commons/components/app/hooks/useAppBarScrollTrigger.tsx +8 -0
- package/commons/components/app/hooks/useAppBreadcrumbs.tsx +6 -0
- package/commons/components/app/hooks/useAppConfigs.tsx +54 -0
- package/commons/components/app/hooks/useAppLanguage.tsx +29 -0
- package/commons/components/app/hooks/useAppLayout.tsx +6 -0
- package/commons/components/app/hooks/useAppLeftNav.tsx +6 -0
- package/commons/components/app/hooks/useAppLogo.tsx +9 -0
- package/commons/components/app/hooks/useAppNotification.tsx +6 -0
- package/commons/components/app/hooks/useAppQuickSearch.tsx +6 -0
- package/commons/components/app/hooks/useAppSearchService.tsx +7 -0
- package/commons/components/app/hooks/useAppSitemap.tsx +84 -0
- package/commons/components/app/hooks/useAppSwitcher.tsx +6 -0
- package/commons/components/app/hooks/useAppTheme.tsx +23 -0
- package/commons/components/app/hooks/useAppUser.tsx +7 -0
- package/commons/components/app/providers/AppBarProvider.tsx +48 -0
- package/commons/components/app/providers/AppBreadcrumbsProvider.tsx +53 -0
- package/commons/components/app/providers/AppLayoutProvider.tsx +114 -0
- package/commons/components/app/providers/AppLeftNavProvider.tsx +30 -0
- package/commons/components/app/providers/AppNotificationProvider.tsx +49 -0
- package/commons/components/app/providers/AppQuickSearchProvider.tsx +32 -0
- package/commons/components/app/providers/AppSearchServiceProvider.tsx +65 -0
- package/commons/components/app/providers/AppSnackbarProvider.tsx +16 -0
- package/commons/components/app/providers/AppSwitcherProvider.tsx +16 -0
- package/commons/components/app/providers/AppUserProvider.tsx +22 -0
- package/commons/components/breadcrumbs/BreadcrumbIcon.tsx +21 -0
- package/commons/components/breadcrumbs/BreadcrumbLastItem.tsx +40 -0
- package/commons/components/breadcrumbs/BreadcrumbLinkItem.tsx +43 -0
- package/commons/components/breadcrumbs/BreadcrumbList.tsx +87 -0
- package/commons/components/breadcrumbs/Breadcrumbs.tsx +40 -0
- package/commons/components/display/AppAvatar.tsx +34 -0
- package/commons/components/display/AppInfoPanel.tsx +30 -0
- package/commons/components/display/AppListEmpty.tsx +5 -0
- package/commons/components/display/AppToc.tsx +160 -0
- package/commons/components/display/hooks/useAppColor.tsx +21 -0
- package/commons/components/leftnav/LeftNavDrawer.tsx +172 -0
- package/commons/components/leftnav/LeftNavGroup.tsx +144 -0
- package/commons/components/leftnav/LeftNavItem.tsx +73 -0
- package/commons/components/notification/FeedModels.ts +163 -0
- package/commons/components/notification/Notification.tsx +152 -0
- package/commons/components/notification/elements/NotificationCloseButton.tsx +14 -0
- package/commons/components/notification/elements/NotificationContainer.tsx +87 -0
- package/commons/components/notification/elements/NotificationEndOfPage.tsx +48 -0
- package/commons/components/notification/elements/NotificationError.tsx +24 -0
- package/commons/components/notification/elements/NotificationHeader.tsx +41 -0
- package/commons/components/notification/elements/NotificationItems.tsx +47 -0
- package/commons/components/notification/elements/NotificationSkeleton.tsx +59 -0
- package/commons/components/notification/elements/NotificationTopNavButton.tsx +27 -0
- package/commons/components/notification/elements/item/NotificationItem.tsx +44 -0
- package/commons/components/notification/elements/item/NotificationItemAuthor.tsx +72 -0
- package/commons/components/notification/elements/item/NotificationItemContent.tsx +29 -0
- package/commons/components/notification/elements/item/NotificationItemDate.tsx +14 -0
- package/commons/components/notification/elements/item/NotificationItemImage.tsx +19 -0
- package/commons/components/notification/elements/item/NotificationItemTag.tsx +18 -0
- package/commons/components/notification/elements/item/NotificationItemTitle.tsx +38 -0
- package/commons/components/notification/index.tsx +2 -0
- package/commons/components/pages/PageCardCentered.tsx +32 -0
- package/commons/components/pages/PageCenter.tsx +46 -0
- package/commons/components/pages/PageContent.tsx +13 -0
- package/commons/components/pages/PageFullScreen.tsx +74 -0
- package/commons/components/pages/PageFullWidth.tsx +30 -0
- package/commons/components/pages/PageHeader.tsx +117 -0
- package/commons/components/pages/hooks/usePageProps.tsx +41 -0
- package/commons/components/search/AppSearch.tsx +256 -0
- package/commons/components/search/AppSearchInput.tsx +104 -0
- package/commons/components/search/AppSearchResult.tsx +66 -0
- package/commons/components/topnav/AppBar.tsx +137 -0
- package/commons/components/topnav/AppName.tsx +53 -0
- package/commons/components/topnav/AppSwitcher.tsx +116 -0
- package/commons/components/topnav/Notifications.tsx +16 -0
- package/commons/components/topnav/ThemeSelection.tsx +143 -0
- package/commons/components/topnav/ThemeSelectionIcon.tsx +39 -0
- package/commons/components/topnav/UserProfile.tsx +196 -0
- package/commons/components/utils/hooks/useClipboard.tsx +31 -0
- package/commons/components/utils/hooks/useEnv.tsx +13 -0
- package/commons/components/utils/hooks/useFullscreenStatus.tsx +47 -0
- package/commons/components/utils/hooks/useGravatar.tsx +13 -0
- package/commons/components/utils/hooks/useLocalStorage.ts +75 -0
- package/commons/components/utils/hooks/useLocalStorageItem.tsx +45 -0
- package/commons/components/utils/hooks/useThemeBuilder.tsx +55 -0
- package/commons/components/utils/keyboard.ts +61 -0
- package/components/app/App.tsx +434 -0
- package/components/app/AppContainer.tsx +19 -0
- package/components/app/drawers/ApiKeyDrawer.tsx +173 -0
- package/components/app/drawers/AppDrawerType.ts +7 -0
- package/components/app/drawers/AssignUserDrawer.tsx +126 -0
- package/components/app/drawers/ViewGroupsDrawer.tsx +24 -0
- package/components/app/hooks/useMatchers.test.ts +328 -0
- package/components/app/hooks/useMatchers.tsx +107 -0
- package/components/app/hooks/useTitle.tsx +77 -0
- package/components/app/providers/AnalyticProvider.tsx +87 -0
- package/components/app/providers/ApiConfigProvider.tsx +31 -0
- package/components/app/providers/AppDrawerProvider.tsx +54 -0
- package/components/app/providers/AvatarProvider.tsx +47 -0
- package/components/app/providers/CustomPluginProvider.tsx +19 -0
- package/components/app/providers/FavouritesProvider.tsx +157 -0
- package/components/app/providers/FieldProvider.tsx +34 -0
- package/components/app/providers/HitProvider.tsx +164 -0
- package/components/app/providers/HitSearchProvider.tsx +248 -0
- package/components/app/providers/LocalStorageProvider.tsx +67 -0
- package/components/app/providers/ModalProvider.tsx +57 -0
- package/components/app/providers/OverviewProvider.tsx +90 -0
- package/components/app/providers/ParameterProvider.tsx +270 -0
- package/components/app/providers/SocketProvider.tsx +329 -0
- package/components/app/providers/UserListProvider.tsx +56 -0
- package/components/app/providers/ViewProvider.test.tsx +244 -0
- package/components/app/providers/ViewProvider.tsx +207 -0
- package/components/elements/Comment.tsx +315 -0
- package/components/elements/EditRow.tsx +268 -0
- package/components/elements/PluginChip.tsx +32 -0
- package/components/elements/PluginTypography.tsx +31 -0
- package/components/elements/ThemedEditor.tsx +130 -0
- package/components/elements/UserList.tsx +79 -0
- package/components/elements/addons/buttons/CustomButton.tsx +93 -0
- package/components/elements/addons/buttons/CustomIconButton.tsx +122 -0
- package/components/elements/addons/buttons/index.ts +7 -0
- package/components/elements/addons/layout/FlexOne.tsx +6 -0
- package/components/elements/addons/layout/FlexPort.tsx +39 -0
- package/components/elements/addons/layout/FlexVertical.tsx +28 -0
- package/components/elements/addons/layout/vsbox/VSBox.tsx +52 -0
- package/components/elements/addons/layout/vsbox/VSBoxContent.tsx +13 -0
- package/components/elements/addons/layout/vsbox/VSBoxElement.tsx +60 -0
- package/components/elements/addons/layout/vsbox/VSBoxHeader.tsx +41 -0
- package/components/elements/addons/lists/TuiList.tsx +31 -0
- package/components/elements/addons/lists/TuiListBase.tsx +98 -0
- package/components/elements/addons/lists/TuiListElement.tsx +51 -0
- package/components/elements/addons/lists/TuiListMenu.tsx +61 -0
- package/components/elements/addons/lists/TuiListProvider.tsx +162 -0
- package/components/elements/addons/lists/hooks/useTuiListKeyboard.tsx +60 -0
- package/components/elements/addons/lists/index.tsx +25 -0
- package/components/elements/addons/lists/table/TuiTable.tsx +151 -0
- package/components/elements/addons/lists/table/TuiTableBody.tsx +77 -0
- package/components/elements/addons/lists/table/TuiTableHead.tsx +29 -0
- package/components/elements/addons/lists/table/TuiTableHeader.tsx +15 -0
- package/components/elements/addons/lists/table/TuiTableLayout.ts +53 -0
- package/components/elements/addons/lists/table/index.tsx +24 -0
- package/components/elements/addons/search/SearchPagination.tsx +26 -0
- package/components/elements/addons/search/SearchTotal.tsx +35 -0
- package/components/elements/addons/search/phrase/Phrase.tsx +175 -0
- package/components/elements/addons/search/phrase/PhraseConsumer.ts +35 -0
- package/components/elements/addons/search/phrase/PhraseLexer.ts +167 -0
- package/components/elements/addons/search/phrase/index.ts +86 -0
- package/components/elements/addons/search/phrase/word/WordLexer.ts +10 -0
- package/components/elements/addons/search/phrase/word/WordSuggester.ts +9 -0
- package/components/elements/addons/search/phrase/word/consumers/WhitespaceConsumer.ts +21 -0
- package/components/elements/addons/search/phrase/word/consumers/WordConsumer.ts +21 -0
- package/components/elements/display/ActionButton.tsx +40 -0
- package/components/elements/display/Classification.tsx +29 -0
- package/components/elements/display/DocumentationButton.tsx +46 -0
- package/components/elements/display/DynamicTabs.tsx +52 -0
- package/components/elements/display/HandlebarsMarkdown.tsx +105 -0
- package/components/elements/display/HowlerAvatar.tsx +66 -0
- package/components/elements/display/HowlerAvatarHeader.tsx +37 -0
- package/components/elements/display/HowlerCard.tsx +10 -0
- package/components/elements/display/Image.tsx +43 -0
- package/components/elements/display/ItemManager.tsx +146 -0
- package/components/elements/display/Markdown.tsx +200 -0
- package/components/elements/display/Modal.tsx +44 -0
- package/components/elements/display/Notebook.tsx +7 -0
- package/components/elements/display/QueryResultText.tsx +25 -0
- package/components/elements/display/TextDivider.tsx +48 -0
- package/components/elements/display/TypingIndicator.tsx +41 -0
- package/components/elements/display/UserPageWrapper.tsx +20 -0
- package/components/elements/display/features/DevelopmentBanner.tsx +24 -0
- package/components/elements/display/features/DevelopmentIcon.tsx +24 -0
- package/components/elements/display/handlebars/helpers.tsx +276 -0
- package/components/elements/display/icons/BundleButton.tsx +77 -0
- package/components/elements/display/icons/Iconified.tsx +16 -0
- package/components/elements/display/icons/SocketBadge.tsx +82 -0
- package/components/elements/display/icons/svg/howler-icon-darkmode.svg +1 -0
- package/components/elements/display/icons/svg/howler-icon-lightmode.svg +1 -0
- package/components/elements/display/icons/svg/howler-logo-full.svg +1 -0
- package/components/elements/display/icons/svg/howler-logo.svg +1 -0
- package/components/elements/display/json/JSONViewer.tsx +98 -0
- package/components/elements/display/markdownPlugins/tabs.ts +81 -0
- package/components/elements/display/modals/ConfirmDeleteModal.tsx +32 -0
- package/components/elements/display/modals/ConfirmNotebookModal.tsx +32 -0
- package/components/elements/display/modals/CreateActionModal.tsx +63 -0
- package/components/elements/display/modals/LoginErrorModal.tsx +31 -0
- package/components/elements/display/modals/RationaleModal.tsx +59 -0
- package/components/elements/hit/HitActions.tsx +298 -0
- package/components/elements/hit/HitBanner.tsx +367 -0
- package/components/elements/hit/HitBannerTooltip.tsx +41 -0
- package/components/elements/hit/HitCard.tsx +42 -0
- package/components/elements/hit/HitComments.tsx +372 -0
- package/components/elements/hit/HitDetails.tsx +324 -0
- package/components/elements/hit/HitLabels.tsx +265 -0
- package/components/elements/hit/HitLayout.ts +5 -0
- package/components/elements/hit/HitNotebooks.tsx +264 -0
- package/components/elements/hit/HitOutline.tsx +56 -0
- package/components/elements/hit/HitOverview.tsx +53 -0
- package/components/elements/hit/HitQuickSearch.tsx +111 -0
- package/components/elements/hit/HitRelated.tsx +18 -0
- package/components/elements/hit/HitShortcuts.ts +5 -0
- package/components/elements/hit/HitSummary.tsx +301 -0
- package/components/elements/hit/HitWorklog.tsx +201 -0
- package/components/elements/hit/actions/ButtonActions.tsx +269 -0
- package/components/elements/hit/actions/DropdownActions.tsx +157 -0
- package/components/elements/hit/actions/SharedComponents.tsx +40 -0
- package/components/elements/hit/aggregate/HitGraph.tsx +351 -0
- package/components/elements/hit/elements/Assigned.tsx +71 -0
- package/components/elements/hit/elements/EscalationChip.tsx +26 -0
- package/components/elements/hit/elements/HitTimestamp.tsx +81 -0
- package/components/elements/hit/outlines/DefaultOutline.tsx +107 -0
- package/components/elements/hit/outlines/al/AssemblyLineRules.tsx +130 -0
- package/components/elements/hit/related/PivotLink.tsx +67 -0
- package/components/elements/hit/related/RelatedIcon.tsx +51 -0
- package/components/elements/hit/related/RelatedLink.tsx +43 -0
- package/components/elements/view/ViewTitle.tsx +61 -0
- package/components/hooks/useHitActions.tsx +276 -0
- package/components/hooks/useHitSelection.tsx +102 -0
- package/components/hooks/useMyApi.tsx +64 -0
- package/components/hooks/useMyChart.tsx +164 -0
- package/components/hooks/useMyLocalStorage.ts +20 -0
- package/components/hooks/useMyPreferences.tsx +309 -0
- package/components/hooks/useMySearch.tsx +77 -0
- package/components/hooks/useMySitemap.tsx +248 -0
- package/components/hooks/useMySnackbar.tsx +67 -0
- package/components/hooks/useMyTheme.tsx +34 -0
- package/components/hooks/useMyUser.tsx +39 -0
- package/components/hooks/useMyUserFunctions.tsx +166 -0
- package/components/hooks/useMyUserList.tsx +15 -0
- package/components/hooks/useMyUtils.tsx +16 -0
- package/components/hooks/useScrollRestoration.tsx +37 -0
- package/components/logins/Login.tsx +62 -0
- package/components/logins/auth/OAuthLogin.tsx +49 -0
- package/components/logins/auth/UserPassLogin.tsx +57 -0
- package/components/logins/hooks/useLogin.tsx +101 -0
- package/components/routes/404.tsx +24 -0
- package/components/routes/ErrorBoundary.tsx +44 -0
- package/components/routes/ErrorOccured.tsx +28 -0
- package/components/routes/Logout.tsx +56 -0
- package/components/routes/action/edit/ActionEditor.tsx +358 -0
- package/components/routes/action/shared/ActionReportDisplay.tsx +84 -0
- package/components/routes/action/shared/OperationEntry.tsx +121 -0
- package/components/routes/action/shared/OperationStep.tsx +219 -0
- package/components/routes/action/useMyActionFunctions.tsx +225 -0
- package/components/routes/action/view/ActionDetails.tsx +205 -0
- package/components/routes/action/view/ActionSearch.tsx +249 -0
- package/components/routes/action/view/Integrations.tsx +49 -0
- package/components/routes/admin/users/UserEditor.tsx +55 -0
- package/components/routes/admin/users/UserSearch.tsx +228 -0
- package/components/routes/advanced/QueryBuilder.tsx +584 -0
- package/components/routes/advanced/QueryEditor.tsx +148 -0
- package/components/routes/advanced/RuleModal.tsx +217 -0
- package/components/routes/advanced/eqlCompletionProvider.ts +94 -0
- package/components/routes/advanced/eqlTokenProvider.ts +110 -0
- package/components/routes/advanced/historyCompletionProvider.ts +61 -0
- package/components/routes/advanced/luceneCompletionProvider.ts +111 -0
- package/components/routes/advanced/luceneTokenProvider.ts +131 -0
- package/components/routes/advanced/yamlCompletionProvider.ts +58 -0
- package/components/routes/analytics/AnalyticComments.tsx +218 -0
- package/components/routes/analytics/AnalyticDetails.tsx +343 -0
- package/components/routes/analytics/AnalyticHitComments.tsx +99 -0
- package/components/routes/analytics/AnalyticNotebooks.tsx +185 -0
- package/components/routes/analytics/AnalyticOverview.tsx +165 -0
- package/components/routes/analytics/AnalyticOverviews.tsx +75 -0
- package/components/routes/analytics/AnalyticSearch.tsx +301 -0
- package/components/routes/analytics/AnalyticTemplates.tsx +77 -0
- package/components/routes/analytics/RuleView.tsx +80 -0
- package/components/routes/analytics/TriageSettings.tsx +146 -0
- package/components/routes/analytics/widgets/Assessment.tsx +71 -0
- package/components/routes/analytics/widgets/Created.tsx +61 -0
- package/components/routes/analytics/widgets/Detection.tsx +11 -0
- package/components/routes/analytics/widgets/Escalation.tsx +65 -0
- package/components/routes/analytics/widgets/Stacked.tsx +109 -0
- package/components/routes/analytics/widgets/Status.tsx +21 -0
- package/components/routes/dossiers/DossierCard.tsx +48 -0
- package/components/routes/dossiers/DossierEditor.tsx +247 -0
- package/components/routes/dossiers/Dossiers.tsx +173 -0
- package/components/routes/dossiers/LeadEditor.tsx +122 -0
- package/components/routes/dossiers/LeadForm.tsx +106 -0
- package/components/routes/dossiers/PivotForm.tsx +311 -0
- package/components/routes/help/ActionDocumentation.tsx +77 -0
- package/components/routes/help/ActionIntroductionDocumentation.tsx +128 -0
- package/components/routes/help/ApiDocumentation.tsx +217 -0
- package/components/routes/help/AuthDocumentation.tsx +26 -0
- package/components/routes/help/BundleDocumentation.tsx +17 -0
- package/components/routes/help/ClientDocumentation.tsx +27 -0
- package/components/routes/help/Help.tsx +96 -0
- package/components/routes/help/HitBannerDocumentation.tsx +71 -0
- package/components/routes/help/HitDocumentation.tsx +77 -0
- package/components/routes/help/HitLabelsDocumentation.tsx +57 -0
- package/components/routes/help/HitLinksDocumentation.tsx +23 -0
- package/components/routes/help/HitSchemaDocumentation.tsx +253 -0
- package/components/routes/help/NotebookDocumentation.tsx +28 -0
- package/components/routes/help/OverviewDocumentation.tsx +21 -0
- package/components/routes/help/RetentionDocumentation.tsx +55 -0
- package/components/routes/help/SearchDocumentation.tsx +700 -0
- package/components/routes/help/TemplateDocumentation.tsx +73 -0
- package/components/routes/help/ViewDocumentation.tsx +32 -0
- package/components/routes/help/components/HelpTabs.tsx +47 -0
- package/components/routes/help/markdown/en/actionIntroduction.md +33 -0
- package/components/routes/help/markdown/en/authentication.md +261 -0
- package/components/routes/help/markdown/en/bundles.md +70 -0
- package/components/routes/help/markdown/en/client.md +213 -0
- package/components/routes/help/markdown/en/links.md +37 -0
- package/components/routes/help/markdown/en/notebook.md +157 -0
- package/components/routes/help/markdown/en/retention.md +15 -0
- package/components/routes/help/markdown/en/schema.md +20 -0
- package/components/routes/help/markdown/en/templates.md +23 -0
- package/components/routes/help/markdown/en/views.md +11 -0
- package/components/routes/help/markdown/fr/actionIntroduction.md +33 -0
- package/components/routes/help/markdown/fr/authentication.md +259 -0
- package/components/routes/help/markdown/fr/bundles.md +70 -0
- package/components/routes/help/markdown/fr/client.md +209 -0
- package/components/routes/help/markdown/fr/links.md +37 -0
- package/components/routes/help/markdown/fr/notebook.md +157 -0
- package/components/routes/help/markdown/fr/retention.md +15 -0
- package/components/routes/help/markdown/fr/schema.md +20 -0
- package/components/routes/help/markdown/fr/templates.md +23 -0
- package/components/routes/help/markdown/fr/views.md +11 -0
- package/components/routes/hits/search/BundleParentMenu.tsx +73 -0
- package/components/routes/hits/search/BundleScroller.tsx +8 -0
- package/components/routes/hits/search/CustomSort.tsx +94 -0
- package/components/routes/hits/search/HitBrowser.tsx +318 -0
- package/components/routes/hits/search/HitContextMenu.tsx +260 -0
- package/components/routes/hits/search/HitQuery.tsx +268 -0
- package/components/routes/hits/search/InformationPane.tsx +430 -0
- package/components/routes/hits/search/SearchPane.tsx +291 -0
- package/components/routes/hits/search/ViewLink.tsx +96 -0
- package/components/routes/hits/search/grid/AddColumnModal.tsx +98 -0
- package/components/routes/hits/search/grid/ColumnHeader.tsx +70 -0
- package/components/routes/hits/search/grid/EnhancedCell.tsx +50 -0
- package/components/routes/hits/search/grid/HitGrid.tsx +342 -0
- package/components/routes/hits/search/grid/HitRow.tsx +121 -0
- package/components/routes/hits/search/shared/CustomSpan.tsx +54 -0
- package/components/routes/hits/search/shared/HitFilter.tsx +110 -0
- package/components/routes/hits/search/shared/HitSort.tsx +111 -0
- package/components/routes/hits/search/shared/QuerySettings.tsx +40 -0
- package/components/routes/hits/search/shared/SearchSpan.tsx +68 -0
- package/components/routes/hits/view/HitViewer.tsx +372 -0
- package/components/routes/hits/view/LeadRenderer.tsx +42 -0
- package/components/routes/home/AddNewCard.tsx +295 -0
- package/components/routes/home/AnalyticCard.tsx +68 -0
- package/components/routes/home/EntryWrapper.tsx +54 -0
- package/components/routes/home/ViewCard.tsx +96 -0
- package/components/routes/home/index.tsx +278 -0
- package/components/routes/overviews/OverviewCard.tsx +51 -0
- package/components/routes/overviews/OverviewEditor.tsx +102 -0
- package/components/routes/overviews/OverviewViewer.tsx +387 -0
- package/components/routes/overviews/Overviews.tsx +179 -0
- package/components/routes/overviews/markdownExtendedTokenProvider.ts +296 -0
- package/components/routes/overviews/startingTemplate.ts +40 -0
- package/components/routes/overviews/template/en.md +167 -0
- package/components/routes/overviews/template/fr.md +167 -0
- package/components/routes/settings/AdminSection.tsx +18 -0
- package/components/routes/settings/LocalSection.tsx +168 -0
- package/components/routes/settings/ProfileSection.tsx +138 -0
- package/components/routes/settings/SecuritySection.tsx +95 -0
- package/components/routes/settings/Settings.tsx +51 -0
- package/components/routes/settings/SettingsSection.tsx +28 -0
- package/components/routes/templates/TemplateCard.tsx +38 -0
- package/components/routes/templates/TemplateDnD.tsx +51 -0
- package/components/routes/templates/TemplateEditor.tsx +121 -0
- package/components/routes/templates/TemplateViewer.tsx +285 -0
- package/components/routes/templates/Templates.tsx +187 -0
- package/components/routes/views/ViewComposer.tsx +317 -0
- package/components/routes/views/Views.tsx +379 -0
- package/globals.d.ts +1 -0
- package/i18n.ts +50 -0
- package/index.tsx +19 -0
- package/locales/en/help/main.json +13 -0
- package/locales/en/help/search.json +186 -0
- package/locales/en/translation.json +799 -0
- package/locales/fr/help/main.json +13 -0
- package/locales/fr/help/search.json +186 -0
- package/locales/fr/translation.json +797 -0
- package/models/ActionTypes.d.ts +50 -0
- package/models/WithMetadata.d.ts +12 -0
- package/models/entities/HowlerUser.d.ts +18 -0
- package/models/entities/generated/Account.d.ts +7 -0
- package/models/entities/generated/Action.d.ts +13 -0
- package/models/entities/generated/Agent.d.ts +9 -0
- package/models/entities/generated/Analytic.d.ts +21 -0
- package/models/entities/generated/Answer.d.ts +10 -0
- package/models/entities/generated/Antivirus.d.ts +9 -0
- package/models/entities/generated/ApiType.d.ts +238 -0
- package/models/entities/generated/Assemblyline.d.ts +22 -0
- package/models/entities/generated/Attachment.d.ts +8 -0
- package/models/entities/generated/Attribution.d.ts +9 -0
- package/models/entities/generated/AutonomousSystems.d.ts +7 -0
- package/models/entities/generated/Aws.d.ts +10 -0
- package/models/entities/generated/Azure.d.ts +10 -0
- package/models/entities/generated/Bcc.d.ts +6 -0
- package/models/entities/generated/Behaviour.d.ts +9 -0
- package/models/entities/generated/Body.d.ts +7 -0
- package/models/entities/generated/Cbs.d.ts +8 -0
- package/models/entities/generated/Cc.d.ts +6 -0
- package/models/entities/generated/Client.d.ts +7 -0
- package/models/entities/generated/Cloud.d.ts +20 -0
- package/models/entities/generated/CloudAccount.d.ts +7 -0
- package/models/entities/generated/CodeSignature.d.ts +14 -0
- package/models/entities/generated/Comment.d.ts +12 -0
- package/models/entities/generated/Container.d.ts +12 -0
- package/models/entities/generated/Created.d.ts +7 -0
- package/models/entities/generated/Dashboard.d.ts +8 -0
- package/models/entities/generated/Data.d.ts +8 -0
- package/models/entities/generated/Destination.d.ts +23 -0
- package/models/entities/generated/Device.d.ts +6 -0
- package/models/entities/generated/Dns.d.ts +16 -0
- package/models/entities/generated/Domain.d.ts +9 -0
- package/models/entities/generated/Dossier.d.ts +15 -0
- package/models/entities/generated/Ecs.d.ts +6 -0
- package/models/entities/generated/Egress.d.ts +6 -0
- package/models/entities/generated/Elf.d.ts +20 -0
- package/models/entities/generated/Email.d.ts +30 -0
- package/models/entities/generated/Enrichment.d.ts +10 -0
- package/models/entities/generated/EntryMeta.d.ts +6 -0
- package/models/entities/generated/Error.d.ts +7 -0
- package/models/entities/generated/Event.d.ts +31 -0
- package/models/entities/generated/Faas.d.ts +13 -0
- package/models/entities/generated/Feed.d.ts +9 -0
- package/models/entities/generated/File.d.ts +12 -0
- package/models/entities/generated/FileHash.d.ts +12 -0
- package/models/entities/generated/From.d.ts +6 -0
- package/models/entities/generated/Gcp.d.ts +10 -0
- package/models/entities/generated/Geo.d.ts +18 -0
- package/models/entities/generated/Group.d.ts +8 -0
- package/models/entities/generated/Hash.d.ts +6 -0
- package/models/entities/generated/Header.d.ts +13 -0
- package/models/entities/generated/Heuristic.d.ts +9 -0
- package/models/entities/generated/Hit.d.ts +102 -0
- package/models/entities/generated/HitFile.d.ts +36 -0
- package/models/entities/generated/HitOrganization.d.ts +7 -0
- package/models/entities/generated/Host.d.ts +11 -0
- package/models/entities/generated/Howler.d.ts +48 -0
- package/models/entities/generated/HowlerComment.d.ts +11 -0
- package/models/entities/generated/HowlerDossier.d.ts +12 -0
- package/models/entities/generated/Http.d.ts +11 -0
- package/models/entities/generated/Image.d.ts +10 -0
- package/models/entities/generated/Incident.d.ts +8 -0
- package/models/entities/generated/Indicator.d.ts +21 -0
- package/models/entities/generated/IndicatorEmail.d.ts +6 -0
- package/models/entities/generated/IndicatorFile.d.ts +36 -0
- package/models/entities/generated/Ingress.d.ts +9 -0
- package/models/entities/generated/Instance.d.ts +7 -0
- package/models/entities/generated/Interface.d.ts +7 -0
- package/models/entities/generated/Label.d.ts +7 -0
- package/models/entities/generated/Labels.d.ts +13 -0
- package/models/entities/generated/Lead.d.ts +12 -0
- package/models/entities/generated/Link.d.ts +8 -0
- package/models/entities/generated/Location.d.ts +7 -0
- package/models/entities/generated/Log.d.ts +13 -0
- package/models/entities/generated/Machine.d.ts +6 -0
- package/models/entities/generated/Mapping.d.ts +8 -0
- package/models/entities/generated/Matched.d.ts +6 -0
- package/models/entities/generated/Mitre.d.ts +10 -0
- package/models/entities/generated/Modified.d.ts +7 -0
- package/models/entities/generated/Nat.d.ts +7 -0
- package/models/entities/generated/Network.d.ts +8 -0
- package/models/entities/generated/Notebook.d.ts +10 -0
- package/models/entities/generated/Observer.d.ts +21 -0
- package/models/entities/generated/Operation.d.ts +7 -0
- package/models/entities/generated/Organization.d.ts +7 -0
- package/models/entities/generated/Original.d.ts +19 -0
- package/models/entities/generated/Os.d.ts +12 -0
- package/models/entities/generated/Outline.d.ts +9 -0
- package/models/entities/generated/Overview.d.ts +10 -0
- package/models/entities/generated/Parent.d.ts +19 -0
- package/models/entities/generated/ParentHash.d.ts +12 -0
- package/models/entities/generated/ParentParent.d.ts +32 -0
- package/models/entities/generated/ParentUser.d.ts +9 -0
- package/models/entities/generated/Pe.d.ts +13 -0
- package/models/entities/generated/Pivot.d.ts +13 -0
- package/models/entities/generated/Process.d.ts +34 -0
- package/models/entities/generated/ProcessHash.d.ts +12 -0
- package/models/entities/generated/ProcessParent.d.ts +34 -0
- package/models/entities/generated/ProcessUser.d.ts +9 -0
- package/models/entities/generated/Project.d.ts +7 -0
- package/models/entities/generated/Question.d.ts +11 -0
- package/models/entities/generated/Registry.d.ts +12 -0
- package/models/entities/generated/Related.d.ts +13 -0
- package/models/entities/generated/ReplyTo.d.ts +6 -0
- package/models/entities/generated/Request.d.ts +13 -0
- package/models/entities/generated/Response.d.ts +11 -0
- package/models/entities/generated/Rule.d.ts +15 -0
- package/models/entities/generated/Section.d.ts +14 -0
- package/models/entities/generated/Segment.d.ts +14 -0
- package/models/entities/generated/Sender.d.ts +6 -0
- package/models/entities/generated/Server.d.ts +8 -0
- package/models/entities/generated/Service.d.ts +6 -0
- package/models/entities/generated/Settings.d.ts +6 -0
- package/models/entities/generated/Sharepoint.d.ts +10 -0
- package/models/entities/generated/Software.d.ts +11 -0
- package/models/entities/generated/Source.d.ts +23 -0
- package/models/entities/generated/SourceOriginal.d.ts +19 -0
- package/models/entities/generated/Tactic.d.ts +9 -0
- package/models/entities/generated/Technique.d.ts +9 -0
- package/models/entities/generated/Template.d.ts +11 -0
- package/models/entities/generated/Threat.d.ts +21 -0
- package/models/entities/generated/ThreatGroup.d.ts +9 -0
- package/models/entities/generated/ThreatIndicator.d.ts +21 -0
- package/models/entities/generated/ThreatTactic.d.ts +8 -0
- package/models/entities/generated/ThreatTechnique.d.ts +8 -0
- package/models/entities/generated/Tls.d.ts +12 -0
- package/models/entities/generated/TlsServer.d.ts +6 -0
- package/models/entities/generated/To.d.ts +6 -0
- package/models/entities/generated/TriageSettings.d.ts +8 -0
- package/models/entities/generated/Trigger.d.ts +7 -0
- package/models/entities/generated/Uri.d.ts +9 -0
- package/models/entities/generated/Url.d.ts +19 -0
- package/models/entities/generated/User.d.ts +15 -0
- package/models/entities/generated/UserAgent.d.ts +13 -0
- package/models/entities/generated/UserUser.d.ts +19 -0
- package/models/entities/generated/View.d.ts +15 -0
- package/models/entities/generated/Votes.d.ts +8 -0
- package/models/entities/generated/Vulnerability.d.ts +12 -0
- package/models/entities/generated/Yara.d.ts +9 -0
- package/models/socket/HitUpdate.d.ts +14 -0
- package/package.json +604 -154
- package/plugins/HowlerPlugin.ts +375 -0
- package/plugins/store.ts +152 -0
- package/rest/AxiosClient.ts +81 -0
- package/rest/FetchClient.ts +27 -0
- package/rest/index.ts +12 -0
- package/setupTests.ts +17 -0
- package/tests/MockLocalStorage.ts +46 -0
- package/tests/server-handlers.ts +114 -0
- package/tests/server.ts +6 -0
- package/utils/Throttler.ts +43 -0
- package/utils/actionUtils.ts +112 -0
- package/utils/constants.tsx +131 -0
- package/utils/hit.json +30356 -0
- package/utils/hitFunctions.ts +10 -0
- package/utils/localStorage.ts +54 -0
- package/utils/menuUtils.ts +274 -0
- package/utils/sessionStorage.ts +59 -0
- package/utils/socketUtils.ts +11 -0
- package/utils/stringUtils.ts +57 -0
- package/utils/utils.ts +222 -0
- package/utils/xsrf.ts +17 -0
- package/vite-env.d.ts +1 -0
- package/assets/abap-DR3EPHcA.js +0 -6
- package/assets/abap-kqcCuNo3.js +0 -1
- package/assets/abnf-0i0y1qLw.js +0 -1
- package/assets/actionscript-CBg9ALMd.js +0 -1
- package/assets/ada-C0C0wsJY.js +0 -1
- package/assets/agda-CxRhcDuf.js +0 -1
- package/assets/al-Dlm67z74.js +0 -1
- package/assets/antlr4-BmA8T_Pf.js +0 -1
- package/assets/apacheconf-Cy80ybHj.js +0 -1
- package/assets/apex-CW6wsJgM.js +0 -6
- package/assets/apex-Sg90mm4u.js +0 -1
- package/assets/apl-EWXH65GD.js +0 -1
- package/assets/applescript-PjHK8QN3.js +0 -1
- package/assets/aql-B5IC4Rcf.js +0 -1
- package/assets/arc-BlYL6j5T.js +0 -1
- package/assets/architecture-O4VJ6CD3-jaQW6ijo.js +0 -1
- package/assets/architectureDiagram-KFL7JDKH-DJeBx9P6.js +0 -36
- package/assets/arduino-C51Narsi.js +0 -1
- package/assets/arff-8aJF8MCW.js +0 -1
- package/assets/asciidoc-YvasCiDo.js +0 -1
- package/assets/asm6502-DNM_ACU3.js +0 -1
- package/assets/asmatmel-B7SjKbvc.js +0 -1
- package/assets/aspnet-BDjjZcvg.js +0 -1
- package/assets/autohotkey-hUSymZ_m.js +0 -1
- package/assets/autoit-z_CsSJmr.js +0 -1
- package/assets/avisynth-lWBoLdVJ.js +0 -1
- package/assets/avro-idl-D8-0MeNx.js +0 -1
- package/assets/azcli-CIONJYq1.js +0 -6
- package/assets/bash-CefCgV5_.js +0 -1
- package/assets/bash-WWuseIss.js +0 -1
- package/assets/basic-5JZah1MP.js +0 -1
- package/assets/basic-DBS9NaGG.js +0 -1
- package/assets/bat-C9Lf3IiR.js +0 -6
- package/assets/batch-CNuZE34T.js +0 -1
- package/assets/bbcode-DUCaeSOc.js +0 -1
- package/assets/bicep-C9cUGcZW.js +0 -1
- package/assets/bicep-D-A_iHuq.js +0 -7
- package/assets/birb-BZmpNpMm.js +0 -1
- package/assets/bison-CywkiQg4.js +0 -1
- package/assets/blockDiagram-ZYB65J3Q-D0Ol2jlv.js +0 -122
- package/assets/bnf-DNey8JGD.js +0 -1
- package/assets/brainfuck-uwCSHc7F.js +0 -1
- package/assets/brightscript-DT7d5-qJ.js +0 -1
- package/assets/bro-CFVRfUbc.js +0 -1
- package/assets/bsl-9S4UgA2J.js +0 -1
- package/assets/c-BgfjASKF.js +0 -1
- package/assets/c-kgVuzdLE.js +0 -1
- package/assets/c4Diagram-AAMF2YG6-v1fpnkx2.js +0 -10
- package/assets/cameligo-v1zEsXLu.js +0 -6
- package/assets/cfscript-49U2aWCh.js +0 -1
- package/assets/chaiscript-4VtsYVpl.js +0 -1
- package/assets/channel-DabOFIhE.js +0 -1
- package/assets/chunk-ANTBXLJU-BBGjDBcL.js +0 -1
- package/assets/chunk-FHKO5MBM-CtXgGiWs.js +0 -1
- package/assets/chunk-GLLZNHP4-CjNMxI4x.js +0 -15
- package/assets/chunk-JBRWN2VN-BIsIHCzN.js +0 -165
- package/assets/chunk-LXBSTHXV-DIuZccqv.js +0 -220
- package/assets/chunk-NRVI72HA-aKshiznA.js +0 -1
- package/assets/chunk-OMD6QJNC-DD9Oy5sh.js +0 -1
- package/assets/chunk-WVR4S24B-B9zmB2Tt.js +0 -1
- package/assets/cil-CIk1nZUD.js +0 -1
- package/assets/classDiagram-3BZAVTQC-CqX7Tp25.js +0 -1
- package/assets/classDiagram-v2-QTMF73CY-CqX7Tp25.js +0 -1
- package/assets/clike-B5tY_8Hg.js +0 -1
- package/assets/clike-CxAeib4_.js +0 -1
- package/assets/clojure-Ck0RXpbo.js +0 -1
- package/assets/clojure-DgNu_ptH.js +0 -6
- package/assets/clone-BDNFedfK.js +0 -1
- package/assets/cmake-C-DeGqDW.js +0 -1
- package/assets/cobol-DB25XrSi.js +0 -1
- package/assets/codicon-B16ygVZF.ttf +0 -0
- package/assets/coffee-DNMvp8RP.js +0 -6
- package/assets/coffeescript-B4nqUg94.js +0 -1
- package/assets/concurnas-Dn9XkZGY.js +0 -1
- package/assets/coq-Cvr3Gn8T.js +0 -1
- package/assets/core-UDSDYEIa.js +0 -8
- package/assets/cpp-BdJVwJpi.js +0 -1
- package/assets/cpp-CKhD-3M2.js +0 -1
- package/assets/cpp-DEDKHd-B.js +0 -6
- package/assets/crystal-CjID7KIv.js +0 -1
- package/assets/csharp-2ALpLYur.js +0 -1
- package/assets/csharp-BoWmgZhk.js +0 -6
- package/assets/csharp-Cd5Udg29.js +0 -1
- package/assets/cshtml-BlacgVaO.js +0 -1
- package/assets/csp-BK5qlsQ9.js +0 -6
- package/assets/csp-HMwJhbi-.js +0 -1
- package/assets/css-B2tK9wdh.js +0 -1
- package/assets/css-CF9HHZb0.js +0 -1
- package/assets/css-D1nB4Vcj.js +0 -8
- package/assets/css-extras-DeVSfTP6.js +0 -1
- package/assets/cssMode-BtnBbnNh.js +0 -9
- package/assets/csv-BD6q7LX1.js +0 -1
- package/assets/cypher-BgMoLKlv.js +0 -1
- package/assets/cypher-Bl5_yQjz.js +0 -6
- package/assets/cytoscape.esm-BQaXIfA_.js +0 -331
- package/assets/d-DbEmK-0B.js +0 -1
- package/assets/dagre-2BBEFEWP-D2XFAJFU.js +0 -4
- package/assets/dart-BVA93hyX.js +0 -6
- package/assets/dart-DkfsI3yC.js +0 -1
- package/assets/dataweave-aZYF5PNL.js +0 -1
- package/assets/dax-V2ts0ypQ.js +0 -1
- package/assets/defaultLocale-C4B-KCzX.js +0 -1
- package/assets/dhall-D3SUU5AE.js +0 -1
- package/assets/diagram-4IRLE6MV-3Ii0VW6l.js +0 -24
- package/assets/diagram-GUPCWM2R-C_bP7Q1P.js +0 -24
- package/assets/diagram-RP2FKANI-BSi4bGof.js +0 -43
- package/assets/diff-CMSY-_TM.js +0 -3
- package/assets/django-DnIhfivE.js +0 -1
- package/assets/dns-zone-file-cve-GUtw.js +0 -1
- package/assets/docker-BNsgT4ys.js +0 -1
- package/assets/dockerfile-fYe1jRYc.js +0 -6
- package/assets/dot-YI_YYuHG.js +0 -1
- package/assets/ebnf-D_RcZu_y.js +0 -1
- package/assets/ecl-Bxo8QmCt.js +0 -6
- package/assets/editorconfig-DUfFHFN4.js +0 -1
- package/assets/eiffel-D62YrVdr.js +0 -1
- package/assets/ejs-B3E9714P.js +0 -1
- package/assets/elixir-BbUoe7nZ.js +0 -6
- package/assets/elixir-wU9BuARX.js +0 -1
- package/assets/elm-GdyPUCRk.js +0 -1
- package/assets/erDiagram-HZWUO2LU-DIXDxlDs.js +0 -60
- package/assets/erb-BLfRgaP8.js +0 -1
- package/assets/erlang-oEvb0Slh.js +0 -1
- package/assets/etlua-B52BFn4o.js +0 -1
- package/assets/excel-formula-DNqVjpMr.js +0 -1
- package/assets/factor-D1OvJ8Qo.js +0 -1
- package/assets/false-Z6QQv6ID.js +0 -1
- package/assets/firestore-security-rules-DTUdd8_9.js +0 -1
- package/assets/flow-1B4ewKvb.js +0 -1
- package/assets/flow9-BKFjllYO.js +0 -6
- package/assets/flowDiagram-THRYKUMA-D3gqWW_d.js +0 -162
- package/assets/fortran-DiWKkvzE.js +0 -1
- package/assets/freemarker2-CwD6ixn2.js +0 -8
- package/assets/fsharp-Dv3_RQKY.js +0 -1
- package/assets/fsharp-ETo-tsZt.js +0 -6
- package/assets/ftl-CaaEO_Z2.js +0 -1
- package/assets/ganttDiagram-WV7ZQ7D5-C-2v9gZQ.js +0 -267
- package/assets/gap-CTp3QxAZ.js +0 -1
- package/assets/gcode-CYwYWCAy.js +0 -1
- package/assets/gdscript-YqSYr01q.js +0 -1
- package/assets/gedcom-DTNpnfmu.js +0 -1
- package/assets/gherkin-RLKHjAi5.js +0 -1
- package/assets/git-0fy9QQAU.js +0 -1
- package/assets/gitGraph-ZV4HHKMB-CjT8UBWJ.js +0 -1
- package/assets/gitGraphDiagram-OJR772UL-DRxxeQJN.js +0 -65
- package/assets/glsl-Df0XRhtW.js +0 -1
- package/assets/gml-rYpCBP8S.js +0 -1
- package/assets/gn-jKfYA_GR.js +0 -1
- package/assets/go-B-SSxtH2.js +0 -1
- package/assets/go-DzbHtIm4.js +0 -6
- package/assets/go-module-DXvSTe3J.js +0 -1
- package/assets/graph-lkROJrYf.js +0 -1
- package/assets/graphql-Btz_aicw.js +0 -1
- package/assets/graphql-k0EsSqLB.js +0 -6
- package/assets/groovy-DTiJadjC.js +0 -1
- package/assets/haml-CcDSAGW3.js +0 -1
- package/assets/handlebars-B7UUNDAM.js +0 -6
- package/assets/handlebars-CTc1FoVV.js +0 -1
- package/assets/haskell-Ba7Fn64p.js +0 -1
- package/assets/haskell-Ds42Eazu.js +0 -1
- package/assets/haxe-BOP5EevR.js +0 -1
- package/assets/hcl-Cq9v6if3.js +0 -6
- package/assets/hcl-D1BwnWLD.js +0 -1
- package/assets/hlsl-CUum5slg.js +0 -1
- package/assets/hoon-QMQpvF33.js +0 -1
- package/assets/hpkp-D6eY57p3.js +0 -1
- package/assets/hsts-C1AgjS7S.js +0 -1
- package/assets/html-D5WIHiP4.js +0 -6
- package/assets/htmlMode-DEpdNVPw.js +0 -9
- package/assets/http-id2mbfvH.js +0 -1
- package/assets/ichigojam-DykLBLF7.js +0 -1
- package/assets/icon-5DLjeVkO.js +0 -1
- package/assets/icu-message-format-BLJSLf7X.js +0 -1
- package/assets/idris-D8W8F3Du.js +0 -1
- package/assets/iecst-DFLR7w9A.js +0 -1
- package/assets/ignore-DApMeS1M.js +0 -1
- package/assets/index-Brc7moWM.js +0 -3412
- package/assets/index-COcBHp7b.css +0 -1
- package/assets/info-63CPKGFF-CMaftaLX.js +0 -1
- package/assets/infoDiagram-6WOFNB3A-DVTxejFg.js +0 -2
- package/assets/inform7-BbmmPtTe.js +0 -1
- package/assets/ini-BscO_0vf.js +0 -6
- package/assets/ini-D-w_ESm3.js +0 -1
- package/assets/init-Gi6I4Gst.js +0 -1
- package/assets/io-CL7TQcwi.js +0 -1
- package/assets/j-uqAhSNfO.js +0 -1
- package/assets/java--eXhSgxg.js +0 -1
- package/assets/java-BxMbkJZ_.js +0 -1
- package/assets/java-CtY9ZHW8.js +0 -6
- package/assets/javadoc-DLDzhXUx.js +0 -1
- package/assets/javadoclike-CcxdcZFw.js +0 -1
- package/assets/javadoclike-myFApC35.js +0 -1
- package/assets/javascript-B2YTQvHv.js +0 -1
- package/assets/javascript-D8vYUPHd.js +0 -1
- package/assets/javascript-DHOrgKX5.js +0 -6
- package/assets/javastacktrace-C2aQ6cZI.js +0 -1
- package/assets/jexl-SUbBpRa5.js +0 -1
- package/assets/jolie-DTTRmX_c.js +0 -1
- package/assets/journeyDiagram-FFXJYRFH-D4P4oZdc.js +0 -139
- package/assets/jq-CNGqc8Wl.js +0 -1
- package/assets/js-extras-BomY8GiL.js +0 -1
- package/assets/js-templates-lvNz8Eo-.js +0 -1
- package/assets/jsdoc-CizF9nqb.js +0 -1
- package/assets/json-BESjz4hO.js +0 -1
- package/assets/json-vpv-MZJY.js +0 -1
- package/assets/json5-Bszym-iC.js +0 -1
- package/assets/jsonMode-BdHvYBEq.js +0 -11
- package/assets/jsonp-K9VXfRN3.js +0 -1
- package/assets/jsstacktrace-5a-l-0QO.js +0 -1
- package/assets/jsx-CWP8P1mH.js +0 -1
- package/assets/jsx-NzQF_8Jf.js +0 -1
- package/assets/julia-DOes61nN.js +0 -6
- package/assets/julia-KpvUUzJF.js +0 -1
- package/assets/kanban-definition-KOZQBZVT-D7tMBarf.js +0 -89
- package/assets/katex-ChWnQ-fc.js +0 -261
- package/assets/keepalived-CKdrdtrU.js +0 -1
- package/assets/keyman-CFPdCbAD.js +0 -1
- package/assets/kotlin-DTDxWyre.js +0 -6
- package/assets/kotlin-tQZl0Xk0.js +0 -1
- package/assets/kumir-DbBBFKAZ.js +0 -1
- package/assets/kusto-Bkg1G97b.js +0 -1
- package/assets/latex-BrfLAxV6.js +0 -1
- package/assets/latte-DsrdWVh6.js +0 -1
- package/assets/layout-C4SVJcQz.js +0 -1
- package/assets/less-CqJAWV1X.js +0 -7
- package/assets/less-Dq-Do1xB.js +0 -1
- package/assets/lexon-BXW1vGDt.js +0 -6
- package/assets/lilypond-BASpUvho.js +0 -1
- package/assets/linear-D84iuv7z.js +0 -1
- package/assets/liquid-Co1yhavg.js +0 -1
- package/assets/liquid-D4hD-XBz.js +0 -6
- package/assets/lisp-ybAJB-FH.js +0 -1
- package/assets/livescript-DLvgD8H_.js +0 -1
- package/assets/llvm-C0anU-7N.js +0 -1
- package/assets/log-D-8B5UAA.js +0 -1
- package/assets/lolcode-OUGz_qsa.js +0 -1
- package/assets/lua-Cc6kp-D4.js +0 -1
- package/assets/lua-DER4jxlW.js +0 -1
- package/assets/lua-DLZgaSX1.js +0 -6
- package/assets/m3-CLtYU2dl.js +0 -6
- package/assets/magma-IaFf4RIf.js +0 -1
- package/assets/makefile-ChKu1MJ1.js +0 -1
- package/assets/markdown-7fQo6M4U.js +0 -6
- package/assets/markdown-DiMlCk4R.js +0 -1
- package/assets/markup-BONeskWm.js +0 -1
- package/assets/markup-CEx1cEoC.js +0 -1
- package/assets/markup-templating-BPwIASy-.js +0 -1
- package/assets/markup-templating-BxAVv-bL.js +0 -1
- package/assets/matlab-C6qGYTR2.js +0 -1
- package/assets/maxscript-CAN0xBDN.js +0 -1
- package/assets/mdx-D6NVpinB.js +0 -6
- package/assets/mel-CRG0vaFw.js +0 -1
- package/assets/mermaid-DTCIS1Vc.js +0 -1
- package/assets/mermaid-parser.core-9OWX7w7H.js +0 -129
- package/assets/min-pXLq1urb.js +0 -1
- package/assets/mindmap-definition-LNHGMQRG-DpNkhLNM.js +0 -95
- package/assets/mips-DcG9r2vI.js +0 -6
- package/assets/mizar-CTjbYK1-.js +0 -1
- package/assets/mongodb-Dwy0e7tV.js +0 -1
- package/assets/monkey-5vs-VaHV.js +0 -1
- package/assets/moonscript-fT7DerrW.js +0 -1
- package/assets/msdax-DN__iVzl.js +0 -6
- package/assets/mysql-05d2lfAy.js +0 -6
- package/assets/n1ql-CyDT-nbG.js +0 -1
- package/assets/n4js-Dmgj3bgd.js +0 -1
- package/assets/nand2tetris-hdl-BPfjS0pS.js +0 -1
- package/assets/naniscript-AIaG6VzF.js +0 -1
- package/assets/nasm-CtaUAK1B.js +0 -1
- package/assets/neon-BGH8Px8Z.js +0 -1
- package/assets/nevod-DKwg2dRw.js +0 -1
- package/assets/nginx-CUZ2OZRs.js +0 -1
- package/assets/nim-DYHpidb8.js +0 -1
- package/assets/nix-DJt2Qxmn.js +0 -1
- package/assets/nsis-Bp97AH1A.js +0 -1
- package/assets/objective-c-B_h_kxCB.js +0 -6
- package/assets/objectivec-DXwXxEEr.js +0 -1
- package/assets/ocaml-alwbEKNU.js +0 -1
- package/assets/opencl-2tlv9GXY.js +0 -1
- package/assets/openqasm-DQQ8Eb1t.js +0 -1
- package/assets/ordinal-Cboi1Yqb.js +0 -1
- package/assets/oz-CmR9PjHE.js +0 -1
- package/assets/packet-HUATNLJX-Df0K9_iv.js +0 -1
- package/assets/parigp-n8ycxTI2.js +0 -1
- package/assets/parser-Bcvfazvc.js +0 -1
- package/assets/pascal-Bc-8SB3K.js +0 -6
- package/assets/pascal-CFHsej71.js +0 -1
- package/assets/pascaligo-C8kSNPDA.js +0 -1
- package/assets/pascaligo-Dcwo06z5.js +0 -6
- package/assets/pcaxis-L1qB_TA8.js +0 -1
- package/assets/peoplecode-B3ZIbHRe.js +0 -1
- package/assets/perl-B4wSx8tF.js +0 -1
- package/assets/perl-BnGpdHsN.js +0 -6
- package/assets/pgsql-DfVleuq_.js +0 -6
- package/assets/php-CH5O-_gG.js +0 -6
- package/assets/php-Cp0BohX-.js +0 -1
- package/assets/php-extras-D_l2V9st.js +0 -1
- package/assets/php-iTdQntIy.js +0 -1
- package/assets/phpdoc-CK9N3DqC.js +0 -1
- package/assets/pie-WTHONI2E-D2V4EPkW.js +0 -1
- package/assets/pieDiagram-DBDJKBY4-CtSiPn-U.js +0 -30
- package/assets/pla-BUVXxyGx.js +0 -6
- package/assets/plsql-C1Z_R7C0.js +0 -1
- package/assets/postiats-DSt55phJ.js +0 -6
- package/assets/powerquery-2KNS9mh4.js +0 -6
- package/assets/powerquery-Cj9zzkL_.js +0 -1
- package/assets/powershell-BMCDkE8B.js +0 -1
- package/assets/powershell-CCS0rx-A.js +0 -6
- package/assets/processing-DOu9EyQL.js +0 -1
- package/assets/prolog-BDx-mKYw.js +0 -1
- package/assets/promql-CyuJUGgC.js +0 -1
- package/assets/properties-Cz9SwuSc.js +0 -1
- package/assets/protobuf-5lyCd6Ku.js +0 -7
- package/assets/protobuf-BCLdPaZg.js +0 -1
- package/assets/psl-BVzbXOmp.js +0 -1
- package/assets/pug-Dg4O54Js.js +0 -6
- package/assets/pug-PBVvhxsU.js +0 -1
- package/assets/puppet-Bp5J_Xf6.js +0 -1
- package/assets/pure-BEODe8Ty.js +0 -1
- package/assets/purebasic-g8QwRKk9.js +0 -1
- package/assets/purescript-UFsBai8q.js +0 -1
- package/assets/python-BEpwHjuW.js +0 -6
- package/assets/python-cW1cr4Xe.js +0 -1
- package/assets/q-CuXsyoDM.js +0 -1
- package/assets/qml-NgPknFa-.js +0 -1
- package/assets/qore-C0g-7ava.js +0 -1
- package/assets/qsharp-BHSA_OC9.js +0 -6
- package/assets/qsharp-BrQJYopz.js +0 -1
- package/assets/quadrantDiagram-YPSRARAO-fpN7laT8.js +0 -7
- package/assets/r-DBvxNhD8.js +0 -6
- package/assets/r-ivB35FJi.js +0 -1
- package/assets/racket-D6952iA-.js +0 -1
- package/assets/radar-NJJJXTRR-Bh0TcAtk.js +0 -1
- package/assets/razor-COaKzAih.js +0 -6
- package/assets/reason-BxyJj1Wv.js +0 -1
- package/assets/redis-mBNZiS5I.js +0 -6
- package/assets/redshift-gtd9hS2x.js +0 -6
- package/assets/reduce-CEguFi6x.js +0 -1
- package/assets/regex-UCZUa98R.js +0 -1
- package/assets/rego-D5bYSBEk.js +0 -1
- package/assets/renpy-DTdz45My.js +0 -1
- package/assets/requirementDiagram-EGVEC5DT-C2aVrzw7.js +0 -64
- package/assets/rest-BxrDSOtP.js +0 -1
- package/assets/restructuredtext-45Xf76JB.js +0 -6
- package/assets/rip-CvJDF04l.js +0 -1
- package/assets/roboconf-DpPdQtT6.js +0 -1
- package/assets/robotframework-CvzHhnGx.js +0 -1
- package/assets/roboto-cyrillic-400-normal-C5q4FMUG.woff +0 -0
- package/assets/roboto-cyrillic-400-normal-DAIM1_dR.woff2 +0 -0
- package/assets/roboto-cyrillic-ext-400-normal-5IDvadIC.woff +0 -0
- package/assets/roboto-cyrillic-ext-400-normal-DzMWdK87.woff2 +0 -0
- package/assets/roboto-greek-400-normal-DwVopRQH.woff +0 -0
- package/assets/roboto-greek-400-normal-jFM2czAU.woff2 +0 -0
- package/assets/roboto-latin-400-normal-BX2H0A0_.woff +0 -0
- package/assets/roboto-latin-400-normal-CNwBRw8h.woff2 +0 -0
- package/assets/roboto-latin-ext-400-normal-BG57dRWO.woff +0 -0
- package/assets/roboto-latin-ext-400-normal-ZYmyxeOy.woff2 +0 -0
- package/assets/roboto-math-400-normal-B3wgz80t.woff2 +0 -0
- package/assets/roboto-math-400-normal-BRMeFL5Z.woff +0 -0
- package/assets/roboto-symbols-400-normal-B2LMqLB2.woff +0 -0
- package/assets/roboto-symbols-400-normal-fF1SLJBj.woff2 +0 -0
- package/assets/roboto-vietnamese-400-normal-BYP5tVVv.woff +0 -0
- package/assets/roboto-vietnamese-400-normal-CDDxGrUb.woff2 +0 -0
- package/assets/ruby-BYts9dao.js +0 -1
- package/assets/ruby-CEgcCkh9.js +0 -6
- package/assets/ruby-DYsn9XfW.js +0 -1
- package/assets/rust-BChN5uNh.js +0 -6
- package/assets/rust-DhU6TFsm.js +0 -1
- package/assets/sankeyDiagram-HRAUVNP4-4oZDeCaD.js +0 -10
- package/assets/sas-ChhKHWGM.js +0 -1
- package/assets/sass-C57bJt_A.js +0 -1
- package/assets/sb-5vPrUWN-.js +0 -6
- package/assets/scala-BQOorN7X.js +0 -6
- package/assets/scala-Cg28kNry.js +0 -1
- package/assets/scheme-Bpk-KLc_.js +0 -1
- package/assets/scheme-Cscf027c.js +0 -1
- package/assets/scheme-DkJ87xtR.js +0 -6
- package/assets/scss-BeU7qozo.js +0 -1
- package/assets/scss-CpPOP9XS.js +0 -8
- package/assets/sequenceDiagram-WFGC7UMF-BS5S-iIx.js +0 -122
- package/assets/shell-BHhUv290.js +0 -6
- package/assets/shell-session-N4BUyO5b.js +0 -1
- package/assets/smali-OZwkp_pU.js +0 -1
- package/assets/smalltalk-Bgd8uXdt.js +0 -1
- package/assets/smarty-BbqdJT5w.js +0 -1
- package/assets/sml-DbDOAWsQ.js +0 -1
- package/assets/solidity-BFcLIl1x.js +0 -6
- package/assets/solidity-DkQCaL_X.js +0 -1
- package/assets/solution-file-DFlRPhIk.js +0 -1
- package/assets/sophia-z0tjJxhY.js +0 -6
- package/assets/soy-CqM5aRME.js +0 -1
- package/assets/sparql-B1GALy7V.js +0 -1
- package/assets/sparql-BTJymgeb.js +0 -6
- package/assets/splunk-spl-DrNqni3-.js +0 -1
- package/assets/sqf-BeBvdmXG.js +0 -1
- package/assets/sql-BFyYaP5s.js +0 -6
- package/assets/sql-CJATM1Qp.js +0 -1
- package/assets/sql-CtDLgxfq.js +0 -1
- package/assets/squirrel-COkcd8Tr.js +0 -1
- package/assets/st-DZS1F9ME.js +0 -6
- package/assets/stan-C1_hogQu.js +0 -1
- package/assets/stateDiagram-UUKSUZ4H-Cb3qH3Cy.js +0 -1
- package/assets/stateDiagram-v2-EYPG3UTE-BzEwA6K7.js +0 -1
- package/assets/stylus-Dw8891LS.js +0 -1
- package/assets/swift-B97O9HHR.js +0 -1
- package/assets/swift-BwlyOzQq.js +0 -8
- package/assets/systemd-CUtXAwEb.js +0 -2
- package/assets/systemverilog-DJsb8r0W.js +0 -6
- package/assets/t4-cs-CyYMVAUn.js +0 -1
- package/assets/t4-templating-B5EzSFYT.js +0 -1
- package/assets/t4-templating-Du1KIrkv.js +0 -1
- package/assets/t4-vb-Pwd8zhQY.js +0 -1
- package/assets/tap-C5-eahra.js +0 -1
- package/assets/tcl-CQrWCRuJ.js +0 -1
- package/assets/tcl-CjHYkh5E.js +0 -6
- package/assets/textile-CyJk6SWo.js +0 -1
- package/assets/timeline-definition-3HZDQTIS-DaBjiVZ7.js +0 -61
- package/assets/toml-Cact8Vna.js +0 -1
- package/assets/treemap-75Q7IDZK-BZoUJEBa.js +0 -1
- package/assets/tremor-BBmidx_C.js +0 -1
- package/assets/tsMode-DjkyL1AP.js +0 -16
- package/assets/tsx-BFgSfn5D.js +0 -1
- package/assets/tt2-CG-UIBmK.js +0 -1
- package/assets/turtle-DigfRE97.js +0 -1
- package/assets/turtle-Ro1R6Je7.js +0 -1
- package/assets/twig-CmYTg8Iu.js +0 -6
- package/assets/twig-PmY_cDoq.js +0 -1
- package/assets/typescript-CVO-8GEc.js +0 -1
- package/assets/typescript-Da47IE7f.js +0 -1
- package/assets/typescript-DgKm9t07.js +0 -6
- package/assets/typespec-Dwv00aWl.js +0 -6
- package/assets/typoscript-CgZr5jEZ.js +0 -1
- package/assets/unrealscript-BI_pn0rK.js +0 -1
- package/assets/uorazor-C7IhUkD6.js +0 -1
- package/assets/uri-BP2d8Ze2.js +0 -1
- package/assets/v-B9O-tbsS.js +0 -1
- package/assets/vala-CS5ZRPeA.js +0 -1
- package/assets/vb-BjPEumh4.js +0 -6
- package/assets/vbnet-B0hx3qRp.js +0 -1
- package/assets/vbnet-BhrUc4aD.js +0 -1
- package/assets/velocity-QemisC16.js +0 -1
- package/assets/verilog-jjjMAm_Y.js +0 -1
- package/assets/vhdl-B9EszVuj.js +0 -1
- package/assets/vim-CxDlf-dr.js +0 -1
- package/assets/visual-basic-CfhBm1gF.js +0 -1
- package/assets/warpscript-DL5ToBao.js +0 -1
- package/assets/wasm-C5WawCVZ.js +0 -1
- package/assets/web-idl-DWKDo7hm.js +0 -1
- package/assets/wgsl-Bp8RP3jd.js +0 -303
- package/assets/wiki-BHpSxg4K.js +0 -1
- package/assets/wolfram-C_oBzCJW.js +0 -1
- package/assets/wren-CA1nFGqi.js +0 -1
- package/assets/xeora-BtUuVarv.js +0 -1
- package/assets/xml-BBqGkZMk.js +0 -6
- package/assets/xml-doc-DhUg29aH.js +0 -1
- package/assets/xojo-BmgifBv1.js +0 -1
- package/assets/xquery-7FfNXUZg.js +0 -1
- package/assets/xychartDiagram-FDP5SA34-DlWJl-YC.js +0 -7
- package/assets/yaml-BOp0Lh0S.js +0 -1
- package/assets/yaml-C8j_iwGJ.js +0 -6
- package/assets/yaml-pHjxJgpq.js +0 -1
- package/assets/yang-CLUWUZcf.js +0 -1
- package/assets/zig-DdXASuyK.js +0 -1
- package/branding/howler/favicon.svg +0 -38
- package/branding/howler/name-dark.svg +0 -21
- package/branding/howler/name-light.svg +0 -21
- package/branding/howler/noswoosh-dark.svg +0 -24
- package/branding/howler/noswoosh-light.svg +0 -28
- package/branding/howler/swoosh-dark.svg +0 -41
- package/branding/howler/swoosh-light.svg +0 -45
- package/components/routes/help/markdown/en/actionIntroduction.md.js +0 -1
- package/components/routes/help/markdown/en/authentication.md.js +0 -1
- package/components/routes/help/markdown/en/bundles.md.js +0 -1
- package/components/routes/help/markdown/en/client.md.js +0 -1
- package/components/routes/help/markdown/en/links.md.js +0 -1
- package/components/routes/help/markdown/en/notebook.md.js +0 -1
- package/components/routes/help/markdown/en/retention.md.js +0 -1
- package/components/routes/help/markdown/en/schema.md.js +0 -1
- package/components/routes/help/markdown/en/templates.md.js +0 -1
- package/components/routes/help/markdown/en/views.md.js +0 -1
- package/components/routes/help/markdown/fr/actionIntroduction.md.js +0 -1
- package/components/routes/help/markdown/fr/authentication.md.js +0 -1
- package/components/routes/help/markdown/fr/bundles.md.js +0 -1
- package/components/routes/help/markdown/fr/client.md.js +0 -1
- package/components/routes/help/markdown/fr/links.md.js +0 -1
- package/components/routes/help/markdown/fr/notebook.md.js +0 -1
- package/components/routes/help/markdown/fr/retention.md.js +0 -1
- package/components/routes/help/markdown/fr/schema.md.js +0 -1
- package/components/routes/help/markdown/fr/templates.md.js +0 -1
- package/components/routes/help/markdown/fr/views.md.js +0 -1
- package/components/routes/overviews/template/en.md.js +0 -1
- package/components/routes/overviews/template/fr.md.js +0 -1
- package/images/doggie.png +0 -0
- package/index.html +0 -24
- package/manifest.json +0 -16
- package/robots.txt +0 -3
- package/scripts/background.js +0 -14
- package/serve.json +0 -14
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { isEmpty, isNull, isUndefined, omitBy, pickBy } from 'lodash-es';
|
|
2
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { useLocation, useParams, useSearchParams } from 'react-router-dom';
|
|
5
|
+
import { createContext, useContextSelector } from 'use-context-selector';
|
|
6
|
+
import Throttler from 'utils/Throttler';
|
|
7
|
+
|
|
8
|
+
interface ParameterProviderType {
|
|
9
|
+
selected?: string;
|
|
10
|
+
query?: string;
|
|
11
|
+
offset: number;
|
|
12
|
+
trackTotalHits: boolean;
|
|
13
|
+
sort?: string;
|
|
14
|
+
span?: string;
|
|
15
|
+
filter?: string;
|
|
16
|
+
startDate?: string;
|
|
17
|
+
endDate?: string;
|
|
18
|
+
|
|
19
|
+
setSelected: (id: string) => void;
|
|
20
|
+
setQuery: (id: string) => void;
|
|
21
|
+
setOffset: (offset: string | number) => void;
|
|
22
|
+
setSort: (sort: string) => void;
|
|
23
|
+
setSpan: (span: string) => void;
|
|
24
|
+
setFilter: (filter: string) => void;
|
|
25
|
+
setCustomSpan: (startDate: string, endDate: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface SearchValues {
|
|
29
|
+
selected: string;
|
|
30
|
+
query: string;
|
|
31
|
+
sort: string;
|
|
32
|
+
span: string;
|
|
33
|
+
filter: string;
|
|
34
|
+
startDate: string;
|
|
35
|
+
endDate: string;
|
|
36
|
+
offset: number;
|
|
37
|
+
trackTotalHits: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const ParameterContext = createContext<ParameterProviderType>(null);
|
|
41
|
+
|
|
42
|
+
const DEFAULT_VALUES = {
|
|
43
|
+
query: 'howler.id:*',
|
|
44
|
+
sort: 'event.created desc',
|
|
45
|
+
span: 'date.range.1.month'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const WRITE_THROTTLER = new Throttler(100);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Helper function to convert a number/string representation of a number into a valid offset.
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
const parseOffset = (_offset: string | number) => {
|
|
55
|
+
if (typeof _offset === 'number') {
|
|
56
|
+
return _offset;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const candidate = parseInt(_offset);
|
|
60
|
+
return isNaN(candidate) ? 0 : candidate;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Context responsible for tracking updates to query operations in hit and view search.
|
|
65
|
+
*/
|
|
66
|
+
const ParameterProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
67
|
+
const location = useLocation();
|
|
68
|
+
const routeParams = useParams();
|
|
69
|
+
const [params, setParams] = useSearchParams();
|
|
70
|
+
|
|
71
|
+
const pendingChanges = useRef<Partial<SearchValues>>({});
|
|
72
|
+
|
|
73
|
+
const [values, _setValues] = useState<SearchValues>({
|
|
74
|
+
selected: params.get('selected'),
|
|
75
|
+
query: params.get('query') ?? DEFAULT_VALUES.query,
|
|
76
|
+
sort: params.get('sort') ?? DEFAULT_VALUES.sort,
|
|
77
|
+
span: params.get('span') ?? DEFAULT_VALUES.span,
|
|
78
|
+
filter: params.get('filter'),
|
|
79
|
+
startDate: params.get('start_date'),
|
|
80
|
+
endDate: params.get('end_date'),
|
|
81
|
+
offset: parseOffset(params.get('offset')),
|
|
82
|
+
trackTotalHits: (params.get('track_total_hits') ?? 'false') !== 'false'
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// TODO: SELECTING A BUNDLE STILL CAUSES A FREAKOUT
|
|
86
|
+
|
|
87
|
+
const set = useCallback(
|
|
88
|
+
(key: keyof SearchValues) => value => {
|
|
89
|
+
if (value === values[key]) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (key === 'selected' && !value && location.pathname.startsWith('/bundles')) {
|
|
94
|
+
pendingChanges.current[key] = routeParams.id;
|
|
95
|
+
} else {
|
|
96
|
+
(pendingChanges.current as any)[key] = value ?? DEFAULT_VALUES[key] ?? null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (key === 'span' && !value.endsWith('custom')) {
|
|
100
|
+
pendingChanges.current.startDate = null;
|
|
101
|
+
pendingChanges.current.endDate = null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
WRITE_THROTTLER.debounce(() => {
|
|
105
|
+
_setValues(_current => ({ ..._current, ...pendingChanges.current }));
|
|
106
|
+
pendingChanges.current = {};
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
[location.pathname, routeParams.id, values]
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const setOffset: ParameterProviderType['setOffset'] = useCallback(
|
|
113
|
+
_offset => _setValues(_current => ({ ..._current, offset: parseOffset(_offset) })),
|
|
114
|
+
[]
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const setCustomSpan: ParameterProviderType['setCustomSpan'] = useCallback((startDate, endDate) => {
|
|
118
|
+
_setValues(_values => ({
|
|
119
|
+
..._values,
|
|
120
|
+
startDate,
|
|
121
|
+
endDate
|
|
122
|
+
}));
|
|
123
|
+
}, []);
|
|
124
|
+
|
|
125
|
+
const getDiff = useCallback(
|
|
126
|
+
(operation: 'read' | 'write') => {
|
|
127
|
+
/**
|
|
128
|
+
* A record of changes necessary to synchronize the query string and the internal values store.
|
|
129
|
+
*/
|
|
130
|
+
const changes: Partial<SearchValues> = {};
|
|
131
|
+
|
|
132
|
+
const standardKeys = [
|
|
133
|
+
['query', values.query],
|
|
134
|
+
['sort', values.sort],
|
|
135
|
+
['span', values.span],
|
|
136
|
+
['filter', values.filter],
|
|
137
|
+
['start_date', values.startDate],
|
|
138
|
+
['end_date', values.endDate]
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
standardKeys.forEach(([key, value]) => {
|
|
142
|
+
// Get the value from the URL, using the default values as fallback (and set to undefined if neither is set)
|
|
143
|
+
const fromSearchWithFallback = params.has(key) ? params.get(key) : (DEFAULT_VALUES[key] ?? undefined);
|
|
144
|
+
|
|
145
|
+
// If there's a difference between the search value and the value in the internal store, we append the key and new value to changes
|
|
146
|
+
// This is based on the operation
|
|
147
|
+
if (fromSearchWithFallback !== value) {
|
|
148
|
+
changes[key] = operation === 'write' ? value : fromSearchWithFallback;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// This is where things get a bit tricky. We use the fact that undefined and null are different concepts in Javascript here
|
|
152
|
+
// "undefined" is later filtered out, meaning "no change", while null means "remove this value"
|
|
153
|
+
if (operation === 'write') {
|
|
154
|
+
// If the change is to just set it to default in the query string, set it to null to just remove that entry altogether
|
|
155
|
+
// Due to the DEFAULT_VALUES check in fromSearchWithFallback above, this will use the defeault value.
|
|
156
|
+
// i.e., this has the same effect, but cleans up the query string
|
|
157
|
+
if (params.has(key) && !isUndefined(changes[key]) && changes[key] === DEFAULT_VALUES[key]) {
|
|
158
|
+
changes[key] = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Logic for the selected key - this can vary depending on the context
|
|
164
|
+
if (operation === 'write') {
|
|
165
|
+
// Are we in a bundle, with a selected parameter?
|
|
166
|
+
// If so, does it match the bundle ID? If so, it's redundant and should be removed
|
|
167
|
+
if (
|
|
168
|
+
location.pathname.startsWith('/bundles') &&
|
|
169
|
+
(!params.has('selected') || values.selected === params.get('selected'))
|
|
170
|
+
) {
|
|
171
|
+
changes.selected = null;
|
|
172
|
+
} else {
|
|
173
|
+
// We're either not in a bundle, or in a bundle and a hit different from the main bundle is selected
|
|
174
|
+
changes.selected = values.selected;
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
if (params.has('selected')) {
|
|
178
|
+
// If we have a selected hit, that's the selected value to use
|
|
179
|
+
changes.selected = params.get('selected');
|
|
180
|
+
} else if (location.pathname.startsWith('/bundles')) {
|
|
181
|
+
// If not, fallback to the bundle ID
|
|
182
|
+
changes.selected = routeParams.id;
|
|
183
|
+
} else {
|
|
184
|
+
// Otherwise nothing has been selected
|
|
185
|
+
changes.selected = null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (parseOffset(params.get('offset')) !== values.offset) {
|
|
190
|
+
changes.offset = operation === 'write' ? values.offset : parseOffset(params.get('offset'));
|
|
191
|
+
|
|
192
|
+
// Same deal - if offset is 0, just remove it entirely (it'll default to 0 offset)
|
|
193
|
+
if (operation === 'write' && !changes.offset) {
|
|
194
|
+
changes.offset = null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// This is where we check for what has actually changed against the given store
|
|
199
|
+
// We first omit undefined keys (fromSearchWithFallback can introduce these)
|
|
200
|
+
// Then we omit any values that already match the store we're updating
|
|
201
|
+
// (query string or internal state).
|
|
202
|
+
return omitBy(omitBy(changes, isUndefined), (val, key) =>
|
|
203
|
+
operation === 'write' ? val == params.get(key) : val == values[key]
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
[values, params, location.pathname, routeParams.id]
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Effect to synchronize the context's state with the address bar
|
|
211
|
+
*/
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
const changes = getDiff('write');
|
|
214
|
+
|
|
215
|
+
if (!isEmpty(changes)) {
|
|
216
|
+
const existingParams = Object.fromEntries(params.entries());
|
|
217
|
+
|
|
218
|
+
setParams(
|
|
219
|
+
_params => {
|
|
220
|
+
const newParams = new URLSearchParams({ ...existingParams, ...(changes as Record<string, string>) });
|
|
221
|
+
|
|
222
|
+
Object.entries(pickBy(changes, isNull)).forEach(([key]) => newParams.delete(key));
|
|
223
|
+
|
|
224
|
+
return newParams;
|
|
225
|
+
},
|
|
226
|
+
{ replace: !changes.query && !Object.keys(changes).includes('offset') }
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
230
|
+
}, [values]);
|
|
231
|
+
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
const changes = getDiff('read');
|
|
234
|
+
|
|
235
|
+
if (!isEmpty(changes)) {
|
|
236
|
+
_setValues(_current => ({
|
|
237
|
+
..._current,
|
|
238
|
+
...changes
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
242
|
+
}, [location.search, location.pathname, routeParams.id]);
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<ParameterContext.Provider
|
|
246
|
+
value={{
|
|
247
|
+
...values,
|
|
248
|
+
|
|
249
|
+
setOffset,
|
|
250
|
+
setCustomSpan,
|
|
251
|
+
|
|
252
|
+
setSelected: useMemo(() => set('selected'), [set]),
|
|
253
|
+
setQuery: useMemo(() => set('query'), [set]),
|
|
254
|
+
setSort: useMemo(() => set('sort'), [set]),
|
|
255
|
+
setSpan: useMemo(() => set('span'), [set]),
|
|
256
|
+
setFilter: useMemo(() => set('filter'), [set])
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
{children}
|
|
260
|
+
</ParameterContext.Provider>
|
|
261
|
+
);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const useParameterContextSelector = <Selected,>(
|
|
265
|
+
selector: (value: ParameterProviderType) => Selected
|
|
266
|
+
): Selected => {
|
|
267
|
+
return useContextSelector<ParameterProviderType, Selected>(ParameterContext, selector);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export default ParameterProvider;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import api from 'api';
|
|
3
|
+
import useMyLocalStorage from 'components/hooks/useMyLocalStorage';
|
|
4
|
+
import type { PropsWithChildren } from 'react';
|
|
5
|
+
import { createContext, useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { StorageKey } from 'utils/constants';
|
|
7
|
+
import { getStored, setAxiosCache, setStored } from 'utils/sessionStorage';
|
|
8
|
+
import { isHitUpdate } from 'utils/socketUtils';
|
|
9
|
+
|
|
10
|
+
export type ListenerType<K extends keyof WebSocketEventMap> = (this: WebSocket, ev: WebSocketEventMap[K]) => void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The type of the data returned from the server during a WebSocket connection.
|
|
14
|
+
* The only guaranteed keys are error, message and status.
|
|
15
|
+
*/
|
|
16
|
+
export type RecievedDataType<T = { [index: string]: any }> = T & {
|
|
17
|
+
error: boolean;
|
|
18
|
+
message: string;
|
|
19
|
+
type: string;
|
|
20
|
+
status: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Enum to help track the status of the Websocket, since the corresponding websocket enums are directly on the object
|
|
25
|
+
*/
|
|
26
|
+
export enum Status {
|
|
27
|
+
CLOSED = WebSocket.CLOSED,
|
|
28
|
+
CLOSING = WebSocket.CLOSING,
|
|
29
|
+
CONNECTING = WebSocket.CONNECTING,
|
|
30
|
+
OPEN = WebSocket.OPEN
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface SocketContextType {
|
|
34
|
+
/**
|
|
35
|
+
* Add a listener for events from the websocket connection.
|
|
36
|
+
* @param key The unique key used to track this listener
|
|
37
|
+
* @param v The listener function
|
|
38
|
+
*/
|
|
39
|
+
addListener: <T = { [index: string]: any }>(key: string, v: (data: RecievedDataType<T>) => void) => void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Remove a listener from the websocket connection.
|
|
43
|
+
* @param key The unique key used to track the listener we're removing
|
|
44
|
+
*/
|
|
45
|
+
removeListener: (key: string) => void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Wrapper function for WebSocket.send(...). Used to send data to the server.
|
|
49
|
+
*/
|
|
50
|
+
emit: (data: any) => void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The status of the websocket connection.
|
|
54
|
+
*/
|
|
55
|
+
status: Status;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Manually attempt reconnecting to the server.
|
|
59
|
+
*/
|
|
60
|
+
reconnect: () => void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to tell if the socket is open
|
|
64
|
+
*/
|
|
65
|
+
isOpen: () => boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const SocketContext = createContext<SocketContextType>(null);
|
|
69
|
+
|
|
70
|
+
const SocketProvider: React.FC<PropsWithChildren> = ({ children }) => {
|
|
71
|
+
const { get } = useMyLocalStorage();
|
|
72
|
+
|
|
73
|
+
// In order to persist the connection through state changes, we use a ref
|
|
74
|
+
const socket = useRef<WebSocket>();
|
|
75
|
+
|
|
76
|
+
// Due to react setState race conditions, listeners are also stored in a ref
|
|
77
|
+
const listeners = useRef<{ [index: string]: ListenerType<'message'> }>({});
|
|
78
|
+
|
|
79
|
+
// We will need to use the app token to authenticate.
|
|
80
|
+
// Note the token MUST BE either an app token or a JWT - user/pass or apikey authentication isn't allowed
|
|
81
|
+
const appToken = get<string>(StorageKey.APP_TOKEN);
|
|
82
|
+
|
|
83
|
+
const [status, setStatus] = useState<Status>(Status.CLOSED);
|
|
84
|
+
// Track whether we should retry the connection to the server
|
|
85
|
+
const [retry, setRetry] = useState(true);
|
|
86
|
+
// Track the number of failed attempts when connecting to the server
|
|
87
|
+
const [failedAttempts, setFailedAttempts] = useState(0);
|
|
88
|
+
|
|
89
|
+
const onClose: ListenerType<'close'> = useCallback(
|
|
90
|
+
e => {
|
|
91
|
+
// https://www.rfc-editor.org/rfc/rfc6455:
|
|
92
|
+
// 1006 is a reserved value and MUST NOT be set as a status code in a
|
|
93
|
+
// Close control frame by an endpoint. It is designated for use in
|
|
94
|
+
// applications expecting a status code to indicate that the
|
|
95
|
+
// connection was closed abnormally, e.g., without sending or
|
|
96
|
+
// receiving a Close control frame.
|
|
97
|
+
if (e.code === 1006) {
|
|
98
|
+
setTimeout(() => setRetry(true), 1000 * Math.pow(2, failedAttempts));
|
|
99
|
+
setFailedAttempts(failedAttempts + 1);
|
|
100
|
+
}
|
|
101
|
+
// https://www.rfc-editor.org/rfc/rfc6455:
|
|
102
|
+
// 1008 indicates that an endpoint is terminating the connection
|
|
103
|
+
// because it has received a message that violates its policy. This
|
|
104
|
+
// is a generic status code that can be returned when there is no
|
|
105
|
+
// other more suitable status code (e.g., 1003 or 1009) or if there
|
|
106
|
+
// is a need to hide specific details about the policy.
|
|
107
|
+
//
|
|
108
|
+
// In our case, we use 1008 to indicate the connection did something wrong.
|
|
109
|
+
// For more granular error handling, we provide a status code equivalent
|
|
110
|
+
// To the HTTP status codes we know (400, 401, 403, etc.).
|
|
111
|
+
else if (e.code === 1008) {
|
|
112
|
+
try {
|
|
113
|
+
// Check to see if there's any data we can parse, or if it's just a bad connection
|
|
114
|
+
const data: RecievedDataType = JSON.parse(e.reason);
|
|
115
|
+
|
|
116
|
+
// If we are unauthorized, we can update the token through the usual process and tell
|
|
117
|
+
// the connection to retry with the new token
|
|
118
|
+
if (data.status === 401) {
|
|
119
|
+
api.user.whoami.get().then(() => setRetry(true));
|
|
120
|
+
} else {
|
|
121
|
+
console.error(data);
|
|
122
|
+
setRetry(false);
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
// There's no useful data, or the refresh attempt failed.
|
|
126
|
+
// Either way, we can't really do anything
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
setStatus(Status.CLOSED);
|
|
131
|
+
},
|
|
132
|
+
[failedAttempts]
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Handler for errors with the websocket connection
|
|
137
|
+
*/
|
|
138
|
+
const onWsError: ListenerType<'error'> = useCallback(() => {
|
|
139
|
+
setStatus(Status.CLOSING);
|
|
140
|
+
socket.current?.close();
|
|
141
|
+
setStatus(Status.CLOSED);
|
|
142
|
+
|
|
143
|
+
// Exponential fall off of connection attempts (1s, then 2, 4, 8, 16, etc.)
|
|
144
|
+
setTimeout(() => setRetry(true), 1000 * Math.pow(2, failedAttempts));
|
|
145
|
+
setFailedAttempts(failedAttempts + 1);
|
|
146
|
+
}, [failedAttempts]);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Handler for messages sent form the server NOT RELATED to the websocket connection itself
|
|
150
|
+
*
|
|
151
|
+
* i.e. We sent bad data, did something the server didn't like, etc.
|
|
152
|
+
*/
|
|
153
|
+
const onMessageError: ListenerType<'message'> = useCallback(e => {
|
|
154
|
+
try {
|
|
155
|
+
const data: RecievedDataType = JSON.parse(e.data);
|
|
156
|
+
|
|
157
|
+
if (data?.error || data?.status >= 400) {
|
|
158
|
+
console.warn(data?.message || 'Websocket Error');
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
console.warn('Websocket Error');
|
|
162
|
+
}
|
|
163
|
+
}, []);
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Handler called when the page unloads, used to gracefully close the socket.
|
|
167
|
+
*
|
|
168
|
+
* This isn't a hard requirement to run, but it's good form.
|
|
169
|
+
*/
|
|
170
|
+
const onBeforeUnload = useCallback(() => socket.current?.close(), []);
|
|
171
|
+
|
|
172
|
+
// Effect used to start a connection to the websocket server
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
// If the socket is already open, ovbviously we don't need to connect again
|
|
175
|
+
if ([Status.OPEN, Status.CONNECTING].includes(status)) {
|
|
176
|
+
if (status === Status.OPEN) {
|
|
177
|
+
setRetry(false);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// If we aren't retrying or we don't have an app token we can use, we don't continue
|
|
184
|
+
if (!retry || !appToken) return;
|
|
185
|
+
|
|
186
|
+
setRetry(false);
|
|
187
|
+
|
|
188
|
+
// Here we go!
|
|
189
|
+
setStatus(Status.CONNECTING);
|
|
190
|
+
|
|
191
|
+
const host = window.location.host.includes('localhost') ? 'localhost:5000' : window.location.host;
|
|
192
|
+
const protocol = window.location.protocol.startsWith('http:') ? 'ws' : 'wss';
|
|
193
|
+
const ws = new WebSocket(`${protocol}://${host}/socket/v1/connect`);
|
|
194
|
+
|
|
195
|
+
// Add our listeners to the websocket
|
|
196
|
+
ws.addEventListener('close', onClose);
|
|
197
|
+
ws.addEventListener('error', onWsError);
|
|
198
|
+
ws.addEventListener('message', onMessageError);
|
|
199
|
+
|
|
200
|
+
ws.addEventListener('open', () => {
|
|
201
|
+
socket.current = ws;
|
|
202
|
+
|
|
203
|
+
// Hooray! The connection was successful.
|
|
204
|
+
// But we aren't done yet - we need to authenticate before doing anything else.
|
|
205
|
+
// So, we send the token
|
|
206
|
+
ws.send(appToken);
|
|
207
|
+
|
|
208
|
+
// Just for this first response, we add a custom listener to the socket.
|
|
209
|
+
// It waits for a response from our token message, and ensures the server accepted it
|
|
210
|
+
const onAuth: ListenerType<'message'> = e => {
|
|
211
|
+
ws.removeEventListener('message', onAuth);
|
|
212
|
+
|
|
213
|
+
const data: RecievedDataType = JSON.parse(e.data);
|
|
214
|
+
|
|
215
|
+
// If there's no error, the token was accepted and we're good to go!
|
|
216
|
+
if (!data.error) {
|
|
217
|
+
console.debug(data.message);
|
|
218
|
+
setStatus(Status.OPEN);
|
|
219
|
+
setRetry(false);
|
|
220
|
+
setFailedAttempts(0);
|
|
221
|
+
|
|
222
|
+
// If there is, the server will close the socket and the token refreshing code will take over
|
|
223
|
+
} else {
|
|
224
|
+
console.error(data.message);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
ws.addEventListener('message', onAuth);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
window.addEventListener('beforeunload', onBeforeUnload);
|
|
232
|
+
}, [appToken, status, onBeforeUnload, onClose, onWsError, onMessageError, retry]);
|
|
233
|
+
|
|
234
|
+
// Handler for when the socket opens
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
// The socket is open, so we can add any listeners that were waiting for it to open
|
|
237
|
+
if (status === Status.OPEN) {
|
|
238
|
+
Object.values(listeners.current).forEach(l => {
|
|
239
|
+
socket.current?.removeEventListener('message', l);
|
|
240
|
+
socket.current?.addEventListener('message', l);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}, [listeners, status]);
|
|
244
|
+
|
|
245
|
+
// Handler for when the socket closes
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
if (!socket.current) return;
|
|
248
|
+
|
|
249
|
+
if ([Status.CLOSED, Status.CLOSING].includes(status)) {
|
|
250
|
+
socket.current.removeEventListener('close', onClose);
|
|
251
|
+
socket.current.removeEventListener('error', onWsError);
|
|
252
|
+
socket.current.removeEventListener('message', onMessageError);
|
|
253
|
+
|
|
254
|
+
Object.values(listeners.current).forEach(l => socket.current.removeEventListener('message', l));
|
|
255
|
+
listeners.current = {};
|
|
256
|
+
|
|
257
|
+
window.removeEventListener('beforeunload', onBeforeUnload);
|
|
258
|
+
|
|
259
|
+
socket.current.close();
|
|
260
|
+
socket.current = null;
|
|
261
|
+
}
|
|
262
|
+
}, [status, socket, appToken, onBeforeUnload, onClose, onWsError, onMessageError]);
|
|
263
|
+
|
|
264
|
+
const addListener: SocketContextType['addListener'] = useCallback((key, callback) => {
|
|
265
|
+
// If a listener with the same key already exists, remove it.
|
|
266
|
+
if (listeners.current[key]) {
|
|
267
|
+
socket.current?.removeEventListener('message', listeners[key]);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// We wrap the callback so that all the listeners don't need to JSON.parse the data
|
|
271
|
+
const wrapped: ListenerType<'message'> = ev => {
|
|
272
|
+
const parsedData = JSON.parse(ev.data) as RecievedDataType;
|
|
273
|
+
|
|
274
|
+
if (isHitUpdate(parsedData) && parsedData.status < 300) {
|
|
275
|
+
setStored(StorageKey.ETAG, {
|
|
276
|
+
...getStored(StorageKey.ETAG),
|
|
277
|
+
[parsedData.hit.howler.id]: parsedData.version
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
setAxiosCache(parsedData.version, {
|
|
281
|
+
api_response: parsedData.hit,
|
|
282
|
+
api_error_message: '',
|
|
283
|
+
api_server_version: '',
|
|
284
|
+
api_status_code: parsedData.status
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
callback(parsedData as RecievedDataType<any>);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
socket.current?.addEventListener('message', wrapped);
|
|
292
|
+
|
|
293
|
+
listeners.current[key] = wrapped;
|
|
294
|
+
}, []);
|
|
295
|
+
|
|
296
|
+
const removeListener: SocketContextType['removeListener'] = useCallback((key: string) => {
|
|
297
|
+
socket.current?.removeEventListener('message', listeners.current[key]);
|
|
298
|
+
|
|
299
|
+
delete listeners.current[key];
|
|
300
|
+
}, []);
|
|
301
|
+
|
|
302
|
+
const emit: SocketContextType['emit'] = useCallback(
|
|
303
|
+
data => {
|
|
304
|
+
if (typeof data !== 'string') {
|
|
305
|
+
data = JSON.stringify(data);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (status !== Status.OPEN || !socket.current) {
|
|
309
|
+
console.warn('socket closed, not sending');
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
socket.current?.send(data);
|
|
314
|
+
},
|
|
315
|
+
[status]
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
const isOpen = useCallback(() => status === Status.OPEN, [status]);
|
|
319
|
+
|
|
320
|
+
const reconnect: SocketContextType['reconnect'] = useCallback(() => setRetry(true), []);
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<SocketContext.Provider value={{ addListener, removeListener, emit, status, reconnect, isOpen }}>
|
|
324
|
+
{children}
|
|
325
|
+
</SocketContext.Provider>
|
|
326
|
+
);
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export default SocketProvider;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import api from 'api';
|
|
2
|
+
import useMyApi from 'components/hooks/useMyApi';
|
|
3
|
+
import type { HowlerUser } from 'models/entities/HowlerUser';
|
|
4
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
5
|
+
import { createContext, useCallback, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
interface UserListContextType {
|
|
8
|
+
users: { [id: string]: HowlerUser };
|
|
9
|
+
searchUsers: (query: string) => void;
|
|
10
|
+
fetchUsers: (ids: Set<string>) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const UserListContext = createContext<UserListContextType>(null);
|
|
14
|
+
|
|
15
|
+
const UserListProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
16
|
+
const { dispatchApi } = useMyApi();
|
|
17
|
+
|
|
18
|
+
const [users, setUsers] = useState<{ [id: string]: HowlerUser }>({});
|
|
19
|
+
|
|
20
|
+
const searchUsers = useCallback(
|
|
21
|
+
async (query: string) => {
|
|
22
|
+
const newUsers = (
|
|
23
|
+
await dispatchApi(api.search.user.post({ query, rows: 1000 }), {
|
|
24
|
+
throwError: false,
|
|
25
|
+
logError: false,
|
|
26
|
+
showError: false
|
|
27
|
+
})
|
|
28
|
+
)?.items?.reduce((dict, user) => ({ ...dict, [user.username]: user }), {});
|
|
29
|
+
|
|
30
|
+
setUsers(_users => ({
|
|
31
|
+
..._users,
|
|
32
|
+
...newUsers
|
|
33
|
+
}));
|
|
34
|
+
},
|
|
35
|
+
[dispatchApi]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const fetchUsers = useCallback(
|
|
39
|
+
async (ids: Set<string>) => {
|
|
40
|
+
ids.delete('Unknown');
|
|
41
|
+
|
|
42
|
+
const idsToGet = Array.from(ids.values()).filter(id => !Object.keys(users).includes(id));
|
|
43
|
+
|
|
44
|
+
if (idsToGet.length <= 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
await searchUsers(`id:${[...idsToGet].join(' OR ')}`);
|
|
49
|
+
},
|
|
50
|
+
[searchUsers, users]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return <UserListContext.Provider value={{ users, fetchUsers, searchUsers }}>{children}</UserListContext.Provider>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default UserListProvider;
|