@cccsaurora/howler-ui 2.17.0-dev.502 → 2.17.0-dev.513

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 (131) 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/index.d.ts +2 -1
  6. package/api/search/index.js +2 -1
  7. package/api/v2/case/index.d.ts +6 -0
  8. package/api/v2/case/index.js +18 -0
  9. package/api/v2/index.d.ts +4 -0
  10. package/api/v2/index.js +6 -0
  11. package/api/v2/search/facet.d.ts +3 -0
  12. package/api/v2/search/facet.js +12 -0
  13. package/api/v2/search/index.d.ts +6 -0
  14. package/api/v2/search/index.js +18 -0
  15. package/commons/components/leftnav/LeftNavDrawer.js +1 -1
  16. package/components/app/App.js +14 -0
  17. package/components/app/providers/FavouritesProvider.js +2 -2
  18. package/components/{routes/overviews/OverviewEditor.js → elements/MarkdownEditor.js} +3 -3
  19. package/components/elements/{hit/HitDetails.d.ts → ObjectDetails.d.ts} +2 -1
  20. package/components/elements/{hit/HitDetails.js → ObjectDetails.js} +14 -14
  21. package/components/elements/PluginTypography.d.ts +2 -1
  22. package/components/elements/PluginTypography.js +3 -2
  23. package/components/elements/UserList.d.ts +5 -2
  24. package/components/elements/UserList.js +14 -5
  25. package/components/elements/addons/search/phrase/Phrase.js +1 -1
  26. package/components/elements/display/HowlerCard.js +1 -1
  27. package/components/elements/hit/HitBanner.js +19 -31
  28. package/components/elements/hit/outlines/DefaultOutline.js +1 -1
  29. package/components/elements/view/ViewTitle.js +1 -1
  30. package/components/hooks/useHitSelection.js +1 -35
  31. package/components/hooks/useMyPreferences.js +10 -1
  32. package/components/hooks/useMySitemap.js +3 -1
  33. package/components/hooks/useMyTheme.js +9 -2
  34. package/components/routes/action/view/ActionSearch.js +1 -1
  35. package/components/routes/action/view/Integrations.js +1 -9
  36. package/components/routes/advanced/QueryBuilder.js +1 -1
  37. package/components/routes/analytics/AnalyticDetails.js +2 -2
  38. package/components/routes/analytics/AnalyticSearch.js +1 -1
  39. package/components/routes/cases/CaseCard.d.ts +8 -0
  40. package/components/routes/cases/CaseCard.js +34 -0
  41. package/components/routes/cases/CaseViewer.d.ts +2 -0
  42. package/components/routes/cases/CaseViewer.js +24 -0
  43. package/components/routes/cases/Cases.d.ts +2 -0
  44. package/components/routes/cases/Cases.js +101 -0
  45. package/components/routes/cases/constants.d.ts +5 -0
  46. package/components/routes/cases/constants.js +5 -0
  47. package/components/routes/cases/detail/AlertPanel.d.ts +6 -0
  48. package/components/routes/cases/detail/AlertPanel.js +32 -0
  49. package/components/routes/cases/detail/CaseDashboard.d.ts +7 -0
  50. package/components/routes/cases/detail/CaseDashboard.js +46 -0
  51. package/components/routes/cases/detail/CaseDetails.d.ts +6 -0
  52. package/components/routes/cases/detail/CaseDetails.js +49 -0
  53. package/components/routes/cases/detail/CaseOverview.d.ts +7 -0
  54. package/components/routes/cases/detail/CaseOverview.js +43 -0
  55. package/components/routes/cases/detail/CaseSidebar.d.ts +6 -0
  56. package/components/routes/cases/detail/CaseSidebar.js +36 -0
  57. package/components/routes/cases/detail/CaseTask.d.ts +10 -0
  58. package/components/routes/cases/detail/CaseTask.js +46 -0
  59. package/components/routes/cases/detail/ItemPage.d.ts +6 -0
  60. package/components/routes/cases/detail/ItemPage.js +93 -0
  61. package/components/routes/cases/detail/RelatedCasePanel.d.ts +6 -0
  62. package/components/routes/cases/detail/RelatedCasePanel.js +31 -0
  63. package/components/routes/cases/detail/TaskPanel.d.ts +7 -0
  64. package/components/routes/cases/detail/TaskPanel.js +23 -0
  65. package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +12 -0
  66. package/components/routes/cases/detail/aggregates/CaseAggregate.js +19 -0
  67. package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +6 -0
  68. package/components/routes/cases/detail/aggregates/SourceAggregate.js +27 -0
  69. package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +12 -0
  70. package/components/routes/cases/detail/sidebar/CaseFolder.js +114 -0
  71. package/components/routes/cases/detail/sidebar/types.d.ts +3 -0
  72. package/components/routes/cases/hooks/useCase.d.ts +13 -0
  73. package/components/routes/cases/hooks/useCase.js +38 -0
  74. package/components/routes/help/ApiDocumentation.js +1 -1
  75. package/components/routes/help/HitDocumentation.js +1 -3
  76. package/components/routes/hits/search/HitContextMenu.js +4 -27
  77. package/components/routes/hits/search/HitContextMenu.test.js +0 -140
  78. package/components/routes/hits/search/InformationPane.d.ts +1 -0
  79. package/components/routes/hits/search/InformationPane.js +6 -29
  80. package/components/routes/hits/search/SearchPane.js +3 -5
  81. package/components/routes/hits/search/ViewLink.js +1 -1
  82. package/components/routes/hits/search/grid/EnhancedCell.js +1 -1
  83. package/components/routes/hits/view/HitViewer.js +3 -4
  84. package/components/routes/home/ViewCard.js +1 -1
  85. package/components/routes/observables/ObservableViewer.d.ts +7 -0
  86. package/components/routes/observables/ObservableViewer.js +27 -0
  87. package/components/routes/overviews/OverviewViewer.js +2 -2
  88. package/locales/en/translation.json +422 -397
  89. package/locales/fr/translation.json +429 -406
  90. package/models/entities/generated/AttachmentsFile.d.ts +12 -0
  91. package/models/entities/generated/Case.d.ts +28 -0
  92. package/models/entities/generated/DestinationOriginal.d.ts +19 -0
  93. package/models/entities/generated/EmailAttachment.d.ts +8 -0
  94. package/models/entities/generated/EmailParent.d.ts +19 -0
  95. package/models/entities/generated/Enrichments.d.ts +7 -0
  96. package/models/entities/generated/EnrichmentsIndicator.d.ts +21 -0
  97. package/models/entities/generated/Howler.d.ts +0 -4
  98. package/models/entities/generated/HttpResponse.d.ts +11 -0
  99. package/models/entities/generated/Item.d.ts +9 -0
  100. package/models/entities/generated/Observable.d.ts +84 -0
  101. package/models/entities/generated/ObservableCloud.d.ts +20 -0
  102. package/models/entities/generated/ObservableDestination.d.ts +23 -0
  103. package/models/entities/generated/ObservableEmail.d.ts +30 -0
  104. package/models/entities/generated/ObservableFile.d.ts +36 -0
  105. package/models/entities/generated/ObservableHowler.d.ts +44 -0
  106. package/models/entities/generated/ObservableHttp.d.ts +11 -0
  107. package/models/entities/generated/ObservableObserver.d.ts +21 -0
  108. package/models/entities/generated/ObservableOrganization.d.ts +7 -0
  109. package/models/entities/generated/ObservableProcess.d.ts +34 -0
  110. package/models/entities/generated/ObservableSource.d.ts +23 -0
  111. package/models/entities/generated/ObservableThreat.d.ts +21 -0
  112. package/models/entities/generated/ObservableTls.d.ts +12 -0
  113. package/models/entities/generated/ObserverIngress.d.ts +9 -0
  114. package/models/entities/generated/Rule.d.ts +2 -10
  115. package/models/entities/generated/Task.d.ts +10 -0
  116. package/models/entities/generated/Threat.d.ts +2 -2
  117. package/models/entities/generated/{Enrichment.d.ts → ThreatEnrichment.d.ts} +1 -1
  118. package/package.json +125 -114
  119. package/plugins/clue/components/ClueTypography.js +2 -2
  120. package/plugins/clue/utils.d.ts +2 -1
  121. package/components/elements/display/icons/BundleButton.d.ts +0 -6
  122. package/components/elements/display/icons/BundleButton.js +0 -32
  123. package/components/routes/action/view/markdown/integrations.en.md.js +0 -1
  124. package/components/routes/action/view/markdown/integrations.fr.md.js +0 -1
  125. package/components/routes/help/BundleDocumentation.d.ts +0 -3
  126. package/components/routes/help/BundleDocumentation.js +0 -12
  127. package/components/routes/help/markdown/en/bundles.md.js +0 -1
  128. package/components/routes/help/markdown/fr/bundles.md.js +0 -1
  129. package/components/routes/hits/search/BundleParentMenu.d.ts +0 -6
  130. package/components/routes/hits/search/BundleParentMenu.js +0 -32
  131. /package/components/{routes/overviews/OverviewEditor.d.ts → elements/MarkdownEditor.d.ts} +0 -0
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Circle, Dashboard } from '@mui/icons-material';
3
+ import { Box, Card, Chip, Divider, Skeleton, Stack, Typography, useTheme } from '@mui/material';
4
+ import dayjs from 'dayjs';
5
+ import {} from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
+ import { Link } from 'react-router-dom';
8
+ import { ESCALATION_COLOR_MAP } from '../constants';
9
+ import CaseFolder from './sidebar/CaseFolder';
10
+ const CaseSidebar = ({ case: _case }) => {
11
+ const { t } = useTranslation();
12
+ const theme = useTheme();
13
+ return (_jsxs(Box, { sx: {
14
+ flex: 1,
15
+ maxWidth: '350px',
16
+ maxHeight: 'calc(100vh - 64px)',
17
+ display: 'flex',
18
+ flexDirection: 'column'
19
+ }, children: [_jsxs(Card, { sx: { borderRadius: 0, px: 2, py: 1 }, children: [_case?.title ? _jsx(Typography, { variant: "body1", children: _case.title }) : _jsx(Skeleton, { height: 24 }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", divider: _jsx(Circle, { color: "disabled", sx: { fontSize: '8px' } }), children: [_jsxs(Typography, { variant: "caption", color: "textSecondary", children: [t('started'), ": ", _case?.created ? dayjs(_case.created).toString() : _jsx(Skeleton, { height: 14 })] }), _case?.escalation ? (_jsx(Chip, { color: ESCALATION_COLOR_MAP[_case.escalation], label: t(_case.escalation) })) : (_jsx(Skeleton, { height: 24 }))] })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: {
20
+ cursor: 'pointer',
21
+ px: 1,
22
+ py: 1,
23
+ transition: theme.transitions.create('background', { duration: 100 }),
24
+ color: `${theme.palette.text.primary} !important`,
25
+ textDecoration: 'none',
26
+ background: 'transparent',
27
+ borderRight: `thin solid ${theme.palette.divider}`,
28
+ '&:hover': {
29
+ background: theme.palette.grey[800]
30
+ }
31
+ }, component: Link, to: `/cases/${_case?.case_id}`, children: [_jsx(Dashboard, {}), _jsx(Typography, { sx: { userSelect: 'none', pl: 0.5, textWrap: 'nowrap' }, children: t('page.cases.dashboard') })] }), _jsx(Divider, {}), _case && (_jsx(Box, { flex: 1, overflow: "auto", width: "100%", sx: {
32
+ position: 'relative',
33
+ borderRight: `thin solid ${theme.palette.divider}`
34
+ }, children: _jsx(Box, { position: "absolute", sx: { left: 0 }, children: _jsx(CaseFolder, { case: _case }) }) }))] }));
35
+ };
36
+ export default CaseSidebar;
@@ -0,0 +1,10 @@
1
+ import type { Task } from '@cccsaurora/howler-ui/models/entities/generated/Task';
2
+ import { type FC } from 'react';
3
+ declare const CaseTask: FC<{
4
+ task: Task;
5
+ paths: string[];
6
+ onDelete: () => void;
7
+ onEdit: (task: Partial<Task>) => Promise<void>;
8
+ loading?: boolean;
9
+ }>;
10
+ export default CaseTask;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check, Close, Delete, Edit } from '@mui/icons-material';
3
+ import { Autocomplete, Card, Checkbox, Chip, IconButton, LinearProgress, Stack, TextField, Tooltip, Typography } from '@mui/material';
4
+ import UserList from '@cccsaurora/howler-ui/components/elements/UserList';
5
+ import { useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
+ import { Link } from 'react-router-dom';
8
+ const CaseTask = ({ task, onEdit, onDelete, paths }) => {
9
+ const { t } = useTranslation();
10
+ const [editing, setEditing] = useState(false);
11
+ const [loading, setLoading] = useState(false);
12
+ const [summary, setSummary] = useState(task.summary);
13
+ const [path, setPath] = useState(task.path);
14
+ const dirty = summary !== task.summary || path !== task.path;
15
+ const onOwnerChange = async ([assignment]) => {
16
+ setLoading(true);
17
+ await onEdit({
18
+ assignment
19
+ });
20
+ setLoading(false);
21
+ };
22
+ const onSubmit = async () => {
23
+ if (dirty) {
24
+ setLoading(true);
25
+ await onEdit({ summary, path: !path ? null : path });
26
+ setLoading(false);
27
+ }
28
+ };
29
+ return (_jsxs(Card, { sx: { pl: 0.5, pr: 1, py: 0.5, position: 'relative' }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, children: [_jsx(Checkbox, { disabled: loading, color: "success", checked: task.complete, size: "small", onChange: async (_ev, complete) => {
30
+ try {
31
+ setLoading(true);
32
+ await onEdit({ complete });
33
+ }
34
+ finally {
35
+ setLoading(false);
36
+ }
37
+ } }), editing ? (_jsx(TextField, { disabled: loading, value: summary, onChange: e => setSummary(e.target.value), size: "small", fullWidth: true, sx: { minWidth: '40%' } })) : (_jsx(Typography, { sx: [task.complete && { textDecoration: 'line-through' }], children: task.summary })), task.path && !editing && _jsx(Chip, { clickable: true, component: Link, to: task.path, label: task.path }), editing && (_jsx(Autocomplete, { disabled: loading, value: path, options: paths, onChange: (_ev, value) => setPath(value), fullWidth: true, renderInput: params => _jsx(TextField, { ...params, size: "small" }) })), task.assignment && (_jsx(UserList, { disabled: loading, userIds: [task.assignment], onChange: onOwnerChange, i18nLabel: "route.cases.task.set.assignment", avatarHeight: 24 })), _jsx("div", { style: { flex: 1 } }), editing && (_jsx(Tooltip, { title: t('route.cases.task.delete'), children: _jsx(IconButton, { size: "small", color: "error", onClick: onDelete, children: _jsx(Delete, { fontSize: "small" }) }) })), _jsx(Tooltip, { title: t(editing ? 'route.cases.task.edit.save' : 'route.cases.task.edit'), children: _jsx(IconButton, { size: "small", color: editing ? 'success' : 'default', onClick: () => {
38
+ if (!editing) {
39
+ setEditing(true);
40
+ return;
41
+ }
42
+ setEditing(false);
43
+ onSubmit();
44
+ }, disabled: (!dirty && editing) || loading, children: editing ? _jsx(Check, { fontSize: "small" }) : _jsx(Edit, { fontSize: "small" }) }) }), editing && (_jsx(Tooltip, { title: t('route.cases.task.edit.cancel'), children: _jsx(IconButton, { size: "small", onClick: () => setEditing(false), disabled: loading, children: _jsx(Close, { fontSize: "small" }) }) }))] }), loading && _jsx(LinearProgress, { sx: { left: 0, bottom: 0, right: 0, position: 'absolute' } })] }, task.id));
45
+ };
46
+ export default CaseTask;
@@ -0,0 +1,6 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ import { type FC } from 'react';
3
+ declare const ItemPage: FC<{
4
+ case: Case;
5
+ }>;
6
+ export default ItemPage;
@@ -0,0 +1,93 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import api from '@cccsaurora/howler-ui/api';
3
+ import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
4
+ import NotFoundPage from '@cccsaurora/howler-ui/components/routes/404';
5
+ import InformationPane from '@cccsaurora/howler-ui/components/routes/hits/search/InformationPane';
6
+ import ObservableViewer from '@cccsaurora/howler-ui/components/routes/observables/ObservableViewer';
7
+ import { useEffect, useMemo, useState } from 'react';
8
+ import { useLocation } from 'react-router';
9
+ import CaseDashboard from './CaseDashboard';
10
+ const ItemPage = ({ case: _case }) => {
11
+ const location = useLocation();
12
+ const { dispatchApi } = useMyApi();
13
+ const [item, setItem] = useState(null);
14
+ const [loading, setLoading] = useState(true);
15
+ const subPath = decodeURIComponent(location.pathname).replace(`/cases/${_case.case_id}/`, '');
16
+ const normalizedSubPath = useMemo(() => subPath.replace(/^\/+|\/+$/g, ''), [subPath]);
17
+ useEffect(() => {
18
+ let cancelled = false;
19
+ const resolveItem = async () => {
20
+ setLoading(true);
21
+ if (!normalizedSubPath) {
22
+ if (!cancelled) {
23
+ setItem(null);
24
+ setLoading(false);
25
+ }
26
+ return;
27
+ }
28
+ let currentCase = _case;
29
+ let remainingPath = normalizedSubPath;
30
+ while (currentCase && remainingPath) {
31
+ const currentRemainingPath = remainingPath;
32
+ const matchedNestedCase = currentCase.items
33
+ .filter(_item => _item?.path &&
34
+ _item?.type?.toLowerCase() === 'case' &&
35
+ (currentRemainingPath === _item.path || currentRemainingPath.startsWith(`${_item.path}/`)))
36
+ .sort((a, b) => (b.path?.length || 0) - (a.path?.length || 0))[0];
37
+ if (!matchedNestedCase) {
38
+ break;
39
+ }
40
+ if (currentRemainingPath === matchedNestedCase.path) {
41
+ if (!cancelled) {
42
+ setItem(matchedNestedCase);
43
+ setLoading(false);
44
+ }
45
+ return;
46
+ }
47
+ if (!matchedNestedCase.id) {
48
+ if (!cancelled) {
49
+ setItem(null);
50
+ setLoading(false);
51
+ }
52
+ return;
53
+ }
54
+ const nextCase = await dispatchApi(api.v2.case.get(matchedNestedCase.id), { throwError: false });
55
+ if (!nextCase) {
56
+ if (!cancelled) {
57
+ setItem(null);
58
+ setLoading(false);
59
+ }
60
+ return;
61
+ }
62
+ remainingPath = currentRemainingPath.slice((matchedNestedCase.path?.length || 0) + 1);
63
+ currentCase = nextCase;
64
+ }
65
+ const resolvedItem = currentCase?.items?.find(_item => _item.path === remainingPath);
66
+ if (!cancelled) {
67
+ setItem(resolvedItem || null);
68
+ setLoading(false);
69
+ }
70
+ };
71
+ resolveItem();
72
+ return () => {
73
+ cancelled = true;
74
+ };
75
+ }, [_case, dispatchApi, normalizedSubPath]);
76
+ if (loading) {
77
+ return null;
78
+ }
79
+ if (!item) {
80
+ return _jsx(NotFoundPage, {});
81
+ }
82
+ if (item.type === 'hit') {
83
+ return _jsx(InformationPane, { selected: item.id });
84
+ }
85
+ if (item.type === 'observable') {
86
+ return _jsx(ObservableViewer, { observableId: item.id });
87
+ }
88
+ if (item.type === 'case') {
89
+ return _jsx(CaseDashboard, { caseId: item.id });
90
+ }
91
+ return _jsx("h1", { children: JSON.stringify(item) });
92
+ };
93
+ export default ItemPage;
@@ -0,0 +1,6 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ import { type FC } from 'react';
3
+ declare const RelatedCasePanel: FC<{
4
+ case: Case;
5
+ }>;
6
+ export default RelatedCasePanel;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Divider, Pagination, Skeleton, Stack, Typography, useTheme } from '@mui/material';
3
+ import { chunk, uniq } from 'lodash-es';
4
+ import { useMemo, useState } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Link } from 'react-router-dom';
7
+ import CaseCard from '../CaseCard';
8
+ const RelatedCasePanel = ({ case: _case }) => {
9
+ const { t } = useTranslation();
10
+ const theme = useTheme();
11
+ const [casePage, setCasePage] = useState(1);
12
+ const casePages = useMemo(() => chunk(uniq((_case?.items ?? []).filter(item => item.type === 'case')), 5), [_case?.items]);
13
+ if (!_case) {
14
+ return _jsx(Skeleton, { height: 240 });
15
+ }
16
+ return (_jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", children: [_jsx(Typography, { flex: 1, variant: "h4", children: t('page.cases.dashboard.alerts') }), _jsx(Pagination, { count: casePages.length, page: casePage, onChange: (_, page) => setCasePage(page) })] }), _jsx(Divider, {}), casePages[casePage - 1]?.map(item => (_jsxs(Box, { position: "relative", children: [_jsx(CaseCard, { caseId: item.id }), _jsx(Box, { component: Link, to: item.path, sx: {
17
+ position: 'absolute',
18
+ top: 0,
19
+ left: 0,
20
+ width: '100%',
21
+ height: '100%',
22
+ cursor: 'pointer',
23
+ zIndex: 100,
24
+ borderRadius: '4px',
25
+ '&:hover': {
26
+ background: theme.palette.divider,
27
+ border: `thin solid ${theme.palette.primary.light}`
28
+ }
29
+ } })] }, item.id)))] }));
30
+ };
31
+ export default RelatedCasePanel;
@@ -0,0 +1,7 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ import { type FC } from 'react';
3
+ declare const TaskPanel: FC<{
4
+ case: Case;
5
+ updateCase: (_case: Partial<Case>) => Promise<void>;
6
+ }>;
7
+ export default TaskPanel;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Divider, Skeleton, Stack, Typography } from '@mui/material';
3
+ import {} from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import CaseTask from './CaseTask';
6
+ const TaskPanel = ({ case: _case, updateCase }) => {
7
+ const { t } = useTranslation();
8
+ if (!_case) {
9
+ return _jsx(Skeleton, { height: 240 });
10
+ }
11
+ return (_jsxs(Stack, { spacing: 1, children: [_jsx(Typography, { flex: 1, variant: "h4", children: t('page.cases.dashboard.tasks') }), _jsx(Divider, {}), _case.tasks.map(task => (_jsx(CaseTask, { task: task, paths: _case.items.map(item => item.path), onEdit: newTask => updateCase({
12
+ tasks: _case.tasks.map(_task => {
13
+ if (_task.id !== task.id) {
14
+ return _task;
15
+ }
16
+ return {
17
+ ..._task,
18
+ ...newTask
19
+ };
20
+ })
21
+ }), onDelete: () => updateCase({ tasks: _case.tasks.filter(_task => _task.id !== task.id) }) }, task.id)))] }));
22
+ };
23
+ export default TaskPanel;
@@ -0,0 +1,12 @@
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 CaseAggregate: FC<{
5
+ icon?: string;
6
+ iconColor?: string;
7
+ field?: string;
8
+ records?: Partial<Hit | Observable>[];
9
+ title?: string;
10
+ subtitle?: string;
11
+ }>;
12
+ export default CaseAggregate;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from '@iconify/react';
3
+ import { Card, CardContent, Skeleton, Stack, styled, Tooltip, tooltipClasses, Typography, useTheme } from '@mui/material';
4
+ import { get, isEmpty, uniq } from 'lodash-es';
5
+ import {} from 'react';
6
+ const NoMaxWidthTooltip = styled(({ className, ...props }) => (_jsx(Tooltip, { ...props, classes: { popper: className } })))({
7
+ [`& .${tooltipClasses.tooltip}`]: {
8
+ maxWidth: 'none'
9
+ }
10
+ });
11
+ const CaseAggregate = ({ icon, iconColor, field, records, title, subtitle }) => {
12
+ const theme = useTheme();
13
+ if (!title && (!records || !field)) {
14
+ return _jsx(Skeleton, { height: 120 });
15
+ }
16
+ const values = uniq(records?.map(_record => get(_record, field)).flat());
17
+ return (_jsx(Card, { sx: { height: '100%' }, children: _jsx(CardContent, { children: _jsxs(Stack, { alignItems: "center", spacing: 1, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, children: [icon && _jsx(Icon, { fontSize: "96px", icon: icon, color: iconColor || theme.palette.grey[700] }), _jsx(NoMaxWidthTooltip, { title: !isEmpty(values) && (_jsx(Stack, { spacing: 0.5, children: values.map(value => (_jsx("span", { children: value }, value))) })), children: _jsxs(Typography, { variant: "h3", children: [values.length, !isEmpty(values) && !!title && ' - ', title] }) })] }), _jsx(Typography, { color: "textSecondary", children: subtitle })] }) }) }));
18
+ };
19
+ export default CaseAggregate;
@@ -0,0 +1,6 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ import { type FC } from 'react';
3
+ declare const SourceAggregate: FC<{
4
+ case: Case;
5
+ }>;
6
+ export default SourceAggregate;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Chip, Grid, Skeleton } from '@mui/material';
3
+ import api from '@cccsaurora/howler-ui/api';
4
+ import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
5
+ import { uniq } from 'lodash-es';
6
+ import { useEffect, useMemo, useState } from 'react';
7
+ import useCase from '../../hooks/useCase';
8
+ const SourceAggregate = ({ case: providedCase }) => {
9
+ const { dispatchApi } = useMyApi();
10
+ const { case: _case } = useCase({ case: providedCase });
11
+ const [analytics, setAnalytics] = useState([]);
12
+ const hitIds = useMemo(() => _case?.items.filter(item => item.type === 'hit').map(item => item.id), [_case?.items]);
13
+ useEffect(() => {
14
+ dispatchApi(api.v2.search.post('hit', { query: `howler.id:(${hitIds.join(' OR ')})`, fl: 'howler.analytic' }))
15
+ .then(response => response?.items.map(hit => hit.howler.analytic) ?? [])
16
+ .then(_analytics => setAnalytics(uniq(_analytics)));
17
+ api.v2.search.facet.post(['hit', 'observable'], {
18
+ query: `howler.id:(${hitIds.join(' OR ')})`,
19
+ fields: ['howler.analytic']
20
+ });
21
+ }, [dispatchApi, hitIds]);
22
+ if (!_case) {
23
+ return _jsx(Skeleton, { height: 12, variant: "rounded" });
24
+ }
25
+ return (_jsx(Grid, { container: true, spacing: 1, children: analytics.map(_analytic => (_jsx(Grid, { item: true, children: _jsx(Chip, { size: "small", label: _analytic }) }, _analytic))) }));
26
+ };
27
+ export default SourceAggregate;
@@ -0,0 +1,12 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ import { type FC } from 'react';
3
+ import type { Tree } from './types';
4
+ declare const CaseFolder: FC<{
5
+ case: Case;
6
+ folder?: Tree;
7
+ name?: string;
8
+ step?: number;
9
+ rootCaseId?: string;
10
+ pathPrefix?: string;
11
+ }>;
12
+ export default CaseFolder;
@@ -0,0 +1,114 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Article, BookRounded, ChevronRight, Folder as FolderIcon } from '@mui/icons-material';
3
+ import { Skeleton, Stack, Typography, useTheme } from '@mui/material';
4
+ import api from '@cccsaurora/howler-ui/api';
5
+ import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
6
+ import { get, last, omit, set } from 'lodash-es';
7
+ import { useMemo, useState } from 'react';
8
+ import { Link, useLocation } from 'react-router-dom';
9
+ const buildTree = (items = []) => {
10
+ // Root tree node stores direct children in `leaves` and nested folders as object keys.
11
+ const tree = { leaves: [] };
12
+ items.forEach(item => {
13
+ // Ignore items that cannot be placed in the folder structure.
14
+ if (!item?.path) {
15
+ return;
16
+ }
17
+ // Split path into folder segments + item name, then remove the item name.
18
+ const parts = item.path.split('/');
19
+ parts.pop();
20
+ if (parts.length > 0) {
21
+ // Use dot notation so lodash `get/set` can address nested folder objects.
22
+ const key = parts.join('.');
23
+ const size = get(tree, key)?.leaves?.length || 0;
24
+ // Append this item to the folder's `leaves` array.
25
+ set(tree, `${key}.leaves.${size}`, item);
26
+ return;
27
+ }
28
+ // Items without parent folders are top-level leaves.
29
+ tree.leaves.push(item);
30
+ });
31
+ return tree;
32
+ };
33
+ const CaseFolder = ({ case: _case, folder, name, step = -1, rootCaseId, pathPrefix = '' }) => {
34
+ const theme = useTheme();
35
+ const location = useLocation();
36
+ const { dispatchApi } = useMyApi();
37
+ const [open, setOpen] = useState(true);
38
+ const [openCases, setOpenCases] = useState({});
39
+ const [loadingCases, setLoadingCases] = useState({});
40
+ const [nestedCases, setNestedCases] = useState({});
41
+ const tree = useMemo(() => folder || buildTree(_case?.items), [folder, _case?.items]);
42
+ const currentRootCaseId = rootCaseId || _case?.case_id;
43
+ const toggleCase = (item, itemKey) => {
44
+ // Use the fully-qualified path key when available so nested case toggles are unique.
45
+ const resolvedItemKey = itemKey || item.path || item.id;
46
+ if (!resolvedItemKey) {
47
+ return;
48
+ }
49
+ // Toggle expand/collapse state for this case node.
50
+ const shouldOpen = !openCases[resolvedItemKey];
51
+ setOpenCases(current => ({ ...current, [resolvedItemKey]: shouldOpen }));
52
+ // Only fetch when opening, with a valid case id, and when no fetch/data is already in-flight/cached.
53
+ if (!shouldOpen || !item.id || nestedCases[resolvedItemKey] || loadingCases[resolvedItemKey]) {
54
+ return;
55
+ }
56
+ setLoadingCases(current => ({ ...current, [resolvedItemKey]: true }));
57
+ // Lazy-load the nested case content and cache it by the same unique key.
58
+ dispatchApi(api.v2.case.get(item.id), { throwError: false })
59
+ .then(caseResponse => {
60
+ if (!caseResponse) {
61
+ return;
62
+ }
63
+ setNestedCases(current => ({ ...current, [resolvedItemKey]: caseResponse }));
64
+ })
65
+ .finally(() => {
66
+ setLoadingCases(current => ({ ...current, [resolvedItemKey]: false }));
67
+ });
68
+ };
69
+ return (_jsxs(Stack, { sx: { overflow: 'visible' }, children: [name && (_jsxs(Stack, { direction: "row", pl: step * 1.5, py: 0.25, sx: {
70
+ cursor: 'pointer',
71
+ transition: theme.transitions.create('background', { duration: 50 }),
72
+ background: 'transparent',
73
+ '&:hover': {
74
+ background: theme.palette.grey[800]
75
+ }
76
+ }, onClick: () => setOpen(_open => !_open), children: [_jsx(ChevronRight, { fontSize: "small", color: "disabled", sx: [
77
+ { transition: theme.transitions.create('transform', { duration: 100 }), transform: 'rotate(0deg)' },
78
+ open && { transform: 'rotate(90deg)' }
79
+ ] }), _jsx(FolderIcon, { fontSize: "small", color: "disabled" }), _jsx(Typography, { variant: "caption", color: "textSecondary", sx: { userSelect: 'none', pl: 0.5, textWrap: 'nowrap' }, children: name })] })), open && (_jsxs(_Fragment, { children: [Object.entries(omit(tree, 'leaves')).map(([path, subfolder]) => (_jsx(CaseFolder, { name: path, case: _case, folder: subfolder, step: step + 1, rootCaseId: currentRootCaseId, pathPrefix: pathPrefix }, `${_case?.case_id}-${path}`))), tree.leaves?.map(leaf => {
80
+ const itemType = leaf.type?.toLowerCase();
81
+ const isCase = itemType === 'case';
82
+ const fullRelativePath = [pathPrefix, leaf.path].filter(Boolean).join('/');
83
+ const itemKey = fullRelativePath || leaf.id;
84
+ const isCaseOpen = !!(itemKey && openCases[itemKey]);
85
+ const isCaseLoading = !!(itemKey && loadingCases[itemKey]);
86
+ const nestedCase = itemKey ? nestedCases[itemKey] : null;
87
+ const itemPath = fullRelativePath
88
+ ? `/cases/${currentRootCaseId}/${fullRelativePath}`
89
+ : `/cases/${currentRootCaseId}`;
90
+ return (_jsxs(Stack, { children: [_jsxs(Stack, { direction: "row", pl: step * 1.5 + 1, py: 0.25, sx: [
91
+ {
92
+ cursor: 'pointer',
93
+ overflow: 'visible',
94
+ color: `${theme.palette.text.secondary} !important`,
95
+ textDecoration: 'none',
96
+ transition: theme.transitions.create('background', { duration: 100 }),
97
+ background: 'transparent',
98
+ '&:hover': {
99
+ background: theme.palette.grey[800]
100
+ }
101
+ },
102
+ decodeURIComponent(location.pathname) === itemPath && {
103
+ background: theme.palette.grey[800]
104
+ }
105
+ ], onClick: () => isCase && toggleCase(leaf, itemKey), component: Link, to: itemPath, children: [_jsx(ChevronRight, { fontSize: "small", sx: [
106
+ !isCase && { opacity: 0 },
107
+ isCase && {
108
+ transition: theme.transitions.create('transform', { duration: 100 }),
109
+ transform: isCaseOpen ? 'rotate(90deg)' : 'rotate(0deg)'
110
+ }
111
+ ] }), isCase ? _jsx(BookRounded, { fontSize: "small" }) : _jsx(Article, { fontSize: "small" }), _jsx(Typography, { variant: "caption", color: "textSecondary", sx: { userSelect: 'none', pl: 0.5, textWrap: 'nowrap' }, children: last(leaf.path?.split('/') || []) })] }), isCase && isCaseOpen && isCaseLoading && (_jsx(Stack, { pl: step * 1.5 + 4, py: 0.25, children: _jsx(Skeleton, { width: 140, height: 16 }) })), isCase && isCaseOpen && nestedCase && (_jsx(CaseFolder, { case: nestedCase, step: step + 1, rootCaseId: currentRootCaseId, pathPrefix: fullRelativePath }))] }, `${_case?.case_id}-${leaf.id}-${leaf.path}`));
112
+ })] }))] }));
113
+ };
114
+ export default CaseFolder;
@@ -0,0 +1,3 @@
1
+ import type { Item } from 'models/entities/generated/Item';
2
+
3
+ export type Tree = { leaves?: Item[]; [folder: string]: Tree | Item[] };
@@ -0,0 +1,13 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ interface CaseArguments {
3
+ case?: Case;
4
+ caseId?: string;
5
+ }
6
+ interface CaseResult {
7
+ case: Case;
8
+ updateCase: (update: Partial<Case>) => Promise<void>;
9
+ loading: boolean;
10
+ missing: boolean;
11
+ }
12
+ declare const useCase: (args: CaseArguments) => CaseResult;
13
+ export default useCase;
@@ -0,0 +1,38 @@
1
+ import api from '@cccsaurora/howler-ui/api';
2
+ import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
3
+ import { useCallback, useEffect, useState } from 'react';
4
+ const useCase = ({ caseId, case: providedCase }) => {
5
+ const { dispatchApi } = useMyApi();
6
+ const [loading, setLoading] = useState(false);
7
+ const [missing, setMissing] = useState(false);
8
+ const [_case, setCase] = useState(providedCase);
9
+ useEffect(() => {
10
+ if (providedCase) {
11
+ setCase(providedCase);
12
+ }
13
+ }, [providedCase]);
14
+ useEffect(() => {
15
+ if (caseId) {
16
+ setLoading(true);
17
+ dispatchApi(api.v2.case.get(caseId), { throwError: false })
18
+ .then(setCase)
19
+ .finally(() => setLoading(false));
20
+ }
21
+ }, [caseId, dispatchApi]);
22
+ const updateCase = useCallback(async (_updatedCase) => {
23
+ if (!_case?.case_id) {
24
+ return;
25
+ }
26
+ try {
27
+ setCase(await dispatchApi(api.v2.case.put(_case.case_id, _updatedCase)));
28
+ }
29
+ catch (e) {
30
+ setMissing(true);
31
+ }
32
+ finally {
33
+ return;
34
+ }
35
+ }, [_case?.case_id, dispatchApi]);
36
+ return { case: _case, updateCase, loading, missing };
37
+ };
38
+ export default useCase;
@@ -49,7 +49,7 @@ const ApiDocumentation = () => {
49
49
  .replace(/(\S+)\s+=>\s+(.+)/g, '\n`$1`: $2\n')
50
50
  .replace(/(Data Block:\n)([\s\S]+)(Result Example:)/, (__, p1, p2, p3) => `${p1}\`\`\`\n${p2.trim()}\n\`\`\`\n${p3}`)
51
51
  .replace(/(Result Example:\n)([\s\S]+)$/, (__, p1, p2) => `${p1}\`\`\`\n${p2.trim()}\n\`\`\``) }));
