@cccsaurora/howler-ui 2.17.0-dev.525 → 2.17.0-dev.533
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 +0 -2
- package/api/index.js +2 -4
- package/api/search/index.d.ts +1 -2
- package/api/search/index.js +1 -2
- package/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/components/app/App.js +0 -14
- package/components/app/providers/FavouritesProvider.js +2 -2
- package/components/elements/PluginTypography.d.ts +1 -2
- package/components/elements/PluginTypography.js +2 -3
- package/components/elements/UserList.d.ts +2 -5
- package/components/elements/UserList.js +5 -14
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/Modal.js +0 -1
- package/components/elements/display/icons/BundleButton.d.ts +6 -0
- package/components/elements/display/icons/BundleButton.js +32 -0
- package/components/elements/hit/HitBanner.js +48 -27
- package/components/elements/{ObjectDetails.d.ts → hit/HitDetails.d.ts} +1 -2
- package/components/elements/{ObjectDetails.js → hit/HitDetails.js} +17 -17
- package/components/elements/hit/outlines/DefaultOutline.js +1 -1
- 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 +35 -1
- package/components/hooks/useMyPreferences.js +1 -10
- package/components/hooks/useMySitemap.js +1 -4
- package/components/hooks/useMyTheme.js +2 -9
- package/components/routes/action/view/ActionSearch.js +1 -1
- package/components/routes/action/view/Integrations.js +9 -1
- package/components/routes/action/view/markdown/integrations.en.md.js +1 -0
- package/components/routes/action/view/markdown/integrations.fr.md.js +1 -0
- 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/help/ApiDocumentation.js +1 -1
- package/components/routes/help/BundleDocumentation.d.ts +3 -0
- package/components/routes/help/BundleDocumentation.js +12 -0
- package/components/routes/help/HitDocumentation.js +3 -1
- package/components/routes/help/markdown/en/bundles.md.js +1 -0
- package/components/routes/help/markdown/fr/bundles.md.js +1 -0
- package/components/routes/hits/search/BundleParentMenu.d.ts +6 -0
- package/components/routes/hits/search/BundleParentMenu.js +32 -0
- package/components/routes/hits/search/HitContextMenu.js +27 -4
- package/components/routes/hits/search/HitContextMenu.test.js +140 -0
- package/components/routes/hits/search/InformationPane.d.ts +0 -1
- package/components/routes/hits/search/InformationPane.js +28 -6
- package/components/routes/hits/search/SearchPane.js +5 -3
- package/components/routes/hits/search/ViewLink.js +1 -1
- package/components/routes/hits/search/grid/EnhancedCell.js +1 -1
- package/components/routes/hits/view/HitViewer.js +4 -3
- package/components/routes/home/ViewCard.js +1 -1
- package/components/{elements/MarkdownEditor.js → routes/overviews/OverviewEditor.js} +3 -3
- package/components/routes/overviews/OverviewViewer.js +2 -2
- package/locales/en/translation.json +396 -423
- package/locales/fr/translation.json +421 -445
- package/models/entities/generated/{ThreatEnrichment.d.ts → Enrichment.d.ts} +1 -1
- package/models/entities/generated/Howler.d.ts +4 -0
- package/models/entities/generated/Rule.d.ts +10 -2
- package/models/entities/generated/Threat.d.ts +2 -2
- package/package.json +4 -16
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/utils.d.ts +1 -2
- package/utils/constants.d.ts +3 -3
- package/api/search/case.d.ts +0 -4
- package/api/search/case.js +0 -8
- package/api/v2/case/index.d.ts +0 -6
- package/api/v2/case/index.js +0 -18
- package/api/v2/index.d.ts +0 -4
- package/api/v2/index.js +0 -6
- package/api/v2/search/facet.d.ts +0 -3
- package/api/v2/search/facet.js +0 -12
- package/api/v2/search/index.d.ts +0 -6
- package/api/v2/search/index.js +0 -18
- package/components/elements/hit/elements/AnalyticLink.d.ts +0 -8
- package/components/elements/hit/elements/AnalyticLink.js +0 -22
- package/components/routes/cases/CaseCard.d.ts +0 -8
- package/components/routes/cases/CaseCard.js +0 -34
- package/components/routes/cases/CaseViewer.d.ts +0 -2
- package/components/routes/cases/CaseViewer.js +0 -24
- package/components/routes/cases/Cases.d.ts +0 -2
- package/components/routes/cases/Cases.js +0 -101
- package/components/routes/cases/constants.d.ts +0 -5
- package/components/routes/cases/constants.js +0 -5
- package/components/routes/cases/detail/AlertPanel.d.ts +0 -6
- package/components/routes/cases/detail/AlertPanel.js +0 -32
- package/components/routes/cases/detail/CaseDashboard.d.ts +0 -7
- package/components/routes/cases/detail/CaseDashboard.js +0 -49
- package/components/routes/cases/detail/CaseDetails.d.ts +0 -6
- package/components/routes/cases/detail/CaseDetails.js +0 -61
- package/components/routes/cases/detail/CaseOverview.d.ts +0 -7
- package/components/routes/cases/detail/CaseOverview.js +0 -43
- package/components/routes/cases/detail/CaseSidebar.d.ts +0 -6
- package/components/routes/cases/detail/CaseSidebar.js +0 -36
- package/components/routes/cases/detail/CaseTask.d.ts +0 -11
- package/components/routes/cases/detail/CaseTask.js +0 -57
- package/components/routes/cases/detail/ItemPage.d.ts +0 -6
- package/components/routes/cases/detail/ItemPage.js +0 -93
- package/components/routes/cases/detail/RelatedCasePanel.d.ts +0 -6
- package/components/routes/cases/detail/RelatedCasePanel.js +0 -31
- package/components/routes/cases/detail/TaskPanel.d.ts +0 -7
- package/components/routes/cases/detail/TaskPanel.js +0 -52
- package/components/routes/cases/detail/Untitled-1.md.js +0 -1
- package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +0 -12
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +0 -19
- package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +0 -6
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +0 -27
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +0 -12
- package/components/routes/cases/detail/sidebar/CaseFolder.js +0 -179
- package/components/routes/cases/detail/sidebar/types.d.ts +0 -3
- package/components/routes/cases/hooks/useCase.d.ts +0 -13
- package/components/routes/cases/hooks/useCase.js +0 -38
- package/components/routes/cases/modals/ResolveModal.d.ts +0 -7
- package/components/routes/cases/modals/ResolveModal.js +0 -56
- package/components/routes/observables/ObservableViewer.d.ts +0 -7
- package/components/routes/observables/ObservableViewer.js +0 -27
- package/models/entities/generated/AttachmentsFile.d.ts +0 -12
- package/models/entities/generated/Case.d.ts +0 -28
- package/models/entities/generated/DestinationOriginal.d.ts +0 -19
- package/models/entities/generated/EmailAttachment.d.ts +0 -8
- package/models/entities/generated/EmailParent.d.ts +0 -19
- package/models/entities/generated/Enrichments.d.ts +0 -7
- package/models/entities/generated/EnrichmentsIndicator.d.ts +0 -21
- package/models/entities/generated/HttpResponse.d.ts +0 -11
- package/models/entities/generated/Item.d.ts +0 -9
- package/models/entities/generated/Observable.d.ts +0 -84
- package/models/entities/generated/ObservableCloud.d.ts +0 -20
- package/models/entities/generated/ObservableDestination.d.ts +0 -23
- package/models/entities/generated/ObservableEmail.d.ts +0 -30
- package/models/entities/generated/ObservableFile.d.ts +0 -36
- package/models/entities/generated/ObservableHowler.d.ts +0 -44
- package/models/entities/generated/ObservableHttp.d.ts +0 -11
- package/models/entities/generated/ObservableObserver.d.ts +0 -21
- package/models/entities/generated/ObservableOrganization.d.ts +0 -7
- package/models/entities/generated/ObservableProcess.d.ts +0 -34
- package/models/entities/generated/ObservableSource.d.ts +0 -23
- package/models/entities/generated/ObservableThreat.d.ts +0 -21
- package/models/entities/generated/ObservableTls.d.ts +0 -12
- package/models/entities/generated/ObserverIngress.d.ts +0 -9
- package/models/entities/generated/Task.d.ts +0 -10
- /package/components/{elements/MarkdownEditor.d.ts → routes/overviews/OverviewEditor.d.ts} +0 -0
package/api/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import * as overview from '@cccsaurora/howler-ui/api/overview';
|
|
|
10
10
|
import * as search from '@cccsaurora/howler-ui/api/search';
|
|
11
11
|
import * as template from '@cccsaurora/howler-ui/api/template';
|
|
12
12
|
import * as user from '@cccsaurora/howler-ui/api/user';
|
|
13
|
-
import * as v2 from '@cccsaurora/howler-ui/api/v2';
|
|
14
13
|
import * as view from '@cccsaurora/howler-ui/api/view';
|
|
15
14
|
/**
|
|
16
15
|
* Defining the default export exposing all children routes of '/api/v1/'.
|
|
@@ -29,7 +28,6 @@ declare const api: {
|
|
|
29
28
|
user: typeof user;
|
|
30
29
|
view: typeof view;
|
|
31
30
|
notebook: typeof notebook;
|
|
32
|
-
v2: typeof v2;
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* The specification interface of an Howler HTTP response.
|
package/api/index.js
CHANGED
|
@@ -10,7 +10,6 @@ import * as overview from '@cccsaurora/howler-ui/api/overview';
|
|
|
10
10
|
import * as search from '@cccsaurora/howler-ui/api/search';
|
|
11
11
|
import * as template from '@cccsaurora/howler-ui/api/template';
|
|
12
12
|
import * as user from '@cccsaurora/howler-ui/api/user';
|
|
13
|
-
import * as v2 from '@cccsaurora/howler-ui/api/v2';
|
|
14
13
|
import * as view from '@cccsaurora/howler-ui/api/view';
|
|
15
14
|
import AxiosClient from '@cccsaurora/howler-ui/rest/AxiosClient';
|
|
16
15
|
import urlJoin from 'url-join';
|
|
@@ -39,8 +38,7 @@ const api = {
|
|
|
39
38
|
template,
|
|
40
39
|
user,
|
|
41
40
|
view,
|
|
42
|
-
notebook
|
|
43
|
-
v2
|
|
41
|
+
notebook
|
|
44
42
|
};
|
|
45
43
|
/**
|
|
46
44
|
* The base section of the Howler API uri.
|
|
@@ -59,7 +57,7 @@ export const uri = () => {
|
|
|
59
57
|
* @returns `string` - properly formatted howler uri.
|
|
60
58
|
*/
|
|
61
59
|
const format = (_uri) => {
|
|
62
|
-
return _uri.startsWith(
|
|
60
|
+
return _uri.startsWith(uri()) ? _uri : `${uri()}/${_uri.replace(/\/$/, '')}`;
|
|
63
61
|
};
|
|
64
62
|
/**
|
|
65
63
|
* Append series of search parameters to the specified uri.
|
package/api/search/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as action from '@cccsaurora/howler-ui/api/search/action';
|
|
2
2
|
import * as analytic from '@cccsaurora/howler-ui/api/search/analytic';
|
|
3
|
-
import * as case_ from '@cccsaurora/howler-ui/api/search/case';
|
|
4
3
|
import * as count from '@cccsaurora/howler-ui/api/search/count';
|
|
5
4
|
import * as dossier from '@cccsaurora/howler-ui/api/search/dossier';
|
|
6
5
|
import * as facet from '@cccsaurora/howler-ui/api/search/facet';
|
|
@@ -61,4 +60,4 @@ export type HowlerExplainSearchResponse = {
|
|
|
61
60
|
explanation: string;
|
|
62
61
|
}[];
|
|
63
62
|
};
|
|
64
|
-
export { action, analytic,
|
|
63
|
+
export { action, analytic, count, dossier, facet, fields, grouped, histogram, hit, overview, template, user, view };
|
package/api/search/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { joinUri, uri as parentUri } from '@cccsaurora/howler-ui/api';
|
|
2
2
|
import * as action from '@cccsaurora/howler-ui/api/search/action';
|
|
3
3
|
import * as analytic from '@cccsaurora/howler-ui/api/search/analytic';
|
|
4
|
-
import * as case_ from '@cccsaurora/howler-ui/api/search/case';
|
|
5
4
|
import * as count from '@cccsaurora/howler-ui/api/search/count';
|
|
6
5
|
import * as dossier from '@cccsaurora/howler-ui/api/search/dossier';
|
|
7
6
|
import * as facet from '@cccsaurora/howler-ui/api/search/facet';
|
|
@@ -16,4 +15,4 @@ import * as view from '@cccsaurora/howler-ui/api/search/view';
|
|
|
16
15
|
export const uri = () => {
|
|
17
16
|
return joinUri(parentUri(), 'search');
|
|
18
17
|
};
|
|
19
|
-
export { action, analytic,
|
|
18
|
+
export { action, analytic, count, dossier, facet, fields, grouped, histogram, hit, overview, template, user, view };
|
|
@@ -75,7 +75,7 @@ const LeftNavDrawer = () => {
|
|
|
75
75
|
}
|
|
76
76
|
}, children: _jsx(AppName, {}) }), !isTopLayout && _jsx(Divider, {})] }));
|
|
77
77
|
const hide = (_jsx(List, { disablePadding: true, children: _jsxs(ListItemButton, { onClick: leftnav.toggle, children: [_jsx(ListItemIcon, { children: leftnav.open ? _jsx(ChevronLeftIcon, {}) : _jsx(ChevronRightIcon, {}) }), _jsx(ListItemText, { primary: t('drawer.collapse') })] }, "chevron") }));
|
|
78
|
-
return (_jsx(ClickAwayListener, { mouseEvent: "onMouseDown", touchEvent: "onTouchStart", onClickAway: onCloseDrawerIfOpen, children: _jsxs(StyledDrawer, { variant: "permanent", style: { height: '100%' }, width: preferences.leftnav.width, open: leftnav.open, children: [leftnav.open ? (header) : (_jsx(Tooltip, { title: preferences.appName, "aria-label": preferences.appName, placement: "right", children: header })), _jsx(List, { disablePadding: true, children: leftnav.elements.map((e, i) => {
|
|
78
|
+
return (_jsx(ClickAwayListener, { mouseEvent: "onMouseDown", touchEvent: "onTouchStart", onClickAway: onCloseDrawerIfOpen, children: _jsxs(StyledDrawer, { PaperProps: { elevation: 1 }, variant: "permanent", style: { height: '100%' }, width: preferences.leftnav.width, open: leftnav.open, children: [leftnav.open ? (header) : (_jsx(Tooltip, { title: preferences.appName, "aria-label": preferences.appName, placement: "right", children: header })), _jsx(List, { disablePadding: true, children: leftnav.elements.map((e, i) => {
|
|
79
79
|
if (e.type === 'item') {
|
|
80
80
|
const item = e.element;
|
|
81
81
|
return _jsx(LeftNavItem, { item: item, onClick: isSmDown && onCloseDrawerIfOpen }, item.id);
|
package/components/app/App.js
CHANGED
|
@@ -25,8 +25,6 @@ import UserSearchProvider from '@cccsaurora/howler-ui/components/routes/admin/us
|
|
|
25
25
|
import QueryBuilder from '@cccsaurora/howler-ui/components/routes/advanced/QueryBuilder';
|
|
26
26
|
import AnalyticDetails from '@cccsaurora/howler-ui/components/routes/analytics/AnalyticDetails';
|
|
27
27
|
import AnalyticSearch from '@cccsaurora/howler-ui/components/routes/analytics/AnalyticSearch';
|
|
28
|
-
import CaseViewer from '@cccsaurora/howler-ui/components/routes/cases/CaseViewer';
|
|
29
|
-
import Cases from '@cccsaurora/howler-ui/components/routes/cases/Cases';
|
|
30
28
|
import DossierEditor from '@cccsaurora/howler-ui/components/routes/dossiers/DossierEditor';
|
|
31
29
|
import Dossiers from '@cccsaurora/howler-ui/components/routes/dossiers/Dossiers';
|
|
32
30
|
import ActionDocumentation from '@cccsaurora/howler-ui/components/routes/help/ActionDocumentation';
|
|
@@ -187,18 +185,6 @@ const router = createBrowserRouter([
|
|
|
187
185
|
path: 'bundles/:id',
|
|
188
186
|
element: _jsx(HitBrowser, {})
|
|
189
187
|
},
|
|
190
|
-
{
|
|
191
|
-
path: 'cases',
|
|
192
|
-
element: _jsx(Cases, {})
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
path: 'cases/:id',
|
|
196
|
-
element: _jsx(CaseViewer, {})
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
path: 'cases/:id/*',
|
|
200
|
-
element: _jsx(CaseViewer, {})
|
|
201
|
-
},
|
|
202
188
|
{
|
|
203
189
|
path: 'templates',
|
|
204
190
|
element: _jsx(Templates, {})
|
|
@@ -120,11 +120,11 @@ const FavouriteProvider = ({ children }) => {
|
|
|
120
120
|
(async () => {
|
|
121
121
|
const analyticElement = processAnalyticElement();
|
|
122
122
|
if (analyticElement) {
|
|
123
|
-
newElements.splice(
|
|
123
|
+
newElements.splice(1, 0, analyticElement);
|
|
124
124
|
}
|
|
125
125
|
const viewElement = await processViewElement();
|
|
126
126
|
if (viewElement) {
|
|
127
|
-
newElements.splice(
|
|
127
|
+
newElements.splice(1, 0, viewElement);
|
|
128
128
|
}
|
|
129
129
|
leftNav.setElements(newElements);
|
|
130
130
|
})();
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { type TypographyProps } from '@mui/material';
|
|
2
2
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
3
|
-
import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
|
|
4
3
|
export type PluginTypographyProps = TypographyProps & {
|
|
5
4
|
value: string;
|
|
6
5
|
context: string;
|
|
7
6
|
field?: string;
|
|
8
|
-
|
|
7
|
+
hit?: Hit;
|
|
9
8
|
};
|
|
10
9
|
declare const _default: import("react").NamedExoticComponent<PluginTypographyProps>;
|
|
11
10
|
export default _default;
|
|
@@ -3,7 +3,7 @@ import { Typography } from '@mui/material';
|
|
|
3
3
|
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { usePluginStore } from 'react-pluggable';
|
|
6
|
-
const PluginTypography = ({ children, value, context, field,
|
|
6
|
+
const PluginTypography = ({ children, value, context, field, hit, ...props }) => {
|
|
7
7
|
const pluginStore = usePluginStore();
|
|
8
8
|
for (const plugin of howlerPluginStore.plugins) {
|
|
9
9
|
const component = pluginStore.executeFunction(`${plugin}.typography`, {
|
|
@@ -11,8 +11,7 @@ const PluginTypography = ({ children, value, context, field, obj, ...props }) =>
|
|
|
11
11
|
value,
|
|
12
12
|
context,
|
|
13
13
|
field,
|
|
14
|
-
hit
|
|
15
|
-
obj,
|
|
14
|
+
hit,
|
|
16
15
|
...props
|
|
17
16
|
});
|
|
18
17
|
if (component) {
|
|
@@ -2,11 +2,8 @@ import type { SxProps, Theme } from '@mui/material';
|
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
declare const UserList: FC<{
|
|
4
4
|
buttonSx?: SxProps<Theme>;
|
|
5
|
-
|
|
6
|
-
onChange: (
|
|
5
|
+
userId: string;
|
|
6
|
+
onChange: (userId: string) => void;
|
|
7
7
|
i18nLabel: string;
|
|
8
|
-
avatarHeight?: number;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
multiple?: boolean;
|
|
11
8
|
}>;
|
|
12
9
|
export default UserList;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Autocomplete, AvatarGroup, Box, IconButton, Popover, Stack, TextField, Typography } from '@mui/material';
|
|
2
|
+
import { Autocomplete, Box, IconButton, Popover, TextField, Typography } from '@mui/material';
|
|
4
3
|
import { UserListContext } from '@cccsaurora/howler-ui/components/app/providers/UserListProvider';
|
|
5
|
-
import { uniq } from 'lodash-es';
|
|
6
4
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
7
5
|
import { useTranslation } from 'react-i18next';
|
|
8
6
|
import HowlerAvatar from './display/HowlerAvatar';
|
|
9
|
-
const UserList = ({ buttonSx = {},
|
|
7
|
+
const UserList = ({ buttonSx = {}, userId, onChange, i18nLabel }) => {
|
|
10
8
|
const { t } = useTranslation();
|
|
11
9
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
12
10
|
const { users, searchUsers } = useContext(UserListContext);
|
|
13
|
-
const
|
|
11
|
+
const userIds = useMemo(() => Object.keys(users), [users]);
|
|
14
12
|
useEffect(() => {
|
|
15
13
|
searchUsers('uname:*');
|
|
16
14
|
}, [searchUsers]);
|
|
17
|
-
return (_jsxs(_Fragment, { children: [
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { sx: buttonSx, onClick: e => setAnchorEl(e.currentTarget), children: _jsx(HowlerAvatar, { userId: userId }) }), _jsx(Popover, { open: !!anchorEl, onClose: () => setAnchorEl(null), anchorEl: anchorEl, anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, children: _jsx(Box, { sx: { p: 2 }, children: _jsx(Autocomplete, { sx: { minWidth: '300px' }, options: userIds, renderInput: params => _jsx(TextField, { ...params, label: t(i18nLabel), size: "small" }), renderOption: (props, _userId) => {
|
|
18
16
|
const user = users[_userId];
|
|
19
17
|
return (_jsx("li", { ...props, children: _jsxs(Box, { sx: {
|
|
20
18
|
display: 'grid',
|
|
@@ -23,13 +21,6 @@ const UserList = ({ buttonSx = {}, userIds, onChange, i18nLabel, avatarHeight =
|
|
|
23
21
|
gridTemplateAreas: `"profile name"\n"profile email"`,
|
|
24
22
|
columnGap: 1.5
|
|
25
23
|
}, children: [_jsx(HowlerAvatar, { sx: { gridArea: 'profile', alignSelf: 'center', height: '32px', width: '32px' }, userId: user.username }), _jsx(Typography, { sx: { gridArea: 'name' }, variant: "body1", children: user.name }), _jsx(Typography, { sx: { gridArea: 'email' }, variant: "caption", children: user.email })] }) }));
|
|
26
|
-
}, value:
|
|
27
|
-
if (multiple) {
|
|
28
|
-
onChange(Array.isArray(options) ? options : [options]);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
onChange([Array.isArray(options) ? (options[0] ?? null) : options]);
|
|
32
|
-
}
|
|
33
|
-
} }) }) })] }));
|
|
24
|
+
}, value: userId, onChange: (__, option) => onChange(option) }) }) })] }));
|
|
34
25
|
};
|
|
35
26
|
export default UserList;
|
|
@@ -80,7 +80,7 @@ const Phrase = ({ value = '', variant = 'outlined', suggestions = [], lexer, sug
|
|
|
80
80
|
onSelectCapture: _onSelectCapture,
|
|
81
81
|
startAdornment: startAdornment && _jsx(InputAdornment, { position: "start", children: startAdornment }),
|
|
82
82
|
endAdornment: endAdornment && _jsx(InputAdornment, { position: "end", children: endAdornment })
|
|
83
|
-
} }), _jsx(Popper, { anchorEl: containerRef.current, style: { width: '100%', zIndex: 100 }, open: optionsOpen && (options.length > 0 || (debug && analysisRef.current?.tokens.length > 0)), disablePortal: true, children: _jsx(Paper, { elevation:
|
|
83
|
+
} }), _jsx(Popper, { anchorEl: containerRef.current, style: { width: '100%', zIndex: 100 }, open: optionsOpen && (options.length > 0 || (debug && analysisRef.current?.tokens.length > 0)), disablePortal: true, children: _jsx(Paper, { elevation: 2, sx: { maxHeight: 200, overflow: 'auto', borderTopRightRadius: 0, borderTopLeftRadius: 0 }, children: _jsx(MenuList, { ref: menuRef, onKeyDown: _onMenuKeyDown, sx: {
|
|
84
84
|
'&:focus': {
|
|
85
85
|
outline: 'none'
|
|
86
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Card } from '@mui/material';
|
|
3
3
|
import { memo } from 'react';
|
|
4
|
-
const HowlerCard = props => _jsx(Card, { elevation: props.variant !== 'outlined' ?
|
|
4
|
+
const HowlerCard = props => (_jsx(Card, { style: { outline: 'none' }, elevation: props.variant !== 'outlined' ? 4 : 0, ...props }));
|
|
5
5
|
export default memo(HowlerCard);
|
|
@@ -15,7 +15,6 @@ const Modal = () => {
|
|
|
15
15
|
left: '50%',
|
|
16
16
|
maxWidth: options.maxWidth || '1200px',
|
|
17
17
|
maxHeight: options.maxHeight || '400px',
|
|
18
|
-
height: '100%',
|
|
19
18
|
transform: 'translate(-50%, -50%)',
|
|
20
19
|
backgroundColor: 'background.paper',
|
|
21
20
|
borderRadius: theme.shape.borderRadius,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AccountTree } from '@mui/icons-material';
|
|
3
|
+
import { ListItemText, Menu, MenuItem, Typography } from '@mui/material';
|
|
4
|
+
import TuiIconButton from '@cccsaurora/howler-ui/components/elements/addons/buttons/CustomIconButton';
|
|
5
|
+
import { useCallback, useState } from 'react';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { useNavigate } from 'react-router-dom';
|
|
8
|
+
const BundleButton = ({ ids, disabled = false }) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const navigate = useNavigate();
|
|
11
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
12
|
+
const onClick = useCallback((event) => {
|
|
13
|
+
if (ids.length === 1) {
|
|
14
|
+
navigate(`/bundles/${ids[0]}`);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
setAnchorEl(event.currentTarget);
|
|
18
|
+
}
|
|
19
|
+
}, [ids, navigate]);
|
|
20
|
+
const handleClose = useCallback(() => setAnchorEl(null), []);
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsx(TuiIconButton, { size: "small", tooltip: t(`hit.panel.bundles.open${ids.length > 1 ? '' : '.prompt'}`), onClick: onClick, disabled: disabled, "aria-disabled": disabled, "aria-haspopup": "true", "aria-controls": anchorEl ? 'bundle-action-menu' : undefined, "aria-expanded": anchorEl ? 'true' : undefined, children: _jsx(AccountTree, {}) }), _jsx(Menu, { id: "bundle-action-menu", anchorEl: anchorEl, open: !!anchorEl, onClose: handleClose, MenuListProps: {
|
|
22
|
+
dense: true,
|
|
23
|
+
'aria-labelledby': `bundle-button`
|
|
24
|
+
}, anchorOrigin: {
|
|
25
|
+
vertical: 'bottom',
|
|
26
|
+
horizontal: 'right'
|
|
27
|
+
}, transformOrigin: {
|
|
28
|
+
vertical: 'top',
|
|
29
|
+
horizontal: 'right'
|
|
30
|
+
}, children: ids.map(id => (_jsx(MenuItem, { onClick: () => navigate(`/bundles/${id}`), children: _jsx(ListItemText, { primary: t('hit.panel.bundles.open.prompt'), secondary: _jsx(Typography, { variant: "caption", color: "text.secondary", children: id }) }) }, id))) })] }));
|
|
31
|
+
};
|
|
32
|
+
export default BundleButton;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Chip, Divider, Grid, Stack, Tooltip, Typography, avatarClasses, iconButtonClasses, useTheme } from '@mui/material';
|
|
3
|
+
import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
|
|
3
4
|
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
4
5
|
import { uniq } from 'lodash-es';
|
|
5
6
|
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
6
|
-
import { useCallback, useContext, useMemo } from 'react';
|
|
7
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
7
8
|
import { Trans, useTranslation } from 'react-i18next';
|
|
8
9
|
import { usePluginStore } from 'react-pluggable';
|
|
10
|
+
import { Link } from 'react-router-dom';
|
|
9
11
|
import { ESCALATION_COLORS, PROVIDER_COLORS } from '@cccsaurora/howler-ui/utils/constants';
|
|
10
12
|
import { stringToColor } from '@cccsaurora/howler-ui/utils/utils';
|
|
11
13
|
import PluginTypography from '../PluginTypography';
|
|
12
|
-
import AnalyticLink from './elements/AnalyticLink';
|
|
13
14
|
import Assigned from './elements/Assigned';
|
|
14
15
|
import EscalationChip from './elements/EscalationChip';
|
|
15
16
|
import HitTimestamp from './elements/HitTimestamp';
|
|
@@ -20,14 +21,18 @@ const HitBanner = ({ hit, layout = HitLayout.NORMAL, showAssigned = true }) => {
|
|
|
20
21
|
const { config } = useContext(ApiConfigContext);
|
|
21
22
|
const theme = useTheme();
|
|
22
23
|
const pluginStore = usePluginStore();
|
|
24
|
+
const { getMatchingAnalytic } = useMatchers();
|
|
25
|
+
const [analyticId, setAnalyticId] = useState();
|
|
23
26
|
const compressed = useMemo(() => layout === HitLayout.DENSE, [layout]);
|
|
24
27
|
const textVariant = useMemo(() => (layout === HitLayout.COMFY ? 'body1' : 'caption'), [layout]);
|
|
25
|
-
|
|
26
|
-
if (!hit?.
|
|
27
|
-
return
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!hit?.howler.analytic) {
|
|
30
|
+
return;
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
getMatchingAnalytic(hit).then(analytic => setAnalyticId(analytic?.analytic_id));
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}, [hit?.howler.analytic]);
|
|
35
|
+
const providerColor = useMemo(() => PROVIDER_COLORS[hit.event?.provider ?? 'unknown'] ?? stringToColor(hit.event.provider), [hit.event?.provider]);
|
|
31
36
|
const mitreId = useMemo(() => {
|
|
32
37
|
if (hit.threat?.framework?.toLowerCase().startsWith('mitre')) {
|
|
33
38
|
return;
|
|
@@ -47,23 +52,35 @@ const HitBanner = ({ hit, layout = HitLayout.NORMAL, showAssigned = true }) => {
|
|
|
47
52
|
}
|
|
48
53
|
return `/api/static/mitre/${mitreId}.svg`;
|
|
49
54
|
}, [mitreId]);
|
|
50
|
-
const leftBox = useMemo(() =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
const leftBox = useMemo(() => {
|
|
56
|
+
if (hit.howler.is_bundle) {
|
|
57
|
+
return (_jsx(Box, { sx: {
|
|
58
|
+
alignSelf: 'stretch',
|
|
59
|
+
backgroundColor: providerColor,
|
|
60
|
+
borderRadius: theme.shape.borderRadius,
|
|
61
|
+
minWidth: '15px'
|
|
62
|
+
} }));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return (_jsx(HitBannerTooltip, { hit: hit, children: _jsxs(Box, { sx: {
|
|
66
|
+
gridColumn: { xs: 'span 3', sm: 'span 1' },
|
|
67
|
+
minWidth: '90px',
|
|
68
|
+
backgroundColor: providerColor,
|
|
69
|
+
color: theme.palette.getContrastText(providerColor),
|
|
70
|
+
alignSelf: 'start',
|
|
71
|
+
borderRadius: theme.shape.borderRadius,
|
|
72
|
+
p: compressed ? 0.5 : 1,
|
|
73
|
+
pt: 2,
|
|
74
|
+
pl: 1
|
|
75
|
+
}, display: "flex", flexDirection: "column", children: [_jsx(Typography, { variant: compressed ? 'caption' : 'body1', style: { wordBreak: 'break-all' }, children: hit.organization?.name ?? _jsx(Trans, { i18nKey: "unknown" }) }), iconUrl && (_jsx(Box, { sx: {
|
|
76
|
+
width: '40px',
|
|
77
|
+
height: '40px',
|
|
78
|
+
mask: `url("${iconUrl}")`,
|
|
79
|
+
maskSize: 'cover',
|
|
80
|
+
background: theme.palette.getContrastText(providerColor)
|
|
81
|
+
} }))] }) }));
|
|
82
|
+
}
|
|
83
|
+
}, [compressed, hit, iconUrl, providerColor, theme.palette, theme.shape.borderRadius]);
|
|
67
84
|
/**
|
|
68
85
|
* The tooltips are necessary only when in the most compressed format
|
|
69
86
|
*/
|
|
@@ -71,7 +88,7 @@ const HitBanner = ({ hit, layout = HitLayout.NORMAL, showAssigned = true }) => {
|
|
|
71
88
|
const _children = (_jsxs(Stack, { direction: "row", spacing: 1, flex: 1, children: [_jsxs(Typography, { variant: textVariant, noWrap: compressed, textOverflow: compressed ? 'ellipsis' : 'wrap', ...typographyProps, sx: [
|
|
72
89
|
{ display: 'flex', flexDirection: 'row' },
|
|
73
90
|
...(Array.isArray(typographyProps?.sx) ? typographyProps?.sx : [typographyProps?.sx])
|
|
74
|
-
], children: [t(i18nKey), ":"] }), (Array.isArray(value) ? value : [value]).map(val => (_jsx(PluginTypography, { component: "span", context: "banner", variant: textVariant, noWrap: compressed, textOverflow: compressed ? 'ellipsis' : 'wrap', ...typographyProps, value: val, field: field,
|
|
91
|
+
], children: [t(i18nKey), ":"] }), (Array.isArray(value) ? value : [value]).map(val => (_jsx(PluginTypography, { component: "span", context: "banner", variant: textVariant, noWrap: compressed, textOverflow: compressed ? 'ellipsis' : 'wrap', ...typographyProps, value: val, field: field, hit: hit }, val)))] }));
|
|
75
92
|
return compressed ? (_jsx(Tooltip, { title: Array.isArray(value) ? (_jsx("div", { children: value.map(_indicator => (_jsx("p", { style: { margin: 0, padding: 0 }, children: _indicator }, _indicator))) })) : (value), children: _children })) : (_children);
|
|
76
93
|
}, [compressed, hit, t, textVariant]);
|
|
77
94
|
return (_jsxs(Box, { display: "grid", gridTemplateColumns: "minmax(0, auto) minmax(0, 1fr) minmax(0, auto)", alignItems: "stretch", sx: { width: '100%', ml: 0, overflow: 'hidden' }, children: [leftBox, _jsxs(Stack, { sx: {
|
|
@@ -81,7 +98,11 @@ const HitBanner = ({ hit, layout = HitLayout.NORMAL, showAssigned = true }) => {
|
|
|
81
98
|
}, spacing: layout !== HitLayout.COMFY ? 1 : 2, divider: _jsx(Divider, { orientation: "horizontal", sx: [
|
|
82
99
|
layout !== HitLayout.COMFY && { marginTop: '4px !important' },
|
|
83
100
|
{ mr: `${theme.spacing(-1)} !important` }
|
|
84
|
-
] }), children: [
|
|
101
|
+
] }), children: [_jsxs(Typography, { variant: compressed ? 'body1' : 'h6', fontWeight: compressed && 'bold', sx: { alignSelf: 'start', '& a': { color: 'text.primary' } }, children: [analyticId ? (_jsx(Link, { to: `/analytics/${analyticId}`, onAuxClick: e => {
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
}, onClick: e => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
}, children: hit.howler.analytic })) : (hit.howler.analytic), hit.howler.detection && ': ', hit.howler.detection] }), hit.howler?.rationale && (_jsxs(Typography, { flex: 1, variant: textVariant, color: ESCALATION_COLORS[hit.howler.escalation] + '.main', sx: { fontWeight: 'bold' }, children: [t('hit.header.rationale'), ": ", hit.howler.rationale] })), hit.howler?.outline && (_jsxs(_Fragment, { children: [_jsxs(Grid, { container: true, spacing: layout !== HitLayout.COMFY ? 1 : 2, sx: { ml: `${theme.spacing(-1)} !important` }, children: [hit.howler.outline.threat && (_jsx(Grid, { item: true, children: _jsx(Wrapper, { i18nKey: "hit.header.threat", value: hit.howler.outline.threat, field: "howler.outline.threat" }) })), hit.howler.outline.target && (_jsx(Grid, { item: true, children: _jsx(Wrapper, { i18nKey: "hit.header.target", value: hit.howler.outline.target, field: "howler.outline.target" }) }))] }), hit.howler.outline.indicators?.length > 0 && (_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsxs(Typography, { component: "span", variant: textVariant, children: [t('hit.header.indicators'), ":"] }), _jsx(Grid, { container: true, spacing: 0.5, sx: { mt: `${theme.spacing(-0.5)} !important`, ml: `${theme.spacing(0.25)} !important` }, children: uniq(hit.howler.outline.indicators).map((_indicator, index) => {
|
|
85
106
|
return (_jsx(Grid, { item: true, children: _jsxs(Stack, { direction: "row", children: [_jsx(PluginTypography, { context: "indicators", variant: textVariant, value: _indicator, children: _indicator }), index < hit.howler.outline.indicators.length - 1 && (_jsx(Typography, { variant: textVariant, children: ',' }))] }) }, _indicator));
|
|
86
107
|
}) })] })), hit.howler.outline.summary && (_jsx(Wrapper, { i18nKey: "hit.header.summary", value: hit.howler.outline.summary, paragraph: true, textOverflow: "wrap", sx: [compressed && { marginTop: `0 !important` }], field: "howler.outline.summary" }))] }))] }), _jsxs(Stack, { direction: "column", spacing: layout !== HitLayout.COMFY ? 0.5 : 1, alignSelf: "stretch", sx: [
|
|
87
108
|
{ minWidth: 0, alignItems: { sm: 'end', md: 'start' }, flex: 1, pl: 1 },
|
|
@@ -95,6 +116,6 @@ const HitBanner = ({ hit, layout = HitLayout.NORMAL, showAssigned = true }) => {
|
|
|
95
116
|
width: theme.spacing(3)
|
|
96
117
|
}
|
|
97
118
|
}
|
|
98
|
-
], children: [_jsx(HitTimestamp, { hit: hit, layout: layout }), showAssigned && _jsx(Assigned, { hit: hit, layout: layout }), _jsxs(Stack, { direction: "row", spacing: layout !== HitLayout.COMFY ? 0.5 : 1, children: [_jsx(EscalationChip, { hit: hit, layout: layout }), ['in-progress', 'on-hold'].includes(hit.howler.status) && (_jsx(Chip, { sx: { width: 'fit-content', display: 'inline-flex' }, label: hit.howler.status, size: layout !== HitLayout.COMFY ? 'small' : 'medium', color: "primary" }))
|
|
119
|
+
], children: [_jsx(HitTimestamp, { hit: hit, layout: layout }), showAssigned && _jsx(Assigned, { hit: hit, layout: layout }), _jsxs(Stack, { direction: "row", spacing: layout !== HitLayout.COMFY ? 0.5 : 1, children: [_jsx(EscalationChip, { hit: hit, layout: layout }), ['in-progress', 'on-hold'].includes(hit.howler.status) && (_jsx(Chip, { sx: { width: 'fit-content', display: 'inline-flex' }, label: hit.howler.status, size: layout !== HitLayout.COMFY ? 'small' : 'medium', color: "primary" })), hit.howler.is_bundle && (_jsx(Chip, { size: layout !== HitLayout.COMFY ? 'small' : 'medium', label: t('hit.header.bundlesize', { hits: hit.howler.hits.length }) }))] }), howlerPluginStore.plugins.flatMap(plugin => pluginStore.executeFunction(`${plugin}.status`, { hit, layout }))] })] }));
|
|
99
120
|
};
|
|
100
121
|
export default HitBanner;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
2
|
-
import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
|
|
3
2
|
declare const _default: import("react").NamedExoticComponent<{
|
|
4
|
-
|
|
3
|
+
hit: Hit;
|
|
5
4
|
}>;
|
|
6
5
|
export default _default;
|
|
@@ -5,12 +5,12 @@ import { ArrowDropDown, InfoOutlined } from '@mui/icons-material';
|
|
|
5
5
|
import { Accordion, AccordionDetails, AccordionSummary, Box, Divider, Grid, Stack, TextField, Tooltip, Typography, useTheme } from '@mui/material';
|
|
6
6
|
import { flatten } from 'flat';
|
|
7
7
|
import Fuse from 'fuse.js';
|
|
8
|
-
import { capitalize, groupBy, isArray,
|
|
8
|
+
import { capitalize, groupBy, isArray, isEmpty, isNull, isObject, isPlainObject, isUndefined, max, sortBy, uniq } from 'lodash-es';
|
|
9
9
|
import { memo, useEffect, useMemo, useState } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import Throttler from '@cccsaurora/howler-ui/utils/Throttler';
|
|
12
|
-
import PluginTypography from '
|
|
13
|
-
const ListRenderer = memo(({
|
|
12
|
+
import PluginTypography from '../PluginTypography';
|
|
13
|
+
const ListRenderer = memo(({ hit, objKey: key, entries, maxKeyLength }) => {
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const allPrimitives = useMemo(() => entries.every(entry => !isObject(entry)), [entries]);
|
|
@@ -36,15 +36,15 @@ const ListRenderer = memo(({ obj, objKey: key, entries, maxKeyLength }) => {
|
|
|
36
36
|
marginBottom: allPrimitives ? 0 : theme.spacing(1)
|
|
37
37
|
}, children: allPrimitives ? key.padStart(maxKeyLength ?? key.length) : key }) }), _jsxs(Grid, { container: true, spacing: allPrimitives ? 1 : 4, ml: allPrimitives ? -1 : -4, overflow: "hidden", maxWidth: "100%", children: [uniqueEntries.map((entry, index) => {
|
|
38
38
|
if (Array.isArray(entry)) {
|
|
39
|
-
return (_jsx(Grid, { item: true, xs: "auto", maxWidth: "100%", children: _jsx(ListRenderer, {
|
|
39
|
+
return (_jsx(Grid, { item: true, xs: "auto", maxWidth: "100%", children: _jsx(ListRenderer, { hit: hit, objKey: `${key}.${index}`, entries: entry }) }, index));
|
|
40
40
|
}
|
|
41
41
|
if (isPlainObject(entry)) {
|
|
42
42
|
return (_jsx(Grid, { item: true, xs: 'auto', maxWidth: "100%", minWidth: "350px", children: _jsx(ObjectRenderer, { parentKey: `${key}.${index}`, indent: true, data: entry }) }, index));
|
|
43
43
|
}
|
|
44
|
-
return (_jsxs(Grid, { item: true, maxWidth: "100%", className: `${key}_${index}`.replace(/\./g, '_'), component: "code", display: "flex", flexDirection: "row", children: [_jsx(PluginTypography, { context: "details", component: "code", style: { maxWidth: '100%', font: 'inherit' }, value: entry, field: key.replace(/\.[0-9]+/g, ''),
|
|
44
|
+
return (_jsxs(Grid, { item: true, maxWidth: "100%", className: `${key}_${index}`.replace(/\./g, '_'), component: "code", display: "flex", flexDirection: "row", children: [_jsx(PluginTypography, { context: "details", component: "code", style: { maxWidth: '100%', font: 'inherit' }, value: entry, field: key.replace(/\.[0-9]+/g, ''), hit: hit, children: entry }), allPrimitives && index < uniqueEntries.length - 1 && _jsx("span", { children: "," })] }, entry));
|
|
45
45
|
}), omittedDuplicates && (_jsx(Grid, { item: true, display: "flex", alignItems: "center", children: _jsx(Tooltip, { title: t('duplicates.omitted'), children: _jsx(InfoOutlined, { sx: { fontSize: '20px', ml: 1 }, color: "disabled" }) }) }))] })] }));
|
|
46
46
|
});
|
|
47
|
-
const ObjectRenderer = memo(({
|
|
47
|
+
const ObjectRenderer = memo(({ hit, data, parentKey, indent = false }) => {
|
|
48
48
|
const theme = useTheme();
|
|
49
49
|
const entries = useMemo(() => {
|
|
50
50
|
const unsorted = Object.entries(flatten(data, { safe: true })).map(([key, val]) => [key, val]);
|
|
@@ -56,10 +56,10 @@ const ObjectRenderer = memo(({ obj: obj, data, parentKey, indent = false }) => {
|
|
|
56
56
|
}, [data]);
|
|
57
57
|
const longestKey = useMemo(() => max(entries.map(([key]) => key.length)), [entries]);
|
|
58
58
|
return (_jsxs(Stack, { direction: "row", overflow: "hidden", maxWidth: "100%", children: [indent && _jsx(Divider, { orientation: "vertical", flexItem: true, sx: { borderColor: 'primary.main', borderWidth: '2px' } }), _jsx(Stack, { flex: 1, ml: 1, maxWidth: "100%", children: entries
|
|
59
|
-
.filter(([__, val]) => !isNull(val) && !isUndefined(val) && !isEmpty(val)
|
|
59
|
+
.filter(([__, val]) => !isNull(val) && !isUndefined(val) && !isEmpty(val))
|
|
60
60
|
.map(([key, val]) => {
|
|
61
61
|
if (Array.isArray(val)) {
|
|
62
|
-
return _jsx(ListRenderer, {
|
|
62
|
+
return _jsx(ListRenderer, { hit: hit, maxKeyLength: longestKey, objKey: key, entries: val }, key);
|
|
63
63
|
}
|
|
64
64
|
return (_jsxs("code", { className: (parentKey ? `${parentKey}.${key}` : key).replace(/\./g, '_'), style: {
|
|
65
65
|
display: 'grid',
|
|
@@ -75,14 +75,14 @@ const ObjectRenderer = memo(({ obj: obj, data, parentKey, indent = false }) => {
|
|
|
75
75
|
paddingRight: theme.spacing(1),
|
|
76
76
|
height: '100%',
|
|
77
77
|
wordWrap: 'break-word'
|
|
78
|
-
}, children: _jsx("code", { style: { maxWidth: '100%' }, children: key }) }), _jsx(Box, { display: "flex", alignItems: "start", children: _jsx(PluginTypography, { context: "details", component: "code", style: { maxWidth: '100%', font: 'inherit' }, value: val, field: (parentKey ? parentKey.concat('.', key) : key).replace(/\.[0-9]+/g, ''),
|
|
78
|
+
}, children: _jsx("code", { style: { maxWidth: '100%' }, children: key }) }), _jsx(Box, { display: "flex", alignItems: "start", children: _jsx(PluginTypography, { context: "details", component: "code", style: { maxWidth: '100%', font: 'inherit' }, value: val, field: (parentKey ? parentKey.concat('.', key) : key).replace(/\.[0-9]+/g, ''), hit: hit, children: val }) })] }, key));
|
|
79
79
|
}) })] }));
|
|
80
80
|
});
|
|
81
|
-
const Collapsible = memo(({
|
|
81
|
+
const Collapsible = memo(({ hit, title, data, query }) => {
|
|
82
82
|
const throttler = useMemo(() => new Throttler(400), []);
|
|
83
83
|
const [scores, setScores] = useState([]);
|
|
84
84
|
const [results, setResults] = useState({});
|
|
85
|
-
const options = useMemo(() => Object.entries(data).map(([key, value]) => ({ key, value
|
|
85
|
+
const options = useMemo(() => Object.entries(data).map(([key, value]) => ({ key, value })), [data]);
|
|
86
86
|
const keys = useMemo(() => options
|
|
87
87
|
.flatMap(option => (isArray(option.value) ? Object.keys(flatten(option.value)) : []))
|
|
88
88
|
.map(key => key.replace(/\d+/g, 'value'))
|
|
@@ -109,20 +109,20 @@ const Collapsible = memo(({ obj, title, data, query }) => {
|
|
|
109
109
|
if (isEmpty(results)) {
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
|
-
return (_jsxs(Accordion, { defaultExpanded: true, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ArrowDropDown, {}),
|
|
112
|
+
return (_jsxs(Accordion, { defaultExpanded: true, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ArrowDropDown, {}), children: _jsx(Typography, { children: title }) }), _jsx(AccordionDetails, { children: _jsx(Stack, { spacing: 1, justifyContent: "stretch", sx: styles, children: _jsx(ObjectRenderer, { hit: hit, showParentKey: true, data: results }) }) })] }));
|
|
113
113
|
});
|
|
114
|
-
const
|
|
114
|
+
const HitDetails = ({ hit }) => {
|
|
115
115
|
const { t } = useTranslation();
|
|
116
116
|
const [query, setQuery] = useState('');
|
|
117
|
-
const groups = useMemo(() => groupBy(Object.entries(flatten(
|
|
117
|
+
const groups = useMemo(() => groupBy(Object.entries(flatten(hit ?? {}, { safe: true })).filter(([key, value]) => !key.startsWith('__') &&
|
|
118
118
|
key.includes('.') &&
|
|
119
119
|
['howler', 'labels'].every(prefix => !key.startsWith(prefix)) &&
|
|
120
|
-
|
|
120
|
+
!isEmpty(value)), ([key]) => key.split('.')[0]), [hit]);
|
|
121
121
|
return (_jsxs(Stack, { spacing: 1, children: [_jsx(TextField, { value: query, onChange: event => setQuery(event.target.value), label: t('overview.search') }), Object.entries(groups).map(([section, entries]) => {
|
|
122
|
-
return (_jsx(Collapsible, {
|
|
122
|
+
return (_jsx(Collapsible, { hit: hit, query: query, title: section
|
|
123
123
|
.split('_')
|
|
124
124
|
.map(word => capitalize(word))
|
|
125
125
|
.join(' '), data: Object.fromEntries(entries) }, section));
|
|
126
126
|
})] }));
|
|
127
127
|
};
|
|
128
|
-
export default memo(
|
|
128
|
+
export default memo(HitDetails);
|
|
@@ -41,7 +41,7 @@ const DefaultOutline = ({ hit, fields, template, layout = HitLayout.NORMAL, read
|
|
|
41
41
|
if (!displayedData) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Tooltip, { title: (config.indexes.hit[field]?.description ?? t('none')).split('\n')[0], children: _jsxs(Typography, { variant: layout !== HitLayout.COMFY ? 'caption' : 'body1', fontWeight: "bold", children: [field, ":"] }) }), _jsx(PluginTypography, { context: "outline", variant: layout !== HitLayout.COMFY ? 'caption' : 'body1', whiteSpace: "normal", sx: { width: '100%', wordBreak: 'break-all' }, value: displayedData, field: field,
|
|
44
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Tooltip, { title: (config.indexes.hit[field]?.description ?? t('none')).split('\n')[0], children: _jsxs(Typography, { variant: layout !== HitLayout.COMFY ? 'caption' : 'body1', fontWeight: "bold", children: [field, ":"] }) }), _jsx(PluginTypography, { context: "outline", variant: layout !== HitLayout.COMFY ? 'caption' : 'body1', whiteSpace: "normal", sx: { width: '100%', wordBreak: 'break-all' }, value: displayedData, field: field, hit: hit, children: displayedData })] }, field));
|
|
45
45
|
})] }));
|
|
46
46
|
};
|
|
47
47
|
export default memo(DefaultOutline);
|
|
@@ -21,5 +21,5 @@ export const ViewTitle = ({ title, type, query, sort, span }) => {
|
|
|
21
21
|
readonly: _jsx(Lock, { fontSize: "small" }),
|
|
22
22
|
global: _jsx(Language, { fontSize: "small" }),
|
|
23
23
|
personal: _jsx(Person, { fontSize: "small" })
|
|
24
|
-
}[type] }), _jsx(Typography, { variant: "body1", children: t(title) })] }), _jsx(Typography, { variant: "caption", children: _jsx("code", { children: query }) }), (sort || span) && (_jsxs(Stack, { direction: "row", sx: { mt: 1 }, spacing: 1, children: [sort?.split(',').map(_sort => (_jsx(Chip, { size: "small", label: _sort.split(' ')[0], icon: _sort.endsWith('desc') ? _jsx(ArrowDownward, {}) : _jsx(ArrowUpward, {}) }, _sort.split(' ')[0]))), spanLabel && _jsx(Chip, { label: spanLabel })] }))] }));
|
|
24
|
+
}[type] }), _jsx(Typography, { variant: "body1", children: t(title) })] }), _jsx(Typography, { variant: "caption", children: _jsx("code", { children: query }) }), (sort || span) && (_jsxs(Stack, { direction: "row", sx: { mt: 1 }, spacing: 1, children: [sort?.split(',').map(_sort => (_jsx(Chip, { size: "small", label: _sort.split(' ')[0], icon: _sort.endsWith('desc') ? _jsx(ArrowDownward, {}) : _jsx(ArrowUpward, {}) }, _sort.split(' ')[0]))), spanLabel && _jsx(Chip, { size: "small", label: spanLabel })] }))] }));
|
|
25
25
|
};
|
|
@@ -7,7 +7,7 @@ declare const useHitActions: (_hits: Hit | Hit[]) => {
|
|
|
7
7
|
canAssess: boolean;
|
|
8
8
|
loading: boolean;
|
|
9
9
|
manage: (transition: string) => Promise<void>;
|
|
10
|
-
assess: (assessment: string, skipRationale?: boolean
|
|
10
|
+
assess: (assessment: string, skipRationale?: boolean) => Promise<void>;
|
|
11
11
|
vote: (v: string) => Promise<void>;
|
|
12
12
|
selectedVote: string;
|
|
13
13
|
};
|
|
@@ -90,9 +90,9 @@ const useHitActions = (_hits) => {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}, [dispatchApi, hits, selectedVote, updateHit, user.email]);
|
|
93
|
-
const assess = useCallback(async (assessment, skipRationale = false
|
|
93
|
+
const assess = useCallback(async (assessment, skipRationale = false) => {
|
|
94
94
|
const rationale = skipRationale
|
|
95
|
-
?
|
|
95
|
+
? t('rationale.default', { assessment })
|
|
96
96
|
: await new Promise(res => {
|
|
97
97
|
showModal(_jsx(RationaleModal, { hits: hits, onSubmit: _rationale => {
|
|
98
98
|
res(_rationale);
|