@cccsaurora/howler-ui 2.17.0-dev.542 → 2.17.0-dev.544

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.
@@ -0,0 +1,10 @@
1
+ import type { Analytic } from '@cccsaurora/howler-ui/models/entities/generated/Analytic';
2
+ import type { Dossier } from '@cccsaurora/howler-ui/models/entities/generated/Dossier';
3
+ import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
4
+ import type { FC } from 'react';
5
+ declare const HitLinks: FC<{
6
+ hit?: Hit;
7
+ analytic?: Analytic;
8
+ dossiers: Dossier[];
9
+ }>;
10
+ export default HitLinks;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Grid } from '@mui/material';
3
+ import HitNotebooks from '@cccsaurora/howler-ui/components/elements/hit/HitNotebooks';
4
+ import PivotLink from '@cccsaurora/howler-ui/components/elements/hit/related/PivotLink';
5
+ import RelatedLink from '@cccsaurora/howler-ui/components/elements/hit/related/RelatedLink';
6
+ import { uniqBy } from 'lodash-es';
7
+ const HitLinks = ({ hit, analytic, dossiers = [] }) => {
8
+ return ((hit?.howler?.links?.length > 0 ||
9
+ analytic?.notebooks?.length > 0 ||
10
+ dossiers.filter(_dossier => _dossier.pivots?.length > 0).length > 0) && (_jsxs(Grid, { container: true, spacing: 1, pr: 2, children: [hit?.howler?.links?.length > 0 &&
11
+ uniqBy(hit.howler.links, 'href')
12
+ .slice(0, 3)
13
+ .map(l => (_jsx(Grid, { item: true, children: _jsx(RelatedLink, { compact: true, ...l }) }, l.href))), dossiers.flatMap(_dossier => (_dossier.pivots ?? []).map((_pivot, index) => (
14
+ // eslint-disable-next-line react/no-array-index-key
15
+ _jsx(Grid, { item: true, children: _jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }) }, _dossier.dossier_id + index)))), analytic?.notebooks?.length > 0 && (_jsx(Grid, { item: true, children: _jsx(HitNotebooks, { analytic: analytic, hit: hit }) }))] })));
16
+ };
17
+ export default HitLinks;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ErrorOutline } from '@mui/icons-material';
3
- import { Card, Tooltip } from '@mui/material';
3
+ import { Tooltip } from '@mui/material';
4
+ import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
4
5
  import Handlebars from 'handlebars';
5
6
  import { isEmpty } from 'lodash-es';
6
7
  import React, { useMemo } from 'react';
