@cccsaurora/howler-ui 2.17.0-dev.564 → 2.17.0-dev.617
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.d.ts +2 -0
- package/api/index.js +4 -2
- package/api/search/case.d.ts +4 -0
- package/api/search/case.js +8 -0
- package/api/search/index.d.ts +2 -1
- package/api/search/index.js +2 -1
- package/api/v2/case/index.d.ts +6 -0
- package/api/v2/case/index.js +18 -0
- package/api/v2/index.d.ts +4 -0
- package/api/v2/index.js +6 -0
- package/api/v2/search/facet.d.ts +3 -0
- package/api/v2/search/facet.js +12 -0
- package/api/v2/search/index.d.ts +5 -0
- package/api/v2/search/index.js +24 -0
- package/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/components/app/App.js +14 -0
- package/components/app/providers/FavouritesProvider.js +2 -2
- package/components/app/providers/HitSearchProvider.d.ts +0 -1
- package/components/app/providers/HitSearchProvider.js +6 -11
- package/components/app/providers/HitSearchProvider.test.js +11 -32
- package/components/app/providers/ParameterProvider.d.ts +9 -2
- package/components/app/providers/ParameterProvider.js +165 -240
- package/components/app/providers/ParameterProvider.test.js +307 -14
- package/components/{routes/overviews/OverviewEditor.js → elements/MarkdownEditor.js} +3 -3
- package/components/elements/ObjectDetails.d.ts +6 -0
- package/components/elements/{hit/HitDetails.js → ObjectDetails.js} +17 -17
- package/components/elements/PluginTypography.d.ts +2 -1
- package/components/elements/PluginTypography.js +3 -2
- package/components/elements/UserList.d.ts +5 -2
- package/components/elements/UserList.js +14 -5
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- package/components/elements/case/CaseCard.d.ts +8 -0
- package/components/elements/case/CaseCard.js +39 -0
- package/components/elements/case/CasePreview.d.ts +6 -0
- package/components/elements/case/CasePreview.js +17 -0
- package/components/elements/case/StatusIcon.d.ts +5 -0
- package/components/elements/case/StatusIcon.js +13 -0
- package/components/elements/display/ChipPopper.d.ts +1 -0
- package/components/elements/display/ChipPopper.js +2 -2
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/Modal.js +1 -0
- package/components/elements/hit/HitBanner.js +28 -48
- package/components/elements/hit/HitCard.js +1 -1
- package/components/elements/hit/{HitQuickSearch.d.ts → HitPreview.d.ts} +3 -3
- package/components/elements/hit/{HitQuickSearch.js → HitPreview.js} +10 -4
- package/components/elements/hit/HitRelated.d.ts +1 -1
- package/components/elements/hit/HitRelated.js +30 -3
- package/components/elements/hit/elements/AnalyticLink.d.ts +8 -0
- package/components/elements/hit/elements/AnalyticLink.js +22 -0
- package/components/elements/hit/outlines/DefaultOutline.js +1 -1
- package/components/elements/hit/related/RelatedRecords.js +63 -0
- package/components/elements/observable/ObservableCard.d.ts +5 -0
- package/components/elements/observable/ObservableCard.js +7 -0
- package/components/elements/observable/ObservablePreview.d.ts +6 -0
- package/components/elements/observable/ObservablePreview.js +12 -0
- package/components/elements/view/ViewTitle.js +1 -1
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +2 -2
- package/components/hooks/useHitSelection.js +3 -24
- package/components/hooks/useMyPreferences.js +10 -1
- package/components/hooks/useMySearch.js +2 -2
- package/components/hooks/useMySitemap.js +4 -1
- package/components/hooks/useMyTheme.js +9 -2
- package/components/hooks/useRelatedRecords.d.ts +13 -0
- package/components/hooks/useRelatedRecords.js +32 -0
- package/components/routes/action/view/ActionSearch.js +1 -1
- package/components/routes/advanced/QueryBuilder.js +1 -1
- package/components/routes/analytics/AnalyticDetails.js +2 -2
- package/components/routes/analytics/AnalyticSearch.js +1 -1
- package/components/routes/cases/CaseViewer.d.ts +2 -0
- package/components/routes/cases/CaseViewer.js +24 -0
- package/components/routes/cases/Cases.d.ts +2 -0
- package/components/routes/cases/Cases.js +101 -0
- package/components/routes/cases/constants.d.ts +5 -0
- package/components/routes/cases/constants.js +5 -0
- package/components/routes/cases/detail/AlertPanel.d.ts +6 -0
- package/components/routes/cases/detail/AlertPanel.js +32 -0
- package/components/routes/cases/detail/CaseDashboard.d.ts +7 -0
- package/components/routes/cases/detail/CaseDashboard.js +49 -0
- package/components/routes/cases/detail/CaseDetails.d.ts +6 -0
- package/components/routes/cases/detail/CaseDetails.js +61 -0
- package/components/routes/cases/detail/CaseOverview.d.ts +7 -0
- package/components/routes/cases/detail/CaseOverview.js +43 -0
- package/components/routes/cases/detail/CaseSidebar.d.ts +6 -0
- package/components/routes/cases/detail/CaseSidebar.js +36 -0
- package/components/routes/cases/detail/CaseTask.d.ts +11 -0
- package/components/routes/cases/detail/CaseTask.js +57 -0
- package/components/routes/cases/detail/ItemPage.d.ts +6 -0
- package/components/routes/cases/detail/ItemPage.js +93 -0
- package/components/routes/cases/detail/RelatedCasePanel.d.ts +6 -0
- package/components/routes/cases/detail/RelatedCasePanel.js +31 -0
- package/components/routes/cases/detail/TaskPanel.d.ts +7 -0
- package/components/routes/cases/detail/TaskPanel.js +52 -0
- package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +12 -0
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +19 -0
- package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +6 -0
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +27 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +13 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.js +134 -0
- package/components/routes/cases/detail/sidebar/types.d.ts +3 -0
- package/components/routes/cases/detail/sidebar/utils.d.ts +3 -0
- package/components/routes/cases/detail/sidebar/utils.js +25 -0
- package/components/routes/cases/hooks/useCase.d.ts +13 -0
- package/components/routes/cases/hooks/useCase.js +38 -0
- package/components/routes/cases/modals/ResolveModal.d.ts +7 -0
- package/components/routes/cases/modals/ResolveModal.js +59 -0
- package/components/routes/help/ApiDocumentation.js +1 -1
- package/components/routes/help/HitDocumentation.js +1 -3
- package/components/routes/hits/search/HitContextMenu.js +3 -2
- package/components/routes/hits/search/InformationPane.d.ts +1 -0
- package/components/routes/hits/search/InformationPane.js +6 -28
- package/components/routes/hits/search/QuerySettings.js +2 -1
- package/components/routes/hits/search/QuerySettings.test.js +14 -9
- package/components/routes/hits/search/SearchPane.js +7 -32
- package/components/routes/hits/search/ViewLink.js +1 -1
- package/components/routes/hits/search/grid/EnhancedCell.js +1 -1
- package/components/routes/hits/search/shared/IndexPicker.d.ts +2 -0
- package/components/routes/hits/search/shared/IndexPicker.js +20 -0
- package/components/routes/hits/view/HitViewer.js +3 -4
- package/components/routes/home/ViewCard.js +1 -1
- package/components/routes/observables/ObservableViewer.d.ts +7 -0
- package/components/routes/observables/ObservableViewer.js +27 -0
- package/components/routes/overviews/OverviewViewer.js +2 -2
- package/locales/en/translation.json +437 -398
- package/locales/fr/translation.json +442 -408
- package/models/WithMetadata.d.ts +2 -1
- package/models/entities/generated/AttachmentsFile.d.ts +12 -0
- package/models/entities/generated/Case.d.ts +28 -0
- package/models/entities/generated/DestinationOriginal.d.ts +19 -0
- package/models/entities/generated/EmailAttachment.d.ts +8 -0
- package/models/entities/generated/EmailParent.d.ts +19 -0
- package/models/entities/generated/Enrichments.d.ts +7 -0
- package/models/entities/generated/EnrichmentsIndicator.d.ts +21 -0
- package/models/entities/generated/Howler.d.ts +0 -4
- package/models/entities/generated/HttpResponse.d.ts +11 -0
- package/models/entities/generated/Item.d.ts +9 -0
- package/models/entities/generated/Observable.d.ts +84 -0
- package/models/entities/generated/ObservableCloud.d.ts +20 -0
- package/models/entities/generated/ObservableDestination.d.ts +23 -0
- package/models/entities/generated/ObservableEmail.d.ts +30 -0
- package/models/entities/generated/ObservableFile.d.ts +36 -0
- package/models/entities/generated/ObservableHowler.d.ts +44 -0
- package/models/entities/generated/ObservableHttp.d.ts +11 -0
- package/models/entities/generated/ObservableObserver.d.ts +21 -0
- package/models/entities/generated/ObservableOrganization.d.ts +7 -0
- package/models/entities/generated/ObservableProcess.d.ts +34 -0
- package/models/entities/generated/ObservableSource.d.ts +23 -0
- package/models/entities/generated/ObservableThreat.d.ts +21 -0
- package/models/entities/generated/ObservableTls.d.ts +12 -0
- package/models/entities/generated/ObserverIngress.d.ts +9 -0
- package/models/entities/generated/Rule.d.ts +2 -10
- package/models/entities/generated/Task.d.ts +10 -0
- package/models/entities/generated/Threat.d.ts +2 -2
- package/models/entities/generated/{Enrichment.d.ts → ThreatEnrichment.d.ts} +1 -1
- package/package.json +16 -1
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/utils.d.ts +2 -1
- package/utils/constants.d.ts +3 -3
- package/utils/typeUtils.d.ts +7 -0
- package/utils/typeUtils.js +18 -0
- package/components/elements/display/icons/BundleButton.d.ts +0 -6
- package/components/elements/display/icons/BundleButton.js +0 -32
- package/components/routes/help/BundleDocumentation.d.ts +0 -3
- package/components/routes/help/BundleDocumentation.js +0 -12
- package/components/routes/help/markdown/en/bundles.md.js +0 -1
- package/components/routes/help/markdown/fr/bundles.md.js +0 -1
- package/components/routes/hits/search/BundleParentMenu.d.ts +0 -6
- package/components/routes/hits/search/BundleParentMenu.js +0 -32
- /package/components/{routes/overviews/OverviewEditor.d.ts → elements/MarkdownEditor.d.ts} +0 -0
- /package/components/elements/hit/{HitDetails.d.ts → related/RelatedRecords.d.ts} +0 -0
|
@@ -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;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { OpenInNew } from '@mui/icons-material';
|
|
3
|
+
import { Autocomplete, Box, Button, Card, Chip, Divider, IconButton, LinearProgress, Skeleton, Stack, TextField, Typography } from '@mui/material';
|
|
4
|
+
import api from '@cccsaurora/howler-ui/api';
|
|
5
|
+
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
6
|
+
import { ModalContext } from '@cccsaurora/howler-ui/components/app/providers/ModalProvider';
|
|
7
|
+
import AnalyticLink from '@cccsaurora/howler-ui/components/elements/hit/elements/AnalyticLink';
|
|
8
|
+
import EscalationChip from '@cccsaurora/howler-ui/components/elements/hit/elements/EscalationChip';
|
|
9
|
+
import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
|
|
10
|
+
import useHitActions from '@cccsaurora/howler-ui/components/hooks/useHitActions';
|
|
11
|
+
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
12
|
+
import { uniq } from 'lodash-es';
|
|
13
|
+
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { Link } from 'react-router-dom';
|
|
16
|
+
import useCase from '../hooks/useCase';
|
|
17
|
+
const ResolveModal = ({ case: _case, onConfirm }) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const { dispatchApi } = useMyApi();
|
|
20
|
+
const { close } = useContext(ModalContext);
|
|
21
|
+
const { config } = useContext(ApiConfigContext);
|
|
22
|
+
const { updateCase } = useCase({ case: _case });
|
|
23
|
+
const [loading, setLoading] = useState(true);
|
|
24
|
+
const [rationale, setRationale] = useState('');
|
|
25
|
+
const [assessment, setAssessment] = useState(null);
|
|
26
|
+
const [hits, setHits] = useState([]);
|
|
27
|
+
const hitIds = useMemo(() => uniq((_case?.items ?? []).filter(item => item.type === 'hit').map(item => item.id)), [_case?.items]);
|
|
28
|
+
const { assess } = useHitActions(hits);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
(async () => {
|
|
31
|
+
try {
|
|
32
|
+
const result = await dispatchApi(api.search.hit.post({
|
|
33
|
+
query: `howler.id:(${hitIds.join(' OR ')}) AND -howler.status:resolved`,
|
|
34
|
+
metadata: ['analytic']
|
|
35
|
+
}));
|
|
36
|
+
setHits(result.items);
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
setLoading(false);
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
}, [dispatchApi, hitIds]);
|
|
43
|
+
const handleConfirm = async () => {
|
|
44
|
+
setLoading(true);
|
|
45
|
+
try {
|
|
46
|
+
await assess(assessment, true, rationale);
|
|
47
|
+
await updateCase({ status: 'resolved' });
|
|
48
|
+
onConfirm();
|
|
49
|
+
close();
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return (_jsxs(Stack, { spacing: 2, p: 2, alignItems: "start", sx: { minWidth: 'min(1000px, 60vw)', maxHeight: '100%', height: '100%' }, children: [_jsx(Typography, { variant: "h4", children: t('modal.cases.resolve') }), _jsx(Typography, { children: t('modal.cases.resolve.description') }), _jsxs(Stack, { spacing: 1, overflow: "auto", width: "100%", flex: 1, children: [_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Box, { flex: 1, children: _jsx(TextField, { size: "small", fullWidth: true, placeholder: t('modal.rationale.label'), value: rationale, onChange: ev => setRationale(ev.target.value) }) }), _jsx(Box, { flex: 1, children: _jsx(Autocomplete, { size: "small", value: assessment, onChange: (_ev, _assessment) => setAssessment(_assessment), options: config.lookups['howler.assessment'], disablePortal: true, renderInput: params => (_jsx(TextField, { ...params, placeholder: t('hit.details.actions.assessment'), fullWidth: true })) }) })] }), _jsxs(Stack, { position: "relative", children: [_jsx(Divider, {}), _jsx(LinearProgress, { sx: { opacity: +loading } })] }), loading
|
|
56
|
+
? hitIds.map(id => _jsx(Skeleton, { variant: "rounded", height: "40px", width: "100%" }, id))
|
|
57
|
+
: hits.map(hit => (_jsx(Card, { sx: { p: 1, flexShrink: 0 }, children: _jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, width: "100%", children: [_jsx(AnalyticLink, { hit: hit, compressed: true, alignSelf: "center" }), _jsx(EscalationChip, { hit: hit, layout: HitLayout.DENSE }), _jsx(Chip, { sx: { width: 'fit-content', display: 'inline-flex' }, label: hit.howler.status, size: "small", color: "primary" }), _jsx("div", { style: { flex: 1 } }), _jsx(IconButton, { size: "small", component: Link, to: `/hits/${hit.howler.id}`, children: _jsx(OpenInNew, { fontSize: "small" }) })] }) }, hit.howler.id)))] }), _jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "end", children: [_jsx(Button, { variant: "outlined", color: "error", onClick: close, children: t('cancel') }), _jsx(Button, { variant: "outlined", color: "success", disabled: loading || !assessment || !rationale, onClick: handleConfirm, children: t('confirm') })] })] }));
|
|
58
|
+
};
|
|
59
|
+
export default ResolveModal;
|
|
@@ -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, {
|
|
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.
|
|
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, {}),
|
|
@@ -170,9 +170,10 @@ const HitContextMenu = ({ children, getSelectedId, Component = Box }) => {
|
|
|
170
170
|
sx: {
|
|
171
171
|
...transformProps,
|
|
172
172
|
overflow: 'visible !important'
|
|
173
|
-
}
|
|
173
|
+
},
|
|
174
|
+
elevation: 2
|
|
174
175
|
}
|
|
175
|
-
}, MenuListProps: { dense: true, sx: { minWidth: '250px' } }, anchorOrigin: { vertical: 'top', horizontal: 'left' }, onClick: () => setAnchorEl(null), children: [_jsxs(MenuItem, { component: Link, to: `/hits/${hit?.howler.id}`, disabled: !hit, children: [_jsx(ListItemIcon, { children: _jsx(OpenInNew, {}) }), _jsx(ListItemText, { children: t('hit.panel.open') })] }), _jsxs(MenuItem, { component: Link, to: `/analytics/${analytic?.analytic_id}`, disabled: !analytic, children: [_jsx(ListItemIcon, { children: _jsx(QueryStats, {}) }), _jsx(ListItemText, { children: t('hit.panel.analytic.open') })] }), _jsx(Divider, {}), entries.map(([type, items]) => (_jsxs(MenuItem, { id: `${type}-menu-item`, sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, [type]: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, [type]: null })), disabled: rowStatus[type] === false, children: [_jsx(ListItemIcon, { children: ICON_MAP[type] ?? _jsx(Terminal, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t(`hit.details.actions.${type}`) }), rowStatus[type] !== false && (_jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } })), _jsx(Fade, { in: !!show[type], unmountOnExit: true, children: _jsx(Paper, { id: `${type}-submenu`, sx: calculateSubMenuStyles(show[type]), elevation:
|
|
176
|
+
}, MenuListProps: { dense: true, sx: { minWidth: '250px' } }, anchorOrigin: { vertical: 'top', horizontal: 'left' }, onClick: () => setAnchorEl(null), children: [_jsxs(MenuItem, { component: Link, to: `/hits/${hit?.howler.id}`, disabled: !hit, children: [_jsx(ListItemIcon, { children: _jsx(OpenInNew, {}) }), _jsx(ListItemText, { children: t('hit.panel.open') })] }), _jsxs(MenuItem, { component: Link, to: `/analytics/${analytic?.analytic_id}`, disabled: !analytic, children: [_jsx(ListItemIcon, { children: _jsx(QueryStats, {}) }), _jsx(ListItemText, { children: t('hit.panel.analytic.open') })] }), _jsx(Divider, {}), entries.map(([type, items]) => (_jsxs(MenuItem, { id: `${type}-menu-item`, sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, [type]: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, [type]: null })), disabled: rowStatus[type] === false, children: [_jsx(ListItemIcon, { children: ICON_MAP[type] ?? _jsx(Terminal, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t(`hit.details.actions.${type}`) }), rowStatus[type] !== false && (_jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } })), _jsx(Fade, { in: !!show[type], unmountOnExit: true, children: _jsx(Paper, { id: `${type}-submenu`, sx: calculateSubMenuStyles(show[type]), elevation: 2, children: _jsx(MenuList, { sx: { p: 0, borderTopLeftRadius: 0 }, dense: true, role: "group", children: items.map(a => (_jsx(MenuItem, { value: a.name, onClick: a.actionFunction, children: a.i18nKey ? t(a.i18nKey) : capitalize(a.name) }, a.name))) }) }) })] }, type))), _jsxs(MenuItem, { id: "actions-menu-item", sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, actions: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, actions: null })), disabled: actions.length < 1, children: [_jsx(ListItemIcon, { children: _jsx(SettingsSuggest, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t('route.actions.change') }), actions.length > 0 && _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show.actions, unmountOnExit: true, children: _jsx(Paper, { id: "actions-submenu", sx: calculateSubMenuStyles(show.actions), elevation: 2, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: actions.map(action => (_jsx(MenuItem, { onClick: () => executeAction(action.action_id, `howler.id:${hit?.howler.id}`), children: _jsx(ListItemText, { children: action.name }) }, action.action_id))) }) }) })] }), !isEmpty(template?.keys ?? []) && setQuery && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs(MenuItem, { id: "excludes-menu-item", sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, excludes: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, excludes: null })), children: [_jsx(ListItemIcon, { children: _jsx(RemoveCircleOutline, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t('hit.panel.exclude') }), _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show.excludes, unmountOnExit: true, children: _jsx(Paper, { id: "excludes-submenu", sx: calculateSubMenuStyles(show.excludes), elevation: 2, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: template?.keys.map(key => {
|
|
176
177
|
// Build exclusion query based on current query and field value
|
|
177
178
|
let newQuery = '';
|
|
178
179
|
if (query !== DEFAULT_QUERY) {
|
|
@@ -12,13 +12,11 @@ import VSBox from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox
|
|
|
12
12
|
import VSBoxContent from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox/VSBoxContent';
|
|
13
13
|
import VSBoxHeader from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox/VSBoxHeader';
|
|
14
14
|
import Phrase from '@cccsaurora/howler-ui/components/elements/addons/search/phrase/Phrase';
|
|
15
|
-
import BundleButton from '@cccsaurora/howler-ui/components/elements/display/icons/BundleButton';
|
|
16
15
|
import SocketBadge from '@cccsaurora/howler-ui/components/elements/display/icons/SocketBadge';
|
|
17
16
|
import JSONViewer from '@cccsaurora/howler-ui/components/elements/display/json/JSONViewer';
|
|
18
17
|
import HitActions from '@cccsaurora/howler-ui/components/elements/hit/HitActions';
|
|
19
18
|
import HitBanner from '@cccsaurora/howler-ui/components/elements/hit/HitBanner';
|
|
20
19
|
import HitComments from '@cccsaurora/howler-ui/components/elements/hit/HitComments';
|
|
21
|
-
import HitDetails from '@cccsaurora/howler-ui/components/elements/hit/HitDetails';
|
|
22
20
|
import HitLabels from '@cccsaurora/howler-ui/components/elements/hit/HitLabels';
|
|
23
21
|
import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
|
|
24
22
|
import HitLinks from '@cccsaurora/howler-ui/components/elements/hit/HitLinks';
|
|
@@ -27,6 +25,7 @@ import HitOverview from '@cccsaurora/howler-ui/components/elements/hit/HitOvervi
|
|
|
27
25
|
import HitRelated from '@cccsaurora/howler-ui/components/elements/hit/HitRelated';
|
|
28
26
|
import HitSummary from '@cccsaurora/howler-ui/components/elements/hit/HitSummary';
|
|
29
27
|
import HitWorklog from '@cccsaurora/howler-ui/components/elements/hit/HitWorklog';
|
|
28
|
+
import ObjectDetails from '@cccsaurora/howler-ui/components/elements/ObjectDetails';
|
|
30
29
|
import useMyUserList from '@cccsaurora/howler-ui/components/hooks/useMyUserList';
|
|
31
30
|
import ErrorBoundary from '@cccsaurora/howler-ui/components/routes/ErrorBoundary';
|
|
32
31
|
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
@@ -39,13 +38,13 @@ import { getUserList } from '@cccsaurora/howler-ui/utils/hitFunctions';
|
|
|
39
38
|
import { validateRegex } from '@cccsaurora/howler-ui/utils/stringUtils';
|
|
40
39
|
import { tryParse } from '@cccsaurora/howler-ui/utils/utils';
|
|
41
40
|
import LeadRenderer from '../view/LeadRenderer';
|
|
42
|
-
const InformationPane = ({ onClose }) => {
|
|
41
|
+
const InformationPane = ({ onClose, selected: _selected }) => {
|
|
43
42
|
const { t, i18n } = useTranslation();
|
|
44
43
|
const theme = useTheme();
|
|
45
44
|
const location = useLocation();
|
|
46
45
|
const { emit, isOpen } = useContext(SocketContext);
|
|
47
46
|
const { getMatchingOverview, getMatchingDossiers, getMatchingAnalytic } = useMatchers();
|
|
48
|
-
const selected = useContextSelector(ParameterContext, ctx => ctx
|
|
47
|
+
const selected = useContextSelector(ParameterContext, ctx => ctx?.selected) ?? _selected;
|
|
49
48
|
const pluginStore = usePluginStore();
|
|
50
49
|
const getHit = useContextSelector(HitContext, ctx => ctx.getHit);
|
|
51
50
|
const [userIds, setUserIds] = useState(new Set());
|
|
@@ -94,11 +93,6 @@ const InformationPane = ({ onClose }) => {
|
|
|
94
93
|
useEffect(() => {
|
|
95
94
|
getMatchingOverview(hit).then(_overview => setHasOverview(!!_overview));
|
|
96
95
|
}, [getMatchingOverview, hit]);
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
if (tab === 'hit_aggregate' && !hit?.howler.is_bundle) {
|
|
99
|
-
setTab('overview');
|
|
100
|
-
}
|
|
101
|
-
}, [hit?.howler.is_bundle, tab]);
|
|
102
96
|
useEffect(() => {
|
|
103
97
|
if (selected && isOpen()) {
|
|
104
98
|
emit({
|
|
@@ -122,28 +116,13 @@ const InformationPane = ({ onClose }) => {
|
|
|
122
116
|
}
|
|
123
117
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
124
118
|
}, [hasOverview]);
|
|
125
|
-
/**
|
|
126
|
-
* What to show as the header? If loading a skeleton, then it depends on bundle or not. Bundles don't
|
|
127
|
-
* show anything while normal hits do
|
|
128
|
-
*/
|
|
129
|
-
const header = useMemo(() => {
|
|
130
|
-
if (loading && !hit?.howler?.is_bundle) {
|
|
131
|
-
return _jsx(Skeleton, { variant: "rounded", height: 152 });
|
|
132
|
-
}
|
|
133
|
-
else if (!!hit && !hit.howler.is_bundle) {
|
|
134
|
-
return _jsx(HitBanner, { layout: HitLayout.DENSE, hit: hit });
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
}, [hit, loading]);
|
|
140
119
|
const tabContent = useMemo(() => {
|
|
141
120
|
if (!tab) {
|
|
142
121
|
return;
|
|
143
122
|
}
|
|
144
123
|
return {
|
|
145
124
|
overview: () => _jsx(HitOverview, { hit: hit }),
|
|
146
|
-
details: () => _jsx(
|
|
125
|
+
details: () => _jsx(ObjectDetails, { obj: hit }),
|
|
147
126
|
hit_comments: () => _jsx(HitComments, { hit: hit, users: users }),
|
|
148
127
|
hit_raw: () => _jsx(JSONViewer, { data: !loading && hit, hideSearch: true, filter: filter }),
|
|
149
128
|
hit_data: () => (_jsx(JSONViewer, { data: !loading && hit?.howler?.data?.map(entry => tryParse(entry)), collapse: false, hideSearch: true, filter: filter })),
|
|
@@ -161,8 +140,7 @@ const InformationPane = ({ onClose }) => {
|
|
|
161
140
|
}[tab]?.();
|
|
162
141
|
}, [dossiers, filter, hit, loading, tab, users]);
|
|
163
142
|
const hasError = useMemo(() => !validateRegex(filter), [filter]);
|
|
164
|
-
return (_jsxs(VSBox, { top: 10, sx: { height: '100%', flex: 1 }, children: [_jsxs(Stack, { direction: "column", flex: 1, sx: { overflowY: 'auto', flexGrow: 1 }, position: "relative", spacing: 1, ml: 2, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, flexShrink: 0, pr: 2,
|
|
165
|
-
!hit.howler.is_bundle &&
|
|
143
|
+
return (_jsxs(VSBox, { top: 10, sx: { height: '100%', flex: 1 }, children: [_jsxs(Stack, { direction: "column", flex: 1, sx: { overflowY: 'auto', flexGrow: 1 }, position: "relative", spacing: 1, ml: 2, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, flexShrink: 0, pr: 2, children: [_jsx(FlexOne, {}), onClose && !location.pathname.startsWith('/bundles') && (_jsx(TuiIconButton, { size: "small", onClick: onClose, tooltip: t('hit.panel.details.exit'), children: _jsx(Clear, {}) })), _jsx(SocketBadge, { size: "small" }), analytic && (_jsx(TuiIconButton, { size: "small", tooltip: t('hit.panel.analytic.open'), disabled: !analytic || loading, route: `/analytics/${analytic.analytic_id}`, children: _jsx(QueryStats, {}) })), !!hit && (_jsx(TuiIconButton, { tooltip: t('hit.panel.open'), href: `/hits/${selected}`, disabled: !hit || loading, size: "small", target: "_blank", children: _jsx(OpenInNew, {}) }))] }), _jsx(Box, { pr: 2, children: loading || !hit ? (_jsx(Skeleton, { variant: "rounded", height: 152 })) : (_jsx(HitBanner, { layout: HitLayout.DENSE, hit: hit })) }), !!hit &&
|
|
166
144
|
(!loading ? (_jsxs(_Fragment, { children: [_jsx(HitOutline, { hit: hit, layout: HitLayout.DENSE }), _jsx(HitLabels, { hit: hit })] })) : (_jsx(Skeleton, { height: 124 }))), _jsx(HitLinks, { hit: hit, analytic: analytic, dossiers: dossiers }), _jsxs(VSBoxHeader, { ml: -1, mr: -1, pb: 1, sx: { top: '0px' }, children: [_jsxs(Tabs, { value: tab === 'overview' && !hasOverview ? 'details' : tab, sx: {
|
|
167
145
|
display: 'flex',
|
|
168
146
|
flexDirection: 'row',
|
|
@@ -192,7 +170,7 @@ const InformationPane = ({ onClose }) => {
|
|
|
192
170
|
right: theme.spacing(-0.5)
|
|
193
171
|
},
|
|
194
172
|
'& > svg': { zIndex: 2 }
|
|
195
|
-
}, badgeContent: hit?.howler.comment?.length ?? 0, children: _jsx(Comment, {}) }) }), value: "hit_comments", onClick: () => setTab('hit_comments') }),
|
|
173
|
+
}, badgeContent: hit?.howler.comment?.length ?? 0, children: _jsx(Comment, {}) }) }), value: "hit_comments", onClick: () => setTab('hit_comments') }), 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
|
|
196
174
|
// eslint-disable-next-line react/no-array-index-key
|
|
197
175
|
, { 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
|
|
198
176
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { useContextSelector } from 'use-context-selector';
|
|
10
10
|
import HitFilter from './shared/HitFilter';
|
|
11
11
|
import HitSort from './shared/HitSort';
|
|
12
|
+
import IndexPicker from './shared/IndexPicker';
|
|
12
13
|
import SearchSpan from './shared/SearchSpan';
|
|
13
14
|
import ViewLink from './ViewLink';
|
|
14
15
|
const QuerySettings = ({ boxSx }) => {
|
|
@@ -25,6 +26,6 @@ const QuerySettings = ({ boxSx }) => {
|
|
|
25
26
|
await fetchViews();
|
|
26
27
|
addView('');
|
|
27
28
|
};
|
|
28
|
-
return (_jsx(Box, { sx: boxSx ?? { position: 'relative', maxWidth: '1200px' }, children: _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsxs(Grid, { container: true, spacing: 1, sx: theme => ({ ml: `${theme.spacing(-1)} !important`, mt: `${theme.spacing(-1)} !important` }), children: [_jsx(Grid, { item: true, children: _jsx(HitSort, {}) }), _jsx(Grid, { item: true, children: _jsx(SearchSpan, {}) }), currentViews?.map((view, id) => (_jsx(Grid, { item: true, children: _jsx(ViewLink, { id: id, viewId: view }) }, view))), filters?.map((filter, id) => (_jsx(Grid, { item: true, children: _jsx(HitFilter, { id: id, value: filter }) }, filter)))] }), _jsx(ChipPopper, { icon: _jsx(Add, {}), deleteIcon: _jsx(ArrowDropDown, {}), toggleOnDelete: true, closeOnClick: true, slotProps: { chip: { size: 'small', color: 'primary' }, paper: { sx: { p: 1 } } }, children: _jsxs(Stack, { spacing: 1, children: [_jsxs(Button, { id: "add-filter", "aria-label": t('hit.search.filter.add'), variant: "outlined", onClick: () => addFilter('howler.assessment:*'), disabled: filters?.some(filter => filter.endsWith('*')), sx: { display: 'flex', pl: 1 }, children: [_jsx(Add, { fontSize: "small", sx: { mr: 1 } }), _jsx("div", { style: { flex: 1 } }), _jsx("span", { children: t('hit.search.filter.add') })] }), _jsxs(Button, { id: "add-view", "aria-label": t('hit.search.view.add'), variant: "outlined", onClick: onAddView, disabled: !allowAddViews, sx: { display: 'flex', pl: 1 }, children: [_jsx(Add, { fontSize: "small", sx: { mr: 1 } }), _jsx("div", { style: { flex: 1 } }), _jsx("span", { children: t('hit.search.view.add') })] })] }) })] }) }));
|
|
29
|
+
return (_jsx(Box, { sx: boxSx ?? { position: 'relative', maxWidth: '1200px' }, children: _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsxs(Grid, { container: true, spacing: 1, sx: theme => ({ ml: `${theme.spacing(-1)} !important`, mt: `${theme.spacing(-1)} !important` }), children: [_jsx(Grid, { item: true, children: _jsx(IndexPicker, {}) }), _jsx(Grid, { item: true, children: _jsx(HitSort, {}) }), _jsx(Grid, { item: true, children: _jsx(SearchSpan, {}) }), currentViews?.map((view, id) => (_jsx(Grid, { item: true, children: _jsx(ViewLink, { id: id, viewId: view }) }, view))), filters?.map((filter, id) => (_jsx(Grid, { item: true, children: _jsx(HitFilter, { id: id, value: filter }) }, filter)))] }), _jsx(ChipPopper, { icon: _jsx(Add, {}), deleteIcon: _jsx(ArrowDropDown, {}), toggleOnDelete: true, closeOnClick: true, slotProps: { chip: { size: 'small', color: 'primary' }, paper: { sx: { p: 1 } } }, children: _jsxs(Stack, { spacing: 1, children: [_jsxs(Button, { id: "add-filter", "aria-label": t('hit.search.filter.add'), variant: "outlined", onClick: () => addFilter('howler.assessment:*'), disabled: filters?.some(filter => filter.endsWith('*')), sx: { display: 'flex', pl: 1 }, children: [_jsx(Add, { fontSize: "small", sx: { mr: 1 } }), _jsx("div", { style: { flex: 1 } }), _jsx("span", { children: t('hit.search.filter.add') })] }), _jsxs(Button, { id: "add-view", "aria-label": t('hit.search.view.add'), variant: "outlined", onClick: onAddView, disabled: !allowAddViews, sx: { display: 'flex', pl: 1 }, children: [_jsx(Add, { fontSize: "small", sx: { mr: 1 } }), _jsx("div", { style: { flex: 1 } }), _jsx("span", { children: t('hit.search.view.add') })] })] }) })] }) }));
|
|
29
30
|
};
|
|
30
31
|
export default memo(QuerySettings);
|
|
@@ -16,6 +16,9 @@ vi.mock('./shared/HitSort', () => ({
|
|
|
16
16
|
vi.mock('./shared/SearchSpan', () => ({
|
|
17
17
|
default: () => _jsx("div", { id: "search-span", children: "SearchSpan" })
|
|
18
18
|
}));
|
|
19
|
+
vi.mock('./shared/IndexPicker', () => ({
|
|
20
|
+
default: () => _jsx("div", { id: "index-picker", children: "IndexPicker" })
|
|
21
|
+
}));
|
|
19
22
|
vi.mock('./ViewLink', () => ({
|
|
20
23
|
default: ({ id, viewId }) => (_jsxs("div", { id: `view-link-${id}`, "data-view-id": viewId, children: ["ViewLink ", id, ": ", viewId] }))
|
|
21
24
|
}));
|
|
@@ -33,6 +36,7 @@ const mockFetchViews = vi.fn();
|
|
|
33
36
|
let mockParameterContext = {
|
|
34
37
|
filters: [],
|
|
35
38
|
views: [],
|
|
39
|
+
indexes: [],
|
|
36
40
|
addFilter: mockAddFilter,
|
|
37
41
|
addView: mockAddView
|
|
38
42
|
};
|
|
@@ -270,16 +274,16 @@ describe('QuerySettings', () => {
|
|
|
270
274
|
mockParameterContext.views = ['view-1'];
|
|
271
275
|
const { container } = render(_jsx(QuerySettings, {}), { wrapper: Wrapper });
|
|
272
276
|
const gridItems = container.querySelectorAll('[class*="MuiGrid-item"]');
|
|
273
|
-
// HitSort + SearchSpan + 1 view + 2 filters = 5 items
|
|
274
|
-
expect(gridItems.length).toBe(
|
|
277
|
+
// IndexPicker + HitSort + SearchSpan + 1 view + 2 filters = 5 items
|
|
278
|
+
expect(gridItems.length).toBe(6);
|
|
275
279
|
});
|
|
276
280
|
it('should render correct number of items with multiple views', () => {
|
|
277
281
|
mockParameterContext.filters = ['filter1'];
|
|
278
282
|
mockParameterContext.views = ['view-1', 'view-2', 'view-3'];
|
|
279
283
|
const { container } = render(_jsx(QuerySettings, {}), { wrapper: Wrapper });
|
|
280
284
|
const gridItems = container.querySelectorAll('[class*="MuiGrid-item"]');
|
|
281
|
-
// HitSort + SearchSpan + 3 views + 1 filter = 6 items
|
|
282
|
-
expect(gridItems.length).toBe(
|
|
285
|
+
// IndexPicker + HitSort + SearchSpan + 3 views + 1 filter = 6 items
|
|
286
|
+
expect(gridItems.length).toBe(7);
|
|
283
287
|
});
|
|
284
288
|
});
|
|
285
289
|
describe('Edge Cases', () => {
|
|
@@ -508,11 +512,12 @@ describe('QuerySettings', () => {
|
|
|
508
512
|
mockParameterContext.views = ['view-1'];
|
|
509
513
|
const { container } = render(_jsx(QuerySettings, {}), { wrapper: Wrapper });
|
|
510
514
|
const gridItems = container.querySelectorAll('[class*="MuiGrid-item"]');
|
|
511
|
-
// Order: HitSort, SearchSpan, ViewLink(s), HitFilter(s)
|
|
512
|
-
expect(gridItems[0]).toContainElement(screen.getByTestId('
|
|
513
|
-
expect(gridItems[1]).toContainElement(screen.getByTestId('
|
|
514
|
-
expect(gridItems[2]).toContainElement(screen.getByTestId('
|
|
515
|
-
expect(gridItems[3]).toContainElement(screen.getByTestId('
|
|
515
|
+
// Order: IndexPicker, HitSort, SearchSpan, ViewLink(s), HitFilter(s)
|
|
516
|
+
expect(gridItems[0]).toContainElement(screen.getByTestId('index-picker'));
|
|
517
|
+
expect(gridItems[1]).toContainElement(screen.getByTestId('hit-sort'));
|
|
518
|
+
expect(gridItems[2]).toContainElement(screen.getByTestId('search-span'));
|
|
519
|
+
expect(gridItems[3]).toContainElement(screen.getByTestId('view-link-0'));
|
|
520
|
+
expect(gridItems[4]).toContainElement(screen.getByTestId('hit-filter-0'));
|
|
516
521
|
});
|
|
517
522
|
it('should pass correct props to ViewLink components', () => {
|
|
518
523
|
mockParameterContext.views = ['view-1', 'view-2'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { ErrorOutline, List, SavedSearch, TableChart, Terminal } from '@mui/icons-material';
|
|
3
3
|
import { Box, IconButton, LinearProgress, Stack, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
4
4
|
import { grey } from '@mui/material/colors';
|
|
5
5
|
import AppListEmpty from '@cccsaurora/howler-ui/commons/components/display/AppListEmpty';
|
|
@@ -14,20 +14,16 @@ import VSBoxContent from '@cccsaurora/howler-ui/components/elements/addons/layou
|
|
|
14
14
|
import VSBoxHeader from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox/VSBoxHeader';
|
|
15
15
|
import SearchPagination from '@cccsaurora/howler-ui/components/elements/addons/search/SearchPagination';
|
|
16
16
|
import SearchTotal from '@cccsaurora/howler-ui/components/elements/addons/search/SearchTotal';
|
|
17
|
-
import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
|
|
18
|
-
import HitBanner from '@cccsaurora/howler-ui/components/elements/hit/HitBanner';
|
|
19
17
|
import HitCard from '@cccsaurora/howler-ui/components/elements/hit/HitCard';
|
|
20
18
|
import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
|
|
21
19
|
import useHitSelection from '@cccsaurora/howler-ui/components/hooks/useHitSelection';
|
|
22
20
|
import useMyLocalStorage, { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
|
|
23
|
-
import React, { memo, useCallback,
|
|
21
|
+
import React, { memo, useCallback, useMemo } from 'react';
|
|
24
22
|
import { isMobile } from 'react-device-detect';
|
|
25
23
|
import { useTranslation } from 'react-i18next';
|
|
26
|
-
import { Link
|
|
24
|
+
import { Link } from 'react-router-dom';
|
|
27
25
|
import { useContextSelector } from 'use-context-selector';
|
|
28
26
|
import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
|
|
29
|
-
import BundleParentMenu from './BundleParentMenu';
|
|
30
|
-
import { BundleScroller } from './BundleScroller';
|
|
31
27
|
import HitContextMenu from './HitContextMenu';
|
|
32
28
|
import HitQuery from './HitQuery';
|
|
33
29
|
import QuerySettings from './QuerySettings';
|
|
@@ -52,7 +48,7 @@ const Item = memo(({ hit, onClick }) => {
|
|
|
52
48
|
'& span,p,h6': {
|
|
53
49
|
cursor: 'text'
|
|
54
50
|
},
|
|
55
|
-
'& .MuiPaper-root': {
|
|
51
|
+
'& > .MuiPaper-root': {
|
|
56
52
|
border: '4px solid transparent',
|
|
57
53
|
boxShadow: `0px 0px 0px 0px transparent`,
|
|
58
54
|
transition: theme.transitions.create(['border-color', 'box-shadow'])
|
|
@@ -66,10 +62,10 @@ const Item = memo(({ hit, onClick }) => {
|
|
|
66
62
|
}
|
|
67
63
|
},
|
|
68
64
|
selectedHits.some(_hit => _hit.howler.id === hit.howler.id) && {
|
|
69
|
-
'& .MuiPaper-root': { borderColor: grey[500], boxShadow: `0px 0px 5px 2px ${grey[500]}` }
|
|
65
|
+
'& > .MuiPaper-root': { borderColor: grey[500], boxShadow: `0px 0px 5px 2px ${grey[500]}` }
|
|
70
66
|
},
|
|
71
67
|
selected === hit.howler.id && {
|
|
72
|
-
'& .MuiPaper-root': {
|
|
68
|
+
'& > .MuiPaper-root': {
|
|
73
69
|
borderColor: 'primary.main',
|
|
74
70
|
boxShadow: `0px 0px 5px 2px ${theme.palette.primary.main}`
|
|
75
71
|
}
|
|
@@ -78,11 +74,6 @@ const Item = memo(({ hit, onClick }) => {
|
|
|
78
74
|
});
|
|
79
75
|
const SearchPane = () => {
|
|
80
76
|
const { t } = useTranslation();
|
|
81
|
-
const location = useLocation();
|
|
82
|
-
const navigate = useNavigate();
|
|
83
|
-
const routeParams = useParams();
|
|
84
|
-
const selected = useContextSelector(ParameterContext, ctx => ctx.selected);
|
|
85
|
-
const setSelected = useContextSelector(ParameterContext, ctx => ctx.setSelected);
|
|
86
77
|
const query = useContextSelector(ParameterContext, ctx => ctx.query);
|
|
87
78
|
const setOffset = useContextSelector(ParameterContext, ctx => ctx.setOffset);
|
|
88
79
|
const displayType = useContextSelector(HitSearchContext, ctx => ctx.displayType);
|
|
@@ -92,9 +83,6 @@ const SearchPane = () => {
|
|
|
92
83
|
const response = useContextSelector(HitSearchContext, ctx => ctx.response);
|
|
93
84
|
const error = useContextSelector(HitSearchContext, ctx => ctx.error);
|
|
94
85
|
const { onClick } = useHitSelection();
|
|
95
|
-
const getHit = useContextSelector(HitContext, ctx => ctx.getHit);
|
|
96
|
-
const clearSelectedHits = useContextSelector(HitContext, ctx => ctx.clearSelectedHits);
|
|
97
|
-
const bundleHit = useContextSelector(HitContext, ctx => location.pathname.startsWith('/bundles') ? ctx.hits[routeParams.id] : null);
|
|
98
86
|
const searchPaneWidth = useMyLocalStorageItem(StorageKey.SEARCH_PANE_WIDTH, null)[0];
|
|
99
87
|
const verticalSorters = useMediaQuery('(max-width: 1919px)') || (searchPaneWidth ?? Number.MAX_SAFE_INTEGER) < 900;
|
|
100
88
|
const getSelectedId = useCallback((event) => {
|
|
@@ -105,20 +93,7 @@ const SearchPane = () => {
|
|
|
105
93
|
}
|
|
106
94
|
return selectedElement.id;
|
|
107
95
|
}, []);
|
|
108
|
-
|
|
109
|
-
if (location.pathname.startsWith('/bundles')) {
|
|
110
|
-
getHit(routeParams.id);
|
|
111
|
-
}
|
|
112
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
-
}, [location.pathname, routeParams.id]);
|
|
114
|
-
return (_jsx(FlexPort, { id: "hitscrollbar", children: _jsx(PageCenter, { textAlign: "left", mt: 0, mb: 6, ml: 0, mr: 0, maxWidth: "1500px", children: _jsxs(VSBox, { top: 0, children: [_jsxs(Stack, { ml: -1, mr: -1, sx: { '& .overflowingContentWidgets > *': { zIndex: '2000 !important' } }, spacing: 1, children: [bundleHit && (_jsx(BundleScroller, { children: _jsx(HitContextMenu, { getSelectedId: () => bundleHit.howler.id, children: _jsx(Stack, { spacing: 1, sx: { mx: -1 }, children: _jsx(HowlerCard, { sx: [
|
|
115
|
-
{ p: 1, border: '4px solid transparent', cursor: 'pointer' },
|
|
116
|
-
location.pathname.startsWith('/bundles') &&
|
|
117
|
-
selected === routeParams.id && { borderColor: 'primary.main' }
|
|
118
|
-
], onClick: () => {
|
|
119
|
-
clearSelectedHits(bundleHit.howler.id);
|
|
120
|
-
setSelected(bundleHit.howler.id);
|
|
121
|
-
}, children: _jsx(HitBanner, { hit: bundleHit, layout: HitLayout.DENSE, useListener: true }) }) }) }) })), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { sx: { color: 'text.secondary', fontSize: '0.9em', fontStyle: 'italic', mb: 0.5 }, variant: "body2", children: t('hit.search.prompt') }), error && (_jsx(Tooltip, { title: `${t('route.advanced.error')}: ${error}`, children: _jsx(ErrorOutline, { fontSize: "small", color: "error" }) })), _jsx(FlexOne, {}), bundleHit?.howler.bundles.length > 0 && _jsx(BundleParentMenu, { bundle: bundleHit }), bundleHit && (_jsx(Tooltip, { title: t('hit.bundle.close'), children: _jsx(IconButton, { size: "small", onClick: () => navigate('/search'), children: _jsx(Close, {}) }) })), _jsx(Tooltip, { title: t('route.views.save'), children: _jsx(IconButton, { component: Link, disabled: !query, to: `/views/create?query=${query}`, children: _jsx(SavedSearch, {}) }) }), _jsx(Tooltip, { title: t('route.actions.save'), children: _jsx(IconButton, { component: Link, disabled: !query, to: `/action/execute?query=${query}`, children: _jsx(Terminal, {}) }) }), _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(VSBoxHeader, { ml: -3, mr: -3, px: 2, pb: 1, sx: { zIndex: 989 }, children: [_jsxs(Stack, { sx: { pt: 1 }, children: [_jsxs(Stack, { sx: { position: 'relative', flex: 1 }, children: [_jsx(HitQuery, { searching: searching, triggerSearch: triggerSearch }), searching && (_jsx(LinearProgress, { sx: theme => ({
|
|
96
|
+
return (_jsx(FlexPort, { id: "hitscrollbar", children: _jsx(PageCenter, { textAlign: "left", mt: 0, mb: 6, ml: 0, mr: 0, maxWidth: "1500px", children: _jsxs(VSBox, { top: 0, children: [_jsx(Stack, { ml: -1, mr: -1, sx: { '& .overflowingContentWidgets > *': { zIndex: '2000 !important' } }, spacing: 1, children: _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { sx: { color: 'text.secondary', fontSize: '0.9em', fontStyle: 'italic', mb: 0.5 }, variant: "body2", children: t('hit.search.prompt') }), error && (_jsx(Tooltip, { title: `${t('route.advanced.error')}: ${error}`, children: _jsx(ErrorOutline, { fontSize: "small", color: "error" }) })), _jsx(FlexOne, {}), _jsx(Tooltip, { title: t('route.views.save'), children: _jsx(IconButton, { component: Link, disabled: !query, to: `/views/create?query=${query}`, children: _jsx(SavedSearch, {}) }) }), _jsx(Tooltip, { title: t('route.actions.save'), children: _jsx(IconButton, { component: Link, disabled: !query, to: `/action/execute?query=${query}`, children: _jsx(Terminal, {}) }) }), _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(VSBoxHeader, { ml: -3, mr: -3, px: 2, pb: 1, sx: { zIndex: 989 }, children: [_jsxs(Stack, { sx: { pt: 1 }, children: [_jsxs(Stack, { sx: { position: 'relative', flex: 1 }, children: [_jsx(HitQuery, { searching: searching, triggerSearch: triggerSearch }), searching && (_jsx(LinearProgress, { sx: theme => ({
|
|
122
97
|
position: 'absolute',
|
|
123
98
|
left: 0,
|
|
124
99
|
right: 0,
|
|
@@ -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, {
|
|
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 },
|
|
@@ -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,
|
|
16
|
+
], children: values.map((value, index) => (_jsx(PluginTypography, { context: "table", sx: { fontSize: 'inherit', textOverflow: 'ellipsis' }, value: value, field: field, obj: hit, children: value }, value + index))) }) }));
|
|
17
17
|
};
|
|
18
18
|
export default memo(EnhancedCell);
|
|
@@ -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.filter.hit', value: 'hit' },
|
|
11
|
+
{ label: 'hit.search.filter.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);
|
|
@@ -7,13 +7,11 @@ import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers'
|
|
|
7
7
|
import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
|
|
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
14
|
import HitComments from '@cccsaurora/howler-ui/components/elements/hit/HitComments';
|
|
16
|
-
import HitDetails from '@cccsaurora/howler-ui/components/elements/hit/HitDetails';
|
|
17
15
|
import HitLabels from '@cccsaurora/howler-ui/components/elements/hit/HitLabels';
|
|
18
16
|
import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
|
|
19
17
|
import HitLinks from '@cccsaurora/howler-ui/components/elements/hit/HitLinks';
|
|
@@ -21,6 +19,7 @@ import HitOutline from '@cccsaurora/howler-ui/components/elements/hit/HitOutline
|
|
|
21
19
|
import HitOverview from '@cccsaurora/howler-ui/components/elements/hit/HitOverview';
|
|
22
20
|
import HitRelated from '@cccsaurora/howler-ui/components/elements/hit/HitRelated';
|
|
23
21
|
import HitWorklog from '@cccsaurora/howler-ui/components/elements/hit/HitWorklog';
|
|
22
|
+
import ObjectDetails from '@cccsaurora/howler-ui/components/elements/ObjectDetails';
|
|
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';
|
|
@@ -94,7 +93,7 @@ const HitViewer = () => {
|
|
|
94
93
|
}
|
|
95
94
|
return {
|
|
96
95
|
overview: () => _jsx(HitOverview, { hit: hit }),
|
|
97
|
-
details: () => _jsx(
|
|
96
|
+
details: () => _jsx(ObjectDetails, { obj: hit }),
|
|
98
97
|
hit_comments: () => _jsx(HitComments, { hit: 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 }),
|
|
@@ -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, {}) }) }))
|
|
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('hit.panel.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
|
|
@@ -150,6 +150,6 @@ const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
|
|
|
150
150
|
}
|
|
151
151
|
return selectedElement.id;
|
|
152
152
|
}, []);
|
|
153
|
-
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", 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(
|
|
153
|
+
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", 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(`/hits/${h.howler.id}`), children: _jsx(CardContent, { children: _jsx(HitBanner, { layout: HitLayout.DENSE, hit: h }) }) }, h.howler.id))) })) : (_jsx(AppListEmpty, {}))] }) }));
|
|
154
154
|
};
|
|
155
155
|
export default ViewCard;
|