@cccsaurora/howler-ui 2.18.0-dev.648 → 2.18.0-dev.674
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 +34 -7
- package/components/app/hooks/useMatchers.js +2 -2
- package/components/app/hooks/useMatchers.test.js +22 -22
- package/components/app/hooks/useTitle.js +3 -3
- package/components/app/providers/FavouritesProvider.js +2 -2
- 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/app/providers/RecordProvider.d.ts +23 -0
- package/components/app/providers/{HitProvider.js → RecordProvider.js} +41 -41
- package/components/app/providers/{HitSearchProvider.d.ts → RecordSearchProvider.d.ts} +6 -6
- package/components/app/providers/{HitSearchProvider.js → RecordSearchProvider.js} +12 -17
- package/components/app/providers/{HitSearchProvider.test.js → RecordSearchProvider.test.js} +51 -70
- package/components/elements/ContextMenu.d.ts +56 -0
- package/components/elements/ContextMenu.js +109 -0
- package/components/elements/ContextMenu.test.js +215 -0
- 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 -1
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/Modal.js +1 -0
- package/components/elements/hit/HitActions.js +4 -4
- package/components/elements/hit/HitBanner.js +28 -48
- package/components/elements/hit/HitCard.js +5 -5
- package/components/elements/hit/HitLabels.js +2 -2
- 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/HitSummary.d.ts +2 -1
- package/components/elements/hit/HitSummary.js +6 -5
- package/components/elements/hit/aggregate/HitGraph.js +8 -8
- 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 +6 -0
- package/components/elements/observable/ObservableCard.js +23 -0
- package/components/elements/observable/ObservablePreview.d.ts +6 -0
- package/components/elements/observable/ObservablePreview.js +12 -0
- package/components/elements/{hit/HitComments.d.ts → record/RecordComments.d.ts} +5 -4
- package/components/elements/{hit/HitComments.js → record/RecordComments.js} +29 -28
- package/components/{routes/hits/search/HitContextMenu.d.ts → elements/record/RecordContextMenu.d.ts} +3 -3
- package/components/elements/record/RecordContextMenu.js +235 -0
- package/components/elements/record/RecordContextMenu.test.d.ts +1 -0
- package/components/{routes/hits/search/HitContextMenu.test.js → elements/record/RecordContextMenu.test.js} +39 -39
- package/components/elements/record/RecordRelated.d.ts +7 -0
- package/components/elements/record/RecordRelated.js +34 -0
- package/components/elements/{hit/HitWorklog.d.ts → record/RecordWorklog.d.ts} +4 -3
- package/components/elements/{hit/HitWorklog.js → record/RecordWorklog.js} +15 -13
- package/components/elements/view/ViewTitle.js +1 -1
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +4 -4
- package/components/hooks/useLocalStorage.test.d.ts +1 -0
- package/components/hooks/useLocalStorage.test.js +137 -0
- 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/useParamState.d.ts +6 -0
- package/components/hooks/useParamState.js +48 -0
- package/components/hooks/useParamState.test.d.ts +1 -0
- package/components/hooks/useParamState.test.js +166 -0
- package/components/hooks/{useHitSelection.d.ts → useRecordSelection.d.ts} +2 -2
- package/components/hooks/{useHitSelection.js → useRecordSelection.js} +12 -33
- package/components/hooks/useRelatedRecords.d.ts +13 -0
- package/components/hooks/useRelatedRecords.js +32 -0
- package/components/routes/action/edit/ActionEditor.js +2 -2
- package/components/routes/action/view/ActionSearch.js +1 -1
- package/components/routes/advanced/QueryBuilder.js +1 -1
- package/components/routes/advanced/QueryEditor.js +3 -3
- package/components/routes/advanced/historyCompletionProvider.js +3 -3
- 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 +22 -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 +33 -0
- package/components/routes/cases/detail/CaseAssets.d.ts +12 -0
- package/components/routes/cases/detail/CaseAssets.js +101 -0
- package/components/routes/cases/detail/CaseAssets.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseAssets.test.js +163 -0
- package/components/routes/cases/detail/CaseDashboard.d.ts +7 -0
- package/components/routes/cases/detail/CaseDashboard.js +51 -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 +61 -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 +99 -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/assets/Asset.d.ts +14 -0
- package/components/routes/cases/detail/assets/Asset.js +12 -0
- package/components/routes/cases/detail/assets/Asset.test.d.ts +1 -0
- package/components/routes/cases/detail/assets/Asset.test.js +72 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +13 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.js +131 -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/dossiers/DossierEditor.js +2 -2
- package/components/routes/dossiers/DossierEditor.test.js +1 -1
- package/components/routes/help/ApiDocumentation.js +1 -1
- package/components/routes/help/HitBannerDocumentation.js +1 -0
- package/components/routes/help/HitDocumentation.js +1 -3
- package/components/routes/hits/search/InformationPane.d.ts +1 -0
- package/components/routes/hits/search/InformationPane.js +47 -60
- package/components/routes/hits/search/LayoutSettings.js +3 -3
- package/components/routes/hits/search/QuerySettings.js +2 -1
- package/components/routes/hits/search/QuerySettings.test.js +14 -9
- package/components/routes/hits/search/{HitBrowser.js → RecordBrowser.js} +9 -9
- package/components/routes/hits/search/{HitQuery.d.ts → RecordQuery.d.ts} +2 -2
- package/components/routes/hits/search/{HitQuery.js → RecordQuery.js} +6 -6
- package/components/routes/hits/search/SearchPane.js +26 -49
- package/components/routes/hits/search/ViewLink.js +3 -3
- package/components/routes/hits/search/ViewLink.test.js +8 -8
- package/components/routes/hits/search/grid/AddColumnModal.js +5 -4
- package/components/routes/hits/search/grid/EnhancedCell.d.ts +2 -1
- package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
- package/components/routes/hits/search/grid/HitGrid.js +20 -18
- package/components/routes/hits/search/grid/{HitRow.d.ts → RecordRow.d.ts} +3 -2
- package/components/routes/hits/search/grid/{HitRow.js → RecordRow.js} +10 -8
- 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 +12 -13
- package/components/routes/home/ViewCard.js +4 -4
- 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/components/routes/views/ViewComposer.js +4 -4
- package/locales/en/translation.json +65 -3
- package/locales/fr/translation.json +63 -3
- 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/Hit.d.ts +1 -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 +85 -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 +43 -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 +18 -1
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/utils.d.ts +2 -1
- package/tests/utils.d.ts +2 -0
- package/tests/utils.js +8 -0
- package/utils/constants.d.ts +3 -3
- package/utils/hitFunctions.d.ts +2 -1
- package/utils/hitFunctions.js +4 -4
- package/utils/typeUtils.d.ts +7 -0
- package/utils/typeUtils.js +27 -0
- package/components/app/providers/HitProvider.d.ts +0 -22
- package/components/elements/display/icons/BundleButton.d.ts +0 -6
- package/components/elements/display/icons/BundleButton.js +0 -32
- package/components/elements/hit/HitRelated.d.ts +0 -6
- package/components/elements/hit/HitRelated.js +0 -7
- 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/hits/search/BundleScroller.d.ts +0 -2
- package/components/routes/hits/search/BundleScroller.js +0 -6
- package/components/routes/hits/search/HitContextMenu.js +0 -227
- /package/components/app/providers/{HitSearchProvider.test.d.ts → RecordSearchProvider.test.d.ts} +0 -0
- /package/components/{routes/hits/search/HitContextMenu.test.d.ts → elements/ContextMenu.test.d.ts} +0 -0
- /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
- /package/components/routes/hits/search/{HitBrowser.d.ts → RecordBrowser.d.ts} +0 -0
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { AddCircleOutline, Assignment, Edit, HowToVote, KeyboardArrowRight, OpenInNew, QueryStats, RemoveCircleOutline, SettingsSuggest, Terminal } from '@mui/icons-material';
|
|
3
|
-
import { Box, Divider, Fade, ListItemIcon, ListItemText, Menu, MenuItem, MenuList, Paper } from '@mui/material';
|
|
4
|
-
import api from '@cccsaurora/howler-ui/api';
|
|
5
|
-
import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
|
|
6
|
-
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
7
|
-
import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
|
|
8
|
-
import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
|
|
9
|
-
import { TOP_ROW, VOTE_OPTIONS } from '@cccsaurora/howler-ui/components/elements/hit/actions/SharedComponents';
|
|
10
|
-
import useHitActions from '@cccsaurora/howler-ui/components/hooks/useHitActions';
|
|
11
|
-
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
12
|
-
import useMyActionFunctions from '@cccsaurora/howler-ui/components/routes/action/useMyActionFunctions';
|
|
13
|
-
import { capitalize, get, groupBy, isEmpty, toString } from 'lodash-es';
|
|
14
|
-
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
15
|
-
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
16
|
-
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { usePluginStore } from 'react-pluggable';
|
|
18
|
-
import { Link } from 'react-router-dom';
|
|
19
|
-
import { useContextSelector } from 'use-context-selector';
|
|
20
|
-
import { DEFAULT_QUERY } from '@cccsaurora/howler-ui/utils/constants';
|
|
21
|
-
import { sanitizeLuceneQuery } from '@cccsaurora/howler-ui/utils/stringUtils';
|
|
22
|
-
/**
|
|
23
|
-
* Order in which action types should be displayed in the context menu
|
|
24
|
-
*/
|
|
25
|
-
const ORDER = ['assessment', 'vote', 'action'];
|
|
26
|
-
/**
|
|
27
|
-
* The margin at the bottom of the screen by which the context menu should be inverted.
|
|
28
|
-
* That is, if right clicking within this many pixels of the bottom, render the context menu to the top right
|
|
29
|
-
* of the pointer instead of the bottom right.
|
|
30
|
-
*/
|
|
31
|
-
const CONTEXTMENU_MARGIN = 350;
|
|
32
|
-
/**
|
|
33
|
-
* Icon mapping for different action types
|
|
34
|
-
*/
|
|
35
|
-
const ICON_MAP = {
|
|
36
|
-
assessment: _jsx(Assignment, {}),
|
|
37
|
-
vote: _jsx(HowToVote, {}),
|
|
38
|
-
action: _jsx(Edit, {})
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Context menu component for hit operations.
|
|
42
|
-
* Provides quick access to common hit actions including assessment, voting,
|
|
43
|
-
* transitions, and exclusion filters based on template fields.
|
|
44
|
-
*/
|
|
45
|
-
const HitContextMenu = ({ children, getSelectedId, Component = Box }) => {
|
|
46
|
-
const { t } = useTranslation();
|
|
47
|
-
const { dispatchApi } = useMyApi();
|
|
48
|
-
const { executeAction } = useMyActionFunctions();
|
|
49
|
-
const { config } = useContext(ApiConfigContext);
|
|
50
|
-
const pluginStore = usePluginStore();
|
|
51
|
-
const { getMatchingAnalytic, getMatchingTemplate } = useMatchers();
|
|
52
|
-
const query = useContextSelector(ParameterContext, ctx => ctx?.query);
|
|
53
|
-
const setQuery = useContextSelector(ParameterContext, ctx => ctx?.setQuery);
|
|
54
|
-
const [id, setId] = useState(null);
|
|
55
|
-
const hit = useContextSelector(HitContext, ctx => ctx.hits[id]);
|
|
56
|
-
const selectedHits = useContextSelector(HitContext, ctx => ctx.selectedHits);
|
|
57
|
-
const [analytic, setAnalytic] = useState(null);
|
|
58
|
-
const [template, setTemplate] = useState(null);
|
|
59
|
-
const [anchorEl, setAnchorEl] = useState();
|
|
60
|
-
const [transformProps, setTransformProps] = useState({});
|
|
61
|
-
const [actions, setActions] = useState([]);
|
|
62
|
-
const [show, setShow] = useState({});
|
|
63
|
-
const hits = useMemo(() => (selectedHits.some(_hit => _hit.howler.id === hit?.howler.id) ? selectedHits : [hit]), [hit, selectedHits]);
|
|
64
|
-
const { availableTransitions, canVote, canAssess, assess, vote } = useHitActions(hits);
|
|
65
|
-
/**
|
|
66
|
-
* Handles right-click context menu events.
|
|
67
|
-
* Opens the context menu at the click location and loads available actions.
|
|
68
|
-
*/
|
|
69
|
-
const onContextMenu = useCallback(async (event) => {
|
|
70
|
-
if (anchorEl) {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
setAnchorEl(null);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
const _id = getSelectedId(event);
|
|
77
|
-
setId(_id);
|
|
78
|
-
if (window.innerHeight - event.clientY < 300) {
|
|
79
|
-
setTransformProps({
|
|
80
|
-
position: 'fixed',
|
|
81
|
-
bottom: `${window.innerHeight - event.clientY}px !important`,
|
|
82
|
-
top: 'unset !important',
|
|
83
|
-
left: `${event.clientX}px !important`
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
setTransformProps({
|
|
88
|
-
position: 'fixed',
|
|
89
|
-
top: `${event.clientY}px !important`,
|
|
90
|
-
left: `${event.clientX}px !important`
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
setAnchorEl(event.target);
|
|
94
|
-
const _actions = (await dispatchApi(api.search.action.post({ query: 'action_id:*' }), { throwError: false }))
|
|
95
|
-
?.items;
|
|
96
|
-
if (_actions) {
|
|
97
|
-
setActions(_actions);
|
|
98
|
-
}
|
|
99
|
-
}, [anchorEl, dispatchApi, getSelectedId]);
|
|
100
|
-
const rowStatus = useMemo(() => ({
|
|
101
|
-
assessment: canAssess,
|
|
102
|
-
vote: canVote
|
|
103
|
-
}), [canAssess, canVote]);
|
|
104
|
-
const pluginActions = howlerPluginStore.plugins.flatMap(plugin => pluginStore.executeFunction(`${plugin}.actions`, hits));
|
|
105
|
-
/**
|
|
106
|
-
* Generates grouped action entries for the context menu.
|
|
107
|
-
* Combines transitions, plugin actions, votes, and assessments based on permissions.
|
|
108
|
-
*/
|
|
109
|
-
const entries = useMemo(() => {
|
|
110
|
-
let _actions = [...availableTransitions, ...pluginActions];
|
|
111
|
-
if (canVote) {
|
|
112
|
-
_actions = [
|
|
113
|
-
..._actions,
|
|
114
|
-
...VOTE_OPTIONS.map(option => ({ ...option, actionFunction: () => vote(option.name.toLowerCase()) }))
|
|
115
|
-
];
|
|
116
|
-
}
|
|
117
|
-
if (config.lookups?.['howler.assessment'] && canAssess) {
|
|
118
|
-
_actions = [
|
|
119
|
-
..._actions,
|
|
120
|
-
...config.lookups['howler.assessment']
|
|
121
|
-
.filter(_assessment => analytic?.triage_settings?.valid_assessments
|
|
122
|
-
? analytic.triage_settings?.valid_assessments.includes(_assessment)
|
|
123
|
-
: true)
|
|
124
|
-
.sort((a, b) => +TOP_ROW.includes(b) - +TOP_ROW.includes(a))
|
|
125
|
-
.map(assessment => ({
|
|
126
|
-
type: 'assessment',
|
|
127
|
-
name: assessment,
|
|
128
|
-
actionFunction: async () => {
|
|
129
|
-
await assess(assessment, analytic?.triage_settings?.skip_rationale);
|
|
130
|
-
}
|
|
131
|
-
}))
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
return Object.entries(groupBy(_actions, 'type')).sort(([a], [b]) => ORDER.indexOf(a) - ORDER.indexOf(b));
|
|
135
|
-
}, [analytic, assess, availableTransitions, canAssess, canVote, config.lookups, vote, pluginActions]);
|
|
136
|
-
/**
|
|
137
|
-
* Calculates appropriate styles for submenu positioning.
|
|
138
|
-
* Adjusts position based on available screen space to prevent overflow.
|
|
139
|
-
*/
|
|
140
|
-
const calculateSubMenuStyles = useCallback((parent) => {
|
|
141
|
-
const baseStyles = { position: 'absolute', maxHeight: '300px', overflow: 'auto' };
|
|
142
|
-
const defaultStyles = { ...baseStyles, top: 0, left: '100%' };
|
|
143
|
-
if (!parent) {
|
|
144
|
-
return defaultStyles;
|
|
145
|
-
}
|
|
146
|
-
const parentBounds = parent.getBoundingClientRect();
|
|
147
|
-
if (window.innerHeight - parentBounds.y < CONTEXTMENU_MARGIN) {
|
|
148
|
-
return { ...baseStyles, bottom: 0, left: '100%' };
|
|
149
|
-
}
|
|
150
|
-
return defaultStyles;
|
|
151
|
-
}, []);
|
|
152
|
-
// Load analytic and template data when a hit is selected
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
if (!hit?.howler.analytic) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
getMatchingAnalytic(hit).then(setAnalytic);
|
|
158
|
-
getMatchingTemplate(hit).then(setTemplate);
|
|
159
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
|
-
}, [hit]);
|
|
161
|
-
// Reset menu state when context menu is closed
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
if (!anchorEl) {
|
|
164
|
-
setShow({});
|
|
165
|
-
setAnalytic(null);
|
|
166
|
-
}
|
|
167
|
-
}, [anchorEl]);
|
|
168
|
-
return (_jsxs(Component, { id: "contextMenu", onContextMenu: onContextMenu, children: [children, _jsxs(Menu, { id: "hit-menu", open: !!anchorEl, anchorEl: anchorEl, onClose: () => setAnchorEl(null), slotProps: {
|
|
169
|
-
paper: {
|
|
170
|
-
sx: {
|
|
171
|
-
...transformProps,
|
|
172
|
-
overflow: 'visible !important'
|
|
173
|
-
}
|
|
174
|
-
}
|
|
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: 8, 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: 8, 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: 8, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: template?.keys.map(key => {
|
|
176
|
-
// Build exclusion query based on current query and field value
|
|
177
|
-
let newQuery = '';
|
|
178
|
-
if (query !== DEFAULT_QUERY) {
|
|
179
|
-
newQuery = `(${query}) AND `;
|
|
180
|
-
}
|
|
181
|
-
const value = get(hit, key);
|
|
182
|
-
if (!value) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
else if (Array.isArray(value)) {
|
|
186
|
-
// Handle array values by excluding all items
|
|
187
|
-
const sanitizedValues = value
|
|
188
|
-
.map(toString)
|
|
189
|
-
.filter(val => !!val)
|
|
190
|
-
.map(val => `"${sanitizeLuceneQuery(val)}"`);
|
|
191
|
-
if (sanitizedValues.length < 1) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
newQuery += `-${key}:(${sanitizedValues.join(' OR ')})`;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
// Handle single value
|
|
198
|
-
newQuery += `-${key}:"${sanitizeLuceneQuery(value.toString())}"`;
|
|
199
|
-
}
|
|
200
|
-
return (_jsx(MenuItem, { onClick: () => setQuery(newQuery), children: _jsx(ListItemText, { children: key }) }, key));
|
|
201
|
-
}) }) }) })] }), _jsxs(MenuItem, { id: "includes-menu-item", sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, includes: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, includes: null })), children: [_jsx(ListItemIcon, { children: _jsx(AddCircleOutline, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t('hit.panel.include') }), _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show.includes, unmountOnExit: true, children: _jsx(Paper, { id: "includes-submenu", sx: calculateSubMenuStyles(show.includes), elevation: 8, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: template?.keys.map(key => {
|
|
202
|
-
// Build inclusion query based on current query and field
|
|
203
|
-
// If default, we include default query
|
|
204
|
-
let newQuery = `(${query}) AND `;
|
|
205
|
-
const value = get(hit, key);
|
|
206
|
-
if (!value) {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
else if (Array.isArray(value)) {
|
|
210
|
-
// Handle array values by including all items
|
|
211
|
-
const sanitizedValues = value
|
|
212
|
-
.map(toString)
|
|
213
|
-
.filter(val => !!val)
|
|
214
|
-
.map(val => `"${sanitizeLuceneQuery(val)}"`);
|
|
215
|
-
if (sanitizedValues.length < 1) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
newQuery += `${key}:(${sanitizedValues.join(' OR ')})`;
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
// Handle single value
|
|
222
|
-
newQuery += `${key}:"${sanitizeLuceneQuery(value.toString())}"`;
|
|
223
|
-
}
|
|
224
|
-
return (_jsx(MenuItem, { onClick: () => setQuery(newQuery), children: _jsx(ListItemText, { children: key }) }, key));
|
|
225
|
-
}) }) }) })] })] }))] })] }));
|
|
226
|
-
};
|
|
227
|
-
export default HitContextMenu;
|
/package/components/app/providers/{HitSearchProvider.test.d.ts → RecordSearchProvider.test.d.ts}
RENAMED
|
File without changes
|
/package/components/{routes/hits/search/HitContextMenu.test.d.ts → elements/ContextMenu.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|