52
- return (_jsxs(Fragment, { children: [_jsxs(TableRow, { style: { marginBottom: '1rem' }, sx: [isLg && { '& > td': { borderBottom: 0 } }], children: [_jsx(TableCell, { children: _jsxs(Stack, { direction: "column", spacing: 1, alignItems: "start", children: [_jsx(Typography, { children: endpoint.name }), _jsx("code", { children: endpoint.path }), _jsxs(Stack, { direction: "row", spacing: 1, children: [endpoint.complete ? (_jsx(Chip, { size: "small", label: "Stable", color: "success" })) : (_jsx(Chip, { size: "small", label: "Unstable", color: "error" })), endpoint.protected ? (_jsx(Chip, { size: "small", label: "Protected", color: "warning" })) : (_jsx(Chip, { size: "small", label: "Unprotected" }))] }), _jsx(Stack, { spacing: 1, direction: "row", children: endpoint.methods.map(m => (_jsx(Chip, { size: "small", label: m }, m))) }), endpoint.ui_only && _jsx(Chip, { size: "small", label: "UI Only" })] }) }), _jsx(TableCell, { children: _jsx(Stack, { spacing: 1, direction: "row", children: endpoint.required_type.map(type => (_jsx(Chip, { size: "small", label: type, color: user.roles?.includes(type) ? 'success' : 'default' }, type))) }) }), _jsx(TableCell, { children: _jsx(Stack, { spacing: 1, direction: "row", children: endpoint.required_priv.map((p) => (_jsx(Chip, { size: "small", label: t(APIKEY_LABELS[p]) }, p))) }) }), !isLg && _jsx(TableCell, { children: documentationCell })] }), isLg && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 3, sx: { '& pre': { whiteSpace: 'pre-wrap' } }, children: documentationCell }) }))] }, endpoint.id));
52
+ return (_jsxs(Fragment, { children: [_jsxs(TableRow, { style: { marginBottom: '1rem' }, sx: [isLg && { '& > td': { borderBottom: 0 } }], children: [_jsx(TableCell, { children: _jsxs(Stack, { direction: "column", spacing: 1, alignItems: "start", children: [_jsx(Typography, { children: endpoint.name }), _jsx("code", { children: endpoint.path }), _jsxs(Stack, { direction: "row", spacing: 1, children: [endpoint.complete ? (_jsx(Chip, { label: "Stable", color: "success" })) : (_jsx(Chip, { label: "Unstable", color: "error" })), endpoint.protected ? (_jsx(Chip, { label: "Protected", color: "warning" })) : (_jsx(Chip, { label: "Unprotected" }))] }), _jsx(Stack, { spacing: 1, direction: "row", children: endpoint.methods.map(m => (_jsx(Chip, { size: "small", label: m }, m))) }), endpoint.ui_only && _jsx(Chip, { label: "UI Only" })] }) }), _jsx(TableCell, { children: _jsx(Stack, { spacing: 1, direction: "row", children: endpoint.required_type.map(type => (_jsx(Chip, { size: "small", label: type, color: user.roles?.includes(type) ? 'success' : 'default' }, type))) }) }), _jsx(TableCell, { children: _jsx(Stack, { spacing: 1, direction: "row", children: endpoint.required_priv.map((p) => (_jsx(Chip, { size: "small", label: t(APIKEY_LABELS[p]) }, p))) }) }), !isLg && _jsx(TableCell, { children: documentationCell })] }), isLg && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 3, sx: { '& pre': { whiteSpace: 'pre-wrap' } }, children: documentationCell }) }))] }, endpoint.id));
53
53
  }) })] }) })] }) }));