@@ -50,7 +51,15 @@ const PivotLink = ({ pivot, hit, compact = false }) => {
50
51
  if (pluginPivot) {
51
52
  return pluginPivot;
52
53
  }
53
- return (_jsx(Card, { variant: "outlined", sx: { display: 'flex', alignItems: 'center', px: 1 }, children: _jsx(Tooltip, { title: _jsxs(_Fragment, { children: [_jsx("span", { children: `Missing Pivot Implementation ${pivot.format}` }), _jsx("code", { children: _jsx("pre", { children: JSON.stringify(pivot, null, 4) }) })] }), slotProps: {
54
+ return (_jsx(HowlerCard, { sx: [
55
+ theme => ({
56
+ p: 0.75,
57
+ backgroundColor: 'transparent',
58
+ transition: theme.transitions.create(['border-color']),
59
+ '&:hover': { borderColor: 'error.main' }
60
+ }),
61
+ { border: 'thin solid', borderColor: 'transparent' }
62
+ ], children: _jsx(Tooltip, { title: _jsxs(_Fragment, { children: [_jsx("span", { children: `Missing Pivot Implementation ${pivot.format}` }), _jsx("code", { children: _jsx("pre", { children: JSON.stringify(pivot, null, 4) }) })] }), slotProps: {
54
63
  popper: {
55
64
  sx: {
56
65
  '& > .MuiTooltip-tooltip': {
@@ -21,17 +21,14 @@ import HitComments from '@cccsaurora/howler-ui/components/elements/hit/HitCommen
21
21
  import HitDetails from '@cccsaurora/howler-ui/components/elements/hit/HitDetails';
22
22
  import HitLabels from '@cccsaurora/howler-ui/components/elements/hit/HitLabels';
23
23
  import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
24
- import HitNotebooks from '@cccsaurora/howler-ui/components/elements/hit/HitNotebooks';
24
+ import HitLinks from '@cccsaurora/howler-ui/components/elements/hit/HitLinks';
25
25
  import HitOutline from '@cccsaurora/howler-ui/components/elements/hit/HitOutline';
26
26
  import HitOverview from '@cccsaurora/howler-ui/components/elements/hit/HitOverview';
27
27
  import HitRelated from '@cccsaurora/howler-ui/components/elements/hit/HitRelated';
28
28
  import HitSummary from '@cccsaurora/howler-ui/components/elements/hit/HitSummary';
29
29
  import HitWorklog from '@cccsaurora/howler-ui/components/elements/hit/HitWorklog';
30
- import PivotLink from '@cccsaurora/howler-ui/components/elements/hit/related/PivotLink';
31
- import RelatedLink from '@cccsaurora/howler-ui/components/elements/hit/related/RelatedLink';
32
30
  import useMyUserList from '@cccsaurora/howler-ui/components/hooks/useMyUserList';
33
31
  import ErrorBoundary from '@cccsaurora/howler-ui/components/routes/ErrorBoundary';
34
- import { uniqBy } from 'lodash-es';
35
32
  import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
36
33
  import { useContext, useEffect, useMemo, useState } from 'react';
37
34
  import { useTranslation } from 'react-i18next';
@@ -166,14 +163,7 @@ const InformationPane = ({ onClose }) => {
166
163
  const hasError = useMemo(() => !validateRegex(filter), [filter]);
167
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, sx: [hit?.howler?.is_bundle && { position: 'absolute', top: 1, right: 0, zIndex: 1100 }], 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?.howler.bundles?.length > 0 && _jsx(BundleButton, { ids: hit.howler.bundles, disabled: loading }), !!hit && !hit.howler.is_bundle && (_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: header }), !!hit &&
168
165
  !hit.howler.is_bundle &&
169
- (!loading ? (_jsxs(_Fragment, { children: [_jsx(HitOutline, { hit: hit, layout: HitLayout.DENSE }), _jsx(HitLabels, { hit: hit })] })) : (_jsx(Skeleton, { height: 124 }))), (hit?.howler?.links?.length > 0 ||
170
- analytic?.notebooks?.length > 0 ||
171
- dossiers.filter(_dossier => _dossier.pivots?.length > 0).length > 0) && (_jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [analytic?.notebooks?.length > 0 && _jsx(HitNotebooks, { analytic: analytic, hit: hit }), hit?.howler?.links?.length > 0 &&
172
- uniqBy(hit.howler.links, 'href')
173
- .slice(0, 3)
174
- .map(l => _jsx(RelatedLink, { compact: true, ...l }, l.href)), dossiers.flatMap(_dossier => (_dossier.pivots ?? []).map((_pivot, index) => (
175
- // eslint-disable-next-line react/no-array-index-key
176
- _jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }, _dossier.dossier_id + index))))] })), _jsxs(VSBoxHeader, { ml: -1, mr: -1, pb: 1, sx: { top: '0px' }, children: [_jsxs(Tabs, { value: tab === 'overview' && !hasOverview ? 'details' : tab, sx: {
166
+ (!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: {
177
167
  display: 'flex',
178
168
  flexDirection: 'row',
179
169
  pr: 2,
@@ -50,6 +50,6 @@ const SearchSpan = ({ omitCustom = false, size }) => {
50
50
  }, [getCurrentViews, views]);
51
51
  return (_jsx(ChipPopper, { icon: _jsx(AvTimer, { fontSize: "small" }), label: _jsx(Typography, { variant: "body2", children: span !== 'date.range.custom'
52
52
  ? t(span)
53
- : `${startDate.format('YYYY-MM-DD HH:mm')} ${t('to')} ${endDate.format('YYYY-MM-DD HH:mm')}` }), minWidth: "225px", slotProps: { chip: { size: 'small' } }, children: _jsxs(Stack, { spacing: 1, children: [_jsx(Autocomplete, { fullWidth: true, sx: { minWidth: '200px', flex: 1 }, size: size ?? 'small', value: span, options: omitCustom ? DATE_RANGES.slice(0, DATE_RANGES.length - 1) : DATE_RANGES, renderInput: _params => _jsx(TextField, { ..._params, label: t('hit.search.span') }), getOptionLabel: option => t(option), onChange: (_, value) => setSpan(value), disableClearable: true }), _jsx(CustomSpan, {})] }) }));
53
+ : `${startDate?.format('YYYY-MM-DD HH:mm') ?? '?'} ${t('to')} ${endDate?.format('YYYY-MM-DD HH:mm') ?? '?'}` }), minWidth: "225px", slotProps: { chip: { size: 'small' } }, children: _jsxs(Stack, { spacing: 1, children: [_jsx(Autocomplete, { fullWidth: true, sx: { minWidth: '200px', flex: 1 }, size: size ?? 'small', value: span, options: omitCustom ? DATE_RANGES.slice(0, DATE_RANGES.length - 1) : DATE_RANGES, renderInput: _params => _jsx(TextField, { ..._params, label: t('hit.search.span') }), getOptionLabel: option => t(option), onChange: (_, value) => setSpan(value), disableClearable: true }), _jsx(CustomSpan, {})] }) }));
54
54
  };
55
55
  export default memo(SearchSpan);
@@ -16,16 +16,13 @@ import HitComments from '@cccsaurora/howler-ui/components/elements/hit/HitCommen
16
16
  import HitDetails from '@cccsaurora/howler-ui/components/elements/hit/HitDetails';
17
17
  import HitLabels from '@cccsaurora/howler-ui/components/elements/hit/HitLabels';
18
18
  import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
19
- import HitNotebooks from '@cccsaurora/howler-ui/components/elements/hit/HitNotebooks';
19
+ import HitLinks from '@cccsaurora/howler-ui/components/elements/hit/HitLinks';
20
20
  import HitOutline from '@cccsaurora/howler-ui/components/elements/hit/HitOutline';
21
21
  import HitOverview from '@cccsaurora/howler-ui/components/elements/hit/HitOverview';
22
22
  import HitRelated from '@cccsaurora/howler-ui/components/elements/hit/HitRelated';
23
23
  import HitWorklog from '@cccsaurora/howler-ui/components/elements/hit/HitWorklog';
24
- import PivotLink from '@cccsaurora/howler-ui/components/elements/hit/related/PivotLink';
25
- import RelatedLink from '@cccsaurora/howler-ui/components/elements/hit/related/RelatedLink';
26
24
  import { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/useMyLocalStorage';
27
25
  import useMyUserList from '@cccsaurora/howler-ui/components/hooks/useMyUserList';
28
- import uniqBy from 'lodash-es/uniqBy';
29
26
  import { useCallback, useEffect, useMemo, useState } from 'react';
30
27
  import { useTranslation } from 'react-i18next';
31
28
  import { useNavigate, useParams } from 'react-router-dom';
@@ -131,14 +128,7 @@ const HitViewer = () => {
131
128
  display: 'flex',
132
129
  '& > .MuiPaper-root': { flex: 1 },
133
130
  mr: orientation === 'vertical' ? 0 : -2
134
- }, children: [_jsx(HowlerCard, { tabIndex: 0, sx: { position: 'relative' }, children: _jsxs(CardContent, { children: [_jsx(HitBanner, { hit: hit, layout: HitLayout.COMFY, useListener: true }), _jsx(HitOutline, { hit: hit, layout: HitLayout.COMFY }), _jsx(HitLabels, { hit: hit }), (hit?.howler?.links?.length > 0 ||
135
- analytic?.notebooks?.length > 0 ||
136
- dossiers.filter(_dossier => _dossier.pivots?.length > 0).length > 0) && (_jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [analytic?.notebooks?.length > 0 && _jsx(HitNotebooks, { analytic: analytic, hit: hit }), hit?.howler?.links?.length > 0 &&
137
- uniqBy(hit.howler.links, 'href')
138
- .slice(0, 3)
139
- .map(l => _jsx(RelatedLink, { compact: true, ...l }, l.href)), dossiers.flatMap(_dossier => (_dossier.pivots ?? []).map((_pivot, index) => (
140
- // eslint-disable-next-line react/no-array-index-key
141
- _jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }, _dossier.dossier_id + index))))] }))] }) }), !isUnderLg && (_jsxs(Stack, { spacing: 1, sx: {
131
+ }, children: [_jsx(HowlerCard, { tabIndex: 0, sx: { position: 'relative' }, children: _jsxs(CardContent, { children: [_jsx(HitBanner, { hit: hit, layout: HitLayout.COMFY, useListener: true }), _jsx(HitOutline, { hit: hit, layout: HitLayout.COMFY }), _jsx(HitLabels, { hit: hit }), _jsx(HitLinks, { hit: hit, analytic: analytic, dossiers: dossiers })] }) }), !isUnderLg && (_jsxs(Stack, { spacing: 1, sx: {
142
132
  position: 'absolute',
143
133
  top: theme.spacing(2),
144
134
  right: theme.spacing(-6)
package/package.json CHANGED
@@ -101,7 +101,7 @@
101
101
  "internal-slot": "1.0.7"
102
102
  },
103
103
  "type": "module",
104
- "version": "2.17.0-dev.542",
104
+ "version": "2.17.0-dev.544",
105
105
  "exports": {
106
106
  "./i18n": "./i18n.js",
107
107
  "./index.css": "./index.css",