@cccsaurora/howler-ui 2.18.0-dev.766 → 2.18.0-dev.778

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 (298) hide show
  1. package/api/index.d.ts +0 -2
  2. package/api/index.js +2 -4
  3. package/api/search/facet/hit.d.ts +3 -1
  4. package/api/search/facet/index.d.ts +1 -3
  5. package/api/search/index.d.ts +1 -2
  6. package/api/search/index.js +1 -2
  7. package/commons/components/leftnav/LeftNavDrawer.js +1 -1
  8. package/components/app/App.js +8 -36
  9. package/components/app/hooks/useMatchers.d.ts +1 -1
  10. package/components/app/hooks/useMatchers.js +11 -23
  11. package/components/app/hooks/useMatchers.test.js +22 -22
  12. package/components/app/hooks/useTitle.js +3 -3
  13. package/components/app/providers/FavouritesProvider.js +2 -2
  14. package/components/app/providers/HitProvider.d.ts +22 -0
  15. package/components/app/providers/{RecordProvider.js → HitProvider.js} +41 -41
  16. package/components/app/providers/{RecordSearchProvider.d.ts → HitSearchProvider.d.ts} +6 -6
  17. package/components/app/providers/{RecordSearchProvider.js → HitSearchProvider.js} +17 -12
  18. package/components/app/providers/{RecordSearchProvider.test.js → HitSearchProvider.test.js} +71 -52
  19. package/components/app/providers/ModalProvider.d.ts +0 -1
  20. package/components/app/providers/ParameterProvider.d.ts +2 -9
  21. package/components/app/providers/ParameterProvider.js +240 -165
  22. package/components/app/providers/ParameterProvider.test.js +94 -346
  23. package/components/app/providers/UserListProvider.js +8 -28
  24. package/components/elements/PluginTypography.d.ts +1 -2
  25. package/components/elements/PluginTypography.js +2 -3
  26. package/components/elements/UserList.d.ts +2 -5
  27. package/components/elements/UserList.js +8 -18
  28. package/components/elements/addons/search/phrase/Phrase.js +1 -1
  29. package/components/elements/display/ChipPopper.d.ts +1 -1
  30. package/components/elements/display/HowlerCard.js +1 -1
  31. package/components/elements/display/Modal.js +0 -2
  32. package/components/elements/display/icons/BundleButton.d.ts +6 -0
  33. package/components/elements/display/icons/BundleButton.js +32 -0
  34. package/components/elements/hit/HitActions.js +4 -4
  35. package/components/elements/hit/HitBanner.d.ts +0 -1
  36. package/components/elements/hit/HitBanner.js +49 -29
  37. package/components/elements/hit/HitCard.d.ts +0 -2
  38. package/components/elements/hit/HitCard.js +7 -7
  39. package/components/elements/{record/RecordComments.d.ts → hit/HitComments.d.ts} +4 -5
  40. package/components/elements/{record/RecordComments.js → hit/HitComments.js} +28 -29
  41. package/components/elements/{ObjectDetails.js → hit/HitDetails.js} +17 -17
  42. package/components/elements/hit/HitLabels.js +2 -2
  43. package/components/elements/hit/HitLinks.js +1 -1
  44. package/components/elements/hit/HitOutline.d.ts +0 -1
  45. package/components/elements/hit/HitOutline.js +3 -3
  46. package/components/elements/hit/{HitPreview.d.ts → HitQuickSearch.d.ts} +3 -3
  47. package/components/elements/hit/{HitPreview.js → HitQuickSearch.js} +4 -10
  48. package/components/elements/hit/HitRelated.d.ts +6 -0
  49. package/components/elements/hit/HitRelated.js +7 -0
  50. package/components/elements/hit/HitSummary.d.ts +1 -2
  51. package/components/elements/hit/HitSummary.js +5 -6
  52. package/components/elements/{record/RecordWorklog.d.ts → hit/HitWorklog.d.ts} +3 -4
  53. package/components/elements/{record/RecordWorklog.js → hit/HitWorklog.js} +13 -15
  54. package/components/elements/hit/aggregate/HitGraph.js +8 -8
  55. package/components/elements/hit/outlines/DefaultOutline.js +1 -1
  56. package/components/elements/view/ViewTitle.d.ts +0 -1
  57. package/components/elements/view/ViewTitle.js +2 -9
  58. package/components/hooks/useHitActions.d.ts +1 -1
  59. package/components/hooks/useHitActions.js +4 -4
  60. package/components/hooks/{useRecordSelection.d.ts → useHitSelection.d.ts} +2 -2
  61. package/components/hooks/{useRecordSelection.js → useHitSelection.js} +33 -12
  62. package/components/hooks/useMyPreferences.js +1 -10
  63. package/components/hooks/useMySearch.js +2 -2
  64. package/components/hooks/useMySitemap.js +1 -4
  65. package/components/hooks/useMyTheme.js +2 -9
  66. package/components/routes/action/edit/ActionEditor.js +2 -2
  67. package/components/routes/action/useMyActionFunctions.js +22 -4
  68. package/components/routes/action/view/ActionSearch.js +1 -1
  69. package/components/routes/advanced/QueryBuilder.js +1 -1
  70. package/components/routes/advanced/QueryEditor.js +3 -3
  71. package/components/routes/advanced/historyCompletionProvider.js +3 -3
  72. package/components/routes/analytics/AnalyticDetails.js +2 -2
  73. package/components/routes/analytics/AnalyticSearch.js +1 -1
  74. package/components/routes/dossiers/DossierEditor.js +2 -2
  75. package/components/routes/dossiers/DossierEditor.test.js +1 -1
  76. package/components/routes/help/ApiDocumentation.js +1 -1
  77. package/components/routes/help/BundleDocumentation.d.ts +3 -0
  78. package/components/routes/help/BundleDocumentation.js +12 -0
  79. package/components/routes/help/HitBannerDocumentation.js +0 -1
  80. package/components/routes/help/HitDocumentation.js +3 -1
  81. package/components/routes/help/markdown/en/bundles.md.js +1 -0
  82. package/components/routes/help/markdown/fr/bundles.md.js +1 -0
  83. package/components/routes/hits/search/BundleParentMenu.d.ts +6 -0
  84. package/components/routes/hits/search/BundleParentMenu.js +32 -0
  85. package/components/routes/hits/search/BundleScroller.d.ts +2 -0
  86. package/components/routes/hits/search/BundleScroller.js +6 -0
  87. package/components/routes/hits/search/{RecordBrowser.js → HitBrowser.js} +9 -9
  88. package/components/{elements/record/RecordContextMenu.d.ts → routes/hits/search/HitContextMenu.d.ts} +3 -3
  89. package/components/routes/hits/search/HitContextMenu.js +227 -0
  90. package/components/{elements/record/RecordContextMenu.test.js → routes/hits/search/HitContextMenu.test.js} +39 -94
  91. package/components/routes/hits/search/{RecordQuery.d.ts → HitQuery.d.ts} +2 -2
  92. package/components/routes/hits/search/{RecordQuery.js → HitQuery.js} +6 -6
  93. package/components/routes/hits/search/InformationPane.d.ts +0 -1
  94. package/components/routes/hits/search/InformationPane.js +60 -47
  95. package/components/routes/hits/search/LayoutSettings.js +3 -3
  96. package/components/routes/hits/search/QuerySettings.js +1 -2
  97. package/components/routes/hits/search/QuerySettings.test.js +9 -14
  98. package/components/routes/hits/search/SearchPane.js +49 -26
  99. package/components/routes/hits/search/ViewLink.js +3 -3
  100. package/components/routes/hits/search/ViewLink.test.js +8 -8
  101. package/components/routes/hits/search/grid/AddColumnModal.js +4 -5
  102. package/components/routes/hits/search/grid/EnhancedCell.d.ts +1 -2
  103. package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
  104. package/components/routes/hits/search/grid/HitGrid.js +18 -20
  105. package/components/routes/hits/search/grid/{RecordRow.d.ts → HitRow.d.ts} +2 -3
  106. package/components/routes/hits/search/grid/{RecordRow.js → HitRow.js} +8 -10
  107. package/components/routes/hits/view/HitViewer.js +13 -12
  108. package/components/routes/home/ViewCard.js +41 -47
  109. package/components/{elements/MarkdownEditor.js → routes/overviews/OverviewEditor.js} +3 -3
  110. package/components/routes/overviews/OverviewViewer.js +2 -2
  111. package/components/routes/views/ViewComposer.js +19 -46
  112. package/locales/en/translation.json +5 -109
  113. package/locales/fr/translation.json +5 -107
  114. package/models/WithMetadata.d.ts +1 -2
  115. package/models/entities/generated/{ThreatEnrichment.d.ts → Enrichment.d.ts} +1 -1
  116. package/models/entities/generated/Hit.d.ts +0 -1
  117. package/models/entities/generated/Howler.d.ts +4 -0
  118. package/models/entities/generated/Rule.d.ts +10 -2
  119. package/models/entities/generated/Threat.d.ts +2 -2
  120. package/models/entities/generated/View.d.ts +0 -1
  121. package/package.json +3 -21
  122. package/plugins/clue/components/ClueTypography.js +2 -2
  123. package/plugins/clue/utils.d.ts +1 -2
  124. package/tests/mocks.d.ts +1 -11
  125. package/tests/mocks.js +7 -12
  126. package/tests/server-handlers.js +1 -6
  127. package/tests/utils.d.ts +0 -4
  128. package/tests/utils.js +0 -20
  129. package/utils/constants.d.ts +3 -4
  130. package/utils/constants.js +0 -6
  131. package/utils/hitFunctions.d.ts +1 -2
  132. package/utils/hitFunctions.js +4 -4
  133. package/utils/viewUtils.js +0 -3
  134. package/api/search/case.d.ts +0 -4
  135. package/api/search/case.js +0 -8
  136. package/api/v2/case/index.d.ts +0 -8
  137. package/api/v2/case/index.js +0 -20
  138. package/api/v2/case/items.d.ts +0 -6
  139. package/api/v2/case/items.js +0 -18
  140. package/api/v2/index.d.ts +0 -4
  141. package/api/v2/index.js +0 -6
  142. package/api/v2/search/facet.d.ts +0 -3
  143. package/api/v2/search/facet.js +0 -12
  144. package/api/v2/search/index.d.ts +0 -5
  145. package/api/v2/search/index.js +0 -24
  146. package/components/app/providers/RecordProvider.d.ts +0 -23
  147. package/components/elements/ContextMenu.d.ts +0 -56
  148. package/components/elements/ContextMenu.js +0 -109
  149. package/components/elements/ContextMenu.test.js +0 -215
  150. package/components/elements/ObjectDetails.d.ts +0 -6
  151. package/components/elements/case/CaseCard.d.ts +0 -12
  152. package/components/elements/case/CaseCard.js +0 -42
  153. package/components/elements/case/CasePreview.d.ts +0 -6
  154. package/components/elements/case/CasePreview.js +0 -17
  155. package/components/elements/case/StatusIcon.d.ts +0 -5
  156. package/components/elements/case/StatusIcon.js +0 -13
  157. package/components/elements/hit/elements/AnalyticLink.d.ts +0 -9
  158. package/components/elements/hit/elements/AnalyticLink.js +0 -22
  159. package/components/elements/hit/related/RelatedRecords.js +0 -63
  160. package/components/elements/observable/ObservableCard.d.ts +0 -6
  161. package/components/elements/observable/ObservableCard.js +0 -22
  162. package/components/elements/observable/ObservablePreview.d.ts +0 -6
  163. package/components/elements/observable/ObservablePreview.js +0 -12
  164. package/components/elements/record/RecordContextMenu.js +0 -256
  165. package/components/elements/record/RecordContextMenu.test.d.ts +0 -1
  166. package/components/elements/record/RecordRelated.d.ts +0 -7
  167. package/components/elements/record/RecordRelated.js +0 -34
  168. package/components/hooks/useRelatedRecords.d.ts +0 -13
  169. package/components/hooks/useRelatedRecords.js +0 -32
  170. package/components/routes/cases/CaseViewer.d.ts +0 -2
  171. package/components/routes/cases/CaseViewer.js +0 -22
  172. package/components/routes/cases/Cases.d.ts +0 -2
  173. package/components/routes/cases/Cases.js +0 -148
  174. package/components/routes/cases/constants.d.ts +0 -6
  175. package/components/routes/cases/constants.js +0 -6
  176. package/components/routes/cases/detail/AlertPanel.d.ts +0 -6
  177. package/components/routes/cases/detail/AlertPanel.js +0 -33
  178. package/components/routes/cases/detail/CaseAssets.d.ts +0 -11
  179. package/components/routes/cases/detail/CaseAssets.js +0 -104
  180. package/components/routes/cases/detail/CaseAssets.test.d.ts +0 -1
  181. package/components/routes/cases/detail/CaseAssets.test.js +0 -167
  182. package/components/routes/cases/detail/CaseDashboard.d.ts +0 -7
  183. package/components/routes/cases/detail/CaseDashboard.js +0 -66
  184. package/components/routes/cases/detail/CaseDetails.d.ts +0 -6
  185. package/components/routes/cases/detail/CaseDetails.js +0 -61
  186. package/components/routes/cases/detail/CaseOverview.d.ts +0 -7
  187. package/components/routes/cases/detail/CaseOverview.js +0 -43
  188. package/components/routes/cases/detail/CaseSidebar.d.ts +0 -8
  189. package/components/routes/cases/detail/CaseSidebar.js +0 -107
  190. package/components/routes/cases/detail/CaseSidebar.test.d.ts +0 -1
  191. package/components/routes/cases/detail/CaseSidebar.test.js +0 -246
  192. package/components/routes/cases/detail/CaseTask.d.ts +0 -11
  193. package/components/routes/cases/detail/CaseTask.js +0 -57
  194. package/components/routes/cases/detail/CaseTimeline.d.ts +0 -12
  195. package/components/routes/cases/detail/CaseTimeline.js +0 -106
  196. package/components/routes/cases/detail/CaseTimeline.test.d.ts +0 -1
  197. package/components/routes/cases/detail/CaseTimeline.test.js +0 -320
  198. package/components/routes/cases/detail/ItemPage.d.ts +0 -6
  199. package/components/routes/cases/detail/ItemPage.js +0 -99
  200. package/components/routes/cases/detail/RelatedCasePanel.d.ts +0 -6
  201. package/components/routes/cases/detail/RelatedCasePanel.js +0 -34
  202. package/components/routes/cases/detail/TaskPanel.d.ts +0 -7
  203. package/components/routes/cases/detail/TaskPanel.js +0 -52
  204. package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +0 -11
  205. package/components/routes/cases/detail/aggregates/CaseAggregate.js +0 -24
  206. package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +0 -6
  207. package/components/routes/cases/detail/aggregates/SourceAggregate.js +0 -26
  208. package/components/routes/cases/detail/assets/Asset.d.ts +0 -14
  209. package/components/routes/cases/detail/assets/Asset.js +0 -12
  210. package/components/routes/cases/detail/assets/Asset.test.d.ts +0 -1
  211. package/components/routes/cases/detail/assets/Asset.test.js +0 -72
  212. package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +0 -20
  213. package/components/routes/cases/detail/sidebar/CaseFolder.js +0 -83
  214. package/components/routes/cases/detail/sidebar/CaseFolder.test.d.ts +0 -1
  215. package/components/routes/cases/detail/sidebar/CaseFolder.test.js +0 -295
  216. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +0 -34
  217. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +0 -103
  218. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.d.ts +0 -1
  219. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +0 -363
  220. package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +0 -25
  221. package/components/routes/cases/detail/sidebar/FolderEntry.js +0 -88
  222. package/components/routes/cases/detail/sidebar/FolderEntry.test.d.ts +0 -1
  223. package/components/routes/cases/detail/sidebar/FolderEntry.test.js +0 -206
  224. package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +0 -5
  225. package/components/routes/cases/detail/sidebar/RootDropZone.js +0 -33
  226. package/components/routes/cases/detail/sidebar/types.d.ts +0 -9
  227. package/components/routes/cases/detail/sidebar/utils.d.ts +0 -3
  228. package/components/routes/cases/detail/sidebar/utils.js +0 -29
  229. package/components/routes/cases/detail/sidebar/utils.test.d.ts +0 -1
  230. package/components/routes/cases/detail/sidebar/utils.test.js +0 -82
  231. package/components/routes/cases/hooks/useCase.d.ts +0 -13
  232. package/components/routes/cases/hooks/useCase.js +0 -51
  233. package/components/routes/cases/modals/AddToCaseModal.d.ts +0 -7
  234. package/components/routes/cases/modals/AddToCaseModal.js +0 -59
  235. package/components/routes/cases/modals/AddToCaseModal.test.d.ts +0 -1
  236. package/components/routes/cases/modals/AddToCaseModal.test.js +0 -313
  237. package/components/routes/cases/modals/CaseRecordRow.d.ts +0 -9
  238. package/components/routes/cases/modals/CaseRecordRow.js +0 -15
  239. package/components/routes/cases/modals/CreateCaseModal.d.ts +0 -7
  240. package/components/routes/cases/modals/CreateCaseModal.js +0 -55
  241. package/components/routes/cases/modals/CreateCaseModal.test.d.ts +0 -1
  242. package/components/routes/cases/modals/CreateCaseModal.test.js +0 -358
  243. package/components/routes/cases/modals/RenameItemModal.d.ts +0 -9
  244. package/components/routes/cases/modals/RenameItemModal.js +0 -48
  245. package/components/routes/cases/modals/ResolveModal.d.ts +0 -7
  246. package/components/routes/cases/modals/ResolveModal.js +0 -115
  247. package/components/routes/cases/modals/ResolveModal.test.d.ts +0 -1
  248. package/components/routes/cases/modals/ResolveModal.test.js +0 -384
  249. package/components/routes/cases/modals/hooks.d.ts +0 -7
  250. package/components/routes/cases/modals/hooks.js +0 -44
  251. package/components/routes/cases/modals/types.d.ts +0 -5
  252. package/components/routes/cases/search/CaseAssigneeFilter.d.ts +0 -6
  253. package/components/routes/cases/search/CaseAssigneeFilter.js +0 -33
  254. package/components/routes/cases/search/CaseAssigneeFilter.test.d.ts +0 -1
  255. package/components/routes/cases/search/CaseAssigneeFilter.test.js +0 -127
  256. package/components/routes/cases/search/CaseDateFilter.d.ts +0 -13
  257. package/components/routes/cases/search/CaseDateFilter.js +0 -26
  258. package/components/routes/cases/search/CaseDateFilter.test.d.ts +0 -1
  259. package/components/routes/cases/search/CaseDateFilter.test.js +0 -115
  260. package/components/routes/cases/search/CaseStatusFilter.d.ts +0 -6
  261. package/components/routes/cases/search/CaseStatusFilter.js +0 -13
  262. package/components/routes/cases/search/CaseStatusFilter.test.d.ts +0 -1
  263. package/components/routes/cases/search/CaseStatusFilter.test.js +0 -86
  264. package/components/routes/hits/search/shared/IndexPicker.d.ts +0 -2
  265. package/components/routes/hits/search/shared/IndexPicker.js +0 -20
  266. package/components/routes/observables/ObservableViewer.d.ts +0 -7
  267. package/components/routes/observables/ObservableViewer.js +0 -27
  268. package/models/entities/generated/AttachmentsFile.d.ts +0 -12
  269. package/models/entities/generated/Case.d.ts +0 -28
  270. package/models/entities/generated/DestinationOriginal.d.ts +0 -19
  271. package/models/entities/generated/EmailAttachment.d.ts +0 -8
  272. package/models/entities/generated/EmailParent.d.ts +0 -19
  273. package/models/entities/generated/Enrichments.d.ts +0 -7
  274. package/models/entities/generated/EnrichmentsIndicator.d.ts +0 -21
  275. package/models/entities/generated/HttpResponse.d.ts +0 -11
  276. package/models/entities/generated/Item.d.ts +0 -9
  277. package/models/entities/generated/Observable.d.ts +0 -85
  278. package/models/entities/generated/ObservableCloud.d.ts +0 -20
  279. package/models/entities/generated/ObservableDestination.d.ts +0 -23
  280. package/models/entities/generated/ObservableEmail.d.ts +0 -30
  281. package/models/entities/generated/ObservableFile.d.ts +0 -36
  282. package/models/entities/generated/ObservableHowler.d.ts +0 -43
  283. package/models/entities/generated/ObservableHttp.d.ts +0 -11
  284. package/models/entities/generated/ObservableObserver.d.ts +0 -21
  285. package/models/entities/generated/ObservableOrganization.d.ts +0 -7
  286. package/models/entities/generated/ObservableProcess.d.ts +0 -34
  287. package/models/entities/generated/ObservableSource.d.ts +0 -23
  288. package/models/entities/generated/ObservableThreat.d.ts +0 -21
  289. package/models/entities/generated/ObservableTls.d.ts +0 -12
  290. package/models/entities/generated/ObserverIngress.d.ts +0 -9
  291. package/models/entities/generated/Task.d.ts +0 -10
  292. package/utils/typeUtils.d.ts +0 -7
  293. package/utils/typeUtils.js +0 -27
  294. /package/components/app/providers/{RecordSearchProvider.test.d.ts → HitSearchProvider.test.d.ts} +0 -0
  295. /package/components/elements/hit/{related/RelatedRecords.d.ts → HitDetails.d.ts} +0 -0
  296. /package/components/routes/hits/search/{RecordBrowser.d.ts → HitBrowser.d.ts} +0 -0
  297. /package/components/{elements/ContextMenu.test.d.ts → routes/hits/search/HitContextMenu.test.d.ts} +0 -0
  298. /package/components/{elements/MarkdownEditor.d.ts → routes/overviews/OverviewEditor.d.ts} +0 -0
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CheckCircleOutline, HourglassBottom, RadioButtonUnchecked, UpdateOutlined } from '@mui/icons-material';
3
- import { Chip, Stack, Tooltip, Typography, useTheme } from '@mui/material';
4
- import dayjs from 'dayjs';
5
- import { countBy } from 'lodash-es';
6
- import { memo } from 'react';
7
- import { useTranslation } from 'react-i18next';
8
- import { twitterShort } from '@cccsaurora/howler-ui/utils/utils';
9
- import HowlerAvatar from '../display/HowlerAvatar';
10
- import StatusIcon from './StatusIcon';
11
- const CasePreview = ({ case: _case }) => {
12
- const { t } = useTranslation();
13
- const theme = useTheme();
14
- const taskCounts = countBy(_case.tasks, task => task.complete);
15
- return (_jsxs(Stack, { flex: 1, spacing: 1, sx: { overflow: 'hidden', borderBottom: `thin solid ${theme.palette.divider}`, pb: 1, mb: 0 }, children: [_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsxs(Stack, { spacing: 1, children: [_jsx(Typography, { variant: "body1", fontWeight: "bold", children: _case.title }), _jsx(Typography, { variant: "caption", color: "textSecondary", children: _case.summary.trim().split('\n')[0] })] }), _jsx(StatusIcon, { status: _case.status }), _jsx("div", { style: { flex: 1 } }), _jsxs(Stack, { spacing: 1, alignItems: "end", children: [_case.start && _case.end && (_jsx(Tooltip, { title: dayjs(_case.updated).toString(), children: _jsx(Chip, { icon: _jsx(HourglassBottom, { fontSize: "small" }), size: "small", label: twitterShort(_case.start) + ' - ' + twitterShort(_case.end) }) })), _jsx(Tooltip, { title: dayjs(_case.updated).toString(), children: _jsx(Chip, { icon: _jsx(UpdateOutlined, { fontSize: "small" }), size: "small", label: twitterShort(_case.updated) }) })] })] }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_case.participants?.length > 0 && (_jsx(Stack, { direction: "row", spacing: 1, children: _case.participants?.map(participant => (_jsx(HowlerAvatar, { sx: { height: '24px', width: '24px' }, userId: participant }, participant))) })), _jsx(Chip, { color: "success", icon: _jsx(CheckCircleOutline, {}), label: `${taskCounts.true ?? 0} ${t('complete')}` }), _jsx(Chip, { icon: _jsx(RadioButtonUnchecked, {}), label: `${taskCounts.false ?? 0} ${t('incomplete')}` })] })] }));
16
- };
17
- export default memo(CasePreview);
@@ -1,5 +0,0 @@
1
- import type { FC } from 'react';
2
- declare const StatusIcon: FC<{
3
- status: string;
4
- }>;
5
- export default StatusIcon;
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Check, HourglassBottom, Pause, Troubleshoot } from '@mui/icons-material';
3
- import { Tooltip } from '@mui/material';
4
- import { useTranslation } from 'react-i18next';
5
- const StatusIcon = ({ status }) => {
6
- const { t } = useTranslation();
7
- return (_jsx(Tooltip, { title: t(`page.cases.status.${status}`), children: {
8
- 'in-progress': _jsx(HourglassBottom, { color: "warning" }),
9
- 'on-hold': _jsx(Pause, { color: "disabled" }),
10
- resolved: _jsx(Check, { color: "success" })
11
- }[status] ?? _jsx(Troubleshoot, { color: "primary" }) }));
12
- };
13
- export default StatusIcon;
@@ -1,9 +0,0 @@
1
- import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
2
- import { type FC } from 'react';
3
- declare const AnalyticLink: FC<{
4
- hit: Hit;
5
- lazy?: boolean;
6
- compressed?: boolean;
7
- alignSelf?: string;
8
- }>;
9
- export default AnalyticLink;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Typography } from '@mui/material';
3
- import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
4
- import { useEffect, useState } from 'react';
5
- import { Link } from 'react-router-dom';
6
- const AnalyticLink = ({ hit, lazy = false, compressed, alignSelf = 'start' }) => {
7
- const { getMatchingAnalytic } = useMatchers(lazy);
8
- const [analyticId, setAnalyticId] = useState();
9
- useEffect(() => {
10
- if (!hit?.howler.analytic) {
11
- return;
12
- }
13
- getMatchingAnalytic(hit).then(analytic => setAnalyticId(analytic?.analytic_id));
14
- // eslint-disable-next-line react-hooks/exhaustive-deps
15
- }, [hit?.howler.analytic]);
16
- return (_jsxs(Typography, { variant: compressed ? 'body1' : 'h6', fontWeight: compressed && 'bold', sx: { alignSelf, '& a': { color: 'text.primary' } }, children: [analyticId ? (_jsx(Link, { to: `/analytics/${analyticId}`, onAuxClick: e => {
17
- e.stopPropagation();
18
- }, onClick: e => {
19
- e.stopPropagation();
20
- }, children: hit.howler.analytic })) : (hit.howler.analytic), hit.howler.detection && ': ', hit.howler.detection] }));
21
- };
22
- export default AnalyticLink;
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Link as LinkIcon } from '@mui/icons-material';
3
- import { alpha, Box, Chip, Divider, Stack, useTheme } from '@mui/material';
4
- import CasePreview from '@cccsaurora/howler-ui/components/elements/case/CasePreview';
5
- import ChipPopper from '@cccsaurora/howler-ui/components/elements/display/ChipPopper';
6
- import ObservablePreview from '@cccsaurora/howler-ui/components/elements/observable/ObservablePreview';
7
- import useRelatedRecords from '@cccsaurora/howler-ui/components/hooks/useRelatedRecords';
8
- import { identity, uniq } from 'lodash-es';
9
- import { memo, useMemo, useState } from 'react';
10
- import { useTranslation } from 'react-i18next';
11
- import { Link } from 'react-router-dom';
12
- import { isCase, isHit, isObservable } from '@cccsaurora/howler-ui/utils/typeUtils';
13
- import HitPreview from '../HitPreview';
14
- const RecordLink = ({ to, ariaLabel, children }) => {
15
- const theme = useTheme();
16
- return (_jsxs(Box, { p: 1, flex: 1, position: "relative", sx: {
17
- '& > a': {
18
- backgroundColor: 'transparent',
19
- transition: theme.transitions.create('background-color', {
20
- duration: theme.transitions.duration.shortest
21
- }),
22
- '&:hover': {
23
- backgroundColor: alpha('#555', 0.5)
24
- }
25
- }
26
- }, children: [_jsx(Link, { to: to, style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 }, target: "_blank", rel: "noopener noreferrer", "aria-label": ariaLabel }), children] }));
27
- };
28
- const RelatedRecords = ({ hit }) => {
29
- const { t } = useTranslation();
30
- const [open, setOpen] = useState(false);
31
- const [filter, setFilter] = useState(null);
32
- const related = useMemo(() => hit?.howler.related ?? [], [hit?.howler.related]);
33
- const records = useRelatedRecords(related, open);
34
- return (_jsxs(ChipPopper
35
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
36
- , {
37
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
38
- icon: _jsx(LinkIcon, {}), label: _jsx("span", { style: { cursor: 'pointer' }, children: t('hit.header.related', { count: related.length }) }), slotProps: {
39
- chip: { disabled: related.length < 1 },
40
- paper: {
41
- elevation: 4,
42
- onAuxClick: ev => ev.stopPropagation()
43
- }
44
- }, disablePortal: false, placement: "bottom-end", onToggle: _open => setOpen(_open), children: [_jsx(Stack, { direction: "row", spacing: 1, mb: 1, justifyContent: "end", children: uniq(records.map(record => record.__index))
45
- .filter(identity)
46
- .map(_type => (_jsx(Chip, { color: _type === filter ? 'primary' : 'default', label: _type, onClick: () => setFilter(current => (current === _type ? null : _type)) }, _type))) }), _jsxs(Stack, { maxWidth: "40vw", maxHeight: "70vh", sx: { overflowY: 'auto' }, children: [_jsx(Divider, {}), records
47
- .filter(record => !filter || record.__index === filter)
48
- .map(entry => {
49
- if (isHit(entry)) {
50
- const key = entry.howler.id;
51
- return (_jsx(RecordLink, { to: `/hits/${key}`, ariaLabel: t('hit.header.view.hit', { id: key }), children: _jsx(HitPreview, { hit: entry }) }, key));
52
- }
53
- else if (isCase(entry)) {
54
- const key = entry.case_id;
55
- return (_jsx(RecordLink, { to: `/cases/${key}`, ariaLabel: t('hit.header.view.case', { id: key }), children: _jsx(CasePreview, { case: entry }) }, key));
56
- }
57
- else if (isObservable(entry)) {
58
- const key = entry.howler.id;
59
- return (_jsx(RecordLink, { to: `/observables/${key}`, ariaLabel: t('hit.header.view.observable', { id: key }), children: _jsx(ObservablePreview, { observable: entry }) }, key));
60
- }
61
- })] })] }));
62
- };
63
- export default memo(RelatedRecords);
@@ -1,6 +0,0 @@
1
- import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
2
- declare const _default: import("react").NamedExoticComponent<{
3
- id?: string;
4
- observable?: Observable;
5
- }>;
6
- export default _default;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CardContent, Skeleton } from '@mui/material';
3
- import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
4
- import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
5
- import { memo, useEffect } from 'react';
6
- import { useContextSelector } from 'use-context-selector';
7
- import ObservablePreview from './ObservablePreview';
8
- const ObservableCard = ({ id, observable: _observable }) => {
9
- const getRecord = useContextSelector(RecordContext, ctx => ctx.getRecord);
10
- const observable = useContextSelector(RecordContext, ctx => _observable ?? ctx.records[id]);
11
- useEffect(() => {
12
- if (!observable) {
13
- getRecord(id);
14
- }
15
- // eslint-disable-next-line react-hooks/exhaustive-deps
16
- }, [id]);
17
- if (!observable) {
18
- return _jsx(Skeleton, { variant: "rounded", height: "200px" });
19
- }
20
- return (_jsx(HowlerCard, { sx: { position: 'relative' }, children: _jsx(CardContent, { children: _jsx(ObservablePreview, { observable: observable }) }) }));
21
- };
22
- export default memo(ObservableCard);
@@ -1,6 +0,0 @@
1
- import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
2
- type PreviewProps = {
3
- observable: Observable;
4
- };
5
- declare const _default: import("react").NamedExoticComponent<PreviewProps>;
6
- export default _default;
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { OpenInNew } from '@mui/icons-material';
3
- import { Chip, IconButton, Stack, Typography, useTheme } from '@mui/material';
4
- import { memo } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { Link } from 'react-router-dom';
7
- const ObservablePreview = ({ observable }) => {
8
- const { t } = useTranslation();
9
- const theme = useTheme();
10
- return (_jsx(Stack, { flex: 1, spacing: 1, sx: { overflow: 'hidden', borderBottom: `thin solid ${theme.palette.divider}`, pb: 1, mb: 0 }, children: _jsxs(Stack, { children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { variant: "body1", fontWeight: "bold", children: observable.event.provider }), _jsx("div", { style: { flex: 1 } }), _jsx(Chip, { label: observable.event.kind }), observable.event.reference && (_jsx(IconButton, { size: "small", component: Link, to: observable.event.reference, sx: { opacity: 1 }, target: "_blank", rel: "noopener noreferrer", children: _jsx(OpenInNew, { fontSize: "small" }) }))] }), observable.event.type && (_jsxs(Typography, { variant: "caption", children: [t('event.type'), " - ", observable.event.type.join(', ')] })), observable.event.module && (_jsxs(Typography, { variant: "caption", children: [t('event.module'), " - ", observable.event.module] }))] }) }));
11
- };
12
- export default memo(ObservablePreview);
@@ -1,256 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AddCircleOutline, Assignment, CreateNewFolder, Edit, HowToVote, NoteAdd, OpenInNew, QueryStats, RemoveCircleOutline, SettingsSuggest, Terminal } from '@mui/icons-material';
3
- import api from '@cccsaurora/howler-ui/api';
4
- import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
5
- import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
6
- import { ModalContext } from '@cccsaurora/howler-ui/components/app/providers/ModalProvider';
7
- import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
8
- import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
9
- import ContextMenu, {} from '@cccsaurora/howler-ui/components/elements/ContextMenu';
10
- import { TOP_ROW, VOTE_OPTIONS } from '@cccsaurora/howler-ui/components/elements/hit/actions/SharedComponents';
11
- import useHitActions from '@cccsaurora/howler-ui/components/hooks/useHitActions';
12
- import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
13
- import useMyActionFunctions from '@cccsaurora/howler-ui/components/routes/action/useMyActionFunctions';
14
- import AddToCaseModal from '@cccsaurora/howler-ui/components/routes/cases/modals/AddToCaseModal';
15
- import CreateCaseModal from '@cccsaurora/howler-ui/components/routes/cases/modals/CreateCaseModal';
16
- import { capitalize, get, groupBy, isEmpty, toString } from 'lodash-es';
17
- import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
18
- import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
19
- import { useTranslation } from 'react-i18next';
20
- import { usePluginStore } from 'react-pluggable';
21
- import { useContextSelector } from 'use-context-selector';
22
- import { DEFAULT_QUERY } from '@cccsaurora/howler-ui/utils/constants';
23
- import { sanitizeLuceneQuery } from '@cccsaurora/howler-ui/utils/stringUtils';
24
- import { isHit } from '@cccsaurora/howler-ui/utils/typeUtils';
25
- /**
26
- * Order in which action types should be displayed in the context menu
27
- */
28
- const ORDER = ['assessment', 'vote', 'action'];
29
- /**
30
- * Icon mapping for different action types
31
- */
32
- const ICON_MAP = {
33
- assessment: _jsx(Assignment, {}),
34
- vote: _jsx(HowToVote, {}),
35
- action: _jsx(Edit, {})
36
- };
37
- /**
38
- * Context menu component for hit operations.
39
- * Provides quick access to common hit actions including assessment, voting,
40
- * transitions, and exclusion filters based on template fields.
41
- */
42
- const RecordContextMenu = ({ children, getSelectedId, Component }) => {
43
- const { t } = useTranslation();
44
- const { dispatchApi } = useMyApi();
45
- const { executeAction } = useMyActionFunctions();
46
- const { config } = useContext(ApiConfigContext);
47
- const { showModal } = useContext(ModalContext);
48
- const pluginStore = usePluginStore();
49
- const { getMatchingAnalytic, getMatchingTemplate } = useMatchers();
50
- const query = useContextSelector(ParameterContext, ctx => ctx?.query);
51
- const setQuery = useContextSelector(ParameterContext, ctx => ctx?.setQuery);
52
- const [id, setId] = useState(null);
53
- const record = useContextSelector(RecordContext, ctx => ctx.records[id]);
54
- const selectedRecords = useContextSelector(RecordContext, ctx => ctx.selectedRecords);
55
- const [analytic, setAnalytic] = useState(null);
56
- const [template, setTemplate] = useState(null);
57
- const [actions, setActions] = useState([]);
58
- const records = useMemo(() => selectedRecords.some(_record => _record.howler.id === record?.howler.id)
59
- ? selectedRecords
60
- : record
61
- ? [record]
62
- : [], [record, selectedRecords]);
63
- const hits = useMemo(() => records.filter(isHit), [records]);
64
- const { availableTransitions, canVote, canAssess, assess, vote } = useHitActions(hits);
65
- /**
66
- * Called by ContextMenu after the menu is positioned and opened.
67
- * Identifies the clicked record and fetches available actions.
68
- */
69
- const onOpen = useCallback(async (event) => {
70
- const _id = getSelectedId(event);
71
- setId(_id);
72
- const _actions = (await dispatchApi(api.search.action.post({ query: 'action_id:*' }), { throwError: false }))
73
- ?.items;
74
- if (_actions) {
75
- setActions(_actions);
76
- }
77
- }, [dispatchApi, getSelectedId]);
78
- const rowStatus = useMemo(() => ({
79
- assessment: canAssess,
80
- vote: canVote
81
- }), [canAssess, canVote]);
82
- const pluginActions = howlerPluginStore.plugins.flatMap(plugin => pluginStore.executeFunction(`${plugin}.actions`, records));
83
- /**
84
- * Generates grouped action entries for the context menu.
85
- * Combines transitions, plugin actions, votes, and assessments based on permissions.
86
- */
87
- const entries = useMemo(() => {
88
- let _actions = [...availableTransitions, ...pluginActions];
89
- if (canVote) {
90
- _actions = [
91
- ..._actions,
92
- ...VOTE_OPTIONS.map(option => ({ ...option, actionFunction: () => vote(option.name.toLowerCase()) }))
93
- ];
94
- }
95
- if (config.lookups?.['howler.assessment'] && canAssess) {
96
- _actions = [
97
- ..._actions,
98
- ...config.lookups['howler.assessment']
99
- .filter(_assessment => analytic?.triage_settings?.valid_assessments
100
- ? analytic.triage_settings?.valid_assessments.includes(_assessment)
101
- : true)
102
- .sort((a, b) => +TOP_ROW.includes(b) - +TOP_ROW.includes(a))
103
- .map(assessment => ({
104
- type: 'assessment',
105
- name: assessment,
106
- actionFunction: async () => {
107
- await assess(assessment, analytic?.triage_settings?.skip_rationale);
108
- }
109
- }))
110
- ];
111
- }
112
- return Object.entries(groupBy(_actions, 'type')).sort(([a], [b]) => ORDER.indexOf(a) - ORDER.indexOf(b));
113
- }, [analytic, assess, availableTransitions, canAssess, canVote, config.lookups, vote, pluginActions]);
114
- // Load analytic and template data when a hit is selected
115
- useEffect(() => {
116
- if (!record?.howler.analytic) {
117
- return;
118
- }
119
- getMatchingAnalytic(record).then(setAnalytic);
120
- getMatchingTemplate(record).then(setTemplate);
121
- // eslint-disable-next-line react-hooks/exhaustive-deps
122
- }, [record]);
123
- /**
124
- * Builds the declarative items structure for the ContextMenu component.
125
- */
126
- const items = useMemo(() => {
127
- const result = [
128
- {
129
- kind: 'item',
130
- id: 'open-record',
131
- icon: _jsx(OpenInNew, {}),
132
- label: t(`${record?.__index ?? 'hit'}.open`),
133
- disabled: !record,
134
- to: `/${record?.__index}s/${record?.howler.id}`
135
- }
136
- ];
137
- if (isHit(record)) {
138
- result.push({
139
- kind: 'item',
140
- id: 'open-analytic',
141
- icon: _jsx(QueryStats, {}),
142
- label: t('analytic.open'),
143
- disabled: !analytic,
144
- to: `/analytics/${analytic?.analytic_id}`
145
- });
146
- result.push({ kind: 'divider', id: 'actions-divider' });
147
- for (const [type, typeItems] of entries) {
148
- result.push({
149
- kind: 'submenu',
150
- id: type,
151
- icon: ICON_MAP[type] ?? _jsx(Terminal, {}),
152
- label: t(`hit.details.actions.${type}`),
153
- disabled: rowStatus[type] === false,
154
- items: typeItems.map(a => ({
155
- key: a.name,
156
- label: a.i18nKey ? t(a.i18nKey) : capitalize(a.name),
157
- onClick: a.actionFunction
158
- }))
159
- });
160
- }
161
- result.push({
162
- kind: 'submenu',
163
- id: 'actions',
164
- icon: _jsx(SettingsSuggest, {}),
165
- label: t('route.actions.change'),
166
- disabled: actions.length < 1,
167
- items: actions.map(action => ({
168
- key: action.action_id,
169
- label: action.name,
170
- onClick: () => executeAction(action.action_id, `howler.id:${record?.howler.id}`)
171
- }))
172
- });
173
- if (!isEmpty(template?.keys ?? []) && setQuery) {
174
- result.push({ kind: 'divider', id: 'filter-divider' });
175
- result.push({
176
- kind: 'submenu',
177
- id: 'excludes',
178
- icon: _jsx(RemoveCircleOutline, {}),
179
- label: t('hit.panel.exclude'),
180
- items: (template?.keys ?? []).flatMap(key => {
181
- let newQuery = '';
182
- if (query !== DEFAULT_QUERY) {
183
- newQuery = `(${query}) AND `;
184
- }
185
- const value = get(record, key);
186
- if (!value) {
187
- return [];
188
- }
189
- else if (Array.isArray(value)) {
190
- const sanitizedValues = value
191
- .map(toString)
192
- .filter(val => !!val)
193
- .map(val => `"${sanitizeLuceneQuery(val)}"`);
194
- if (sanitizedValues.length < 1) {
195
- return [];
196
- }
197
- newQuery += `-${key}:(${sanitizedValues.join(' OR ')})`;
198
- }
199
- else {
200
- newQuery += `-${key}:"${sanitizeLuceneQuery(value.toString())}"`;
201
- }
202
- return [{ key, label: key, onClick: () => setQuery(newQuery) }];
203
- })
204
- });
205
- result.push({
206
- kind: 'submenu',
207
- id: 'includes',
208
- icon: _jsx(AddCircleOutline, {}),
209
- label: t('hit.panel.include'),
210
- items: (template?.keys ?? []).flatMap(key => {
211
- let newQuery = `(${query}) AND `;
212
- const value = get(record, key);
213
- if (!value) {
214
- return [];
215
- }
216
- else if (Array.isArray(value)) {
217
- const sanitizedValues = value
218
- .map(toString)
219
- .filter(val => !!val)
220
- .map(val => `"${sanitizeLuceneQuery(val)}"`);
221
- if (sanitizedValues.length < 1) {
222
- return [];
223
- }
224
- newQuery += `${key}:(${sanitizedValues.join(' OR ')})`;
225
- }
226
- else {
227
- newQuery += `${key}:"${sanitizeLuceneQuery(value.toString())}"`;
228
- }
229
- return [{ key, label: key, onClick: () => setQuery(newQuery) }];
230
- })
231
- });
232
- }
233
- }
234
- result.push({ kind: 'divider', id: 'add-to-case-divider' });
235
- result.push({
236
- kind: 'item',
237
- id: 'add-to-case',
238
- icon: _jsx(CreateNewFolder, {}),
239
- label: t('modal.cases.add_to_case'),
240
- disabled: !record,
241
- onClick: () => showModal(_jsx(AddToCaseModal, { records: records }), { maxHeight: '90vh' })
242
- });
243
- result.push({
244
- kind: 'item',
245
- id: 'create-case',
246
- icon: _jsx(NoteAdd, {}),
247
- label: t('modal.cases.create_case'),
248
- disabled: !record,
249
- onClick: () => showModal(_jsx(CreateCaseModal, { records: records }), { maxHeight: '90vh' })
250
- });
251
- return result;
252
- // eslint-disable-next-line react-hooks/exhaustive-deps
253
- }, [record, analytic, template, entries, rowStatus, actions, query, t, setQuery, executeAction, showModal, records]);
254
- return (_jsx(ContextMenu, { id: "contextMenu", Component: Component, onOpen: onOpen, onClose: () => setAnalytic(null), items: items, children: children }));
255
- };
256
- export default RecordContextMenu;
@@ -1,7 +0,0 @@
1
- import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
2
- import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
3
- import { type FC } from 'react';
4
- declare const RecordRelated: FC<{
5
- record: Hit | Observable;
6
- }>;
7
- export default RecordRelated;
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Stack, Tab, Tabs, useTheme } from '@mui/material';
3
- import ObservableCard from '@cccsaurora/howler-ui/components/elements/observable/ObservableCard';
4
- import useRelatedRecords from '@cccsaurora/howler-ui/components/hooks/useRelatedRecords';
5
- import { groupBy } from 'lodash-es';
6
- import { useMemo, useState } from 'react';
7
- import { useTranslation } from 'react-i18next';
8
- import { Link } from 'react-router-dom';
9
- import { isCase, isHit, isObservable } from '@cccsaurora/howler-ui/utils/typeUtils';
10
- import CaseCard from '../case/CaseCard';
11
- import HitCard from '../hit/HitCard';
12
- import { HitLayout } from '../hit/HitLayout';
13
- import RelatedLink from '../hit/related/RelatedLink';
14
- const RecordRelated = ({ record }) => {
15
- const theme = useTheme();
16
- const { t } = useTranslation();
17
- const related = useMemo(() => record?.howler.related ?? [], [record?.howler.related]);
18
- const records = useRelatedRecords(related, related.length > 0);
19
- const groups = groupBy(records, '__index');
20
- const hasLinks = (record?.howler.links?.length ?? 0) > 0;
21
- const tabs = [
22
- hasLinks && 'links',
23
- groups.hit?.length > 0 && 'hit',
24
- groups.case?.length > 0 && 'case',
25
- groups.observable?.length > 0 && 'observable'
26
- ].filter(Boolean);
27
- const [activeTab, setActiveTab] = useState(false);
28
- const currentTab = activeTab !== false && tabs.includes(activeTab) ? activeTab : (tabs[0] ?? false);
29
- if (!record) {
30
- return null;
31
- }
32
- return (_jsxs(Box, { sx: { borderTop: `thin solid ${theme.palette.divider}`, height: '100%', flex: 1, mr: 2, pb: 2 }, children: [_jsxs(Tabs, { value: currentTab, onChange: (_, v) => setActiveTab(v), variant: "scrollable", scrollButtons: "auto", children: [hasLinks && _jsx(Tab, { value: "links", label: t('hit.related.tab.links') }), groups.hit?.length > 0 && _jsx(Tab, { value: "hit", label: t('hit.related.tab.hit') }), groups.case?.length > 0 && _jsx(Tab, { value: "case", label: t('hit.related.tab.case') }), groups.observable?.length > 0 && _jsx(Tab, { value: "observable", label: t('hit.related.tab.observable') })] }), currentTab === 'links' && (_jsx(Box, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))", gap: 1, pt: 1, children: record.howler.links.map(l => (_jsx(RelatedLink, { ...l }, l.title + l.href))) })), currentTab === 'hit' && (_jsx(Stack, { spacing: 1, pt: 1, children: records.filter(isHit).map(h => (_jsx(Link, { to: `/hits/${h.howler.id}`, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: 'none' }, children: _jsx(HitCard, { id: h.howler.id, layout: HitLayout.NORMAL }) }, h.howler.id))) })), currentTab === 'case' && (_jsx(Stack, { spacing: 1, pt: 1, children: records.filter(isCase).map(c => (_jsx(Link, { to: `/cases/${c.case_id}`, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: 'none' }, children: _jsx(CaseCard, { case: c }) }, c.case_id))) })), currentTab === 'observable' && (_jsx(Stack, { spacing: 1, pt: 1, children: records.filter(isObservable).map(o => (_jsx(Link, { to: `/observables/${o.howler.id}`, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: 'none' }, children: _jsx(ObservableCard, { observable: o }) }, o.howler.id))) }))] }));
33
- };
34
- export default RecordRelated;
@@ -1,13 +0,0 @@
1
- import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
- import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
3
- import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
4
- import type { WithMetadata } from '@cccsaurora/howler-ui/models/WithMetadata';
5
- type MixedRecords = Hit | Observable | Case;
6
- /**
7
- * Fetches records matching the provided IDs from the hit, observable, and case indexes.
8
- *
9
- * @param ids - List of howler.id / case_id values to look up.
10
- * @param enabled - When false the fetch is skipped (e.g. while a panel is closed).
11
- */
12
- declare const useRelatedRecords: <T = MixedRecords>(ids: string[], enabled?: boolean) => WithMetadata<T>[];
13
- export default useRelatedRecords;
@@ -1,32 +0,0 @@
1
- import api from '@cccsaurora/howler-ui/api';
2
- import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
3
- import { useEffect, useState } from 'react';
4
- /**
5
- * Fetches records matching the provided IDs from the hit, observable, and case indexes.
6
- *
7
- * @param ids - List of howler.id / case_id values to look up.
8
- * @param enabled - When false the fetch is skipped (e.g. while a panel is closed).
9
- */
10
- const useRelatedRecords = (ids, enabled = true) => {
11
- const { dispatchApi } = useMyApi();
12
- const [records, setRecords] = useState([]);
13
- useEffect(() => {
14
- if (!enabled || ids.length === 0) {
15
- if (records.length > 0) {
16
- setRecords([]);
17
- }
18
- return;
19
- }
20
- (async () => {
21
- const joined = ids.join(' OR ');
22
- const result = await dispatchApi(api.v2.search.post('hit,observable,case', {
23
- query: `howler.id:(${joined}) OR case_id:(${joined})`
24
- }), { throwError: false, showError: true });
25
- if (result) {
26
- setRecords(result.items);
27
- }
28
- })();
29
- }, [dispatchApi, enabled, ids, records.length]);
30
- return records;
31
- };
32
- export default useRelatedRecords;
@@ -1,2 +0,0 @@
1
- declare const _default: import("react").NamedExoticComponent<{}>;
2
- export default _default;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Stack } from '@mui/material';
3
- import { memo } from 'react';
4
- import { Outlet, useParams } from 'react-router-dom';
5
- import NotFoundPage from '../404';
6
- import ErrorBoundary from '../ErrorBoundary';
7
- import CaseDetails from './detail/CaseDetails';
8
- import CaseSidebar from './detail/CaseSidebar';
9
- import useCase from './hooks/useCase';
10
- const CaseViewer = () => {
11
- const params = useParams();
12
- const { case: _case, missing, update } = useCase({ caseId: params.id });
13
- if (missing) {
14
- return _jsx(NotFoundPage, {});
15
- }
16
- return (_jsx(ErrorBoundary, { children: _jsxs(Stack, { direction: "row", height: "100%", children: [_jsx(CaseSidebar, { case: _case, update: updatedCase => update(updatedCase, false) }), _jsx(Box, { sx: {
17
- maxHeight: 'calc(100vh - 64px)',
18
- flex: 1,
19
- overflow: 'auto'
20
- }, children: _jsx(ErrorBoundary, { children: _jsx(Outlet, { context: _case }) }) }), _jsx(CaseDetails, { case: _case })] }) }));
21
- };
22
- export default memo(CaseViewer);
@@ -1,2 +0,0 @@
1
- declare const Cases: () => import("react/jsx-runtime").JSX.Element;
2
- export default Cases;