54
54
  };
55
55
  export default ApiDocumentation;
@@ -5,7 +5,6 @@ import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/use
5
5
  import { useCallback, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useSearchParams } from 'react-router-dom';
8
- import BundleDocumentation from './BundleDocumentation';
9
8
  import HelpTabs from './components/HelpTabs';
10
9
  import HitBannerDocumentation from './HitBannerDocumentation';
11
10
  import HitLabelsDocumentation from './HitLabelsDocumentation';
@@ -23,8 +22,7 @@ const HitDocumentation = () => {
23
22
  searchParams.set('tab', _tab);
24
23
  setSearchParams(new URLSearchParams(searchParams));
25
24
  }, [searchParams, setSearchParams]);
26
- return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { sx: { flexDirection: useHorizontal ? 'column' : 'row', '& h1': { mt: 0 } }, children: [_jsxs(HelpTabs, { value: tab, children: [_jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.schema.title') }), value: "schema", onClick: () => onChange('schema') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.banner.title') }), value: "header", onClick: () => onChange('header') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.bundle.title') }), value: "bundle", onClick: () => onChange('bundle') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.links.title') }), value: "links", onClick: () => onChange('links') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.labels.title') }), value: "labels", onClick: () => onChange('labels') })] }), _jsx(Box, { children: {
27
- bundle: () => _jsx(BundleDocumentation, {}),
25
+ return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { sx: { flexDirection: useHorizontal ? 'column' : 'row', '& h1': { mt: 0 } }, children: [_jsxs(HelpTabs, { value: tab, children: [_jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.schema.title') }), value: "schema", onClick: () => onChange('schema') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.banner.title') }), value: "header", onClick: () => onChange('header') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.links.title') }), value: "links", onClick: () => onChange('links') }), _jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t('help.hit.labels.title') }), value: "labels", onClick: () => onChange('labels') })] }), _jsx(Box, { children: {
28
26
  header: () => _jsx(HitBannerDocumentation, {}),
29
27
  links: () => _jsx(HitLinksDocumentation, {}),
30
28
  labels: () => _jsx(HitLabelsDocumentation, {}),