@cccsaurora/howler-ui 2.18.0-dev.732 → 2.18.0-dev.736

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.
Files changed (273) hide show
  1. package/api/index.d.ts +2 -0
  2. package/api/index.js +4 -2
  3. package/api/search/case.d.ts +4 -0
  4. package/api/search/case.js +8 -0
  5. package/api/search/facet/hit.d.ts +1 -3
  6. package/api/search/facet/index.d.ts +3 -1
  7. package/api/search/index.d.ts +2 -1
  8. package/api/search/index.js +2 -1
  9. package/api/v2/case/index.d.ts +8 -0
  10. package/api/v2/case/index.js +20 -0
  11. package/api/v2/case/items.d.ts +6 -0
  12. package/api/v2/case/items.js +18 -0
  13. package/api/v2/index.d.ts +4 -0
  14. package/api/v2/index.js +6 -0
  15. package/api/v2/search/facet.d.ts +3 -0
  16. package/api/v2/search/facet.js +12 -0
  17. package/api/v2/search/index.d.ts +5 -0
  18. package/api/v2/search/index.js +24 -0
  19. package/commons/components/leftnav/LeftNavDrawer.js +1 -1
  20. package/components/app/App.js +39 -7
  21. package/components/app/hooks/useMatchers.d.ts +1 -1
  22. package/components/app/hooks/useMatchers.js +23 -11
  23. package/components/app/hooks/useMatchers.test.js +22 -22
  24. package/components/app/hooks/useTitle.js +3 -3
  25. package/components/app/providers/FavouritesProvider.js +2 -2
  26. package/components/app/providers/ModalProvider.d.ts +1 -0
  27. package/components/app/providers/ParameterProvider.d.ts +9 -2
  28. package/components/app/providers/ParameterProvider.js +165 -240
  29. package/components/app/providers/ParameterProvider.test.js +346 -94
  30. package/components/app/providers/RecordProvider.d.ts +23 -0
  31. package/components/app/providers/{HitProvider.js → RecordProvider.js} +41 -41
  32. package/components/app/providers/{HitSearchProvider.d.ts → RecordSearchProvider.d.ts} +6 -6
  33. package/components/app/providers/{HitSearchProvider.js → RecordSearchProvider.js} +12 -17
  34. package/components/app/providers/{HitSearchProvider.test.js → RecordSearchProvider.test.js} +51 -70
  35. package/components/app/providers/UserListProvider.js +28 -8
  36. package/components/elements/ContextMenu.d.ts +56 -0
  37. package/components/elements/ContextMenu.js +109 -0
  38. package/components/elements/ContextMenu.test.js +215 -0
  39. package/components/{routes/overviews/OverviewEditor.js → elements/MarkdownEditor.js} +3 -3
  40. package/components/elements/ObjectDetails.d.ts +6 -0
  41. package/components/elements/{hit/HitDetails.js → ObjectDetails.js} +17 -17
  42. package/components/elements/PluginTypography.d.ts +2 -1
  43. package/components/elements/PluginTypography.js +3 -2
  44. package/components/elements/UserList.d.ts +5 -2
  45. package/components/elements/UserList.js +18 -8
  46. package/components/elements/addons/search/phrase/Phrase.js +1 -1
  47. package/components/elements/case/CaseCard.d.ts +12 -0
  48. package/components/elements/case/CaseCard.js +42 -0
  49. package/components/elements/case/CasePreview.d.ts +6 -0
  50. package/components/elements/case/CasePreview.js +17 -0
  51. package/components/elements/case/StatusIcon.d.ts +5 -0
  52. package/components/elements/case/StatusIcon.js +13 -0
  53. package/components/elements/display/ChipPopper.d.ts +1 -1
  54. package/components/elements/display/HowlerCard.js +1 -1
  55. package/components/elements/display/Modal.js +2 -0
  56. package/components/elements/hit/HitActions.js +4 -4
  57. package/components/elements/hit/HitBanner.d.ts +1 -0
  58. package/components/elements/hit/HitBanner.js +29 -49
  59. package/components/elements/hit/HitCard.d.ts +2 -0
  60. package/components/elements/hit/HitCard.js +7 -7
  61. package/components/elements/hit/HitLabels.js +2 -2
  62. package/components/elements/hit/HitOutline.d.ts +1 -0
  63. package/components/elements/hit/HitOutline.js +3 -3
  64. package/components/elements/hit/{HitQuickSearch.d.ts → HitPreview.d.ts} +3 -3
  65. package/components/elements/hit/{HitQuickSearch.js → HitPreview.js} +10 -4
  66. package/components/elements/hit/HitSummary.d.ts +2 -1
  67. package/components/elements/hit/HitSummary.js +6 -5
  68. package/components/elements/hit/aggregate/HitGraph.js +8 -8
  69. package/components/elements/hit/elements/AnalyticLink.d.ts +9 -0
  70. package/components/elements/hit/elements/AnalyticLink.js +22 -0
  71. package/components/elements/hit/outlines/DefaultOutline.js +1 -1
  72. package/components/elements/hit/related/RelatedRecords.js +63 -0
  73. package/components/elements/observable/ObservableCard.d.ts +6 -0
  74. package/components/elements/observable/ObservableCard.js +22 -0
  75. package/components/elements/observable/ObservablePreview.d.ts +6 -0
  76. package/components/elements/observable/ObservablePreview.js +12 -0
  77. package/components/elements/{hit/HitComments.d.ts → record/RecordComments.d.ts} +5 -4
  78. package/components/elements/{hit/HitComments.js → record/RecordComments.js} +29 -28
  79. package/components/{routes/hits/search/HitContextMenu.d.ts → elements/record/RecordContextMenu.d.ts} +3 -3
  80. package/components/elements/record/RecordContextMenu.js +247 -0
  81. package/components/elements/record/RecordContextMenu.test.d.ts +1 -0
  82. package/components/{routes/hits/search/HitContextMenu.test.js → elements/record/RecordContextMenu.test.js} +94 -39
  83. package/components/elements/record/RecordRelated.d.ts +7 -0
  84. package/components/elements/record/RecordRelated.js +34 -0
  85. package/components/elements/{hit/HitWorklog.d.ts → record/RecordWorklog.d.ts} +4 -3
  86. package/components/elements/{hit/HitWorklog.js → record/RecordWorklog.js} +15 -13
  87. package/components/elements/view/ViewTitle.d.ts +1 -0
  88. package/components/elements/view/ViewTitle.js +9 -2
  89. package/components/hooks/useHitActions.d.ts +1 -1
  90. package/components/hooks/useHitActions.js +4 -4
  91. package/components/hooks/useMyPreferences.js +10 -1
  92. package/components/hooks/useMySearch.js +2 -2
  93. package/components/hooks/useMySitemap.js +4 -1
  94. package/components/hooks/useMyTheme.js +9 -2
  95. package/components/hooks/useParamState.test.js +3 -4
  96. package/components/hooks/{useHitSelection.d.ts → useRecordSelection.d.ts} +2 -2
  97. package/components/hooks/{useHitSelection.js → useRecordSelection.js} +12 -33
  98. package/components/hooks/useRelatedRecords.d.ts +13 -0
  99. package/components/hooks/useRelatedRecords.js +32 -0
  100. package/components/routes/action/edit/ActionEditor.js +2 -2
  101. package/components/routes/action/view/ActionSearch.js +1 -1
  102. package/components/routes/advanced/QueryBuilder.js +1 -1
  103. package/components/routes/advanced/QueryEditor.js +3 -3
  104. package/components/routes/advanced/historyCompletionProvider.js +3 -3
  105. package/components/routes/analytics/AnalyticDetails.js +2 -2
  106. package/components/routes/analytics/AnalyticSearch.js +1 -1
  107. package/components/routes/cases/CaseViewer.d.ts +2 -0
  108. package/components/routes/cases/CaseViewer.js +22 -0
  109. package/components/routes/cases/Cases.d.ts +2 -0
  110. package/components/routes/cases/Cases.js +101 -0
  111. package/components/routes/cases/constants.d.ts +5 -0
  112. package/components/routes/cases/constants.js +5 -0
  113. package/components/routes/cases/detail/AlertPanel.d.ts +6 -0
  114. package/components/routes/cases/detail/AlertPanel.js +33 -0
  115. package/components/routes/cases/detail/CaseAssets.d.ts +11 -0
  116. package/components/routes/cases/detail/CaseAssets.js +104 -0
  117. package/components/routes/cases/detail/CaseAssets.test.d.ts +1 -0
  118. package/components/routes/cases/detail/CaseAssets.test.js +167 -0
  119. package/components/routes/cases/detail/CaseDashboard.d.ts +7 -0
  120. package/components/routes/cases/detail/CaseDashboard.js +66 -0
  121. package/components/routes/cases/detail/CaseDetails.d.ts +6 -0
  122. package/components/routes/cases/detail/CaseDetails.js +61 -0
  123. package/components/routes/cases/detail/CaseOverview.d.ts +7 -0
  124. package/components/routes/cases/detail/CaseOverview.js +43 -0
  125. package/components/routes/cases/detail/CaseSidebar.d.ts +8 -0
  126. package/components/routes/cases/detail/CaseSidebar.js +107 -0
  127. package/components/routes/cases/detail/CaseSidebar.test.d.ts +1 -0
  128. package/components/routes/cases/detail/CaseSidebar.test.js +246 -0
  129. package/components/routes/cases/detail/CaseTask.d.ts +11 -0
  130. package/components/routes/cases/detail/CaseTask.js +57 -0
  131. package/components/routes/cases/detail/CaseTimeline.d.ts +12 -0
  132. package/components/routes/cases/detail/CaseTimeline.js +106 -0
  133. package/components/routes/cases/detail/CaseTimeline.test.d.ts +1 -0
  134. package/components/routes/cases/detail/CaseTimeline.test.js +227 -0
  135. package/components/routes/cases/detail/ItemPage.d.ts +6 -0
  136. package/components/routes/cases/detail/ItemPage.js +99 -0
  137. package/components/routes/cases/detail/RelatedCasePanel.d.ts +6 -0
  138. package/components/routes/cases/detail/RelatedCasePanel.js +34 -0
  139. package/components/routes/cases/detail/TaskPanel.d.ts +7 -0
  140. package/components/routes/cases/detail/TaskPanel.js +52 -0
  141. package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +11 -0
  142. package/components/routes/cases/detail/aggregates/CaseAggregate.js +24 -0
  143. package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +6 -0
  144. package/components/routes/cases/detail/aggregates/SourceAggregate.js +26 -0
  145. package/components/routes/cases/detail/assets/Asset.d.ts +14 -0
  146. package/components/routes/cases/detail/assets/Asset.js +12 -0
  147. package/components/routes/cases/detail/assets/Asset.test.d.ts +1 -0
  148. package/components/routes/cases/detail/assets/Asset.test.js +72 -0
  149. package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +20 -0
  150. package/components/routes/cases/detail/sidebar/CaseFolder.js +83 -0
  151. package/components/routes/cases/detail/sidebar/CaseFolder.test.d.ts +1 -0
  152. package/components/routes/cases/detail/sidebar/CaseFolder.test.js +295 -0
  153. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +34 -0
  154. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +103 -0
  155. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.d.ts +1 -0
  156. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +363 -0
  157. package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +25 -0
  158. package/components/routes/cases/detail/sidebar/FolderEntry.js +88 -0
  159. package/components/routes/cases/detail/sidebar/FolderEntry.test.d.ts +1 -0
  160. package/components/routes/cases/detail/sidebar/FolderEntry.test.js +206 -0
  161. package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +5 -0
  162. package/components/routes/cases/detail/sidebar/RootDropZone.js +33 -0
  163. package/components/routes/cases/detail/sidebar/types.d.ts +9 -0
  164. package/components/routes/cases/detail/sidebar/utils.d.ts +3 -0
  165. package/components/routes/cases/detail/sidebar/utils.js +29 -0
  166. package/components/routes/cases/detail/sidebar/utils.test.d.ts +1 -0
  167. package/components/routes/cases/detail/sidebar/utils.test.js +82 -0
  168. package/components/routes/cases/hooks/useCase.d.ts +13 -0
  169. package/components/routes/cases/hooks/useCase.js +51 -0
  170. package/components/routes/cases/modals/AddToCaseModal.d.ts +7 -0
  171. package/components/routes/cases/modals/AddToCaseModal.js +62 -0
  172. package/components/routes/cases/modals/RenameItemModal.d.ts +9 -0
  173. package/components/routes/cases/modals/RenameItemModal.js +48 -0
  174. package/components/routes/cases/modals/ResolveModal.d.ts +7 -0
  175. package/components/routes/cases/modals/ResolveModal.js +115 -0
  176. package/components/routes/cases/modals/ResolveModal.test.d.ts +1 -0
  177. package/components/routes/cases/modals/ResolveModal.test.js +384 -0
  178. package/components/routes/dossiers/DossierEditor.js +2 -2
  179. package/components/routes/dossiers/DossierEditor.test.js +1 -1
  180. package/components/routes/help/ApiDocumentation.js +1 -1
  181. package/components/routes/help/HitBannerDocumentation.js +1 -0
  182. package/components/routes/help/HitDocumentation.js +1 -3
  183. package/components/routes/hits/search/InformationPane.d.ts +1 -0
  184. package/components/routes/hits/search/InformationPane.js +47 -60
  185. package/components/routes/hits/search/LayoutSettings.js +3 -3
  186. package/components/routes/hits/search/QuerySettings.js +2 -1
  187. package/components/routes/hits/search/QuerySettings.test.js +14 -9
  188. package/components/routes/hits/search/{HitBrowser.js → RecordBrowser.js} +9 -9
  189. package/components/routes/hits/search/{HitQuery.d.ts → RecordQuery.d.ts} +2 -2
  190. package/components/routes/hits/search/{HitQuery.js → RecordQuery.js} +6 -6
  191. package/components/routes/hits/search/SearchPane.js +26 -49
  192. package/components/routes/hits/search/ViewLink.js +3 -3
  193. package/components/routes/hits/search/ViewLink.test.js +8 -8
  194. package/components/routes/hits/search/grid/AddColumnModal.js +5 -4
  195. package/components/routes/hits/search/grid/EnhancedCell.d.ts +2 -1
  196. package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
  197. package/components/routes/hits/search/grid/HitGrid.js +20 -18
  198. package/components/routes/hits/search/grid/{HitRow.d.ts → RecordRow.d.ts} +3 -2
  199. package/components/routes/hits/search/grid/{HitRow.js → RecordRow.js} +10 -8
  200. package/components/routes/hits/search/shared/IndexPicker.d.ts +2 -0
  201. package/components/routes/hits/search/shared/IndexPicker.js +20 -0
  202. package/components/routes/hits/view/HitViewer.js +12 -13
  203. package/components/routes/home/ViewCard.js +47 -41
  204. package/components/routes/observables/ObservableViewer.d.ts +7 -0
  205. package/components/routes/observables/ObservableViewer.js +27 -0
  206. package/components/routes/overviews/OverviewViewer.js +2 -2
  207. package/components/routes/views/ViewComposer.js +46 -19
  208. package/locales/en/translation.json +89 -3
  209. package/locales/fr/translation.json +87 -3
  210. package/models/WithMetadata.d.ts +2 -1
  211. package/models/entities/generated/AttachmentsFile.d.ts +12 -0
  212. package/models/entities/generated/Case.d.ts +28 -0
  213. package/models/entities/generated/DestinationOriginal.d.ts +19 -0
  214. package/models/entities/generated/EmailAttachment.d.ts +8 -0
  215. package/models/entities/generated/EmailParent.d.ts +19 -0
  216. package/models/entities/generated/Enrichments.d.ts +7 -0
  217. package/models/entities/generated/EnrichmentsIndicator.d.ts +21 -0
  218. package/models/entities/generated/Hit.d.ts +1 -0
  219. package/models/entities/generated/Howler.d.ts +0 -4
  220. package/models/entities/generated/HttpResponse.d.ts +11 -0
  221. package/models/entities/generated/Item.d.ts +9 -0
  222. package/models/entities/generated/Observable.d.ts +85 -0
  223. package/models/entities/generated/ObservableCloud.d.ts +20 -0
  224. package/models/entities/generated/ObservableDestination.d.ts +23 -0
  225. package/models/entities/generated/ObservableEmail.d.ts +30 -0
  226. package/models/entities/generated/ObservableFile.d.ts +36 -0
  227. package/models/entities/generated/ObservableHowler.d.ts +43 -0
  228. package/models/entities/generated/ObservableHttp.d.ts +11 -0
  229. package/models/entities/generated/ObservableObserver.d.ts +21 -0
  230. package/models/entities/generated/ObservableOrganization.d.ts +7 -0
  231. package/models/entities/generated/ObservableProcess.d.ts +34 -0
  232. package/models/entities/generated/ObservableSource.d.ts +23 -0
  233. package/models/entities/generated/ObservableThreat.d.ts +21 -0
  234. package/models/entities/generated/ObservableTls.d.ts +12 -0
  235. package/models/entities/generated/ObserverIngress.d.ts +9 -0
  236. package/models/entities/generated/Rule.d.ts +2 -10
  237. package/models/entities/generated/Task.d.ts +10 -0
  238. package/models/entities/generated/Threat.d.ts +2 -2
  239. package/models/entities/generated/{Enrichment.d.ts → ThreatEnrichment.d.ts} +1 -1
  240. package/models/entities/generated/View.d.ts +1 -0
  241. package/package.json +114 -97
  242. package/plugins/clue/components/ClueTypography.js +2 -2
  243. package/plugins/clue/utils.d.ts +2 -1
  244. package/tests/mocks.d.ts +11 -1
  245. package/tests/mocks.js +12 -7
  246. package/tests/server-handlers.js +6 -1
  247. package/tests/utils.d.ts +4 -0
  248. package/tests/utils.js +20 -0
  249. package/utils/constants.d.ts +3 -3
  250. package/utils/hitFunctions.d.ts +2 -1
  251. package/utils/hitFunctions.js +4 -4
  252. package/utils/typeUtils.d.ts +7 -0
  253. package/utils/typeUtils.js +27 -0
  254. package/utils/viewUtils.js +3 -0
  255. package/components/app/providers/HitProvider.d.ts +0 -22
  256. package/components/elements/display/icons/BundleButton.d.ts +0 -6
  257. package/components/elements/display/icons/BundleButton.js +0 -32
  258. package/components/elements/hit/HitRelated.d.ts +0 -6
  259. package/components/elements/hit/HitRelated.js +0 -7
  260. package/components/routes/help/BundleDocumentation.d.ts +0 -3
  261. package/components/routes/help/BundleDocumentation.js +0 -12
  262. package/components/routes/help/markdown/en/bundles.md.js +0 -1
  263. package/components/routes/help/markdown/fr/bundles.md.js +0 -1
  264. package/components/routes/hits/search/BundleParentMenu.d.ts +0 -6
  265. package/components/routes/hits/search/BundleParentMenu.js +0 -32
  266. package/components/routes/hits/search/BundleScroller.d.ts +0 -2
  267. package/components/routes/hits/search/BundleScroller.js +0 -6
  268. package/components/routes/hits/search/HitContextMenu.js +0 -227
  269. /package/components/app/providers/{HitSearchProvider.test.d.ts → RecordSearchProvider.test.d.ts} +0 -0
  270. /package/components/{routes/hits/search/HitContextMenu.test.d.ts → elements/ContextMenu.test.d.ts} +0 -0
  271. /package/components/{routes/overviews/OverviewEditor.d.ts → elements/MarkdownEditor.d.ts} +0 -0
  272. /package/components/elements/hit/{HitDetails.d.ts → related/RelatedRecords.d.ts} +0 -0
  273. /package/components/routes/hits/search/{HitBrowser.d.ts → RecordBrowser.d.ts} +0 -0
