@cccsaurora/clue-ui 1.3.0 → 1.4.0-dev.426
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/ActionForm-CqKcnDWC.js +6099 -0
- package/AnnotationDetails-BlPd3T8k.js +176 -0
- package/AnnotationPreview-Bl447SKT.js +188 -0
- package/ClueEnrichContext-B3YrTCaJ.js +567 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_MapCache-kuEY_iOH.js +220 -0
- package/_Set-BrSMTlHn.js +6 -0
- package/_Uint8Array-OPpgYQj7.js +123 -0
- package/_arrayIncludes-BNqL-9ZP.js +31 -0
- package/_arrayPush-CBkQqaE_.js +10 -0
- package/_baseAssignValue-CNUVPOBW.js +16 -0
- package/_baseClone-9FaRd1R2.js +287 -0
- package/_baseExtremum-wOGT4Dgw.js +18 -0
- package/_baseFlatten-Co6QHDlG.js +92 -0
- package/_baseGet-Cmp6FztG.js +109 -0
- package/_baseGetTag-Hj-0NTYF.js +44 -0
- package/_baseIsEqual-1CpU47TZ.js +211 -0
- package/_baseIteratee-BN7Vbe5g.js +126 -0
- package/_baseRest-BZ_hQ9PC.js +8 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-BnvS3JHL.js +63 -0
- package/_cacheHas-_aF2y2Xv.js +25 -0
- package/_commonjsHelpers-CUmg6egw.js +6 -0
- package/_createAggregator-BUZrP_is.js +63 -0
- package/_defineProperty-DolZLKmv.js +12 -0
- package/_getPrototype-Bb4gm-5m.js +5 -0
- package/_getTag-CML_cXiN.js +105 -0
- package/_isIterateeCall-B1IFEqVv.js +17 -0
- package/_setToArray-CqyqC8ib.js +10 -0
- package/cloneDeep-l3UkXG5M.js +8 -0
- package/components/AnnotationBody.js +49 -35
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +7 -7
- package/components/AnnotationEntry.js +35 -35
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +110 -97
- package/components/EnrichedChip.js +130 -105
- package/components/EnrichedTypography.js +133 -107
- package/components/ErrorBoundary.js +28 -24
- package/components/RetryFailedEnrichments.js +10 -9
- package/components/SourcePicker.js +57 -49
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +75 -59
- package/components/actions/ResultModal.js +4 -4
- package/components/actions/form/schemaAdapter.js +39 -23
- package/components/actions/formats/FileResult.js +86 -59
- package/components/actions/formats/index.js +29 -25
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +111 -91
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +261 -202
- package/components/display/graph/visualizations/Leaf.js +89 -70
- package/components/display/graph/visualizations/cloud/index.js +98 -81
- package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
- package/components/display/graph/visualizations/icons/index.js +14 -13
- package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
- package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +408 -306
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/index.js +8678 -5770
- package/components/enrichment/EnrichPopover.js +54 -46
- package/components/fetchers/Fetcher.js +166 -123
- package/components/fetchers/FetcherResultView.js +31 -27
- package/components/fetchers/PreviewModal.js +17 -16
- package/components/fetchers/StatusChip.js +21 -17
- package/components/group/Entry.js +13 -11
- package/components/group/Group.js +13 -10
- package/components/group/GroupControl.js +76 -65
- package/components/stats/QueryStatus.js +45 -32
- package/countBy-Bqcp3VCs.js +14 -0
- package/data/event.js +6 -4
- package/database/globals.js +2 -2
- package/database/index.js +3 -3
- package/database/replication.js +4 -4
- package/get-CdMThM8x.js +8 -0
- package/groupBy-BVV07EGQ.js +14 -0
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +29 -23
- package/hooks/ClueConfigProvider.js +14 -12
- package/hooks/ClueDatabaseContext.js +35 -23
- package/hooks/ClueEnrichContext.js +11 -11
- package/hooks/ClueFetcherContext.js +83 -56
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +13 -11
- package/hooks/ClueUIPluginContext.js +49 -35
- package/hooks/selectors.js +7 -7
- package/hooks/useActionResult.js +3 -3
- package/hooks/useAnnotations.js +48 -32
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +6 -4
- package/hooks/useClueTypeConfig.js +49 -24
- package/hooks/useClueUIPlugins.js +8 -7
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useFetcherResult.js +33 -24
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +66 -37
- package/iconify-DJxl6dC-.js +1789 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +85 -69
- package/icons/Context.js +77 -63
- package/icons/Opinion.js +76 -60
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-CAvu7vwt.js +1172 -0
- package/index-CVUD9o3t.js +15768 -0
- package/index-DUEubgWN.js +464 -0
- package/index-Dj1N4IQP.js +9314 -0
- package/index-DpJxD74E.js +3272 -0
- package/index-_gpzM2Px.js +702 -0
- package/isArguments-CuYlEuhP.js +27 -0
- package/isArray-RJPfgWqI.js +4 -0
- package/isEmpty-BE656RUK.js +30 -0
- package/isNil-CIubwp4T.js +6 -0
- package/isObject-FTY-5JQX.js +7 -0
- package/isObjectLike-CeENW9FN.js +6 -0
- package/isSymbol-D_H4HPZQ.js +9 -0
- package/last-CUCl67Im.js +7 -0
- package/main.js +62 -62
- package/maxBy-BjjQmX5t.js +8 -0
- package/package.json +1 -1
- package/plugins/ClueUIPlugin.js +163 -96
- package/plugins/file/index.js +15 -15
- package/plugins/graph/index.js +29 -26
- package/plugins/image/index.js +28 -24
- package/plugins/json/index.js +21 -21
- package/plugins/markdown/index.js +18 -18
- package/plugins/registry.js +6 -6
- package/plugins/store.js +4 -4
- package/plugins/test/index.js +17 -17
- package/plugins/utils.js +13 -12
- package/replication--gLEZw8a.js +11777 -0
- package/sessionStorage-B68y-wnE.js +140 -0
- package/sortBy-B8JVsLQY.js +95 -0
- package/store-B9sjQbcS.js +2163 -0
- package/sumBy-D-HCzM2i.js +8 -0
- package/text/Frequency.js +42 -23
- package/toFinite-meZTg4Su.js +16 -0
- package/toNumber-B5JaA1vX.js +39 -0
- package/uniq-CahZPAwp.js +7 -0
- package/utils/chain.js +92 -65
- package/utils/classificationParser.js +519 -256
- package/utils/constants.js +37 -11
- package/utils/graph.js +72 -45
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +131 -81
- package/utils/loggerUtil.js +5 -3
- package/utils/sessionStorage.js +7 -7
- package/utils/time.js +447 -427
- package/utils/utils.js +10 -10
- package/utils/window.js +21 -10
- package/utils-CEySTPtg.js +224 -0
- package/ActionForm-CHOSKfvu.js +0 -4403
- package/AnnotationDetails-Bqq6Ymmg.js +0 -160
- package/AnnotationPreview-CqXmC-j8.js +0 -140
- package/ClueEnrichContext-DL6aGe1k.js +0 -432
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_MapCache-DRK-s2eK.js +0 -179
- package/_Set-DrS_bbSV.js +0 -6
- package/_Uint8Array-D9R2N9Lp.js +0 -98
- package/_arrayIncludes-Dcl_29E6.js +0 -25
- package/_arrayPush-DBJIuK2V.js +0 -8
- package/_baseAssignValue-Bx1cxHj5.js +0 -12
- package/_baseClone-DRhywkxm.js +0 -211
- package/_baseExtremum-DodEaEyF.js +0 -16
- package/_baseFlatten-CD9NgrYE.js +0 -72
- package/_baseGet-bVwDaGrA.js +0 -80
- package/_baseGetTag-CxDaTem-.js +0 -25
- package/_baseIsEqual-C-FKsm1J.js +0 -150
- package/_baseIteratee-D0FhC5bC.js +0 -95
- package/_baseRest-D_eW2E0d.js +0 -8
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-D3N8igOm.js +0 -41
- package/_cacheHas-Wgl-hw34.js +0 -22
- package/_commonjsHelpers-C6fGbg64.js +0 -6
- package/_createAggregator-BVj8IAuF.js +0 -53
- package/_defineProperty-BZU4WKA3.js +0 -11
- package/_getPrototype-BGBCg-aX.js +0 -5
- package/_getTag-B7R9qBo7.js +0 -73
- package/_isIterateeCall-Dm0VTAYy.js +0 -13
- package/_setToArray-Ck4YZu0Z.js +0 -9
- package/cloneDeep-fV59zwUf.js +0 -8
- package/countBy-B3rNuG4T.js +0 -8
- package/get-Bil3mzRD.js +0 -8
- package/groupBy-CrJC7sGa.js +0 -8
- package/iconify-Ptb5dTKy.js +0 -1270
- package/identity-ByMq8VxU.js +0 -6
- package/index-BH-gBhtO.js +0 -2282
- package/index-BM9Sve5T.js +0 -571
- package/index-Cj4d5cGz.js +0 -357
- package/index-Dh2PP9h8.js +0 -11747
- package/index-DoFpWPHo.js +0 -975
- package/index-DzVIklWY.js +0 -6464
- package/isArguments-BWcXOE6a.js +0 -24
- package/isArray-WzO_os3q.js +0 -4
- package/isEmpty-DKxrY-_M.js +0 -22
- package/isNil-CjWwlQS3.js +0 -6
- package/isObject-B53jY8Qg.js +0 -7
- package/isObjectLike-CYbdrIBr.js +0 -6
- package/isSymbol-DE1Kcy2M.js +0 -9
- package/last-7CdUxN0r.js +0 -7
- package/maxBy-BOWDkL_D.js +0 -8
- package/replication-WkKbPdwG.js +0 -8453
- package/sessionStorage-DFMae61b.js +0 -90
- package/sortBy-BHe812lF.js +0 -74
- package/store-DClHBq7r.js +0 -1169
- package/sumBy-B7f_bP_k.js +0 -8
- package/toFinite-CBrE65MP.js +0 -14
- package/toNumber-CxmWey0f.js +0 -31
- package/uniq-B4UZ671_.js +0 -7
- package/utils-SpTOhPYl.js +0 -147
|
@@ -1,79 +1,87 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { useTheme
|
|
3
|
-
import { e as
|
|
4
|
-
import { useState
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
const { t
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Box, Typography, Divider } from "@mui/material";
|
|
3
|
+
import { e as useClueComponentSelector, f as useClueEnrichSelector, c as capitalize } from "../../ActionForm-CqKcnDWC.js";
|
|
4
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
5
|
+
import Iconified from "../display/icons/Iconified.js";
|
|
6
|
+
const EnrichPopover = ({ show = false, size = "small", selector }) => {
|
|
7
|
+
const { t } = useClueComponentSelector((ctx) => ctx.i18next);
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
const availableSources = useClueEnrichSelector((ctx) => ctx.availableSources);
|
|
10
|
+
const _enrich = useClueEnrichSelector((ctx) => ctx.enrich);
|
|
11
|
+
const [showEnrichMenu, setShowEnrichMenu] = useState(show);
|
|
12
|
+
const [loading, setLoading] = useState(false);
|
|
13
|
+
const enrichEl = useRef(null);
|
|
14
|
+
const enrich = useCallback(
|
|
15
|
+
async (_source) => {
|
|
16
|
+
setLoading(true);
|
|
10
17
|
try {
|
|
11
|
-
await
|
|
12
|
-
classification:
|
|
18
|
+
await _enrich(selector.type, selector.value, {
|
|
19
|
+
classification: selector.classification,
|
|
13
20
|
timeout: 30,
|
|
14
|
-
force:
|
|
15
|
-
noCache:
|
|
16
|
-
sources: [
|
|
17
|
-
append:
|
|
21
|
+
force: true,
|
|
22
|
+
noCache: true,
|
|
23
|
+
sources: [_source],
|
|
24
|
+
append: true
|
|
18
25
|
});
|
|
19
26
|
} finally {
|
|
20
|
-
|
|
27
|
+
setLoading(false);
|
|
21
28
|
}
|
|
22
29
|
},
|
|
23
|
-
[
|
|
30
|
+
[_enrich, selector.classification, selector.type, selector.value]
|
|
24
31
|
);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setShowEnrichMenu(show);
|
|
34
|
+
}, [show]);
|
|
35
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
size === "small" ? /* @__PURE__ */ jsx(Tooltip, { ref: enrichEl, title: t("enrich"), children: /* @__PURE__ */ jsx("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ jsx(
|
|
37
|
+
IconButton,
|
|
30
38
|
{
|
|
31
|
-
onClick: () =>
|
|
32
|
-
disabled: Object.keys(
|
|
39
|
+
onClick: () => setShowEnrichMenu(true),
|
|
40
|
+
disabled: Object.keys(availableSources).length < 1 || loading,
|
|
33
41
|
color: "info",
|
|
34
|
-
children:
|
|
42
|
+
children: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "24px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-auto-fix-high" })
|
|
35
43
|
}
|
|
36
|
-
) }) }) : /* @__PURE__ */
|
|
37
|
-
|
|
44
|
+
) }) }) : /* @__PURE__ */ jsx(
|
|
45
|
+
Button,
|
|
38
46
|
{
|
|
39
|
-
ref:
|
|
47
|
+
ref: enrichEl,
|
|
40
48
|
variant: "outlined",
|
|
41
49
|
color: "info",
|
|
42
|
-
disabled: Object.keys(
|
|
43
|
-
startIcon:
|
|
50
|
+
disabled: Object.keys(availableSources).length < 1 || loading,
|
|
51
|
+
startIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "20px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-auto-fix-high" }),
|
|
44
52
|
sx: { alignSelf: "stretch" },
|
|
45
|
-
onClick: () =>
|
|
46
|
-
children:
|
|
53
|
+
onClick: () => setShowEnrichMenu(true),
|
|
54
|
+
children: t("enrich")
|
|
47
55
|
}
|
|
48
56
|
),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Popover,
|
|
51
59
|
{
|
|
52
60
|
sx: { zIndex: 2e3 },
|
|
53
|
-
open:
|
|
54
|
-
disablePortal:
|
|
55
|
-
onClose: () =>
|
|
56
|
-
anchorEl:
|
|
61
|
+
open: showEnrichMenu,
|
|
62
|
+
disablePortal: true,
|
|
63
|
+
onClose: () => setShowEnrichMenu(false),
|
|
64
|
+
anchorEl: enrichEl.current,
|
|
57
65
|
anchorOrigin: { horizontal: "left", vertical: "bottom" },
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
|
|
66
|
+
children: /* @__PURE__ */ jsx(Paper, { onClick: () => setShowEnrichMenu(false), children: /* @__PURE__ */ jsx(Stack, { divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }), children: availableSources.map((_source) => /* @__PURE__ */ jsx(
|
|
67
|
+
Box,
|
|
60
68
|
{
|
|
61
69
|
sx: {
|
|
62
70
|
px: 3,
|
|
63
71
|
py: 1,
|
|
64
72
|
cursor: "pointer",
|
|
65
|
-
transition:
|
|
66
|
-
"&:hover": { backgroundColor:
|
|
73
|
+
transition: theme.transitions.create("background-color"),
|
|
74
|
+
"&:hover": { backgroundColor: theme.palette.background.default }
|
|
67
75
|
},
|
|
68
|
-
onClick: () =>
|
|
69
|
-
children: /* @__PURE__ */
|
|
76
|
+
onClick: () => enrich(_source),
|
|
77
|
+
children: /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: _source.split("-").map(capitalize).join(" ") }) }) })
|
|
70
78
|
},
|
|
71
|
-
|
|
79
|
+
_source
|
|
72
80
|
)) }) })
|
|
73
81
|
}
|
|
74
82
|
)
|
|
75
83
|
] });
|
|
76
84
|
};
|
|
77
85
|
export {
|
|
78
|
-
|
|
86
|
+
EnrichPopover as default
|
|
79
87
|
};
|
|
@@ -1,106 +1,148 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { I as
|
|
3
|
-
import { useTheme
|
|
4
|
-
import { F as
|
|
5
|
-
import
|
|
6
|
-
import { ClueComponentContext
|
|
7
|
-
import { g as
|
|
8
|
-
import
|
|
9
|
-
import { a as
|
|
10
|
-
import { FetcherResultView
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
const
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { I as Icon } from "../../iconify-DJxl6dC-.js";
|
|
3
|
+
import { useTheme, Skeleton, Chip, Tooltip, Stack, Typography, LinearProgress, Paper, IconButton } from "@mui/material";
|
|
4
|
+
import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
|
|
5
|
+
import Iconified from "../display/icons/Iconified.js";
|
|
6
|
+
import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
|
|
7
|
+
import { g as useClueFetcherSelector } from "../../ActionForm-CqKcnDWC.js";
|
|
8
|
+
import React__default, { useState, useRef, useMemo, useEffect, memo } from "react";
|
|
9
|
+
import { a as useContextSelector } from "../../index-_gpzM2Px.js";
|
|
10
|
+
import { FetcherResultView } from "./FetcherResultView.js";
|
|
11
|
+
import PreviewModal from "./PreviewModal.js";
|
|
12
|
+
import StatusChip from "./StatusChip.js";
|
|
13
|
+
const Fetcher = React__default.memo(
|
|
14
14
|
({
|
|
15
|
-
type
|
|
16
|
-
value
|
|
17
|
-
classification
|
|
18
|
-
fetcherId
|
|
15
|
+
type,
|
|
16
|
+
value,
|
|
17
|
+
classification,
|
|
18
|
+
fetcherId,
|
|
19
19
|
slotProps: {
|
|
20
|
-
paper:
|
|
21
|
-
preview:
|
|
22
|
-
stack:
|
|
23
|
-
image:
|
|
24
|
-
chip:
|
|
25
|
-
skeleton:
|
|
20
|
+
paper: paperProps = {},
|
|
21
|
+
preview: previewProps = {},
|
|
22
|
+
stack: stackProps = {},
|
|
23
|
+
image: imageProps = {},
|
|
24
|
+
chip: chipProps = {},
|
|
25
|
+
skeleton: skeletonProps = {}
|
|
26
26
|
} = {}
|
|
27
27
|
}) => {
|
|
28
|
-
var
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
const fetchers = useClueFetcherSelector((ctx) => ctx.fetchers);
|
|
31
|
+
const fetchSelector = useClueFetcherSelector((ctx) => ctx.fetchSelector);
|
|
32
|
+
const getFetcherStatus = useClueFetcherSelector((ctx) => ctx.getFetcherStatus);
|
|
33
|
+
const fetchCompleted = useClueFetcherSelector((ctx) => ctx.fetchCompleted);
|
|
34
|
+
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx == null ? void 0 : ctx.i18next);
|
|
35
|
+
const [result, setResult] = useState(null);
|
|
36
|
+
const [loading, setLoading] = useState(true);
|
|
37
|
+
const [showPreview, setShowPreview] = useState(false);
|
|
38
|
+
const timeoutRef = useRef(null);
|
|
39
|
+
const taskId = useMemo(() => result == null ? void 0 : result.task_id, [result == null ? void 0 : result.task_id]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if ((result == null ? void 0 : result.outcome) !== "pending" || !taskId) return;
|
|
42
|
+
let cancelled = false;
|
|
43
|
+
const poll = async () => {
|
|
44
|
+
const res = await getFetcherStatus(fetcherId, taskId);
|
|
45
|
+
if (!res) {
|
|
46
|
+
setResult({ outcome: "failure", done: true, error: "Missing result", link: "" });
|
|
47
|
+
} else if (res.outcome === "success" || res.outcome === "failure") {
|
|
48
|
+
setResult({ ...res, done: true });
|
|
49
|
+
} else {
|
|
50
|
+
if (cancelled) return;
|
|
51
|
+
setResult({ ...res });
|
|
52
|
+
timeoutRef.current = setTimeout(poll, 2e3);
|
|
42
53
|
}
|
|
43
54
|
};
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
poll();
|
|
56
|
+
return () => {
|
|
57
|
+
cancelled = true;
|
|
58
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
46
59
|
};
|
|
47
|
-
}, [
|
|
60
|
+
}, [fetcherId, getFetcherStatus, result == null ? void 0 : result.outcome, taskId]);
|
|
61
|
+
useEffect(() => {
|
|
48
62
|
(async () => {
|
|
49
63
|
try {
|
|
50
|
-
|
|
64
|
+
setLoading(true);
|
|
65
|
+
setResult(await fetchSelector(fetcherId, { type, value, classification }));
|
|
51
66
|
} catch {
|
|
52
|
-
|
|
67
|
+
setResult({ outcome: "failure", done: true, error: t("error.unexpected") });
|
|
53
68
|
} finally {
|
|
54
|
-
|
|
69
|
+
setLoading(false);
|
|
55
70
|
}
|
|
56
71
|
})();
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
}, [classification, fetchSelector, fetcherId, t, type, value]);
|
|
73
|
+
const resultAdditionalProps = useMemo(() => {
|
|
74
|
+
if ((result == null ? void 0 : result.outcome) === "success" && result.format === "image") {
|
|
75
|
+
return { ...imageProps, onClick: () => setShowPreview(true) };
|
|
76
|
+
}
|
|
77
|
+
return { result };
|
|
78
|
+
}, [imageProps, result]);
|
|
79
|
+
if (fetchCompleted) {
|
|
80
|
+
if (!fetcherId) {
|
|
81
|
+
console.warn("Missing fetcher Id. Component will not render.");
|
|
82
|
+
return null;
|
|
83
|
+
} else if (!fetcherId.includes(".")) {
|
|
84
|
+
console.warn(
|
|
65
85
|
"Invalid fetcher id. Must be in the format '<plugin_id>.<fetcher_id>'. Component will not render."
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
W,
|
|
72
|
-
{
|
|
73
|
-
variant: "rounded",
|
|
74
|
-
height: "32px",
|
|
75
|
-
width: "150px",
|
|
76
|
-
...r,
|
|
77
|
-
sx: [
|
|
78
|
-
{ borderRadius: "16px" },
|
|
79
|
-
...Array.isArray(r == null ? void 0 : r.sx) ? r == null ? void 0 : r.sx : [r == null ? void 0 : r.sx]
|
|
80
|
-
]
|
|
86
|
+
);
|
|
87
|
+
return null;
|
|
88
|
+
} else if (!(fetcherId in fetchers)) {
|
|
89
|
+
console.warn("Fetcher ID does not correspond to a registered fetcher. Component will not render.");
|
|
90
|
+
return null;
|
|
81
91
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
} else {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
if (loading) {
|
|
96
|
+
if (((_a = fetchers[fetcherId]) == null ? void 0 : _a.format) === "status") {
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
Skeleton,
|
|
99
|
+
{
|
|
100
|
+
variant: "rounded",
|
|
101
|
+
height: "32px",
|
|
102
|
+
width: "150px",
|
|
103
|
+
...skeletonProps,
|
|
104
|
+
sx: [
|
|
105
|
+
{ borderRadius: "16px" },
|
|
106
|
+
...Array.isArray(skeletonProps == null ? void 0 : skeletonProps.sx) ? skeletonProps == null ? void 0 : skeletonProps.sx : [skeletonProps == null ? void 0 : skeletonProps.sx]
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
} else {
|
|
111
|
+
return /* @__PURE__ */ jsx(Skeleton, { variant: "rounded", height: "325px", width: "300px", ...skeletonProps });
|
|
89
112
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
113
|
+
}
|
|
114
|
+
if (!result) return null;
|
|
115
|
+
if (result.outcome === "failure" && fetchers[fetcherId].format === "status") {
|
|
116
|
+
return /* @__PURE__ */ jsx(
|
|
117
|
+
Chip,
|
|
94
118
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
icon: /* @__PURE__ */ jsx(Tooltip, { title: result.error, children: /* @__PURE__ */ jsx(Icon, { icon: "mdi:information-outline", fontSize: "1.25rem" }) }),
|
|
120
|
+
label: t("error"),
|
|
121
|
+
color: "error",
|
|
122
|
+
...chipProps
|
|
98
123
|
}
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
if (result.outcome === "pending") {
|
|
127
|
+
return /* @__PURE__ */ jsxs(Stack, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
|
|
128
|
+
((_b = result.data) == null ? void 0 : _b.summary) && /* @__PURE__ */ jsx(Typography, { variant: "caption", children: result.data.summary }),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
LinearProgress,
|
|
131
|
+
{
|
|
132
|
+
variant: ((_c = result.data) == null ? void 0 : _c.progress) ? "determinate" : "indeterminate",
|
|
133
|
+
value: ((_d = result.data) == null ? void 0 : _d.progress) * 100,
|
|
134
|
+
sx: { maxWidth: 500, width: "100%", borderRadius: theme.shape.borderRadius }
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] });
|
|
138
|
+
}
|
|
139
|
+
if (result.format === "status") {
|
|
140
|
+
return /* @__PURE__ */ jsx(StatusChip, { data: result.data, ...chipProps });
|
|
141
|
+
}
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
Paper,
|
|
102
144
|
{
|
|
103
|
-
...
|
|
145
|
+
...paperProps,
|
|
104
146
|
sx: [
|
|
105
147
|
{
|
|
106
148
|
p: 1,
|
|
@@ -109,16 +151,16 @@ const re = p.memo(
|
|
|
109
151
|
width: "100%",
|
|
110
152
|
minWidth: "300px"
|
|
111
153
|
},
|
|
112
|
-
...Array.isArray(
|
|
154
|
+
...Array.isArray(paperProps == null ? void 0 : paperProps.sx) ? paperProps == null ? void 0 : paperProps.sx : [paperProps == null ? void 0 : paperProps.sx]
|
|
113
155
|
],
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
-
|
|
156
|
+
children: /* @__PURE__ */ jsxs(
|
|
157
|
+
Stack,
|
|
116
158
|
{
|
|
117
159
|
sx: {
|
|
118
160
|
"& > img": {
|
|
119
161
|
borderRadius: "3px",
|
|
120
162
|
cursor: "zoom-in",
|
|
121
|
-
transition:
|
|
163
|
+
transition: theme.transitions.create("border-color", { duration: theme.transitions.duration.shortest }),
|
|
122
164
|
border: "3px solid transparent",
|
|
123
165
|
"&:hover": {
|
|
124
166
|
borderColor: "primary.main"
|
|
@@ -126,71 +168,72 @@ const re = p.memo(
|
|
|
126
168
|
}
|
|
127
169
|
},
|
|
128
170
|
children: [
|
|
129
|
-
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
|
|
171
|
+
result.outcome === "failure" && /* @__PURE__ */ jsx("code", { style: { color: theme.palette.error.main }, children: /* @__PURE__ */ jsx("pre", { style: { marginTop: 0, marginBottom: 0 }, children: result.error }) }),
|
|
172
|
+
/* @__PURE__ */ jsx(FetcherResultView, { result, fetcherId, ...resultAdditionalProps }),
|
|
173
|
+
/* @__PURE__ */ jsx(FlexOne, {}),
|
|
174
|
+
/* @__PURE__ */ jsxs(
|
|
175
|
+
Stack,
|
|
134
176
|
{
|
|
135
177
|
direction: "row",
|
|
136
178
|
spacing: 1,
|
|
137
|
-
...
|
|
179
|
+
...stackProps,
|
|
138
180
|
sx: [
|
|
139
181
|
{
|
|
140
|
-
py:
|
|
182
|
+
py: theme.spacing(0.5),
|
|
141
183
|
display: "flex",
|
|
142
184
|
alignItems: "center"
|
|
143
185
|
},
|
|
144
|
-
...Array.isArray(
|
|
186
|
+
...Array.isArray(stackProps == null ? void 0 : stackProps.sx) ? stackProps == null ? void 0 : stackProps.sx : [stackProps == null ? void 0 : stackProps.sx]
|
|
145
187
|
],
|
|
146
188
|
children: [
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
|
|
189
|
+
/* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-landscape", color: "primary", fontSize: "small" }),
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
Tooltip,
|
|
150
192
|
{
|
|
151
|
-
title: /* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
193
|
+
title: /* @__PURE__ */ jsxs(Stack, { spacing: 0.5, children: [
|
|
194
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
195
|
+
t("type"),
|
|
154
196
|
": ",
|
|
155
|
-
|
|
197
|
+
type
|
|
156
198
|
] }),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
|
|
199
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
200
|
+
t("value"),
|
|
159
201
|
": ",
|
|
160
|
-
|
|
202
|
+
value
|
|
161
203
|
] }),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
|
|
204
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
205
|
+
t("classification"),
|
|
164
206
|
": ",
|
|
165
|
-
|
|
207
|
+
classification ?? "N/A"
|
|
166
208
|
] })
|
|
167
209
|
] }),
|
|
168
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-info", fontSize: "small" })
|
|
169
211
|
}
|
|
170
212
|
),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
|
|
213
|
+
/* @__PURE__ */ jsx(FlexOne, {}),
|
|
214
|
+
result.link && /* @__PURE__ */ jsx(IconButton, { size: "small", component: "a", href: result.link, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
|
|
173
215
|
]
|
|
174
216
|
}
|
|
175
217
|
),
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
218
|
+
/* @__PURE__ */ jsx(
|
|
219
|
+
PreviewModal,
|
|
178
220
|
{
|
|
179
|
-
...
|
|
180
|
-
fetcherId
|
|
181
|
-
slotProps: { fetcherResultView:
|
|
182
|
-
open:
|
|
183
|
-
result
|
|
184
|
-
onClose: () =>
|
|
221
|
+
...previewProps,
|
|
222
|
+
fetcherId,
|
|
223
|
+
slotProps: { fetcherResultView: resultAdditionalProps },
|
|
224
|
+
open: showPreview,
|
|
225
|
+
result,
|
|
226
|
+
onClose: () => setShowPreview(false)
|
|
185
227
|
}
|
|
186
228
|
)
|
|
187
229
|
]
|
|
188
230
|
}
|
|
189
231
|
)
|
|
190
232
|
}
|
|
191
|
-
)
|
|
233
|
+
);
|
|
192
234
|
}
|
|
193
|
-
)
|
|
235
|
+
);
|
|
236
|
+
const Fetcher_default = memo(Fetcher);
|
|
194
237
|
export {
|
|
195
|
-
|
|
238
|
+
Fetcher_default as default
|
|
196
239
|
};
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { Stack
|
|
3
|
-
import { J as
|
|
4
|
-
import
|
|
5
|
-
import { u as
|
|
6
|
-
import { useTranslation
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
pluginName
|
|
10
|
-
result
|
|
11
|
-
fetcherId
|
|
12
|
-
...
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack } from "@mui/material";
|
|
3
|
+
import { J as JSONViewer } from "../../index-DUEubgWN.js";
|
|
4
|
+
import Markdown from "../display/markdown/index.js";
|
|
5
|
+
import { u as usePluginStore, c as clueUIPluginStore } from "../../store-B9sjQbcS.js";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import ErrorBoundary from "../ErrorBoundary.js";
|
|
8
|
+
const FetcherResultView = ({
|
|
9
|
+
pluginName,
|
|
10
|
+
result,
|
|
11
|
+
fetcherId,
|
|
12
|
+
...props
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const pluginStore = usePluginStore();
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const availablePlugin = pluginName ?? clueUIPluginStore.getPlugin(result.format ?? "undefined", "fetcher", void 0, fetcherId);
|
|
17
|
+
if (availablePlugin) {
|
|
16
18
|
try {
|
|
17
|
-
const
|
|
18
|
-
result
|
|
19
|
-
fetcherId
|
|
20
|
-
...
|
|
19
|
+
const component = pluginStore.executeFunction(`${availablePlugin}.fetcherResult`, {
|
|
20
|
+
result,
|
|
21
|
+
fetcherId,
|
|
22
|
+
...props
|
|
21
23
|
});
|
|
22
|
-
if (
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
+
if (component !== void 0) {
|
|
25
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, { children: component });
|
|
26
|
+
}
|
|
24
27
|
} catch {
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Stack, { sx: { overflowY: "auto" }, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Markdown, { md: t("format.render.error", { format: result.format }) }),
|
|
30
|
+
/* @__PURE__ */ jsx(JSONViewer, { data: result, collapse: true, forceCompact: true })
|
|
28
31
|
] }) });
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsxs(Stack, { sx: { overflowY: "auto" }, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Markdown, { md: t("format.not.recognized", { format: result.format }) }),
|
|
36
|
+
/* @__PURE__ */ jsx(JSONViewer, { data: result, collapse: true, forceCompact: true })
|
|
33
37
|
] });
|
|
34
38
|
};
|
|
35
39
|
export {
|
|
36
|
-
|
|
40
|
+
FetcherResultView
|
|
37
41
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { Modal
|
|
3
|
-
import { memo
|
|
4
|
-
import { FetcherResultView
|
|
5
|
-
const
|
|
6
|
-
const { fetcherResultView
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Modal, Paper } from "@mui/material";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { FetcherResultView } from "./FetcherResultView.js";
|
|
5
|
+
const PreviewModal = ({ result, slotProps = {}, fetcherId, onClose, open = false, ...otherProps }) => {
|
|
6
|
+
const { fetcherResultView, ...modalSlotProps } = slotProps;
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Modal,
|
|
9
9
|
{
|
|
10
|
-
open
|
|
10
|
+
open,
|
|
11
11
|
sx: [
|
|
12
12
|
{ display: "flex", alignItems: "center", justifyContent: "center" },
|
|
13
|
-
...Array.isArray(
|
|
13
|
+
...Array.isArray(otherProps == null ? void 0 : otherProps.sx) ? otherProps == null ? void 0 : otherProps.sx : [otherProps == null ? void 0 : otherProps.sx]
|
|
14
14
|
],
|
|
15
|
-
onClose
|
|
16
|
-
slotProps:
|
|
17
|
-
...
|
|
18
|
-
children: /* @__PURE__ */
|
|
15
|
+
onClose,
|
|
16
|
+
slotProps: modalSlotProps,
|
|
17
|
+
...otherProps,
|
|
18
|
+
children: /* @__PURE__ */ jsx(Paper, { sx: { maxHeight: "90%", maxWidth: "90%", p: 2, overflow: "auto" }, children: /* @__PURE__ */ jsx(FetcherResultView, { ...fetcherResultView ?? {}, result, fetcherId }) })
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
|
+
const PreviewModal$1 = memo(PreviewModal);
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
PreviewModal$1 as default
|
|
24
25
|
};
|