@@ -2,8 +2,8 @@ import { createElement as _createElement } from "react";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ArrowDropDown, Delete, Edit, Language, Lock, OpenInNew, Person, Refresh, SavedSearch, SelectAll } from '@mui/icons-material';
4
4
  import { Autocomplete, Chip, CircularProgress, IconButton, Stack, TextField, Tooltip, Typography } from '@mui/material';
5
- import { HitSearchContext } from '@cccsaurora/howler-ui/components/app/providers/HitSearchProvider';
6
5
  import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
6
+ import { RecordSearchContext } from '@cccsaurora/howler-ui/components/app/providers/RecordSearchProvider';
7
7
  import { ViewContext } from '@cccsaurora/howler-ui/components/app/providers/ViewProvider';
8
8
  import ChipPopper from '@cccsaurora/howler-ui/components/elements/display/ChipPopper';
9
9
  import { memo, useEffect, useMemo, useState } from 'react';
@@ -20,7 +20,7 @@ const ViewLink = ({ id, viewId }) => {
20
20
  const currentViews = useContextSelector(ParameterContext, ctx => ctx.views);
21
21
  const removeView = useContextSelector(ParameterContext, ctx => ctx.removeView);
22
22
  const setParamView = useContextSelector(ParameterContext, ctx => ctx.setView);
23
- const search = useContextSelector(HitSearchContext, ctx => ctx.search);
23
+ const search = useContextSelector(RecordSearchContext, ctx => ctx.search);
24
24
  const [loading, setLoading] = useState(true);
25
25
  const [view, setView] = useState(null);
26
26
  useEffect(() => {
@@ -47,7 +47,7 @@ const ViewLink = ({ id, viewId }) => {
47
47
  }, [query, sort, span, view]);
48
48
  const options = useMemo(() => Object.values(views).filter(_view => !!_view && !currentViews?.includes(_view.view_id)), [currentViews, views]);
49
49
  if (loading) {
50
- return _jsx(Chip, { size: "small", icon: _jsx(CircularProgress, { size: 12 }) });
50
+ return _jsx(Chip, { icon: _jsx(CircularProgress, { size: 12 }) });
51
51
  }
52
52
  if (viewId === '') {
53
53
  return (_jsx(ChipPopper, { icon: _jsx(SelectAll, {}), label: t('hit.search.view.select'), deleteIcon: _jsx(ArrowDropDown, {}), toggleOnDelete: true, slotProps: { chip: { size: 'small', color: 'warning' } }, children: _jsxs(Stack, { spacing: 1, direction: "row", children: [_jsx(Autocomplete, { fullWidth: true, size: "small", options: options, getOptionLabel: _view => t(_view.title), renderOption: ({ key, ...props }, o) => (_createElement("li", { ...props, key: key },
@@ -7,8 +7,8 @@ import { setupReactRouterMock } from '@cccsaurora/howler-ui/tests/mocks';
7
7
  import { vi } from 'vitest';
8
8
  setupReactRouterMock();
9
9
  // Import component after mocks
10
- import { HitSearchContext } from '@cccsaurora/howler-ui/components/app/providers/HitSearchProvider';
11
10
  import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
11
+ import { RecordSearchContext } from '@cccsaurora/howler-ui/components/app/providers/RecordSearchProvider';
12
12
  import { ViewContext } from '@cccsaurora/howler-ui/components/app/providers/ViewProvider';
13
13
  import i18n from '@cccsaurora/howler-ui/i18n';
14
14
  import { I18nextProvider } from 'react-i18next';
@@ -26,7 +26,7 @@ let mockParameterContext = {
26
26
  removeView: vi.fn(),
27
27
  setView: vi.fn()
28
28
  };
29
- let mockHitSearchContext = {
29
+ let mockRecordSearchContext = {
30
30
  search: vi.fn()
31
31
  };
32
32
  let mockViewContext = {
@@ -38,7 +38,7 @@ let mockViewContext = {
38
38
  };
39
39
  // Test wrapper
40
40
  const Wrapper = ({ children }) => {
41
- return (_jsx(I18nextProvider, { i18n: i18n, children: _jsx(ParameterContext.Provider, { value: mockParameterContext, children: _jsx(HitSearchContext.Provider, { value: mockHitSearchContext, children: _jsx(ViewContext.Provider, { value: mockViewContext, children: children }) }) }) }));
41
+ return (_jsx(I18nextProvider, { i18n: i18n, children: _jsx(ParameterContext.Provider, { value: mockParameterContext, children: _jsx(RecordSearchContext.Provider, { value: mockRecordSearchContext, children: _jsx(ViewContext.Provider, { value: mockViewContext, children: children }) }) }) }));
42
42
  };
43
43
  describe('ViewLink', () => {
44
44
  let user;
@@ -52,7 +52,7 @@ describe('ViewLink', () => {
52
52
  mockParameterContext.views = ['test-view-id'];
53
53
  mockParameterContext.removeView = vi.fn();
54
54
  mockParameterContext.setView = vi.fn();
55
- mockHitSearchContext.search = vi.fn();
55
+ mockRecordSearchContext.search = vi.fn();
56
56
  mockViewContext.getCurrentViews = vi.fn().mockResolvedValue([createMockView()]);
57
57
  mockViewContext.views = {
58
58
  'test-view-id': createMockView(),
@@ -230,7 +230,7 @@ describe('ViewLink', () => {
230
230
  await user.click(screen.getByText('Test View').parentElement);
231
231
  const refreshButton = await screen.findByLabelText(i18n.t('view.refresh'));
232
232
  await user.click(refreshButton);
233
- expect(mockHitSearchContext.search).toHaveBeenCalledWith('howler.id:*');
233
+ expect(mockRecordSearchContext.search).toHaveBeenCalledWith('howler.id:*');
234
234
  });
235
235
  it('should display open button', async () => {
236
236
  render(_jsx(ViewLink, { id: 0, viewId: "test-view-id" }), { wrapper: Wrapper });
@@ -306,7 +306,7 @@ describe('ViewLink', () => {
306
306
  await user.click(screen.getByText('Test View').parentElement);
307
307
  const refreshButton = await screen.findByLabelText(i18n.t('view.refresh'));
308
308
  await user.click(refreshButton);
309
- expect(mockHitSearchContext.search).toHaveBeenCalledWith(undefined);
309
+ expect(mockRecordSearchContext.search).toHaveBeenCalledWith(undefined);
310
310
  });
311
311
  it('should handle custom span correctly', async () => {
312
312
  mockParameterContext.span = 'date.range.custom';
@@ -398,14 +398,14 @@ describe('ViewLink', () => {
398
398
  expect(mockParameterContext.removeView).toHaveBeenCalledWith('test-view-id');
399
399
  }
400
400
  });
401
- it('should use search from HitSearchContext', async () => {
401
+ it('should use search from RecordSearchContext', async () => {
402
402
  mockViewContext.getCurrentViews = vi.fn().mockResolvedValue([createMockView()]);
403
403
  render(_jsx(ViewLink, { id: 0, viewId: "test-view-id" }), { wrapper: Wrapper });
404
404
  await screen.findByText('Test View');
405
405
  await user.click(screen.getByText('Test View').parentElement);
406
406
  const refreshButton = await screen.findByLabelText(i18n.t('view.refresh'));
407
407
  await user.click(refreshButton);
408
- expect(mockHitSearchContext.search).toHaveBeenCalledWith('howler.id:*');
408
+ expect(mockRecordSearchContext.search).toHaveBeenCalledWith('howler.id:*');
409
409
  });
410
410
  it('should filter available views using currentViews from ParameterContext', async () => {
411
411
  mockParameterContext.views = ['test-view-id'];
@@ -3,23 +3,24 @@ import { Add, Check, Settings, TableChart } from '@mui/icons-material';
3
3
  import { Autocomplete, Chip, Divider, Grid, IconButton, Stack, TextField } from '@mui/material';
4
4
  import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
5
5
  import { FieldContext } from '@cccsaurora/howler-ui/components/app/providers/FieldProvider';
6
- import { HitSearchContext } from '@cccsaurora/howler-ui/components/app/providers/HitSearchProvider';
6
+ import { RecordSearchContext } from '@cccsaurora/howler-ui/components/app/providers/RecordSearchProvider';
7
7
  import ChipPopper from '@cccsaurora/howler-ui/components/elements/display/ChipPopper';
8
- import { has, sortBy, uniq } from 'lodash-es';
8
+ import { sortBy, uniq } from 'lodash-es';
9
9
  import { memo, useContext, useEffect, useMemo, useState } from 'react';
10
10
  import { useTranslation } from 'react-i18next';
11
11
  import { useContextSelector } from 'use-context-selector';
12
+ import { isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
12
13
  const AddColumnModal = ({ addColumn, columns }) => {
13
14
  const { t } = useTranslation();
14
15
  const { hitFields } = useContext(FieldContext);
15
- const response = useContextSelector(HitSearchContext, ctx => ctx.response);
16
+ const response = useContextSelector(RecordSearchContext, ctx => ctx.response);
16
17
  const { getMatchingTemplate } = useMatchers();
17
18
  const [columnToAdd, setColumnToAdd] = useState(null);
18
19
  const options = useMemo(() => hitFields.map(field => field.key), [hitFields]);
19
20
  const [suggestions, setSuggestions] = useState([]);
20
21
  useEffect(() => {
21
22
  (async () => {
22
- setSuggestions(uniq((await Promise.all((response?.items ?? []).map(async (_hit) => (has(_hit, '__template') ? _hit.__template?.keys : (await getMatchingTemplate(_hit))?.keys) ?? []))).flat()));
23
+ setSuggestions(uniq((await Promise.all((response?.items ?? []).filter(isHit).map(async (_hit) => (await getMatchingTemplate(_hit))?.keys ?? []))).flat()));
23
24
  })();
24
25
  }, [getMatchingTemplate, response?.items]);
25
26
  return (_jsx(ChipPopper, { icon: _jsx(TableChart, {}), deleteIcon: _jsx(Settings, {}), toggleOnDelete: true, slotProps: { chip: { size: 'small' } }, children: _jsxs(Stack, { spacing: 1, p: 1, width: "500px", children: [_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Autocomplete, { sx: { flex: 1 }, size: "small", options: options, value: columnToAdd, renderInput: params => _jsx(TextField, { fullWidth: true, placeholder: t('hit.fields'), ...params }), onChange: (_ev, value) => setColumnToAdd(value) }), _jsx(IconButton, { disabled: !columnToAdd, onClick: () => {
@@ -1,7 +1,8 @@
1
1
  import { type SxProps } from '@mui/material';
2
2
  import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
3
+ import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
3
4
  declare const _default: import("react").NamedExoticComponent<{
4
- hit: Hit;
5
+ record: Hit | Observable;
5
6
  value: string;
6
7
  sx?: SxProps;
7
8
  className: string;
@@ -4,7 +4,7 @@ import { Stack, TableCell } from '@mui/material';
4
4
  import PluginTypography from '@cccsaurora/howler-ui/components/elements/PluginTypography';
5
5
  import { memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
- const EnhancedCell = ({ hit, value: rawValue, sx = {}, className, field }) => {
7
+ const EnhancedCell = ({ record, value: rawValue, sx = {}, className, field }) => {
8
8
  const { t } = useTranslation();
9
9
  if (!rawValue) {
10
10
  return _jsx(TableCell, { style: { borderBottom: 'none' }, children: t('none') });
@@ -13,6 +13,6 @@ const EnhancedCell = ({ hit, value: rawValue, sx = {}, className, field }) => {
13
13
  return (_jsx(TableCell, { sx: { borderBottom: 'none', borderRight: 'thin solid', borderRightColor: 'divider', fontSize: '0.8rem' }, children: _jsx(Stack, { direction: "row", className: className, spacing: 0.5, sx: [
14
14
  { display: 'flex', justifyContent: 'start', width: '100%', overflow: 'hidden' },
15
15
  ...(Array.isArray(sx) ? sx : [sx])
16
- ], children: values.map((value, index) => (_jsx(PluginTypography, { context: "table", sx: { fontSize: 'inherit', textOverflow: 'ellipsis' }, value: value, field: field, hit: hit, children: value }, value + index))) }) }));
16
+ ], children: values.map((value, index) => (_jsx(PluginTypography, { context: "table", sx: { fontSize: 'inherit', textOverflow: 'ellipsis' }, value: value, field: field, obj: record, children: value }, value + index))) }) }));
17
17
  };
18
18
  export default memo(EnhancedCell);
@@ -4,36 +4,37 @@ import { arrayMove, SortableContext, sortableKeyboardCoordinates } from '@dnd-ki
4
4
  import { FormatIndentDecrease, FormatIndentIncrease, Info, List, Search, TableChart } from '@mui/icons-material';
5
5
  import { IconButton, LinearProgress, Paper, Stack, Table, TableBody, TableCell, TableHead, TableRow, ToggleButton, ToggleButtonGroup, Typography, useTheme } from '@mui/material';
6
6
  import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
7
- import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
8
- import { HitSearchContext } from '@cccsaurora/howler-ui/components/app/providers/HitSearchProvider';
9
7
  import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
8
+ import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
9
+ import { RecordSearchContext } from '@cccsaurora/howler-ui/components/app/providers/RecordSearchProvider';
10
10
  import SearchTotal from '@cccsaurora/howler-ui/components/elements/addons/search/SearchTotal';
11
11
  import DevelopmentBanner from '@cccsaurora/howler-ui/components/elements/display/features/DevelopmentBanner';
12
- import useHitSelection from '@cccsaurora/howler-ui/components/hooks/useHitSelection';
12
+ import RecordContextMenu from '@cccsaurora/howler-ui/components/elements/record/RecordContextMenu';
13
13
  import { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
14
+ import useRecordSelection from '@cccsaurora/howler-ui/components/hooks/useRecordSelection';
14
15
  import { uniq } from 'lodash-es';
15
16
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
16
17
  import { useTranslation } from 'react-i18next';
17
18
  import { useContextSelector } from 'use-context-selector';
18
19
  import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
19
- import HitContextMenu from '../HitContextMenu';
20
- import HitQuery from '../HitQuery';
20
+ import { isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
21
21
  import QuerySettings from '../QuerySettings';
22
+ import RecordQuery from '../RecordQuery';
22
23
  import AddColumnModal from './AddColumnModal';
23
24
  import ColumnHeader from './ColumnHeader';
24
- import HitRow from './HitRow';
25
+ import RecordRow from './RecordRow';
25
26
  const HitGrid = () => {
26
27
  const { t } = useTranslation();
27
28
  const theme = useTheme();
28
29
  const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
29
- const { onClick } = useHitSelection();
30
+ const { onClick } = useRecordSelection();
30
31
  const { getMatchingAnalytic } = useMatchers();
31
- const search = useContextSelector(HitSearchContext, ctx => ctx.search);
32
- const displayType = useContextSelector(HitSearchContext, ctx => ctx.displayType);
33
- const setDisplayType = useContextSelector(HitSearchContext, ctx => ctx.setDisplayType);
34
- const response = useContextSelector(HitSearchContext, ctx => ctx.response);
35
- const searching = useContextSelector(HitSearchContext, ctx => ctx.searching);
36
- const selectedHits = useContextSelector(HitContext, ctx => ctx.selectedHits);
32
+ const search = useContextSelector(RecordSearchContext, ctx => ctx.search);
33
+ const displayType = useContextSelector(RecordSearchContext, ctx => ctx.displayType);
34
+ const setDisplayType = useContextSelector(RecordSearchContext, ctx => ctx.setDisplayType);
35
+ const response = useContextSelector(RecordSearchContext, ctx => ctx.response);
36
+ const searching = useContextSelector(RecordSearchContext, ctx => ctx.searching);
37
+ const selectedHits = useContextSelector(RecordContext, ctx => ctx.selectedRecords);
37
38
  const query = useContextSelector(ParameterContext, ctx => ctx.query);
38
39
  const selected = useContextSelector(ParameterContext, ctx => ctx.selected);
39
40
  const [collapseMainColumn, setCollapseMainColumn] = useMyLocalStorageItem(StorageKey.GRID_COLLAPSE_COLUMN, false);
@@ -56,10 +57,11 @@ const HitGrid = () => {
56
57
  return false;
57
58
  }, [selected, selectedHits]);
58
59
  useEffect(() => {
59
- response?.items.forEach(hit => {
60
- if (!analyticIds[hit.howler.analytic]) {
61
- getMatchingAnalytic(hit).then(_analytic => setAnalyticIds(_analyticIds => ({ ..._analyticIds, [hit.howler.analytic]: _analytic.analytic_id })));
60
+ response?.items.forEach(record => {
61
+ if (!isHit(record) || analyticIds[record.howler.analytic]) {
62
+ return;
62
63
  }
64
+ getMatchingAnalytic(record).then(_analytic => setAnalyticIds(_analyticIds => ({ ..._analyticIds, [record.howler.analytic]: _analytic.analytic_id })));
63
65
  });
64
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
65
67
  }, [analyticIds, response]);
@@ -117,7 +119,7 @@ const HitGrid = () => {
117
119
  }
118
120
  return selectedElement.id;
119
121
  }, []);
120
- return (_jsxs(Stack, { spacing: 1, p: 2, width: "100%", sx: { overflow: 'hidden', height: `calc(100vh - ${theme.spacing(showSelectBar ? 13 : 8)})` }, children: [_jsx(DevelopmentBanner, {}), _jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [_jsx(Typography, { sx: { color: 'text.secondary', fontSize: '0.9em', fontStyle: 'italic', mb: 0.5, textAlign: 'left' }, variant: "body2", children: t('hit.search.prompt') }), response && (_jsx(SearchTotal, { sx: { color: 'text.secondary', fontSize: '0.9em', fontStyle: 'italic', mb: 0.5 }, variant: "body2", offset: response.offset, pageLength: response.rows, total: response.total }))] }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsxs(Stack, { position: "relative", flex: 1, children: [_jsx(HitQuery, { searching: searching, triggerSearch: search, compact: true }), searching && (_jsx(LinearProgress, { sx: {
122
+ return (_jsxs(Stack, { spacing: 1, p: 2, width: "100%", sx: { overflow: 'hidden', height: `calc(100vh - ${theme.spacing(showSelectBar ? 13 : 8)})` }, children: [_jsx(DevelopmentBanner, {}), _jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [_jsx(Typography, { sx: { color: 'text.secondary', fontSize: '0.9em', fontStyle: 'italic', mb: 0.5, textAlign: 'left' }, variant: "body2", children: t('hit.search.prompt') }), response && (_jsx(SearchTotal, { sx: { color: 'text.secondary', fontSize: '0.9em', fontStyle: 'italic', mb: 0.5 }, variant: "body2", offset: response.offset, pageLength: response.rows, total: response.total }))] }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsxs(Stack, { position: "relative", flex: 1, children: [_jsx(RecordQuery, { searching: searching, triggerSearch: search, compact: true }), searching && (_jsx(LinearProgress, { sx: {
121
123
  position: 'absolute',
122
124
  left: 0,
123
125
  right: 0,
@@ -127,6 +129,6 @@ const HitGrid = () => {
127
129
  } }))] }), _jsxs(ToggleButtonGroup, { exclusive: true, value: displayType, onChange: (__, value) => setDisplayType(value), size: "small", children: [_jsx(ToggleButton, { value: "list", children: _jsx(List, {}) }), _jsx(ToggleButton, { value: "grid", children: _jsx(TableChart, {}) })] })] }), _jsxs(Stack, { direction: "row", spacing: 1, width: "100%", alignItems: "center", children: [_jsx(QuerySettings, { boxSx: { flex: 1 } }), _jsx(AddColumnModal, { columns: columns, addColumn: key => setColumns(uniq([...columns, key])) })] }), _jsxs(Stack, { component: Paper, spacing: 1, width: "100%", height: "100%", sx: { overflow: 'auto', flex: 1 }, onScroll: onScroll, children: [_jsxs(Table, { sx: { '& td,th': { px: 1, py: 0.25, whiteSpace: 'nowrap' } }, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { sx: {
128
130
  borderRight: 'thin solid',
129
131
  borderRightColor: 'divider'
130
- }, children: _jsx(IconButton, { onClick: () => setCollapseMainColumn(!collapseMainColumn), children: collapseMainColumn ? (_jsx(FormatIndentIncrease, { fontSize: "small" })) : (_jsx(FormatIndentDecrease, { fontSize: "small" })) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: pointerWithin, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: columns, children: columns.map(col => (_jsx(ColumnHeader, { col: col, width: columnWidths[col], onMouseDown: onMouseDown, setColumns: setColumns }, col))) }) }), _jsx(TableCell, { sx: { width: '100%' } })] }) }), _jsxs(HitContextMenu, { Component: TableBody, getSelectedId: getSelectedId, children: [response?.items.map(hit => (_jsx(HitRow, { hit: hit, analyticIds: analyticIds, columns: columns, columnWidths: columnWidths, collapseMainColumn: collapseMainColumn, onClick: onClick }, hit.howler.id))), _jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + 2, children: _jsx(Stack, { alignItems: "center", justifyContent: "center", py: 0.5, px: 1, children: _jsx(IconButton, { onClick: () => search(query, true), children: _jsx(Search, {}) }) }) }) })] })] }), (response?.total ?? 0) < 1 && (_jsx(Stack, { direction: "row", spacing: 1, alignItems: "center", p: 1, justifyContent: "center", flex: 1, children: _jsxs(Typography, { variant: "h3", color: "text.secondary", display: "flex", flexDirection: "row", alignItems: "center", children: [_jsx(Info, { fontSize: "inherit", sx: { color: 'text.secondary', mr: 1 } }), _jsx("span", { children: t('app.list.empty') })] }) }))] })] }));
132
+ }, children: _jsx(IconButton, { onClick: () => setCollapseMainColumn(!collapseMainColumn), children: collapseMainColumn ? (_jsx(FormatIndentIncrease, { fontSize: "small" })) : (_jsx(FormatIndentDecrease, { fontSize: "small" })) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: pointerWithin, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: columns, children: columns.map(col => (_jsx(ColumnHeader, { col: col, width: columnWidths[col], onMouseDown: onMouseDown, setColumns: setColumns }, col))) }) }), _jsx(TableCell, { sx: { width: '100%' } })] }) }), _jsxs(RecordContextMenu, { Component: TableBody, getSelectedId: getSelectedId, children: [response?.items.map(hit => (_jsx(RecordRow, { record: hit, analyticIds: analyticIds, columns: columns, columnWidths: columnWidths, collapseMainColumn: collapseMainColumn, onClick: onClick }, hit.howler.id))), _jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + 2, children: _jsx(Stack, { alignItems: "center", justifyContent: "center", py: 0.5, px: 1, children: _jsx(IconButton, { onClick: () => search(query, true), children: _jsx(Search, {}) }) }) }) })] })] }), (response?.total ?? 0) < 1 && (_jsx(Stack, { direction: "row", spacing: 1, alignItems: "center", p: 1, justifyContent: "center", flex: 1, children: _jsxs(Typography, { variant: "h3", color: "text.secondary", display: "flex", flexDirection: "row", alignItems: "center", children: [_jsx(Info, { fontSize: "inherit", sx: { color: 'text.secondary', mr: 1 } }), _jsx("span", { children: t('app.list.empty') })] }) }))] })] }));
131
133
  };
132
134
  export default HitGrid;
@@ -1,10 +1,11 @@
1
1
  import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
2
+ import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
2
3
  declare const _default: import("react").NamedExoticComponent<{
3
- hit: Hit;
4
+ record: Hit | Observable;
4
5
  analyticIds: Record<string, string>;
5
6
  columns: string[];
6
7
  columnWidths: Record<string, string>;
7
8
  collapseMainColumn: boolean;
8
- onClick: (e: React.MouseEvent<HTMLDivElement>, hit: Hit) => void;
9
+ onClick: (e: React.MouseEvent<HTMLDivElement>, record: Hit | Observable) => void;
9
10
  }>;
10
11
  export default _default;
@@ -1,25 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { KeyboardArrowUp } from '@mui/icons-material';
3
3
  import { Box, Collapse, IconButton, lighten, Stack, TableCell, TableRow, Typography, useTheme } from '@mui/material';
4
- import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
5
4
  import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
5
+ import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
6
6
  import Assigned from '@cccsaurora/howler-ui/components/elements/hit/elements/Assigned';
7
7
  import EscalationChip from '@cccsaurora/howler-ui/components/elements/hit/elements/EscalationChip';
8
8
  import HitCard from '@cccsaurora/howler-ui/components/elements/hit/HitCard';
9
9
  import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
10
+ import ObservableCard from '@cccsaurora/howler-ui/components/elements/observable/ObservableCard';
10
11
  import { get } from 'lodash-es';
11
12
  import { memo, useState } from 'react';
12
13
  import { useTranslation } from 'react-i18next';
13
14
  import { Link } from 'react-router-dom';
14
15
  import { useContextSelector } from 'use-context-selector';
16
+ import { isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
15
17
  import EnhancedCell from './EnhancedCell';
16
- const HitRow = ({ hit, analyticIds, columns, columnWidths, collapseMainColumn, onClick }) => {
18
+ const RecordRow = ({ record, analyticIds, columns, columnWidths, collapseMainColumn, onClick }) => {
17
19
  const theme = useTheme();
18
20
  const { t } = useTranslation();
19
- const selectedHits = useContextSelector(HitContext, ctx => ctx.selectedHits);
21
+ const selectedHits = useContextSelector(RecordContext, ctx => ctx.selectedRecords);
20
22
  const selected = useContextSelector(ParameterContext, ctx => ctx.selected);
21
23
  const [expandRow, setExpandRow] = useState(false);
22
- return (_jsxs(_Fragment, { children: [_jsxs(TableRow, { id: hit.howler.id, onClick: ev => onClick(ev, hit), sx: [
24
+ return (_jsxs(_Fragment, { children: [_jsxs(TableRow, { id: record.howler.id, onClick: ev => onClick(ev, record), sx: [
23
25
  {
24
26
  transition: theme.transitions.create('background-color'),
25
27
  '&:hover': {
@@ -27,10 +29,10 @@ const HitRow = ({ hit, analyticIds, columns, columnWidths, collapseMainColumn, o
27
29
  backgroundColor: theme.palette.background.paper
28
30
  }
29
31
  },
30
- selectedHits.some(_hit => _hit.howler.id === hit.howler.id) && {
32
+ selectedHits.some(_hit => _hit.howler.id === record.howler.id) && {
31
33
  backgroundColor: lighten(theme.palette.background.paper, 0.15)
32
34
  },
33
- selected === hit.howler.id && {
35
+ selected === record.howler.id && {
34
36
  backgroundColor: lighten(theme.palette.background.paper, 0.25)
35
37
  }
36
38
  ], children: [_jsx(TableCell, { sx: {
@@ -45,6 +47,6 @@ const HitRow = ({ hit, analyticIds, columns, columnWidths, collapseMainColumn, o
45
47
  e.preventDefault();
46
48
  e.stopPropagation();
47
49
  setExpandRow(_expanded => !_expanded);
48
- }, children: _jsx(KeyboardArrowUp, {}) }), _jsx(Collapse, { in: !collapseMainColumn, orientation: "horizontal", unmountOnExit: true, children: _jsxs(Stack, { direction: "row", spacing: 1, flexWrap: "nowrap", children: [_jsx(EscalationChip, { hit: hit, layout: HitLayout.DENSE, hideLabel: true }), _jsxs(Typography, { sx: { textWrap: 'nowrap', whiteSpace: 'nowrap', fontSize: 'inherit' }, children: [analyticIds[hit.howler.analytic] ? (_jsx(Link, { to: `/analytics/${analyticIds[hit.howler.analytic]}`, onClick: e => e.stopPropagation(), children: hit.howler.analytic })) : (hit.howler.analytic), hit.howler.detection && ': ', hit.howler.detection] }), hit.howler.assignment !== 'unassigned' && _jsx(Assigned, { hit: hit, layout: HitLayout.DENSE, hideLabel: true })] }) })] }) }), columns.map(col => (_jsx(EnhancedCell, { hit: hit, className: `col-${col.replaceAll('.', '-')}`, value: get(hit, col) ?? t('none'), sx: columnWidths[col] ? { width: columnWidths[col] } : { width: '220px', maxWidth: '300px' }, field: col }, col)))] }, hit.howler.id), _jsx(TableRow, { onClick: ev => onClick(ev, hit), children: _jsx(TableCell, { colSpan: columns.length + 2, style: { paddingBottom: 0, paddingTop: 0 }, children: _jsx(Collapse, { in: expandRow, unmountOnExit: true, children: _jsx(Box, { width: "100%", maxWidth: "1200px", margin: 1, children: _jsx(HitCard, { id: hit.howler.id, layout: HitLayout.NORMAL }) }) }) }) })] }));
50
+ }, children: _jsx(KeyboardArrowUp, {}) }), _jsx(Collapse, { in: !collapseMainColumn, orientation: "horizontal", unmountOnExit: true, children: _jsxs(Stack, { direction: "row", spacing: 1, flexWrap: "nowrap", children: [isHit(record) && _jsx(EscalationChip, { hit: record, layout: HitLayout.DENSE, hideLabel: true }), _jsxs(Typography, { sx: { textWrap: 'nowrap', whiteSpace: 'nowrap', fontSize: 'inherit' }, children: [analyticIds[record.howler.analytic] ? (_jsx(Link, { to: `/analytics/${analyticIds[record.howler.analytic]}`, onClick: e => e.stopPropagation(), children: record.howler.analytic })) : (record.howler.analytic), record.howler.detection && ': ', record.howler.detection] }), isHit(record) && record.howler.assignment !== 'unassigned' && (_jsx(Assigned, { hit: record, layout: HitLayout.DENSE, hideLabel: true }))] }) })] }) }), columns.map(col => (_jsx(EnhancedCell, { record: record, className: `col-${col.replaceAll('.', '-')}`, value: get(record, col) ?? t('none'), sx: columnWidths[col] ? { width: columnWidths[col] } : { width: '220px', maxWidth: '300px' }, field: col }, col)))] }, record.howler.id), _jsx(TableRow, { onClick: ev => onClick(ev, record), children: _jsx(TableCell, { colSpan: columns.length + 2, style: { paddingBottom: 0, paddingTop: 0 }, children: _jsx(Collapse, { in: expandRow, unmountOnExit: true, children: _jsx(Box, { width: "100%", maxWidth: "1200px", margin: 1, children: isHit(record) ? (_jsx(HitCard, { id: record.howler.id, layout: HitLayout.NORMAL })) : (_jsx(ObservableCard, { id: record.howler.id, observable: record })) }) }) }) })] }));
49
51
  };
50
- export default memo(HitRow);
52
+ export default memo(RecordRow);
@@ -0,0 +1,2 @@
1
+ declare const _default: import("react").NamedExoticComponent<{}>;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FilterList } from '@mui/icons-material';
3
+ import { Autocomplete, TextField } from '@mui/material';
4
+ import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
5
+ import ChipPopper from '@cccsaurora/howler-ui/components/elements/display/ChipPopper';
6
+ import { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { useContextSelector } from 'use-context-selector';
9
+ const FILTER_OPTIONS = [
10
+ { label: 'hit.search.index.hit', value: 'hit' },
11
+ { label: 'hit.search.index.observable', value: 'observable' }
12
+ ];
13
+ const IndexPicker = () => {
14
+ const { t } = useTranslation();
15
+ const indexes = useContextSelector(ParameterContext, ctx => ctx.indexes);
16
+ const setIndexes = useContextSelector(ParameterContext, ctx => ctx.setIndexes);
17
+ const selectedOptions = FILTER_OPTIONS.filter(opt => indexes.includes(opt.value));
18
+ return (_jsx(ChipPopper, { icon: _jsx(FilterList, { fontSize: "small" }), label: selectedOptions.map(opt => t(opt.label)).join(', '), minWidth: "225px", slotProps: { chip: { size: 'small' } }, children: _jsx(Autocomplete, { size: "small", multiple: true, options: FILTER_OPTIONS, value: selectedOptions, onChange: (_ev, values) => values.length > 0 && setIndexes(values.map(val => val.value)), isOptionEqualToValue: (opt, val) => opt.value === val.value, getOptionLabel: opt => t(opt.label), renderInput: params => _jsx(TextField, { ...params }) }) }));
19
+ };
20
+ export default memo(IndexPicker);
@@ -4,23 +4,22 @@ import { Code, Comment, DataObject, History, LinkSharp, QueryStats, ViewAgenda }
4
4
  import { Badge, Box, CardContent, Collapse, IconButton, Skeleton, Stack, Tab, Tabs, Tooltip, useMediaQuery, useTheme } from '@mui/material';
5
5
  import PageCenter from '@cccsaurora/howler-ui/commons/components/pages/PageCenter';
6
6
  import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
7
- import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
7
+ import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
8
8
  import FlexOne from '@cccsaurora/howler-ui/components/elements/addons/layout/FlexOne';
9
9
  import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
10
- import BundleButton from '@cccsaurora/howler-ui/components/elements/display/icons/BundleButton';
11
10
  import SocketBadge from '@cccsaurora/howler-ui/components/elements/display/icons/SocketBadge';
12
11
  import JSONViewer from '@cccsaurora/howler-ui/components/elements/display/json/JSONViewer';
13
12
  import HitActions from '@cccsaurora/howler-ui/components/elements/hit/HitActions';
14
13
  import HitBanner from '@cccsaurora/howler-ui/components/elements/hit/HitBanner';
15
- import HitComments from '@cccsaurora/howler-ui/components/elements/hit/HitComments';
16
- import HitDetails from '@cccsaurora/howler-ui/components/elements/hit/HitDetails';
17
14
  import HitLabels from '@cccsaurora/howler-ui/components/elements/hit/HitLabels';
18
15
  import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
19
16
  import HitLinks from '@cccsaurora/howler-ui/components/elements/hit/HitLinks';
20
17
  import HitOutline from '@cccsaurora/howler-ui/components/elements/hit/HitOutline';
21
18
  import HitOverview from '@cccsaurora/howler-ui/components/elements/hit/HitOverview';
22
- import HitRelated from '@cccsaurora/howler-ui/components/elements/hit/HitRelated';
23
- import HitWorklog from '@cccsaurora/howler-ui/components/elements/hit/HitWorklog';
19
+ import ObjectDetails from '@cccsaurora/howler-ui/components/elements/ObjectDetails';
20
+ import RecordComments from '@cccsaurora/howler-ui/components/elements/record/RecordComments';
21
+ import RecordRelated from '@cccsaurora/howler-ui/components/elements/record/RecordRelated';
22
+ import RecordWorklog from '@cccsaurora/howler-ui/components/elements/record/RecordWorklog';
24
23
  import { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
25
24
  import useMyUserList from '@cccsaurora/howler-ui/components/hooks/useMyUserList';
26
25
  import { useCallback, useEffect, useMemo, useState } from 'react';
@@ -44,8 +43,8 @@ const HitViewer = () => {
44
43
  const isUnderLg = useMediaQuery(theme.breakpoints.down('lg'));
45
44
  const [orientation, setOrientation] = useMyLocalStorageItem(StorageKey.VIEWER_ORIENTATION, Orientation.VERTICAL);
46
45
  const { getMatchingOverview, getMatchingDossiers, getMatchingAnalytic } = useMatchers();
47
- const getHit = useContextSelector(HitContext, ctx => ctx.getHit);
48
- const hit = useContextSelector(HitContext, ctx => ctx.hits[params.id]);
46
+ const getHit = useContextSelector(RecordContext, ctx => ctx.getRecord);
47
+ const hit = useContextSelector(RecordContext, ctx => ctx.records[params.id]);
49
48
  const [userIds, setUserIds] = useState(new Set());
50
49
  const users = useMyUserList(userIds);
51
50
  const [tab, setTab] = useState('details');
@@ -94,12 +93,12 @@ const HitViewer = () => {
94
93
  }
95
94
  return {
96
95
  overview: () => _jsx(HitOverview, { hit: hit }),
97
- details: () => _jsx(HitDetails, { hit: hit }),
98
- hit_comments: () => _jsx(HitComments, { hit: hit, users: users }),
96
+ details: () => _jsx(ObjectDetails, { obj: hit }),
97
+ hit_comments: () => _jsx(RecordComments, { record: hit, users: users }),
99
98
  hit_raw: () => _jsx(JSONViewer, { data: hit }),
100
99
  hit_data: () => _jsx(JSONViewer, { data: hit?.howler?.data?.map(entry => tryParse(entry)), collapse: false }),
101
- hit_worklog: () => _jsx(HitWorklog, { hit: hit, users: users }),
102
- hit_related: () => _jsx(HitRelated, { hit: hit }),
100
+ hit_worklog: () => _jsx(RecordWorklog, { record: hit, users: users }),
101
+ hit_related: () => _jsx(RecordRelated, { record: hit }),
103
102
  ...Object.fromEntries(hit?.howler.dossier?.map((lead, index) => ['lead:' + index, () => _jsx(LeadRenderer, { lead: lead, hit: hit })]) ?? []),
104
103
  ...Object.fromEntries(dossiers.flatMap((_dossier, dossierIndex) => (_dossier.leads ?? []).map((_lead, leadIndex) => [
105
104
  `external-lead:${dossierIndex}:${leadIndex}`,
@@ -132,7 +131,7 @@ const HitViewer = () => {
132
131
  position: 'absolute',
133
132
  top: theme.spacing(2),
134
133
  right: theme.spacing(-6)
135
- }, children: [_jsx(Tooltip, { title: t('hit.panel.view.layout'), children: _jsx(IconButton, { onClick: onOrientationChange, children: _jsx(ViewAgenda, { sx: { transition: 'rotate 250ms', rotate: orientation === 'vertical' ? '90deg' : '0deg' } }) }) }), _jsx(SocketBadge, { size: "medium" }), analytic && (_jsx(Tooltip, { title: t('hit.panel.analytic.open'), children: _jsx(IconButton, { onClick: () => navigate(`/analytics/${analytic.analytic_id}`), children: _jsx(QueryStats, {}) }) })), hit?.howler.bundles?.length > 0 && _jsx(BundleButton, { ids: hit.howler.bundles })] }))] }), _jsx(HowlerCard, { sx: [orientation === 'horizontal' && { height: '0px' }], children: _jsx(CardContent, { sx: { padding: 1, position: 'relative' }, children: _jsx(HitActions, { hit: hit, orientation: "vertical" }) }) }), _jsx(Box, { sx: { gridColumn: '1 / span 2', mb: 1 }, children: _jsxs(Tabs, { value: tab === 'overview' && !hasOverview ? 'details' : tab, sx: { display: 'flex', flexDirection: 'row', pr: 2, alignItems: 'center' }, children: [hit?.howler?.is_bundle && (_jsx(Tab, { label: t('hit.viewer.aggregate'), value: "hit_aggregate", onClick: () => setTab('hit_aggregate') })), hasOverview && (_jsx(Tab, { label: t('hit.viewer.overview'), value: "overview", onClick: () => setTab('overview') })), _jsx(Tab, { label: t('hit.viewer.details'), value: "details", onClick: () => setTab('details') }), hit?.howler.dossier?.map((lead, index) => (_jsx(Tab
134
+ }, children: [_jsx(Tooltip, { title: t('hit.panel.view.layout'), children: _jsx(IconButton, { onClick: onOrientationChange, children: _jsx(ViewAgenda, { sx: { transition: 'rotate 250ms', rotate: orientation === 'vertical' ? '90deg' : '0deg' } }) }) }), _jsx(SocketBadge, { size: "medium" }), analytic && (_jsx(Tooltip, { title: t('analytic.open'), children: _jsx(IconButton, { onClick: () => navigate(`/analytics/${analytic.analytic_id}`), children: _jsx(QueryStats, {}) }) }))] }))] }), _jsx(HowlerCard, { sx: [orientation === 'horizontal' && { height: '0px' }], children: _jsx(CardContent, { sx: { padding: 1, position: 'relative' }, children: _jsx(HitActions, { hit: hit, orientation: "vertical" }) }) }), _jsx(Box, { sx: { gridColumn: '1 / span 2', mb: 1 }, children: _jsxs(Tabs, { value: tab === 'overview' && !hasOverview ? 'details' : tab, sx: { display: 'flex', flexDirection: 'row', pr: 2, alignItems: 'center' }, children: [hasOverview && (_jsx(Tab, { label: t('hit.viewer.overview'), value: "overview", onClick: () => setTab('overview') })), _jsx(Tab, { label: t('hit.viewer.details'), value: "details", onClick: () => setTab('details') }), hit?.howler.dossier?.map((lead, index) => (_jsx(Tab
136
135
  // eslint-disable-next-line react/no-array-index-key
137
136
  , { label: _jsxs(Stack, { direction: "row", spacing: 0.5, children: [lead.icon && _jsx(Icon, { icon: lead.icon }), _jsx("span", { children: i18n.language === 'en' ? lead.label.en : lead.label.fr })] }), value: 'lead:' + index, onClick: () => setTab('lead:' + index) }, 'lead:' + index))), dossiers.flatMap((_dossier, dossierIndex) => (_dossier.leads ?? []).map((_lead, leadIndex) => (_jsx(Tab
138
137
  // eslint-disable-next-line react/no-array-index-key
@@ -3,74 +3,80 @@ import { OpenInNew } from '@mui/icons-material';
3
3
  import { Card, CardContent, IconButton, Skeleton, Stack, Typography } from '@mui/material';
4
4
  import api from '@cccsaurora/howler-ui/api';
5
5
  import AppListEmpty from '@cccsaurora/howler-ui/commons/components/display/AppListEmpty';
6
- import { useHitContextSelector } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
6
+ import { useHitContextSelector as useRecordContextSelector } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
7
7
  import { ViewContext } from '@cccsaurora/howler-ui/components/app/providers/ViewProvider';
8
8
  import HitBanner from '@cccsaurora/howler-ui/components/elements/hit/HitBanner';
9
9
  import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
10
+ import ObservableCard from '@cccsaurora/howler-ui/components/elements/observable/ObservableCard';
11
+ import RecordContextMenu from '@cccsaurora/howler-ui/components/elements/record/RecordContextMenu';
10
12
  import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
11
- import HitContextMenu from '@cccsaurora/howler-ui/components/routes/hits/search/HitContextMenu';
12
13
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
14
  import { useTranslation } from 'react-i18next';
14
15
  import { Link, useNavigate } from 'react-router-dom';
15
16
  import { useContextSelector } from 'use-context-selector';
17
+ import { isObservable } from '@cccsaurora/howler-ui/utils/typeUtils';
16
18
  import { buildViewUrl } from '@cccsaurora/howler-ui/utils/viewUtils';
17
- // Custom hook to select hits by IDs with proper memoization
18
- const useSelectHitsByIds = (hitIds) => {
19
- const hitIdsRef = useRef(hitIds);
19
+ // Custom hook to select records by IDs with proper memoization
20
+ const useSelectRecordsByIds = (recordIds) => {
21
+ const recordIdsRef = useRef(recordIds);
20
22
  const prevResultRef = useRef([]);
21
- const prevHitIdsRef = useRef([]);
22
- // Keep ref up to date with latest hitIds
23
- hitIdsRef.current = hitIds;
23
+ const prevRecordIdsRef = useRef([]);
24
+ // Keep ref up to date with latest recordIds
25
+ recordIdsRef.current = recordIds;
24
26
  const selector = useCallback(ctx => {
25
- const currentHitIds = hitIdsRef.current;
26
- // Fast path: if hitIds array didn't change, check if hit objects changed
27
- if (prevHitIdsRef.current.length === currentHitIds.length &&
28
- currentHitIds.every((id, i) => id === prevHitIdsRef.current[i])) {
29
- // HitIds unchanged - check if any hit objects changed by reference
30
- const anyHitChanged = currentHitIds.some((id, i) => ctx.hits[id] !== prevResultRef.current[i]);
31
- if (!anyHitChanged) {
27
+ const currentRecordIds = recordIdsRef.current;
28
+ // Fast path: if recordIds array didn't change, check if record objects changed
29
+ if (prevRecordIdsRef.current.length === currentRecordIds.length &&
30
+ currentRecordIds.every((id, i) => id === prevRecordIdsRef.current[i])) {
31
+ // RecordIds unchanged - check if any record objects changed by reference
32
+ const anyRecordChanged = currentRecordIds.some((id, i) => ctx.records[id] !== prevResultRef.current[i]);
33
+ if (!anyRecordChanged) {
32
34
  return prevResultRef.current;
33
35
  }
34
36
  }
35
37
  // Something changed - rebuild the array
36
- const currentHits = currentHitIds.map(id => ctx.hits[id]).filter(Boolean);
37
- prevHitIdsRef.current = currentHitIds;
38
- prevResultRef.current = currentHits;
39
- return currentHits;
38
+ const currentRecords = currentRecordIds.map(id => ctx.records[id]).filter(Boolean);
39
+ prevRecordIdsRef.current = currentRecordIds;
40
+ prevResultRef.current = currentRecords;
41
+ return currentRecords;
40
42
  }, []); // Empty deps - selector never changes
41
- return useHitContextSelector(selector);
43
+ return useRecordContextSelector(selector);
42
44
  };
43
45
  // Utility functions
44
46
  const normalize = (val) => (val == null ? '' : String(val));
45
47
  // Have to normalize the fields as websockets and api return null and undefined respectively. This causes false positives when comparing signatures if not normalized to a consistent value. We also stringify non-primitive values to ensure changes are detected.
46
- const createHitSignature = (hit) => {
47
- if (!hit)
48
+ const createRecordSignature = (record) => {
49
+ if (!record) {
48
50
  return '';
49
- return `${hit.howler?.id}:${normalize(hit.howler?.status)}:${normalize(hit.howler?.assignment)}:${normalize(hit.howler?.assessment)}`;
51
+ }
52
+ if (isObservable(record)) {
53
+ return record.howler?.id;
54
+ }
55
+ return `${record.howler?.id}:${normalize(record.howler?.status)}:${normalize(record.howler?.assignment)}:${normalize(record.howler?.assessment)}`;
50
56
  };
51
- const createSignatureFromHits = (hits) => {
52
- if (hits.length === 0)
57
+ const createSignatureFromRecords = (records) => {
58
+ if (records.length === 0)
53
59
  return '';
54
- return hits.map(createHitSignature).join('|');
60
+ return records.map(createRecordSignature).join('|');
55
61
  };
56
62
  const DEBOUNCE_TIME = 1000; // 1 second debounce for signature changes
57
63
  const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
58
64
  const navigate = useNavigate();
59
65
  const { t } = useTranslation();
60
66
  const { dispatchApi } = useMyApi();
61
- const [hitIds, setHitIds] = useState([]);
67
+ const [recordIds, setRecordIds] = useState([]);
62
68
  const [loading, setLoading] = useState(false);
63
69
  const debounceTimerRef = useRef(null);
64
70
  const isRefreshing = useRef(false);
65
71
  const lastSignature = useRef('');
66
72
  const view = useContextSelector(ViewContext, ctx => ctx.views[viewId]);
67
73
  const fetchViews = useContextSelector(ViewContext, ctx => ctx.fetchViews);
68
- const loadHits = useHitContextSelector(ctx => ctx.loadHits);
74
+ const loadRecords = useRecordContextSelector(ctx => ctx.loadRecords);
69
75
  // Subscribe to hits from HitProvider cache based on current hitIds in the view
70
76
  // Uses memoized selector to avoid unnecessary re-renders on unrelated hit updates
71
- const hits = useSelectHitsByIds(hitIds);
77
+ const records = useSelectRecordsByIds(recordIds);
72
78
  // Create a stable signature that only changes when relevant fields change
73
- const hitsSignature = useMemo(() => createSignatureFromHits(hits), [hits]);
79
+ const recordsSignature = useMemo(() => createSignatureFromRecords(records), [records]);
74
80
  const refreshView = useCallback(async () => {
75
81
  if (!view?.query || isRefreshing.current) {
76
82
  onRefreshComplete?.();
@@ -78,21 +84,21 @@ const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
78
84
  }
79
85
  isRefreshing.current = true;
80
86
  try {
81
- const res = await dispatchApi(api.search.hit.post({
87
+ const res = await dispatchApi(api.v2.search.post(view.indexes, {
82
88
  query: view.query,
83
89
  rows: limit,
84
90
  metadata: ['analytic']
85
91
  }));
86
- const fetchedHits = res.items ?? [];
87
- loadHits(fetchedHits);
88
- setHitIds(fetchedHits.map(h => h.howler.id));
89
- lastSignature.current = createSignatureFromHits(fetchedHits);
92
+ const fetchedRecords = res.items ?? [];
93
+ loadRecords(fetchedRecords);
94
+ setRecordIds(fetchedRecords.map(r => r.howler.id));
95
+ lastSignature.current = createSignatureFromRecords(fetchedRecords);
90
96
  }
91
97
  finally {
92
98
  isRefreshing.current = false;
93
99
  onRefreshComplete?.();
94
100
  }
95
- }, [dispatchApi, limit, view?.query, loadHits, onRefreshComplete]);
101
+ }, [dispatchApi, limit, view?.query, view?.indexes, loadRecords, onRefreshComplete]);
96
102
  const debouncedRefresh = useCallback(() => {
97
103
  if (debounceTimerRef.current) {
98
104
  clearTimeout(debounceTimerRef.current);
@@ -125,16 +131,16 @@ const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
125
131
  }, [view?.query, limit, refreshView]);
126
132
  // Monitor hits currently in the view for changes that might affect query results
127
133
  useEffect(() => {
128
- if (!hitsSignature || hitIds.length === 0 || !lastSignature.current) {
129
- lastSignature.current = hitsSignature;
134
+ if (!recordsSignature || recordIds.length === 0 || !lastSignature.current) {
135
+ lastSignature.current = recordsSignature;
130
136
  return;
131
137
  }
132
138
  // Check if signature actually changed
133
- if (lastSignature.current === hitsSignature) {
139
+ if (lastSignature.current === recordsSignature) {
134
140
  return;
135
141
  }
136
142
  debouncedRefresh();
137
- }, [hitsSignature, hitIds, debouncedRefresh]);
143
+ }, [recordsSignature, recordIds, debouncedRefresh]);
138
144
  useEffect(() => {
139
145
  return () => {
140
146
  if (debounceTimerRef.current) {
@@ -151,6 +157,6 @@ const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
151
157
  }
152
158
  return selectedElement.id;
153
159
  }, []);
154
- return (_jsx(Card, { variant: "outlined", sx: { height: '100%' }, children: _jsxs(Stack, { spacing: 1, sx: { p: 1, minHeight: 100 }, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { variant: "h6", children: t(view?.title) || _jsx(Skeleton, { variant: "text", height: "2em", width: "100px" }) }), _jsx(IconButton, { size: "small", component: Link, disabled: !view, to: view ? buildViewUrl(view) : '', onClick: () => onClick(view.query), children: _jsx(OpenInNew, { fontSize: "small" }) })] }), loading ? (_jsxs(_Fragment, { children: [_jsx(Skeleton, { height: 150, width: "100%", variant: "rounded" }), _jsx(Skeleton, { height: 160, width: "100%", variant: "rounded" }), _jsx(Skeleton, { height: 140, width: "100%", variant: "rounded" })] })) : hits.length > 0 ? (_jsx(HitContextMenu, { getSelectedId: getSelectedId, children: hits.map(h => (_jsx(Card, { id: h.howler.id, variant: "outlined", sx: { cursor: 'pointer' }, onClick: () => navigate((h.howler.is_bundle ? '/bundles/' : '/hits/') + h.howler.id), children: _jsx(CardContent, { children: _jsx(HitBanner, { layout: HitLayout.DENSE, hit: h }) }) }, h.howler.id))) })) : (_jsx(AppListEmpty, {}))] }) }));
160
+ return (_jsx(Card, { variant: "outlined", sx: { height: '100%' }, children: _jsxs(Stack, { spacing: 1, sx: { p: 1, minHeight: 100 }, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { variant: "h6", children: t(view?.title) || _jsx(Skeleton, { variant: "text", height: "2em", width: "100px" }) }), _jsx(IconButton, { size: "small", component: Link, disabled: !view, to: view ? buildViewUrl(view) : '', onClick: () => onClick(view.query), children: _jsx(OpenInNew, { fontSize: "small" }) })] }), loading ? (_jsxs(_Fragment, { children: [_jsx(Skeleton, { height: 150, width: "100%", variant: "rounded" }), _jsx(Skeleton, { height: 160, width: "100%", variant: "rounded" }), _jsx(Skeleton, { height: 140, width: "100%", variant: "rounded" })] })) : records.length > 0 ? (_jsx(RecordContextMenu, { getSelectedId: getSelectedId, children: records.map((r) => (_jsx(Card, { id: r.howler.id, variant: "outlined", sx: { cursor: 'pointer' }, onClick: () => navigate(`/hits/${r.howler.id}`), children: _jsx(CardContent, { children: r.__index == 'hit' ? (_jsx(HitBanner, { layout: HitLayout.DENSE, hit: r })) : (_jsx(ObservableCard, { observable: r })) }) }, r.howler.id))) })) : (_jsx(AppListEmpty, {}))] }) }));
155
161
  };
156
162
  export default ViewCard;