@sanity/workflow-studio-plugin 0.32.0 → 0.34.0
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/CHANGELOG.md +170 -0
- package/README.md +51 -5
- package/dist/_chunks-cjs/index.cjs +1850 -409
- package/dist/_chunks-cjs/workflows-tool-root.cjs +180 -1676
- package/dist/_chunks-es/index.js +1720 -292
- package/dist/_chunks-es/workflows-tool-root.js +123 -1620
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +272 -14
- package/dist/index.d.ts +272 -14
- package/dist/index.js +2 -2
- package/package.json +29 -23
package/dist/_chunks-es/index.js
CHANGED
|
@@ -2,23 +2,23 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
|
|
3
3
|
import { TimelineIcon } from "@sanity/icons/Timeline";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useClickOutsideEvent, Box, Flex, TextInput, Button, Select, Checkbox, Text, Stack, Card, TextArea, Dialog, Switch, useTheme_v2, TextSkeleton, Badge, Spinner, useElementSize, TabList, Tab, TabPanel } from "@sanity/ui";
|
|
6
6
|
|
|
7
7
|
import { editFieldTarget, useWorkflowTelemetry, useRefcountedIds } from "@sanity/workflow-react";
|
|
8
8
|
|
|
9
|
-
import { createContext, useContext, useEffect, useSyncExternalStore, useCallback, Fragment as Fragment$1, useRef, useMemo, useState, createElement, isValidElement, useId, useLayoutEffect, Component, useEffectEvent, lazy, Suspense } from "react";
|
|
9
|
+
import { createContext, useContext, useEffect, useSyncExternalStore, useCallback, Fragment as Fragment$1, useRef, useMemo, useState, createElement, isValidElement, useId, useLayoutEffect, Component, useEffectEvent, lazy, Suspense, memo } from "react";
|
|
10
10
|
|
|
11
11
|
import { usePaneRouter } from "sanity/structure";
|
|
12
12
|
|
|
13
|
-
import { WORKFLOW_INSTANCE_TYPE, WORKFLOW_DEFINITION_TYPE, GUARD_DOC_TYPE, tryParseGdr, resourceFromParsed, latestDeployedDefinitions, isStartableDefinition, isSubjectEntry, isInputSourced, acceptsDocumentType, initialFieldIssues, gdrRef, releaseRef, refKindAcceptsTypes, rejectedRefTypes, ActionDisabledError, MutationGuardDeniedError, EditFieldDeniedError, errorMessage, actionRendering, terminalState, findOpenStageEntry, isTodoListEntry, isTodoListItem, isTerminalActivityStatus, assignmentMembers, describeCondition, sentenceCase, checklistLines, findCurrentActivityEntry, ENGINE_API_VERSION, userLoginProvider, classifyPrincipalId, scalarValidationIssues, toBareId, findStageNode, findActivityNode, isSingleDocRefEntry, isGdr, resolveFieldEntry, isSingleDocRefKind, isNotesEntry, remediationsFor, diagnoseInstance, diagnoseInputFromEvaluation, documentStuckCause, parseDefinitionSnapshot, isUnprimed, isTerminalStage, DEFAULT_TRANSITION_WHEN, instancesQuery, assertReadableModel, projectStartSliceRow, StartNotSettledError, StartNotAllowedError, isRevisionConflict, humanize, unboundRequirementReads, explainStartRequirement, singleSubjectRequirementRefused, evaluateStartFilter, startKindOf, hasSingleSubjectRequirement, readsRootDocument, latestDefinitionsGroq, gdrFromResource, subscriptionDocumentsForInstance, aclPathForResource, documentActionDenials, definitionLookupGroq, instanceDocId, missingRequiredInputs, clientGuardDereference } from "@sanity/workflow-engine";
|
|
13
|
+
import { WORKFLOW_INSTANCE_TYPE, WORKFLOW_DEFINITION_TYPE, GUARD_DOC_TYPE, tryParseGdr, resourceFromParsed, latestDeployedDefinitions, isStartableDefinition, isSubjectEntry, isInputSourced, acceptsDocumentType, initialFieldIssues, gdrRef, releaseRef, refKindAcceptsTypes, rejectedRefTypes, ActionDisabledError, MutationGuardDeniedError, EditFieldDeniedError, errorMessage, actionRendering, terminalState, findOpenStageEntry, isTodoListEntry, isTodoListItem, isTerminalActivityStatus, assignmentMembers, describeCondition, sentenceCase, checklistLines, findCurrentActivityEntry, ENGINE_API_VERSION, userLoginProvider, classifyPrincipalId, scalarValidationIssues, toBareId, findStageNode, findActivityNode, isSingleDocRefEntry, isGdr, resolveFieldEntry, isSingleDocRefKind, isNotesEntry, remediationsFor, _additionalMissingDocuments, _missingDocumentsSummary, diagnoseInstance, diagnoseInputFromEvaluation, documentStuckCause, parseDefinitionSnapshot, isUnprimed, isTerminalStage, DEFAULT_TRANSITION_WHEN, instancesQuery, assertReadableModel, projectStartSliceRow, StartNotSettledError, StartNotAllowedError, isRevisionConflict, humanize, unboundRequirementReads, explainStartRequirement, singleSubjectRequirementRefused, evaluateStartFilter, startKindOf, hasSingleSubjectRequirement, readsRootDocument, latestDefinitionsGroq, gdrFromResource, subscriptionDocumentsForInstance, aclPathForResource, documentActionDenials, definitionLookupGroq, instanceDocId, missingRequiredInputs, clientGuardDereference, deriveWorkflowAutonomy, deriveExecutorClassification, entryDocRefs, openActivityAssignments, assignmentState, activeAssignmentMembers } from "@sanity/workflow-engine";
|
|
14
14
|
|
|
15
15
|
import { CheckmarkIcon } from "@sanity/icons/Checkmark";
|
|
16
16
|
|
|
17
17
|
import { CloseIcon } from "@sanity/icons/Close";
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { _formatShortDateTime, assignmentMatch, sameAssignee, projectMemberRow, providerTitle, ClearableDatePicker, AssigneePicker as AssigneePicker$1, MemberPicker as MemberPicker$1, MemberAvatar, _HoverHint, AssigneeBadges as AssigneeBadges$1, AssigneeBadge as AssigneeBadge$1, _useDelayedFlag, ProgressBar, memberRoleFor, AssigneeStack, roleLabel, ActivityStatusIcon, clampProgress, MemberAvatarGroup, progressCaption, DatePicker, roleLabelFor, roleListLabel, AgoStamp, StartIncompleteBadge, _CheckmarkCircleFilledIcon, _shortSpanOf, roleMemberCount, memberCountLabel, _formatShortAgo } from "@sanity/workflow-components";
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
|
|
22
22
|
|
|
23
23
|
import { getPublishedId, getDraftId } from "@sanity/client/csm";
|
|
24
24
|
|
|
@@ -30,16 +30,24 @@ import { useCurrentUser, Preview, useValuePreview, SanityDefaultPreview, useClie
|
|
|
30
30
|
|
|
31
31
|
import { CalendarIcon } from "@sanity/icons/Calendar";
|
|
32
32
|
|
|
33
|
+
import { Popover } from "@sanity/ui/popover";
|
|
34
|
+
|
|
33
35
|
import { UserIcon } from "@sanity/icons/User";
|
|
34
36
|
|
|
35
37
|
import { SearchIcon } from "@sanity/icons/Search";
|
|
36
38
|
|
|
39
|
+
import { Autocomplete } from "@sanity/ui/autocomplete";
|
|
40
|
+
|
|
41
|
+
import { useToast } from "@sanity/ui/toast";
|
|
42
|
+
|
|
37
43
|
import { EditIcon } from "@sanity/icons/Edit";
|
|
38
44
|
|
|
39
45
|
import { randomKey } from "@sanity/util/content";
|
|
40
46
|
|
|
41
47
|
import { InfoOutlineIcon } from "@sanity/icons/InfoOutline";
|
|
42
48
|
|
|
49
|
+
import { Code } from "@sanity/ui/code";
|
|
50
|
+
|
|
43
51
|
import { DocumentIcon } from "@sanity/icons/Document";
|
|
44
52
|
|
|
45
53
|
import { WarningOutlineIcon } from "@sanity/icons/WarningOutline";
|
|
@@ -48,16 +56,12 @@ import { IntentLink, route } from "sanity/router";
|
|
|
48
56
|
|
|
49
57
|
import { isDocumentSchemaType } from "@sanity/types";
|
|
50
58
|
|
|
59
|
+
import { useKeyed } from "@sanity/workflow-react/observer";
|
|
60
|
+
|
|
51
61
|
import { LaunchIcon } from "@sanity/icons/Launch";
|
|
52
62
|
|
|
53
63
|
import { ErrorOutlineIcon } from "@sanity/icons/ErrorOutline";
|
|
54
64
|
|
|
55
|
-
import { EmptyIcon } from "@sanity/icons/Empty";
|
|
56
|
-
|
|
57
|
-
import { ErrorFilledIcon } from "@sanity/icons/ErrorFilled";
|
|
58
|
-
|
|
59
|
-
import { RemoveCircleIcon } from "@sanity/icons/RemoveCircle";
|
|
60
|
-
|
|
61
65
|
import { AddUserIcon } from "@sanity/icons/AddUser";
|
|
62
66
|
|
|
63
67
|
import { AddIcon } from "@sanity/icons/Add";
|
|
@@ -70,6 +74,8 @@ import { BoltIcon } from "@sanity/icons/Bolt";
|
|
|
70
74
|
|
|
71
75
|
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
72
76
|
|
|
77
|
+
import { MenuButton, Menu, MenuItem, MenuDivider } from "@sanity/ui/menu";
|
|
78
|
+
|
|
73
79
|
import pluralize from "pluralize-esm";
|
|
74
80
|
|
|
75
81
|
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
|
|
@@ -86,10 +92,14 @@ import { ArrowUpIcon } from "@sanity/icons/ArrowUp";
|
|
|
86
92
|
|
|
87
93
|
import { of } from "rxjs";
|
|
88
94
|
|
|
89
|
-
import { switchMap, distinctUntilChanged } from "rxjs/operators";
|
|
95
|
+
import { switchMap, startWith, distinctUntilChanged } from "rxjs/operators";
|
|
90
96
|
|
|
91
97
|
import { TransferIcon } from "@sanity/icons/Transfer";
|
|
92
98
|
|
|
99
|
+
import { UsersIcon } from "@sanity/icons/Users";
|
|
100
|
+
|
|
101
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
102
|
+
|
|
93
103
|
const WORKFLOW_SYSTEM_TYPES = [ WORKFLOW_INSTANCE_TYPE, WORKFLOW_DEFINITION_TYPE, GUARD_DOC_TYPE ];
|
|
94
104
|
|
|
95
105
|
function contentDocumentTypes(schema) {
|
|
@@ -464,17 +474,6 @@ function formatDateTime(value) {
|
|
|
464
474
|
return Number.isNaN(d.getTime()) ? "—" : d.toLocaleString();
|
|
465
475
|
}
|
|
466
476
|
|
|
467
|
-
function formatShortDateTime(value) {
|
|
468
|
-
const d = new Date(value);
|
|
469
|
-
return Number.isNaN(d.getTime()) ? "—" : d.toLocaleString(void 0, {
|
|
470
|
-
day: "numeric",
|
|
471
|
-
month: "short",
|
|
472
|
-
year: "numeric",
|
|
473
|
-
hour: "2-digit",
|
|
474
|
-
minute: "2-digit"
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
|
|
478
477
|
function formatTimeAgo(value) {
|
|
479
478
|
const d = new Date(value);
|
|
480
479
|
return Number.isNaN(d.getTime()) ? "" : formatDistanceToNow(d, {
|
|
@@ -482,32 +481,13 @@ function formatTimeAgo(value) {
|
|
|
482
481
|
});
|
|
483
482
|
}
|
|
484
483
|
|
|
485
|
-
function formatShortAgo(value, now) {
|
|
486
|
-
const span = formatShortSpan(value, now);
|
|
487
|
-
return span === "—" ? "—" : span === "now" ? "just now" : `${span} ago`;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
function formatShortSpan(value, now) {
|
|
491
|
-
return shortSpanOf(new Date(value), now);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
function shortSpanOf(from, now) {
|
|
495
|
-
if (from === void 0 || Number.isNaN(from.getTime())) return "—";
|
|
496
|
-
const seconds = Math.floor((now.getTime() - from.getTime()) / 1e3);
|
|
497
|
-
if (seconds < 60) return "now";
|
|
498
|
-
const minutes = Math.floor(seconds / 60);
|
|
499
|
-
if (minutes < 60) return `${minutes}m`;
|
|
500
|
-
const hours = Math.floor(minutes / 60);
|
|
501
|
-
return hours < 24 ? `${hours}h` : `${Math.floor(hours / 24)}d`;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
484
|
function stampFace(verb, at) {
|
|
505
485
|
const ago = formatTimeAgo(at);
|
|
506
486
|
return ago === "" ? {
|
|
507
|
-
lead: `${verb} ${
|
|
487
|
+
lead: `${verb} ${_formatShortDateTime(at)}`
|
|
508
488
|
} : {
|
|
509
489
|
lead: `${verb} ${ago}`,
|
|
510
|
-
detail:
|
|
490
|
+
detail: _formatShortDateTime(at)
|
|
511
491
|
};
|
|
512
492
|
}
|
|
513
493
|
|
|
@@ -522,7 +502,7 @@ function formatDate(value) {
|
|
|
522
502
|
}
|
|
523
503
|
|
|
524
504
|
function formatDueMoment(value) {
|
|
525
|
-
return storedDateKind(value) === "date" ? formatDate(value) :
|
|
505
|
+
return storedDateKind(value) === "date" ? formatDate(value) : _formatShortDateTime(value);
|
|
526
506
|
}
|
|
527
507
|
|
|
528
508
|
function dueMomentSentence(value, now) {
|
|
@@ -1656,105 +1636,6 @@ function buildParams(decls, values) {
|
|
|
1656
1636
|
};
|
|
1657
1637
|
}
|
|
1658
1638
|
|
|
1659
|
-
const LOADING_CUE_DELAY_MS = 400;
|
|
1660
|
-
|
|
1661
|
-
function useDelayedFlag(active, delayMs) {
|
|
1662
|
-
const [held, setHeld] = useState(!1);
|
|
1663
|
-
return useEffect(() => {
|
|
1664
|
-
if (!active) {
|
|
1665
|
-
setHeld(!1);
|
|
1666
|
-
return;
|
|
1667
|
-
}
|
|
1668
|
-
const timer = setTimeout(() => setHeld(!0), delayMs);
|
|
1669
|
-
return () => clearTimeout(timer);
|
|
1670
|
-
}, [ active, delayMs ]), held && active;
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
const NEVER_MS = 2 ** 31 - 1, OPEN_DELAY_MS = 300;
|
|
1674
|
-
|
|
1675
|
-
function HoverHint(props) {
|
|
1676
|
-
return props.anchor !== void 0 ? /* @__PURE__ */ jsx(AnchoredHint, {
|
|
1677
|
-
...props
|
|
1678
|
-
}) : /* @__PURE__ */ jsx(WrappingHint, {
|
|
1679
|
-
...props
|
|
1680
|
-
});
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
function AnchoredHint(props) {
|
|
1684
|
-
const {disabled: disabled = !1} = props, open = useDelayedFlag(props.open === !0 && !disabled, OPEN_DELAY_MS);
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
return jsx(Popover, {
|
|
1687
|
-
animate: !0,
|
|
1688
|
-
content: /* @__PURE__ */ jsx(HintBody, {
|
|
1689
|
-
...props
|
|
1690
|
-
}),
|
|
1691
|
-
open: open,
|
|
1692
|
-
padding: hintPadding(props),
|
|
1693
|
-
placement: props.placement ?? "top",
|
|
1694
|
-
portal: !0,
|
|
1695
|
-
radius: 3,
|
|
1696
|
-
referenceElement: props.anchor
|
|
1697
|
-
});
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
function hintPadding(props) {
|
|
1701
|
-
return props.content !== void 0 && props.flush ? 0 : 2;
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
function WrappingHint(props) {
|
|
1705
|
-
const {children: children, disabled: disabled = !1} = props;
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
return jsx(Tooltip, {
|
|
1708
|
-
animate: !0,
|
|
1709
|
-
content: disabled ? null : /* @__PURE__ */ jsx(HintBody, {
|
|
1710
|
-
...props
|
|
1711
|
-
}),
|
|
1712
|
-
delay: {
|
|
1713
|
-
close: 0,
|
|
1714
|
-
open: disabled ? NEVER_MS : OPEN_DELAY_MS
|
|
1715
|
-
},
|
|
1716
|
-
padding: hintPadding(props),
|
|
1717
|
-
placement: props.placement ?? "top",
|
|
1718
|
-
portal: !0,
|
|
1719
|
-
radius: 3,
|
|
1720
|
-
children: /* @__PURE__ */ jsx(Box, {
|
|
1721
|
-
"data-testid": props["data-testid"],
|
|
1722
|
-
style: {
|
|
1723
|
-
display: props.fill ? "flex" : "inline-flex",
|
|
1724
|
-
maxWidth: "100%",
|
|
1725
|
-
...props.fill ? {
|
|
1726
|
-
width: "100%"
|
|
1727
|
-
} : {}
|
|
1728
|
-
},
|
|
1729
|
-
children: children
|
|
1730
|
-
})
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
function HintBody(props) {
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
return jsx(Box, {
|
|
1737
|
-
style: {
|
|
1738
|
-
maxWidth: props.content !== void 0 && props.wide ? 400 : 280
|
|
1739
|
-
},
|
|
1740
|
-
children: props.content !== void 0 ? props.content : /* @__PURE__ */ jsxs(Stack, {
|
|
1741
|
-
gap: 3,
|
|
1742
|
-
children: [
|
|
1743
|
-
/* @__PURE__ */ jsx(Text, {
|
|
1744
|
-
size: 1,
|
|
1745
|
-
...props.textWeight === void 0 ? {} : {
|
|
1746
|
-
weight: props.textWeight
|
|
1747
|
-
},
|
|
1748
|
-
children: props.text
|
|
1749
|
-
}), props.description === void 0 ? null : /* @__PURE__ */ jsx(Text, {
|
|
1750
|
-
muted: !0,
|
|
1751
|
-
size: 1,
|
|
1752
|
-
children: props.description
|
|
1753
|
-
}) ]
|
|
1754
|
-
})
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
1639
|
function textInputFacet(kind) {
|
|
1759
1640
|
return kind === "number" || kind === "progress" ? {
|
|
1760
1641
|
type: "number"
|
|
@@ -2163,7 +2044,7 @@ function DocRefsInput({value: value, onChange: onChange, types: types}) {
|
|
|
2163
2044
|
type: ref.type
|
|
2164
2045
|
})
|
|
2165
2046
|
}),
|
|
2166
|
-
/* @__PURE__ */ jsx(
|
|
2047
|
+
/* @__PURE__ */ jsx(_HoverHint, {
|
|
2167
2048
|
text: "Remove",
|
|
2168
2049
|
children: /* @__PURE__ */ jsx(Button, {
|
|
2169
2050
|
"aria-label": "Remove",
|
|
@@ -2497,7 +2378,7 @@ function DisabledActionButton({actionEval: actionEval, activity: activity, chrom
|
|
|
2497
2378
|
...spanTriggerProps(chrome),
|
|
2498
2379
|
disabled: !0
|
|
2499
2380
|
});
|
|
2500
|
-
return actionEval.disabledReason ? /* @__PURE__ */ jsx(
|
|
2381
|
+
return actionEval.disabledReason ? /* @__PURE__ */ jsx(_HoverHint, {
|
|
2501
2382
|
text: describeDisabledReason(actionEval.disabledReason),
|
|
2502
2383
|
children: button
|
|
2503
2384
|
}) : button;
|
|
@@ -2519,7 +2400,7 @@ function PlainActionButton({actionEval: actionEval, instanceId: instanceId, acti
|
|
|
2519
2400
|
surface: surface,
|
|
2520
2401
|
tone: btn.tone
|
|
2521
2402
|
});
|
|
2522
|
-
return action.description ? /* @__PURE__ */ jsx(
|
|
2403
|
+
return action.description ? /* @__PURE__ */ jsx(_HoverHint, {
|
|
2523
2404
|
text: action.description,
|
|
2524
2405
|
children: button
|
|
2525
2406
|
}) : button;
|
|
@@ -2699,10 +2580,10 @@ function InfoHint({content: content, label: label}) {
|
|
|
2699
2580
|
size: 0,
|
|
2700
2581
|
children: /* @__PURE__ */ jsx(InfoOutlineIcon, {})
|
|
2701
2582
|
});
|
|
2702
|
-
return typeof content == "string" ? /* @__PURE__ */ jsx(
|
|
2583
|
+
return typeof content == "string" ? /* @__PURE__ */ jsx(_HoverHint, {
|
|
2703
2584
|
text: content,
|
|
2704
2585
|
children: icon
|
|
2705
|
-
}) : /* @__PURE__ */ jsx(
|
|
2586
|
+
}) : /* @__PURE__ */ jsx(_HoverHint, {
|
|
2706
2587
|
content: content,
|
|
2707
2588
|
children: icon
|
|
2708
2589
|
});
|
|
@@ -2802,6 +2683,8 @@ function FieldInput$1({kind: kind, value: value, onChange: onChange, onEnter: on
|
|
|
2802
2683
|
}
|
|
2803
2684
|
}
|
|
2804
2685
|
|
|
2686
|
+
const LOADING_CUE_DELAY_MS = 400;
|
|
2687
|
+
|
|
2805
2688
|
function isCompact(layout) {
|
|
2806
2689
|
return layout === "inline" || layout === "row";
|
|
2807
2690
|
}
|
|
@@ -2913,7 +2796,7 @@ function useChipTrim() {
|
|
|
2913
2796
|
|
|
2914
2797
|
function LinkChip({hint: hint, children: children, as: as = "a", fill: fill = !1, ...anchorProps}) {
|
|
2915
2798
|
/* @__PURE__ */
|
|
2916
|
-
return jsx(
|
|
2799
|
+
return jsx(_HoverHint, {
|
|
2917
2800
|
fill: fill,
|
|
2918
2801
|
text: hint,
|
|
2919
2802
|
children: /* @__PURE__ */ jsx(Card, {
|
|
@@ -2939,6 +2822,8 @@ function LinkChip({hint: hint, children: children, as: as = "a", fill: fill = !1
|
|
|
2939
2822
|
});
|
|
2940
2823
|
}
|
|
2941
2824
|
|
|
2825
|
+
const UNREADABLE_DOCUMENT = /* @__PURE__ */ Symbol("unreadable document");
|
|
2826
|
+
|
|
2942
2827
|
function docLinkState(input) {
|
|
2943
2828
|
const {bareId: bareId, resource: resource} = input;
|
|
2944
2829
|
if (bareId === void 0 || resource === void 0) return {
|
|
@@ -2981,6 +2866,23 @@ function openableSchemaType(schema, typeName) {
|
|
|
2981
2866
|
if (!(entry === void 0 || !isDocumentSchemaType(entry) || entry.name === "document")) return entry;
|
|
2982
2867
|
}
|
|
2983
2868
|
|
|
2869
|
+
function snapshotOf(store, ids) {
|
|
2870
|
+
let snapshot = /* @__PURE__ */ new Map;
|
|
2871
|
+
return () => {
|
|
2872
|
+
const next = new Map(ids.map(id => [ id, store.read(id) ]));
|
|
2873
|
+
return (next.size !== snapshot.size || ids.some(id => next.get(id) !== snapshot.get(id))) && (snapshot = next),
|
|
2874
|
+
snapshot;
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
function useActualDocTypes(ids) {
|
|
2879
|
+
const {actualTypes: actualTypes} = useWorkflowContext(), uniqueIds2 = [ ...new Set(ids) ].sort(), trackedIds = useKeyed([ JSON.stringify(uniqueIds2) ], () => uniqueIds2);
|
|
2880
|
+
return useEffect(() => {
|
|
2881
|
+
const releases = trackedIds.map(id => actualTypes.track(id));
|
|
2882
|
+
return () => releases.forEach(release => release());
|
|
2883
|
+
}, [ actualTypes, trackedIds ]), useSyncExternalStore(actualTypes.subscribe, useMemo(() => snapshotOf(actualTypes, trackedIds), [ actualTypes, trackedIds ]));
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2984
2886
|
function useLocalDocRef(gdr) {
|
|
2985
2887
|
const {binding: binding} = useWorkflowContext(), schema = useSchema(), schemaType = gdr === void 0 ? void 0 : schema.get(gdr.type);
|
|
2986
2888
|
return {
|
|
@@ -2991,10 +2893,8 @@ function useLocalDocRef(gdr) {
|
|
|
2991
2893
|
}
|
|
2992
2894
|
|
|
2993
2895
|
function useActualDocType(bareId) {
|
|
2994
|
-
const
|
|
2995
|
-
return
|
|
2996
|
-
if (bareId !== null) return actualTypes.track(bareId);
|
|
2997
|
-
}, [ actualTypes, bareId ]), useSyncExternalStore(actualTypes.subscribe, useCallback(() => bareId === null ? void 0 : actualTypes.read(bareId), [ actualTypes, bareId ]));
|
|
2896
|
+
const ids = useMemo(() => bareId === null ? [] : [ bareId ], [ bareId ]);
|
|
2897
|
+
return useActualDocTypes(ids).get(bareId ?? "");
|
|
2998
2898
|
}
|
|
2999
2899
|
|
|
3000
2900
|
function useDocLink(gdr) {
|
|
@@ -3151,7 +3051,7 @@ function CompactDocRef({face: face, fill: fill, link: link, onClick: onClick}) {
|
|
|
3151
3051
|
const PENDING_FACE_MAX_WAIT_MS = 4e3;
|
|
3152
3052
|
|
|
3153
3053
|
function PendingDocFace({bareId: bareId, layout: layout}) {
|
|
3154
|
-
const expired =
|
|
3054
|
+
const expired = _useDelayedFlag(!0, PENDING_FACE_MAX_WAIT_MS), compact = isCompact(layout);
|
|
3155
3055
|
if (expired) {
|
|
3156
3056
|
const id = /* @__PURE__ */ jsx(Text, {
|
|
3157
3057
|
muted: !0,
|
|
@@ -3690,7 +3590,7 @@ function EditableFieldControl({instanceId: instanceId, field: field, surface: su
|
|
|
3690
3590
|
|
|
3691
3591
|
function EditableValueButton({children: children, hint: hint, hintDisabled: hintDisabled = !1, onClick: onClick}) {
|
|
3692
3592
|
/* @__PURE__ */
|
|
3693
|
-
return jsx(
|
|
3593
|
+
return jsx(_HoverHint, {
|
|
3694
3594
|
disabled: hintDisabled,
|
|
3695
3595
|
text: hint,
|
|
3696
3596
|
children: /* @__PURE__ */ jsx(Button, {
|
|
@@ -3974,7 +3874,7 @@ function FieldEditRow({field: field, onSave: onSave, onCancel: onCancel, saving:
|
|
|
3974
3874
|
}
|
|
3975
3875
|
})
|
|
3976
3876
|
}),
|
|
3977
|
-
/* @__PURE__ */ jsx(
|
|
3877
|
+
/* @__PURE__ */ jsx(_HoverHint, {
|
|
3978
3878
|
text: "Save",
|
|
3979
3879
|
children: /* @__PURE__ */ jsx(Button, {
|
|
3980
3880
|
"aria-label": "Save",
|
|
@@ -3986,7 +3886,7 @@ function FieldEditRow({field: field, onSave: onSave, onCancel: onCancel, saving:
|
|
|
3986
3886
|
padding: 2
|
|
3987
3887
|
})
|
|
3988
3888
|
}),
|
|
3989
|
-
/* @__PURE__ */ jsx(
|
|
3889
|
+
/* @__PURE__ */ jsx(_HoverHint, {
|
|
3990
3890
|
text: "Cancel",
|
|
3991
3891
|
children: /* @__PURE__ */ jsx(Button, {
|
|
3992
3892
|
"aria-label": "Cancel",
|
|
@@ -4194,7 +4094,7 @@ const ACTION_LABEL = {
|
|
|
4194
4094
|
"set-stage": "Move the workflow on to its next stage yourself."
|
|
4195
4095
|
};
|
|
4196
4096
|
|
|
4197
|
-
function detailOf(cause) {
|
|
4097
|
+
function detailOf(cause, missingSummary) {
|
|
4198
4098
|
switch (cause.kind) {
|
|
4199
4099
|
case "failed-effect":
|
|
4200
4100
|
return `The step “${effectLabel(cause.effect)}” failed`;
|
|
@@ -4206,12 +4106,15 @@ function detailOf(cause) {
|
|
|
4206
4106
|
return "This task failed";
|
|
4207
4107
|
|
|
4208
4108
|
default:
|
|
4209
|
-
return summaryOf(cause);
|
|
4109
|
+
return summaryOf(cause, missingSummary);
|
|
4210
4110
|
}
|
|
4211
4111
|
}
|
|
4212
4112
|
|
|
4213
|
-
function summaryOf(cause) {
|
|
4113
|
+
function summaryOf(cause, missingSummary) {
|
|
4214
4114
|
switch (cause.kind) {
|
|
4115
|
+
case "document-missing":
|
|
4116
|
+
return missingSummary;
|
|
4117
|
+
|
|
4215
4118
|
case "failed-effect":
|
|
4216
4119
|
return "An automated step failed";
|
|
4217
4120
|
|
|
@@ -4229,6 +4132,10 @@ function summaryOf(cause) {
|
|
|
4229
4132
|
}
|
|
4230
4133
|
}
|
|
4231
4134
|
|
|
4135
|
+
function withMissingDocuments(title, missingSummary) {
|
|
4136
|
+
return missingSummary ? `${title}. ${missingSummary}` : title;
|
|
4137
|
+
}
|
|
4138
|
+
|
|
4232
4139
|
function activityDeclaringEffect(args) {
|
|
4233
4140
|
return findStageNode(args)?.activities?.find(activity => (activity.actions ?? []).some(action => (action.effects ?? []).some(effect => effect.name === args.effectName)))?.name;
|
|
4234
4141
|
}
|
|
@@ -4262,15 +4169,15 @@ function diagnosisOf(args) {
|
|
|
4262
4169
|
function instanceFault(args) {
|
|
4263
4170
|
const diagnosis = diagnosisOf(args);
|
|
4264
4171
|
if (diagnosis === void 0 || diagnosis.state !== "stuck") return;
|
|
4265
|
-
const verbs = remediationsFor(diagnosis).map(remediation2 => remediation2.verb);
|
|
4172
|
+
const verbs = remediationsFor(diagnosis).map(remediation2 => remediation2.verb), additional = _additionalMissingDocuments(diagnosis, args.evaluation?.missingDocuments), missingSummary = _missingDocumentsSummary(diagnosis.cause.kind === "document-missing" ? diagnosis.cause.documents : additional), additionalSummary = additional.length > 0 ? missingSummary : "";
|
|
4266
4173
|
return {
|
|
4267
4174
|
activity: faultingActivity({
|
|
4268
4175
|
cause: diagnosis.cause,
|
|
4269
4176
|
definition: args.definition,
|
|
4270
4177
|
stageName: args.instance.currentStage
|
|
4271
4178
|
}),
|
|
4272
|
-
detail: detailOf(diagnosis.cause),
|
|
4273
|
-
summary: summaryOf(diagnosis.cause),
|
|
4179
|
+
detail: withMissingDocuments(detailOf(diagnosis.cause, missingSummary), additionalSummary),
|
|
4180
|
+
summary: withMissingDocuments(summaryOf(diagnosis.cause, missingSummary), additionalSummary),
|
|
4274
4181
|
remedies: verbs.flatMap(verb => REMEDY_TEXT[verb] ?? []),
|
|
4275
4182
|
actions: verbs.flatMap(verb => isRunnable(verb) ? [ {
|
|
4276
4183
|
verb: verb,
|
|
@@ -4315,7 +4222,7 @@ function AbortedBadge({instance: instance}) {
|
|
|
4315
4222
|
|
|
4316
4223
|
function OlderDefinitionBadge({instance: instance}) {
|
|
4317
4224
|
const {latestDefinitionVersions: latestDefinitionVersions} = useWorkflowContext(), latest = latestDefinitionVersions.get(instance.definition);
|
|
4318
|
-
return latest === void 0 || latest <= instance.pinnedVersion ? null : /* @__PURE__ */ jsx(
|
|
4225
|
+
return latest === void 0 || latest <= instance.pinnedVersion ? null : /* @__PURE__ */ jsx(_HoverHint, {
|
|
4319
4226
|
description: "Running workflows keep the version they started on",
|
|
4320
4227
|
text: `Started on v${instance.pinnedVersion}, latest is now v${latest}`,
|
|
4321
4228
|
textWeight: "medium",
|
|
@@ -4470,7 +4377,7 @@ function RowAssignees({assignees: assignees, hint: hint}) {
|
|
|
4470
4377
|
if (ids.length === 0 && roles.length === 0) return null;
|
|
4471
4378
|
const bothKinds = roles.length > 0 && displays.length > 0;
|
|
4472
4379
|
/* @__PURE__ */
|
|
4473
|
-
return jsx(
|
|
4380
|
+
return jsx(_HoverHint, {
|
|
4474
4381
|
content: /* @__PURE__ */ jsxs(Stack, {
|
|
4475
4382
|
gap: 3,
|
|
4476
4383
|
children: [ roles.length > 0 ? /* @__PURE__ */ jsx(HintSection, {
|
|
@@ -4539,61 +4446,8 @@ function OverlineHeading({children: children}) {
|
|
|
4539
4446
|
});
|
|
4540
4447
|
}
|
|
4541
4448
|
|
|
4542
|
-
function CheckmarkCircleFilledIcon(props) {
|
|
4543
|
-
/* @__PURE__ */
|
|
4544
|
-
return jsx("svg", {
|
|
4545
|
-
"data-sanity-icon": "checkmark-circle-filled",
|
|
4546
|
-
fill: "none",
|
|
4547
|
-
height: "1em",
|
|
4548
|
-
viewBox: "0 0 25 25",
|
|
4549
|
-
width: "1em",
|
|
4550
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4551
|
-
...props,
|
|
4552
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
4553
|
-
clipRule: "evenodd",
|
|
4554
|
-
d: "M4 12.5C4 7.80558 7.80558 4 12.5 4C17.1944 4 21 7.80558 21 12.5C21 17.1944 17.1944 21 12.5 21C7.80558 21 4 17.1944 4 12.5ZM9.9358 11.7192L11.7414 13.6271L15.5642 9.5876L16.4358 10.4124L12.1772 14.9124C11.9406 15.1624 11.5422 15.1624 11.3056 14.9124L9.0642 12.544L9.9358 11.7192Z",
|
|
4555
|
-
fill: "currentColor",
|
|
4556
|
-
fillRule: "evenodd"
|
|
4557
|
-
})
|
|
4558
|
-
});
|
|
4559
|
-
}
|
|
4560
|
-
|
|
4561
|
-
const STATUS_ICON = /* @__PURE__ */ new Map([ [ "active", {
|
|
4562
|
-
icon: EmptyIcon,
|
|
4563
|
-
muted: !1
|
|
4564
|
-
} ], [ "done", {
|
|
4565
|
-
icon: CheckmarkCircleFilledIcon,
|
|
4566
|
-
muted: !1
|
|
4567
|
-
} ], [ "failed", {
|
|
4568
|
-
icon: ErrorFilledIcon,
|
|
4569
|
-
muted: !1
|
|
4570
|
-
} ], [ "skipped", {
|
|
4571
|
-
icon: RemoveCircleIcon,
|
|
4572
|
-
muted: !0
|
|
4573
|
-
} ] ]);
|
|
4574
|
-
|
|
4575
|
-
function ActivityStatusIcon({status: status}) {
|
|
4576
|
-
const {icon: Icon, muted: muted} = STATUS_ICON.get(status) ?? {
|
|
4577
|
-
icon: EmptyIcon,
|
|
4578
|
-
muted: !0
|
|
4579
|
-
};
|
|
4580
|
-
return status === "failed" ? /* @__PURE__ */ jsx(TextWithTone, {
|
|
4581
|
-
size: 1,
|
|
4582
|
-
tone: "critical",
|
|
4583
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
4584
|
-
style: {
|
|
4585
|
-
color: "inherit"
|
|
4586
|
-
}
|
|
4587
|
-
})
|
|
4588
|
-
}) : /* @__PURE__ */ jsx(Text, {
|
|
4589
|
-
muted: muted,
|
|
4590
|
-
size: 1,
|
|
4591
|
-
children: /* @__PURE__ */ jsx(Icon, {})
|
|
4592
|
-
});
|
|
4593
|
-
}
|
|
4594
|
-
|
|
4595
4449
|
function SpinnerSlot({busy: busy, reserve: reserve = !0}) {
|
|
4596
|
-
const size = useTextIconSize(), trim = useCapTrimFor(size), spinning =
|
|
4450
|
+
const size = useTextIconSize(), trim = useCapTrimFor(size), spinning = _useDelayedFlag(busy, LOADING_CUE_DELAY_MS);
|
|
4597
4451
|
return !spinning && !reserve ? null : /* @__PURE__ */ jsx(Flex, {
|
|
4598
4452
|
align: "center",
|
|
4599
4453
|
flex: "none",
|
|
@@ -4612,7 +4466,7 @@ function SpinnerSlot({busy: busy, reserve: reserve = !0}) {
|
|
|
4612
4466
|
}
|
|
4613
4467
|
|
|
4614
4468
|
function LoadingRow({label: label, padding: padding}) {
|
|
4615
|
-
const announced =
|
|
4469
|
+
const announced = _useDelayedFlag(!0, LOADING_CUE_DELAY_MS);
|
|
4616
4470
|
/* @__PURE__ */
|
|
4617
4471
|
return jsxs(Flex, {
|
|
4618
4472
|
align: "center",
|
|
@@ -4736,7 +4590,7 @@ function AssignActivityControl({instanceId: instanceId, state: state, surface: s
|
|
|
4736
4590
|
}),
|
|
4737
4591
|
onClick: handleClick,
|
|
4738
4592
|
onMouseDown: stopRowMouseDown
|
|
4739
|
-
}) : /* @__PURE__ */ jsx(
|
|
4593
|
+
}) : /* @__PURE__ */ jsx(_HoverHint, {
|
|
4740
4594
|
disabled: open,
|
|
4741
4595
|
text: "Assign",
|
|
4742
4596
|
children: /* @__PURE__ */ jsx(Button, {
|
|
@@ -4876,7 +4730,7 @@ function DueDate({dueDate: dueDate, hintDisabled: hintDisabled, overdue: overdue
|
|
|
4876
4730
|
return face === void 0 ? text :
|
|
4877
4731
|
/* @__PURE__ */ jsx(Flex, {
|
|
4878
4732
|
align: "center",
|
|
4879
|
-
children: /* @__PURE__ */ jsx(
|
|
4733
|
+
children: /* @__PURE__ */ jsx(_HoverHint, {
|
|
4880
4734
|
...face,
|
|
4881
4735
|
disabled: hintDisabled === !0,
|
|
4882
4736
|
children: text
|
|
@@ -4959,7 +4813,7 @@ function DueDateControl({item: item, editable: editable, onPatch: onPatch}) {
|
|
|
4959
4813
|
padding: 2,
|
|
4960
4814
|
tone: overdue ? "caution" : "default",
|
|
4961
4815
|
children: display
|
|
4962
|
-
}) : /* @__PURE__ */ jsx(
|
|
4816
|
+
}) : /* @__PURE__ */ jsx(_HoverHint, {
|
|
4963
4817
|
disabled: open,
|
|
4964
4818
|
text: "Set due date",
|
|
4965
4819
|
children: /* @__PURE__ */ jsx(Button, {
|
|
@@ -4996,7 +4850,7 @@ function AssigneeControl({item: item, editable: editable, eligibleRoles: eligibl
|
|
|
4996
4850
|
"aria-label": "Reassign",
|
|
4997
4851
|
avatar: chip,
|
|
4998
4852
|
onClick: () => setOpen(v => !v)
|
|
4999
|
-
}) : /* @__PURE__ */ jsx(
|
|
4853
|
+
}) : /* @__PURE__ */ jsx(_HoverHint, {
|
|
5000
4854
|
disabled: open,
|
|
5001
4855
|
text: "Assign",
|
|
5002
4856
|
children: /* @__PURE__ */ jsx(Button, {
|
|
@@ -5058,7 +4912,7 @@ function AddItemControl({onAdd: onAdd, button: button, busy: busy}) {
|
|
|
5058
4912
|
|
|
5059
4913
|
function RemoveItemButton({onClick: onClick}) {
|
|
5060
4914
|
/* @__PURE__ */
|
|
5061
|
-
return jsx(
|
|
4915
|
+
return jsx(_HoverHint, {
|
|
5062
4916
|
text: "Remove item",
|
|
5063
4917
|
children: /* @__PURE__ */ jsx(Button, {
|
|
5064
4918
|
"aria-label": "Remove item",
|
|
@@ -5162,7 +5016,7 @@ function TodoItemRowView({breadcrumb: breadcrumb, row: row, onToggle: onToggle,
|
|
|
5162
5016
|
}),
|
|
5163
5017
|
lead:
|
|
5164
5018
|
/* @__PURE__ */ jsx(CheckboxSlot, {
|
|
5165
|
-
children: hint === void 0 ? checkbox : /* @__PURE__ */ jsx(
|
|
5019
|
+
children: hint === void 0 ? checkbox : /* @__PURE__ */ jsx(_HoverHint, {
|
|
5166
5020
|
text: hint,
|
|
5167
5021
|
children: checkbox
|
|
5168
5022
|
})
|
|
@@ -5374,7 +5228,7 @@ function hintContent(hint) {
|
|
|
5374
5228
|
|
|
5375
5229
|
function AutomationActionRow({actionEval: actionEval, definition: definition}) {
|
|
5376
5230
|
/* @__PURE__ */
|
|
5377
|
-
return jsx(
|
|
5231
|
+
return jsx(_HoverHint, {
|
|
5378
5232
|
content: hintContent(automationHint({
|
|
5379
5233
|
actionEval: actionEval,
|
|
5380
5234
|
definition: definition
|
|
@@ -6148,7 +6002,7 @@ function MetricText({children: children, tone: tone}) {
|
|
|
6148
6002
|
|
|
6149
6003
|
function MetricPair({face: face, ...lockup}) {
|
|
6150
6004
|
/* @__PURE__ */
|
|
6151
|
-
return jsx(
|
|
6005
|
+
return jsx(_HoverHint, {
|
|
6152
6006
|
...face,
|
|
6153
6007
|
children: /* @__PURE__ */ jsx(MetricLockup, {
|
|
6154
6008
|
...lockup
|
|
@@ -6183,7 +6037,7 @@ function MetricLockup({Icon: Icon, empty: empty, label: label, tone: tone, value
|
|
|
6183
6037
|
|
|
6184
6038
|
function AlertGlyph({Icon: Icon, hint: hint, label: label, tone: tone}) {
|
|
6185
6039
|
/* @__PURE__ */
|
|
6186
|
-
return jsx(
|
|
6040
|
+
return jsx(_HoverHint, {
|
|
6187
6041
|
text: hint,
|
|
6188
6042
|
children: /* @__PURE__ */ jsx(TextWithTone, {
|
|
6189
6043
|
size: 1,
|
|
@@ -6198,10 +6052,14 @@ function AlertGlyph({Icon: Icon, hint: hint, label: label, tone: tone}) {
|
|
|
6198
6052
|
});
|
|
6199
6053
|
}
|
|
6200
6054
|
|
|
6055
|
+
function useAlertChipSize() {
|
|
6056
|
+
return useTextIconSize() + useSpaceToken(1) * 2;
|
|
6057
|
+
}
|
|
6058
|
+
|
|
6201
6059
|
function AlertChip({Icon: Icon, hint: hint, label: label, tone: tone}) {
|
|
6202
|
-
const glyph = useTextIconSize(), disc =
|
|
6060
|
+
const glyph = useTextIconSize(), disc = useAlertChipSize();
|
|
6203
6061
|
/* @__PURE__ */
|
|
6204
|
-
return jsx(
|
|
6062
|
+
return jsx(_HoverHint, {
|
|
6205
6063
|
text: hint,
|
|
6206
6064
|
children: /* @__PURE__ */ jsx(Card, {
|
|
6207
6065
|
radius: "full",
|
|
@@ -6301,7 +6159,7 @@ function ActivityDateControl({instanceId: instanceId, state: state, surface: sur
|
|
|
6301
6159
|
onMouseDown: stopRowMouseDown,
|
|
6302
6160
|
padding: 2,
|
|
6303
6161
|
children: dueDate()
|
|
6304
|
-
}) : /* @__PURE__ */ jsx(
|
|
6162
|
+
}) : /* @__PURE__ */ jsx(_HoverHint, {
|
|
6305
6163
|
disabled: open,
|
|
6306
6164
|
text: "Set date",
|
|
6307
6165
|
children: /* @__PURE__ */ jsx(Button, {
|
|
@@ -6326,7 +6184,7 @@ function settledDim(settled) {
|
|
|
6326
6184
|
|
|
6327
6185
|
function ActivityStatusLead({status: status}) {
|
|
6328
6186
|
/* @__PURE__ */
|
|
6329
|
-
return jsx(
|
|
6187
|
+
return jsx(_HoverHint, {
|
|
6330
6188
|
text: ACTIVITY_STATUS_LABEL[status],
|
|
6331
6189
|
children: /* @__PURE__ */ jsx(ActivityStatusIcon, {
|
|
6332
6190
|
status: status
|
|
@@ -6377,7 +6235,7 @@ function RowTerminalActions({actions: actions, activity: activity, instanceId: i
|
|
|
6377
6235
|
function TitleTag({hint: hint, tone: tone, children: children}) {
|
|
6378
6236
|
const badgeTrim = useBadgeCapTrim();
|
|
6379
6237
|
/* @__PURE__ */
|
|
6380
|
-
return jsx(
|
|
6238
|
+
return jsx(_HoverHint, {
|
|
6381
6239
|
text: hint,
|
|
6382
6240
|
children: /* @__PURE__ */ jsx(Badge, {
|
|
6383
6241
|
fontSize: 1,
|
|
@@ -6643,7 +6501,7 @@ function deriveFieldPills(args) {
|
|
|
6643
6501
|
function UserAvatar({id: id}) {
|
|
6644
6502
|
const {name: name, imageUrl: imageUrl} = useUserDisplay(id);
|
|
6645
6503
|
/* @__PURE__ */
|
|
6646
|
-
return jsx(
|
|
6504
|
+
return jsx(_HoverHint, {
|
|
6647
6505
|
text: name,
|
|
6648
6506
|
children: /* @__PURE__ */ jsx(MemberAvatar, {
|
|
6649
6507
|
imageUrl: imageUrl,
|
|
@@ -6654,7 +6512,7 @@ function UserAvatar({id: id}) {
|
|
|
6654
6512
|
|
|
6655
6513
|
function UserAvatarGroup({ids: ids, hint: hint}) {
|
|
6656
6514
|
const displays = useUserDisplays(ids);
|
|
6657
|
-
return displays.length === 0 ? null : /* @__PURE__ */ jsx(
|
|
6515
|
+
return displays.length === 0 ? null : /* @__PURE__ */ jsx(_HoverHint, {
|
|
6658
6516
|
text: disambiguatedNames(displays).join(", "),
|
|
6659
6517
|
...hint === void 0 ? {} : {
|
|
6660
6518
|
description: hint
|
|
@@ -6874,7 +6732,7 @@ function usePillChrome(face) {
|
|
|
6874
6732
|
function PillHint({pill: pill, disabled: disabled = !1, children: children}) {
|
|
6875
6733
|
const {description: description} = pill;
|
|
6876
6734
|
/* @__PURE__ */
|
|
6877
|
-
return jsx(
|
|
6735
|
+
return jsx(_HoverHint, {
|
|
6878
6736
|
disabled: disabled || description === void 0,
|
|
6879
6737
|
text: description ?? "",
|
|
6880
6738
|
children: children
|
|
@@ -7446,17 +7304,6 @@ function conditionLines(description) {
|
|
|
7446
7304
|
});
|
|
7447
7305
|
}
|
|
7448
7306
|
|
|
7449
|
-
function StartIncompleteBadge({style: style}) {
|
|
7450
|
-
/* @__PURE__ */
|
|
7451
|
-
return jsx(Badge, {
|
|
7452
|
-
fontSize: 1,
|
|
7453
|
-
mode: "outline",
|
|
7454
|
-
style: style,
|
|
7455
|
-
tone: "caution",
|
|
7456
|
-
children: "Start incomplete"
|
|
7457
|
-
});
|
|
7458
|
-
}
|
|
7459
|
-
|
|
7460
7307
|
function normalizeAbortReason(raw) {
|
|
7461
7308
|
const trimmed = raw.trim();
|
|
7462
7309
|
return trimmed === "" ? void 0 : trimmed;
|
|
@@ -7668,24 +7515,6 @@ function historyLine(h, titles) {
|
|
|
7668
7515
|
return historyLiner[h._type](h, titles);
|
|
7669
7516
|
}
|
|
7670
7517
|
|
|
7671
|
-
function AgoStamp({at: at, now: now}) {
|
|
7672
|
-
/* @__PURE__ */
|
|
7673
|
-
return jsx(Flex, {
|
|
7674
|
-
align: "center",
|
|
7675
|
-
children: /* @__PURE__ */ jsx(HoverHint, {
|
|
7676
|
-
text: formatShortDateTime(at),
|
|
7677
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
7678
|
-
muted: !0,
|
|
7679
|
-
size: 1,
|
|
7680
|
-
style: {
|
|
7681
|
-
whiteSpace: "nowrap"
|
|
7682
|
-
},
|
|
7683
|
-
children: formatShortAgo(at, now)
|
|
7684
|
-
})
|
|
7685
|
-
})
|
|
7686
|
-
});
|
|
7687
|
-
}
|
|
7688
|
-
|
|
7689
7518
|
function CodeChip({value: value}) {
|
|
7690
7519
|
/* @__PURE__ */
|
|
7691
7520
|
return jsx("code", {
|
|
@@ -7708,7 +7537,7 @@ function HintedMenuButton({hint: hint, ...menuButtonProps}) {
|
|
|
7708
7537
|
return hint === void 0 ? /* @__PURE__ */ jsx(MenuButton, {
|
|
7709
7538
|
...menuButtonProps,
|
|
7710
7539
|
popover: popover
|
|
7711
|
-
}) : /* @__PURE__ */ jsx(
|
|
7540
|
+
}) : /* @__PURE__ */ jsx(_HoverHint, {
|
|
7712
7541
|
disabled: open,
|
|
7713
7542
|
text: hint,
|
|
7714
7543
|
children: /* @__PURE__ */ jsx(MenuButton, {
|
|
@@ -7975,7 +7804,7 @@ function ActorNameSpan({id: id}) {
|
|
|
7975
7804
|
function FeedGlyph({hint: hint, icon: icon}) {
|
|
7976
7805
|
const size = useAvatarSize();
|
|
7977
7806
|
/* @__PURE__ */
|
|
7978
|
-
return jsx(
|
|
7807
|
+
return jsx(_HoverHint, {
|
|
7979
7808
|
text: hint,
|
|
7980
7809
|
children: /* @__PURE__ */ jsx(Flex, {
|
|
7981
7810
|
align: "center",
|
|
@@ -8286,7 +8115,7 @@ function StageFace({completed: completed = !1, detail: detail, title: title}) {
|
|
|
8286
8115
|
/* @__PURE__ */ jsx(TextWithTone, {
|
|
8287
8116
|
size: 1,
|
|
8288
8117
|
tone: tone,
|
|
8289
|
-
children: completed ? /* @__PURE__ */ jsx(
|
|
8118
|
+
children: completed ? /* @__PURE__ */ jsx(_CheckmarkCircleFilledIcon, {
|
|
8290
8119
|
style: {
|
|
8291
8120
|
color: "inherit"
|
|
8292
8121
|
}
|
|
@@ -8378,7 +8207,7 @@ function SpineNodeView({definition: definition, node: node, transitions: transit
|
|
|
8378
8207
|
if (node.state === "current") {
|
|
8379
8208
|
const detail = roundDetail(node.round);
|
|
8380
8209
|
/* @__PURE__ */
|
|
8381
|
-
return jsx(
|
|
8210
|
+
return jsx(_HoverHint, {
|
|
8382
8211
|
content: card,
|
|
8383
8212
|
"data-testid": `spine-node-${node.name}`,
|
|
8384
8213
|
flush: !0,
|
|
@@ -8394,7 +8223,7 @@ function SpineNodeView({definition: definition, node: node, transitions: transit
|
|
|
8394
8223
|
}
|
|
8395
8224
|
const Icon = NODE_ICON[node.state];
|
|
8396
8225
|
/* @__PURE__ */
|
|
8397
|
-
return jsx(
|
|
8226
|
+
return jsx(_HoverHint, {
|
|
8398
8227
|
content: card,
|
|
8399
8228
|
"data-testid": `spine-node-${node.name}`,
|
|
8400
8229
|
flush: !0,
|
|
@@ -8542,10 +8371,21 @@ function WorkflowInstanceSection({defaultOpen: defaultOpen, entry: entry, onOpen
|
|
|
8542
8371
|
return jsx(InstanceCard, {
|
|
8543
8372
|
defaultOpen: defaultOpen,
|
|
8544
8373
|
entry: entry,
|
|
8545
|
-
children: /* @__PURE__ */
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8374
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
8375
|
+
gap: 3,
|
|
8376
|
+
children: [
|
|
8377
|
+
/* @__PURE__ */ jsx(InstanceFaultNote, {
|
|
8378
|
+
entry: entry,
|
|
8379
|
+
scope: {
|
|
8380
|
+
kind: "run",
|
|
8381
|
+
onOpenActivity: onOpenActivity
|
|
8382
|
+
}
|
|
8383
|
+
}),
|
|
8384
|
+
/* @__PURE__ */ jsx(InstanceSnapshotBody, {
|
|
8385
|
+
entry: entry,
|
|
8386
|
+
onOpenActivity: onOpenActivity,
|
|
8387
|
+
surface: "document-view"
|
|
8388
|
+
}) ]
|
|
8549
8389
|
})
|
|
8550
8390
|
});
|
|
8551
8391
|
}
|
|
@@ -8705,7 +8545,7 @@ function InvalidDocNotice({invalid: invalid}) {
|
|
|
8705
8545
|
radius: 2,
|
|
8706
8546
|
tone: "caution",
|
|
8707
8547
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
8708
|
-
|
|
8548
|
+
gap: 3,
|
|
8709
8549
|
children: [
|
|
8710
8550
|
/* @__PURE__ */ jsx(Text, {
|
|
8711
8551
|
size: 1,
|
|
@@ -9409,7 +9249,7 @@ function StartWorkflowButton({mapping: mapping, docId: docId, initialValue: init
|
|
|
9409
9249
|
},
|
|
9410
9250
|
tone: tone
|
|
9411
9251
|
}), hint = tooltip ?? (iconOnly ? startLabel : void 0);
|
|
9412
|
-
return hint ? /* @__PURE__ */ jsx(
|
|
9252
|
+
return hint ? /* @__PURE__ */ jsx(_HoverHint, {
|
|
9413
9253
|
text: hint,
|
|
9414
9254
|
children: button
|
|
9415
9255
|
}) : button;
|
|
@@ -9486,7 +9326,7 @@ function StartWorkflowMenuItem({mapping: mapping, docId: docId, initialValue: in
|
|
|
9486
9326
|
},
|
|
9487
9327
|
text: `Start ${mapping.label}`
|
|
9488
9328
|
});
|
|
9489
|
-
return tooltip ? /* @__PURE__ */ jsx(
|
|
9329
|
+
return tooltip ? /* @__PURE__ */ jsx(_HoverHint, {
|
|
9490
9330
|
text: tooltip,
|
|
9491
9331
|
children: item
|
|
9492
9332
|
}) : item;
|
|
@@ -9574,7 +9414,7 @@ const VIEW_TAB_CODEC = workflowsTabCodec([ "overview", "for-me" ]), WorkflowsVie
|
|
|
9574
9414
|
};
|
|
9575
9415
|
|
|
9576
9416
|
function DiscoverySpinner() {
|
|
9577
|
-
const visible =
|
|
9417
|
+
const visible = _useDelayedFlag(!0, 1e3);
|
|
9578
9418
|
/* @__PURE__ */
|
|
9579
9419
|
return jsx(Flex, {
|
|
9580
9420
|
align: "center",
|
|
@@ -9944,20 +9784,30 @@ function createSubscribers() {
|
|
|
9944
9784
|
}
|
|
9945
9785
|
|
|
9946
9786
|
function actualType$(previews, bareId) {
|
|
9947
|
-
return previews.unstable_observeDocumentPairAvailability(bareId).pipe(switchMap(
|
|
9787
|
+
return previews.unstable_observeDocumentPairAvailability(bareId).pipe(switchMap(pair => representationType$(previews, {
|
|
9788
|
+
bareId: bareId,
|
|
9789
|
+
...pair
|
|
9790
|
+
}).pipe(startWith(void 0))), distinctUntilChanged());
|
|
9791
|
+
}
|
|
9792
|
+
|
|
9793
|
+
function representationType$(previews, {bareId: bareId, draft: draft, published: published}) {
|
|
9794
|
+
return draft.available ? previews.observeDocumentTypeFromId(getDraftId(bareId)) : published.available ? previews.observeDocumentTypeFromId(bareId) : draft.reason === "PERMISSION_DENIED" || published.reason === "PERMISSION_DENIED" ? of(UNREADABLE_DOCUMENT) : previews.unstable_observeVersionDocumentIds(bareId).pipe(switchMap(([firstVersionId]) => firstVersionId === void 0 ? of(null) : previews.observeDocumentTypeFromId(firstVersionId).pipe(startWith(void 0))));
|
|
9948
9795
|
}
|
|
9949
9796
|
|
|
9950
9797
|
const REBUILD_DELAY_MS = 5e3;
|
|
9951
9798
|
|
|
9952
9799
|
function createActualTypeProbeStore(previews) {
|
|
9953
|
-
const verdicts = /* @__PURE__ */ new Map, live = /* @__PURE__ */ new Map, subscribers = createSubscribers(),
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9800
|
+
const verdicts = /* @__PURE__ */ new Map, live = /* @__PURE__ */ new Map, subscribers = createSubscribers(), publish = (bareId, value) => {
|
|
9801
|
+
const changed = verdicts.get(bareId) !== value;
|
|
9802
|
+
verdicts.set(bareId, value), changed && subscribers.notify();
|
|
9803
|
+
}, forgetUnavailable = bareId => {
|
|
9804
|
+
const verdict = verdicts.get(bareId);
|
|
9805
|
+
(verdict === null || verdict === UNREADABLE_DOCUMENT) && publish(bareId, void 0);
|
|
9806
|
+
}, start = (bareId, entry) => actualType$(previews, bareId).subscribe({
|
|
9807
|
+
next: value => publish(bareId, value),
|
|
9958
9808
|
error: err => {
|
|
9959
9809
|
console.error(`[workflow-studio-plugin] actual-type probe for "${bareId}" failed:`, err),
|
|
9960
|
-
entry.subscription = void 0, entry.rebuildTimer = setTimeout(() => {
|
|
9810
|
+
forgetUnavailable(bareId), entry.subscription = void 0, entry.rebuildTimer = setTimeout(() => {
|
|
9961
9811
|
entry.rebuildTimer = void 0, !(live.get(bareId) !== entry || entry.count === 0) && (entry.subscription = start(bareId, entry));
|
|
9962
9812
|
}, REBUILD_DELAY_MS);
|
|
9963
9813
|
}
|
|
@@ -9985,7 +9835,8 @@ function createActualTypeProbeStore(previews) {
|
|
|
9985
9835
|
let released = !1;
|
|
9986
9836
|
return () => {
|
|
9987
9837
|
released || (released = !0, entry.count -= 1, !(entry.count > 0) && (entry.subscription?.unsubscribe(),
|
|
9988
|
-
entry.rebuildTimer !== void 0 && clearTimeout(entry.rebuildTimer), live.get(bareId) === entry && live.delete(bareId)
|
|
9838
|
+
entry.rebuildTimer !== void 0 && clearTimeout(entry.rebuildTimer), live.get(bareId) === entry && live.delete(bareId),
|
|
9839
|
+
forgetUnavailable(bareId)));
|
|
9989
9840
|
};
|
|
9990
9841
|
}
|
|
9991
9842
|
};
|
|
@@ -10615,7 +10466,7 @@ function AssigneesInput({value: value, onChange: onChange, eligibleRoles: eligib
|
|
|
10615
10466
|
/* @__PURE__ */ jsx(AssigneeBadge, {
|
|
10616
10467
|
assignee: assignee
|
|
10617
10468
|
}),
|
|
10618
|
-
/* @__PURE__ */ jsx(
|
|
10469
|
+
/* @__PURE__ */ jsx(_HoverHint, {
|
|
10619
10470
|
text: "Remove",
|
|
10620
10471
|
children: /* @__PURE__ */ jsx(Button, {
|
|
10621
10472
|
"aria-label": "Remove",
|
|
@@ -11090,7 +10941,6 @@ function SelectedReleaseRow({mapping: mapping, selectedReleaseId: selectedReleas
|
|
|
11090
10941
|
children: "Release:"
|
|
11091
10942
|
}),
|
|
11092
10943
|
/* @__PURE__ */ jsx(Badge, {
|
|
11093
|
-
mode: "outline",
|
|
11094
10944
|
style: badgeTrim,
|
|
11095
10945
|
tone: "primary",
|
|
11096
10946
|
children: selectedReleaseId
|
|
@@ -11854,7 +11704,7 @@ function StripLine({aside: aside, children: children, hint: hint, onOpen: onOpen
|
|
|
11854
11704
|
return jsxs(Flex, {
|
|
11855
11705
|
align: "center",
|
|
11856
11706
|
children: [
|
|
11857
|
-
/* @__PURE__ */ jsx(
|
|
11707
|
+
/* @__PURE__ */ jsx(_HoverHint, {
|
|
11858
11708
|
...hint,
|
|
11859
11709
|
children: /* @__PURE__ */ jsx(Card, {
|
|
11860
11710
|
as: "button",
|
|
@@ -12127,4 +11977,1582 @@ function WorkflowRootInput(props) {
|
|
|
12127
11977
|
});
|
|
12128
11978
|
}
|
|
12129
11979
|
|
|
12130
|
-
|
|
11980
|
+
function openActivitiesOf(instance) {
|
|
11981
|
+
return (findOpenStageEntry(instance)?.activities ?? []).filter(activity => isOpenActivityStatus(activity.status));
|
|
11982
|
+
}
|
|
11983
|
+
|
|
11984
|
+
function overdueTasks(instance, now) {
|
|
11985
|
+
return openActivitiesOf(instance).filter(activity => passedDuesOf(activity, now).length > 0);
|
|
11986
|
+
}
|
|
11987
|
+
|
|
11988
|
+
function earliestDue(activity) {
|
|
11989
|
+
return earliestOf(dueDatesOf(activity.fields ?? []));
|
|
11990
|
+
}
|
|
11991
|
+
|
|
11992
|
+
function passedDueOf(activity, now) {
|
|
11993
|
+
const passed = passedDuesOf(activity, now);
|
|
11994
|
+
return earliestOf(passed) ?? passed[0];
|
|
11995
|
+
}
|
|
11996
|
+
|
|
11997
|
+
function passedDuesOf(activity, now) {
|
|
11998
|
+
return dueDatesOf(activity.fields ?? []).filter(due => isDueDatePast(due, now));
|
|
11999
|
+
}
|
|
12000
|
+
|
|
12001
|
+
function earliestOf(values) {
|
|
12002
|
+
let earliest;
|
|
12003
|
+
for (const value of values) {
|
|
12004
|
+
const time = parseStoredDateValue(value)?.getTime();
|
|
12005
|
+
time !== void 0 && (earliest === void 0 || time < earliest.time) && (earliest = {
|
|
12006
|
+
time: time,
|
|
12007
|
+
value: value
|
|
12008
|
+
});
|
|
12009
|
+
}
|
|
12010
|
+
return earliest?.value;
|
|
12011
|
+
}
|
|
12012
|
+
|
|
12013
|
+
const AUTONOMY_BY_DEFINITION = /* @__PURE__ */ new WeakMap;
|
|
12014
|
+
|
|
12015
|
+
function cachedAutonomy(definition) {
|
|
12016
|
+
const hit = AUTONOMY_BY_DEFINITION.get(definition);
|
|
12017
|
+
if (hit !== void 0) return hit;
|
|
12018
|
+
const derived = deriveWorkflowAutonomy(definition);
|
|
12019
|
+
return AUTONOMY_BY_DEFINITION.set(definition, derived), derived;
|
|
12020
|
+
}
|
|
12021
|
+
|
|
12022
|
+
function isAutomatedActivity(args) {
|
|
12023
|
+
const stage = args.autonomy?.stages.find(entry => entry.stage === args.stageName);
|
|
12024
|
+
return isHandsOff({
|
|
12025
|
+
classification: deriveExecutorClassification(args.activity),
|
|
12026
|
+
completesWithoutCaller: stage?.activities[args.activity.name]?.completesWithoutCaller
|
|
12027
|
+
});
|
|
12028
|
+
}
|
|
12029
|
+
|
|
12030
|
+
function taskOf(args) {
|
|
12031
|
+
const {entry: entry, now: now, openedAt: openedAt, roleAliases: roleAliases, title: title} = args;
|
|
12032
|
+
return {
|
|
12033
|
+
name: entry.name,
|
|
12034
|
+
title: title,
|
|
12035
|
+
assignees: assigneesOf(entry.fields ?? []),
|
|
12036
|
+
roleAliases: roleAliases,
|
|
12037
|
+
openedAt: openedAt,
|
|
12038
|
+
due: earliestDue(entry),
|
|
12039
|
+
overdueSince: passedDueOf(entry, now),
|
|
12040
|
+
status: entry.status
|
|
12041
|
+
};
|
|
12042
|
+
}
|
|
12043
|
+
|
|
12044
|
+
function humanTask(args) {
|
|
12045
|
+
const {activity: activity, autonomy: autonomy, entry: entry, now: now, openedAt: openedAt, roleAliases: roleAliases, stageName: stageName} = args;
|
|
12046
|
+
return entry === void 0 ? [] : isAutomatedActivity({
|
|
12047
|
+
activity: activity,
|
|
12048
|
+
autonomy: autonomy,
|
|
12049
|
+
stageName: stageName
|
|
12050
|
+
}) ? [] : [ taskOf({
|
|
12051
|
+
entry: entry,
|
|
12052
|
+
now: now,
|
|
12053
|
+
openedAt: openedAt,
|
|
12054
|
+
roleAliases: roleAliases,
|
|
12055
|
+
title: activityLabel(activity)
|
|
12056
|
+
}) ];
|
|
12057
|
+
}
|
|
12058
|
+
|
|
12059
|
+
function undeclaredTasks(args) {
|
|
12060
|
+
const {definition: definition, now: now, open: open, openedAt: openedAt, roleAliases: roleAliases, seen: seen, stageName: stageName} = args;
|
|
12061
|
+
return open.filter(entry => !seen.has(entry.name)).map(entry => taskOf({
|
|
12062
|
+
entry: entry,
|
|
12063
|
+
now: now,
|
|
12064
|
+
openedAt: openedAt,
|
|
12065
|
+
roleAliases: roleAliases,
|
|
12066
|
+
title: findActivity({
|
|
12067
|
+
activityName: entry.name,
|
|
12068
|
+
definition: definition,
|
|
12069
|
+
stageName: stageName
|
|
12070
|
+
}).title
|
|
12071
|
+
}));
|
|
12072
|
+
}
|
|
12073
|
+
|
|
12074
|
+
function definitionForPinned(definition, pinnedVersion) {
|
|
12075
|
+
if (!(definition === void 0 || definition.version !== pinnedVersion)) return definition;
|
|
12076
|
+
}
|
|
12077
|
+
|
|
12078
|
+
function stageTasksOf(args) {
|
|
12079
|
+
const {definition: definition, instance: instance, now: now} = args, stageEntry = findOpenStageEntry(instance);
|
|
12080
|
+
if (stageEntry === void 0) return [];
|
|
12081
|
+
const listed = listedStageActivities(stageEntry);
|
|
12082
|
+
if (listed.length === 0) return [];
|
|
12083
|
+
const openedAt = stageEntry.enteredAt, pinnedDefinition = definitionForPinned(definition, instance.pinnedVersion), autonomy = pinnedDefinition === void 0 ? void 0 : cachedAutonomy(pinnedDefinition), roleAliases = pinnedDefinition?.roleAliases, stageName = instance.currentStage, openByName = new Map(listed.map(entry => [ entry.name, entry ])), declared = findStageNode({
|
|
12084
|
+
definition: definition,
|
|
12085
|
+
stageName: stageName
|
|
12086
|
+
})?.activities ?? [];
|
|
12087
|
+
return [ ...declared.flatMap(activity => humanTask({
|
|
12088
|
+
activity: activity,
|
|
12089
|
+
autonomy: autonomy,
|
|
12090
|
+
entry: openByName.get(activity.name),
|
|
12091
|
+
now: now,
|
|
12092
|
+
openedAt: openedAt,
|
|
12093
|
+
roleAliases: roleAliases,
|
|
12094
|
+
stageName: stageName
|
|
12095
|
+
})), ...undeclaredTasks({
|
|
12096
|
+
definition: definition,
|
|
12097
|
+
now: now,
|
|
12098
|
+
open: listed,
|
|
12099
|
+
openedAt: openedAt,
|
|
12100
|
+
roleAliases: roleAliases,
|
|
12101
|
+
seen: new Set(declared.map(activity => activity.name)),
|
|
12102
|
+
stageName: stageName
|
|
12103
|
+
}) ];
|
|
12104
|
+
}
|
|
12105
|
+
|
|
12106
|
+
function listedStageActivities(stage) {
|
|
12107
|
+
return stage.activities.filter(entry => isOpenActivityStatus(entry.status) || entry.status === "failed");
|
|
12108
|
+
}
|
|
12109
|
+
|
|
12110
|
+
function groupWidthOf(task, metrics) {
|
|
12111
|
+
const mark = taskAssignmentMarkOf(task.assignees), faces = mark.kind === "held" ? mark.members.length : 1;
|
|
12112
|
+
return metrics.face + (faces - 1) * (metrics.face - metrics.overlap);
|
|
12113
|
+
}
|
|
12114
|
+
|
|
12115
|
+
function rowWidthOf(tasks, metrics) {
|
|
12116
|
+
return tasks.reduce((total, task) => total + groupWidthOf(task, metrics), 0) + Math.max(0, tasks.length - 1) * metrics.gap;
|
|
12117
|
+
}
|
|
12118
|
+
|
|
12119
|
+
function countWithin(args) {
|
|
12120
|
+
const {budget: budget, metrics: metrics, tasks: tasks} = args;
|
|
12121
|
+
let used = 0, count = 0;
|
|
12122
|
+
for (const task of tasks) {
|
|
12123
|
+
const next = used + (count === 0 ? 0 : metrics.gap) + groupWidthOf(task, metrics);
|
|
12124
|
+
if (next > budget) break;
|
|
12125
|
+
used = next, count += 1;
|
|
12126
|
+
}
|
|
12127
|
+
return Math.max(1, count);
|
|
12128
|
+
}
|
|
12129
|
+
|
|
12130
|
+
function visibleStageTasks(args) {
|
|
12131
|
+
const {metrics: metrics, room: room, tasks: tasks} = args;
|
|
12132
|
+
if (rowWidthOf(tasks, metrics) <= room) return {
|
|
12133
|
+
overflow: 0,
|
|
12134
|
+
visible: tasks
|
|
12135
|
+
};
|
|
12136
|
+
const shown = countWithin({
|
|
12137
|
+
budget: room - metrics.gap - metrics.counter,
|
|
12138
|
+
metrics: metrics,
|
|
12139
|
+
tasks: tasks
|
|
12140
|
+
});
|
|
12141
|
+
return {
|
|
12142
|
+
overflow: tasks.length - shown,
|
|
12143
|
+
visible: tasks.slice(0, shown)
|
|
12144
|
+
};
|
|
12145
|
+
}
|
|
12146
|
+
|
|
12147
|
+
function taskAssignmentMarkOf(assignees) {
|
|
12148
|
+
const members = assignees.filter(assignee => assignee.type === "user");
|
|
12149
|
+
if (members.length > 0) return {
|
|
12150
|
+
kind: "held",
|
|
12151
|
+
members: members
|
|
12152
|
+
};
|
|
12153
|
+
const roles = assignees.flatMap(assignee => assignee.type === "role" ? [ assignee.role ] : []);
|
|
12154
|
+
return roles.length > 0 ? {
|
|
12155
|
+
kind: "routed",
|
|
12156
|
+
roles: roles
|
|
12157
|
+
} : {
|
|
12158
|
+
kind: "unassigned"
|
|
12159
|
+
};
|
|
12160
|
+
}
|
|
12161
|
+
|
|
12162
|
+
const LATE_FACE = {
|
|
12163
|
+
Icon: CalendarIcon,
|
|
12164
|
+
tone: "caution"
|
|
12165
|
+
};
|
|
12166
|
+
|
|
12167
|
+
function LateSpan({now: now, since: since}) {
|
|
12168
|
+
/* @__PURE__ */
|
|
12169
|
+
return jsx(MetricLockup, {
|
|
12170
|
+
Icon: LATE_FACE.Icon,
|
|
12171
|
+
tone: LATE_FACE.tone,
|
|
12172
|
+
value: _shortSpanOf(parseStoredDateValue(since), now)
|
|
12173
|
+
});
|
|
12174
|
+
}
|
|
12175
|
+
|
|
12176
|
+
const HOLDER_OVERLAP = 7, HOLDER_RING = 1.5, GROUP_GAP_TOKEN = 3, OVERDUE_DOT_RATIO = .4;
|
|
12177
|
+
|
|
12178
|
+
function overdueDotOf(face) {
|
|
12179
|
+
const size = Math.round(face * OVERDUE_DOT_RATIO);
|
|
12180
|
+
return {
|
|
12181
|
+
overhang: Math.round(size / 4),
|
|
12182
|
+
size: size
|
|
12183
|
+
};
|
|
12184
|
+
}
|
|
12185
|
+
|
|
12186
|
+
function useDisplayById(ids) {
|
|
12187
|
+
const displays = useUserDisplays(uniqueIds(ids)), labels = disambiguatedNames(displays);
|
|
12188
|
+
return new Map(displays.map((display, index) => [ display.id, {
|
|
12189
|
+
...display,
|
|
12190
|
+
label: labels[index] ?? display.name
|
|
12191
|
+
} ]));
|
|
12192
|
+
}
|
|
12193
|
+
|
|
12194
|
+
function holderKey(assignee, index) {
|
|
12195
|
+
return `${assignee.id}-${index}`;
|
|
12196
|
+
}
|
|
12197
|
+
|
|
12198
|
+
function stageTasksFace(args) {
|
|
12199
|
+
return {
|
|
12200
|
+
content: /* @__PURE__ */ jsx(StageTasksCard, {
|
|
12201
|
+
now: args.now,
|
|
12202
|
+
tasks: args.tasks
|
|
12203
|
+
}),
|
|
12204
|
+
flush: !0,
|
|
12205
|
+
wide: !0
|
|
12206
|
+
};
|
|
12207
|
+
}
|
|
12208
|
+
|
|
12209
|
+
function StageTaskGroups({now: now, room: room, tasks: tasks}) {
|
|
12210
|
+
const gap = useSpaceToken(GROUP_GAP_TOKEN), face = useAvatarSize(), {overhang: overhang} = overdueDotOf(face), {overflow: overflow, visible: visible} = visibleStageTasks({
|
|
12211
|
+
metrics: {
|
|
12212
|
+
counter: face,
|
|
12213
|
+
face: face,
|
|
12214
|
+
gap: gap,
|
|
12215
|
+
overlap: HOLDER_OVERLAP
|
|
12216
|
+
},
|
|
12217
|
+
room: room === void 0 ? face * 3 + gap * 2 : room - overhang,
|
|
12218
|
+
tasks: tasks
|
|
12219
|
+
});
|
|
12220
|
+
return tasks.length === 0 ? null : /* @__PURE__ */ jsx(_HoverHint, {
|
|
12221
|
+
...stageTasksFace({
|
|
12222
|
+
now: now,
|
|
12223
|
+
tasks: tasks
|
|
12224
|
+
}),
|
|
12225
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
12226
|
+
align: "center",
|
|
12227
|
+
"aria-label": "Tasks",
|
|
12228
|
+
style: {
|
|
12229
|
+
columnGap: gap,
|
|
12230
|
+
paddingRight: overhang
|
|
12231
|
+
},
|
|
12232
|
+
children: [ visible.map(task => /* @__PURE__ */ jsx(TaskGroupFace, {
|
|
12233
|
+
task: task
|
|
12234
|
+
}, task.name)), overflow === 0 ? null : /* @__PURE__ */ jsxs(Text, {
|
|
12235
|
+
muted: !0,
|
|
12236
|
+
size: 1,
|
|
12237
|
+
children: [ "+", overflow ]
|
|
12238
|
+
}) ]
|
|
12239
|
+
})
|
|
12240
|
+
});
|
|
12241
|
+
}
|
|
12242
|
+
|
|
12243
|
+
function TaskGroupFace({task: task}) {
|
|
12244
|
+
/* @__PURE__ */
|
|
12245
|
+
return jsxs(Box, {
|
|
12246
|
+
style: {
|
|
12247
|
+
flexShrink: 0,
|
|
12248
|
+
position: "relative"
|
|
12249
|
+
},
|
|
12250
|
+
children: [
|
|
12251
|
+
/* @__PURE__ */ jsx(AssignmentFace, {
|
|
12252
|
+
assignees: task.assignees
|
|
12253
|
+
}), task.overdueSince === void 0 ? null : /* @__PURE__ */ jsx(OverdueDot, {}) ]
|
|
12254
|
+
});
|
|
12255
|
+
}
|
|
12256
|
+
|
|
12257
|
+
function AssignmentFace({assignees: assignees}) {
|
|
12258
|
+
const mark = taskAssignmentMarkOf(assignees);
|
|
12259
|
+
return mark.kind === "unassigned" ? /* @__PURE__ */ jsx(PersonToken, {}) : mark.kind === "routed" ? /* @__PURE__ */ jsx(PersonToken, {
|
|
12260
|
+
routed: !0
|
|
12261
|
+
}) : /* @__PURE__ */ jsx(OverlappedHolders, {
|
|
12262
|
+
assignees: mark.members
|
|
12263
|
+
});
|
|
12264
|
+
}
|
|
12265
|
+
|
|
12266
|
+
function OverdueDot() {
|
|
12267
|
+
const {color: color} = useTheme_v2(), {overhang: overhang, size: size} = overdueDotOf(useAvatarSize());
|
|
12268
|
+
/* @__PURE__ */
|
|
12269
|
+
return jsx(Box, {
|
|
12270
|
+
"aria-label": "Overdue",
|
|
12271
|
+
role: "img",
|
|
12272
|
+
style: {
|
|
12273
|
+
backgroundColor: color.button.default.caution.enabled.bg,
|
|
12274
|
+
borderRadius: "50%",
|
|
12275
|
+
boxShadow: `0 0 0 ${HOLDER_RING}px ${color.bg}`,
|
|
12276
|
+
height: size,
|
|
12277
|
+
position: "absolute",
|
|
12278
|
+
right: -overhang,
|
|
12279
|
+
top: -overhang,
|
|
12280
|
+
width: size
|
|
12281
|
+
}
|
|
12282
|
+
});
|
|
12283
|
+
}
|
|
12284
|
+
|
|
12285
|
+
function HolderFace({assignee: assignee, displayById: displayById}) {
|
|
12286
|
+
const display = displayById.get(assignee.id);
|
|
12287
|
+
/* @__PURE__ */
|
|
12288
|
+
return jsx(MemberAvatar, {
|
|
12289
|
+
imageUrl: display?.imageUrl,
|
|
12290
|
+
name: display?.name ?? assignee.id,
|
|
12291
|
+
size: 0
|
|
12292
|
+
});
|
|
12293
|
+
}
|
|
12294
|
+
|
|
12295
|
+
function OverlappedHolders({assignees: assignees}) {
|
|
12296
|
+
const {color: color} = useTheme_v2(), displayById = useDisplayById(userIdsOf(assignees)), ring = `0 0 0 ${HOLDER_RING}px ${color.bg}`;
|
|
12297
|
+
/* @__PURE__ */
|
|
12298
|
+
return jsx(Flex, {
|
|
12299
|
+
align: "center",
|
|
12300
|
+
style: {
|
|
12301
|
+
flexShrink: 0,
|
|
12302
|
+
isolation: "isolate"
|
|
12303
|
+
},
|
|
12304
|
+
children: assignees.map((assignee, index) => /* @__PURE__ */ jsx(Box, {
|
|
12305
|
+
style: {
|
|
12306
|
+
borderRadius: "50%",
|
|
12307
|
+
boxShadow: ring,
|
|
12308
|
+
flexShrink: 0,
|
|
12309
|
+
marginLeft: index === 0 ? 0 : -HOLDER_OVERLAP,
|
|
12310
|
+
position: "relative",
|
|
12311
|
+
zIndex: index
|
|
12312
|
+
},
|
|
12313
|
+
children: /* @__PURE__ */ jsx(HolderFace, {
|
|
12314
|
+
assignee: assignee,
|
|
12315
|
+
displayById: displayById
|
|
12316
|
+
})
|
|
12317
|
+
}, holderKey(assignee, index)))
|
|
12318
|
+
});
|
|
12319
|
+
}
|
|
12320
|
+
|
|
12321
|
+
function PersonToken({routed: routed = !1}) {
|
|
12322
|
+
const size = useAvatarSize(), {color: color} = useTheme_v2();
|
|
12323
|
+
/* @__PURE__ */
|
|
12324
|
+
return jsxs(Box, {
|
|
12325
|
+
"aria-label": routed ? "Routed, no person assigned" : "Unassigned",
|
|
12326
|
+
role: "img",
|
|
12327
|
+
style: {
|
|
12328
|
+
flexShrink: 0,
|
|
12329
|
+
height: size,
|
|
12330
|
+
position: "relative",
|
|
12331
|
+
width: size
|
|
12332
|
+
},
|
|
12333
|
+
children: [
|
|
12334
|
+
/* @__PURE__ */ jsx(Flex, {
|
|
12335
|
+
align: "center",
|
|
12336
|
+
justify: "center",
|
|
12337
|
+
style: {
|
|
12338
|
+
border: `1px dashed ${color.border}`,
|
|
12339
|
+
borderRadius: "50%",
|
|
12340
|
+
boxSizing: "border-box",
|
|
12341
|
+
height: size,
|
|
12342
|
+
width: size
|
|
12343
|
+
},
|
|
12344
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
12345
|
+
size: 0,
|
|
12346
|
+
children: /* @__PURE__ */ jsx(UserIcon, {
|
|
12347
|
+
style: {
|
|
12348
|
+
color: color.input.default.enabled.placeholder
|
|
12349
|
+
}
|
|
12350
|
+
})
|
|
12351
|
+
})
|
|
12352
|
+
}), routed ? /* @__PURE__ */ jsx(Card, {
|
|
12353
|
+
radius: 1,
|
|
12354
|
+
tone: "primary",
|
|
12355
|
+
style: {
|
|
12356
|
+
bottom: -3,
|
|
12357
|
+
position: "absolute",
|
|
12358
|
+
right: -3
|
|
12359
|
+
},
|
|
12360
|
+
children: /* @__PURE__ */ jsx(Flex, {
|
|
12361
|
+
align: "center",
|
|
12362
|
+
justify: "center",
|
|
12363
|
+
style: {
|
|
12364
|
+
height: 13,
|
|
12365
|
+
width: 13
|
|
12366
|
+
},
|
|
12367
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
12368
|
+
size: 0,
|
|
12369
|
+
children: /* @__PURE__ */ jsx(UsersIcon, {})
|
|
12370
|
+
})
|
|
12371
|
+
})
|
|
12372
|
+
}) : null ]
|
|
12373
|
+
});
|
|
12374
|
+
}
|
|
12375
|
+
|
|
12376
|
+
function StageTasksCard({now: now, tasks: tasks}) {
|
|
12377
|
+
const displayById = useDisplayById(tasks.flatMap(task => userIdsOf(task.assignees)));
|
|
12378
|
+
/* @__PURE__ */
|
|
12379
|
+
return jsxs(Stack, {
|
|
12380
|
+
gap: 4,
|
|
12381
|
+
padding: 3,
|
|
12382
|
+
children: [
|
|
12383
|
+
/* @__PURE__ */ jsx(OverlineHeading, {
|
|
12384
|
+
children: "Tasks in this stage"
|
|
12385
|
+
}),
|
|
12386
|
+
/* @__PURE__ */ jsx(Stack, {
|
|
12387
|
+
gap: 4,
|
|
12388
|
+
children: tasks.map(task => /* @__PURE__ */ jsx(TaskCardRow, {
|
|
12389
|
+
displayById: displayById,
|
|
12390
|
+
now: now,
|
|
12391
|
+
task: task
|
|
12392
|
+
}, task.name))
|
|
12393
|
+
}) ]
|
|
12394
|
+
});
|
|
12395
|
+
}
|
|
12396
|
+
|
|
12397
|
+
function TaskCardRow({displayById: displayById, now: now, task: task}) {
|
|
12398
|
+
const mark = taskAssignmentMarkOf(task.assignees);
|
|
12399
|
+
/* @__PURE__ */
|
|
12400
|
+
return jsxs(Stack, {
|
|
12401
|
+
gap: 3,
|
|
12402
|
+
children: [
|
|
12403
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
12404
|
+
gap: 2,
|
|
12405
|
+
children: [
|
|
12406
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
12407
|
+
align: "center",
|
|
12408
|
+
gap: 3,
|
|
12409
|
+
children: [
|
|
12410
|
+
/* @__PURE__ */ jsx(Text, {
|
|
12411
|
+
size: 1,
|
|
12412
|
+
children: task.title
|
|
12413
|
+
}), task.overdueSince === void 0 ? null : /* @__PURE__ */ jsx(LateSpan, {
|
|
12414
|
+
now: now,
|
|
12415
|
+
since: task.overdueSince
|
|
12416
|
+
}) ]
|
|
12417
|
+
}), task.due === void 0 ? null : /* @__PURE__ */ jsx(Text, {
|
|
12418
|
+
muted: !0,
|
|
12419
|
+
size: 1,
|
|
12420
|
+
children: dueMomentSentence(task.due, now)
|
|
12421
|
+
}) ]
|
|
12422
|
+
}),
|
|
12423
|
+
/* @__PURE__ */ jsx(AssignmentLine, {
|
|
12424
|
+
displayById: displayById,
|
|
12425
|
+
mark: mark,
|
|
12426
|
+
now: now,
|
|
12427
|
+
openedAt: task.openedAt,
|
|
12428
|
+
roleAliases: task.roleAliases
|
|
12429
|
+
}) ]
|
|
12430
|
+
});
|
|
12431
|
+
}
|
|
12432
|
+
|
|
12433
|
+
function AssignmentLine({displayById: displayById, mark: mark, now: now, openedAt: openedAt, roleAliases: roleAliases}) {
|
|
12434
|
+
return mark.kind === "unassigned" ? /* @__PURE__ */ jsxs(Flex, {
|
|
12435
|
+
align: "center",
|
|
12436
|
+
gap: 2,
|
|
12437
|
+
children: [
|
|
12438
|
+
/* @__PURE__ */ jsx(PersonToken, {}),
|
|
12439
|
+
/* @__PURE__ */ jsx(Text, {
|
|
12440
|
+
muted: !0,
|
|
12441
|
+
size: 1,
|
|
12442
|
+
children: "Unassigned"
|
|
12443
|
+
}) ]
|
|
12444
|
+
}) : mark.kind === "routed" ? /* @__PURE__ */ jsx(RoutedAssignmentLine, {
|
|
12445
|
+
mark: mark,
|
|
12446
|
+
now: now,
|
|
12447
|
+
openedAt: openedAt,
|
|
12448
|
+
roleAliases: roleAliases
|
|
12449
|
+
}) : /* @__PURE__ */ jsx(Stack, {
|
|
12450
|
+
gap: 2,
|
|
12451
|
+
children: mark.members.map((assignee, index) => /* @__PURE__ */ jsxs(Flex, {
|
|
12452
|
+
align: "center",
|
|
12453
|
+
gap: 2,
|
|
12454
|
+
children: [
|
|
12455
|
+
/* @__PURE__ */ jsx(HolderFace, {
|
|
12456
|
+
assignee: assignee,
|
|
12457
|
+
displayById: displayById
|
|
12458
|
+
}),
|
|
12459
|
+
/* @__PURE__ */ jsx(Text, {
|
|
12460
|
+
size: 1,
|
|
12461
|
+
children: displayById.get(assignee.id)?.label ?? assignee.id
|
|
12462
|
+
}) ]
|
|
12463
|
+
}, holderKey(assignee, index)))
|
|
12464
|
+
});
|
|
12465
|
+
}
|
|
12466
|
+
|
|
12467
|
+
function RoutedAssignmentLine({mark: mark, now: now, openedAt: openedAt, roleAliases: roleAliases}) {
|
|
12468
|
+
const vocabulary = useProjectMembers(), count = roleMemberCount({
|
|
12469
|
+
members: vocabulary.members,
|
|
12470
|
+
requiredRoles: mark.roles,
|
|
12471
|
+
roleAliases: roleAliases
|
|
12472
|
+
}), names = mark.roles.map(role => roleLabel(memberRoleFor(vocabulary, role)));
|
|
12473
|
+
/* @__PURE__ */
|
|
12474
|
+
return jsxs(Flex, {
|
|
12475
|
+
align: "center",
|
|
12476
|
+
gap: 2,
|
|
12477
|
+
children: [
|
|
12478
|
+
/* @__PURE__ */ jsx(PersonToken, {
|
|
12479
|
+
routed: !0
|
|
12480
|
+
}),
|
|
12481
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
12482
|
+
gap: 1,
|
|
12483
|
+
children: [
|
|
12484
|
+
/* @__PURE__ */ jsx(Text, {
|
|
12485
|
+
size: 1,
|
|
12486
|
+
children: names.join(", ")
|
|
12487
|
+
}),
|
|
12488
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
12489
|
+
muted: !0,
|
|
12490
|
+
size: 1,
|
|
12491
|
+
children: [ memberCountLabel(count), " · Open ", _formatShortAgo(openedAt, now) ]
|
|
12492
|
+
}) ]
|
|
12493
|
+
}) ]
|
|
12494
|
+
});
|
|
12495
|
+
}
|
|
12496
|
+
|
|
12497
|
+
function useTableWidth(element) {
|
|
12498
|
+
const [width, setWidth] = useState(void 0);
|
|
12499
|
+
return useLayoutEffect(() => {
|
|
12500
|
+
if (element === null) {
|
|
12501
|
+
setWidth(void 0);
|
|
12502
|
+
return;
|
|
12503
|
+
}
|
|
12504
|
+
const measure = () => setWidth(element.getBoundingClientRect().width || void 0);
|
|
12505
|
+
measure();
|
|
12506
|
+
const observer = new ResizeObserver(measure);
|
|
12507
|
+
return observer.observe(element), () => observer.disconnect();
|
|
12508
|
+
}, [ element ]), width;
|
|
12509
|
+
}
|
|
12510
|
+
|
|
12511
|
+
function useTableStyles() {
|
|
12512
|
+
const {color: color} = useTheme_v2(), headTop = useSpaceToken(3), cellX = useSpaceToken(2);
|
|
12513
|
+
return useMemo(() => ({
|
|
12514
|
+
cell: {
|
|
12515
|
+
borderBottom: `1px solid ${color.border}`,
|
|
12516
|
+
boxSizing: "border-box",
|
|
12517
|
+
padding: `0 ${cellX}px`,
|
|
12518
|
+
verticalAlign: "middle",
|
|
12519
|
+
whiteSpace: "nowrap"
|
|
12520
|
+
},
|
|
12521
|
+
head: {
|
|
12522
|
+
background: color.bg,
|
|
12523
|
+
borderBottom: `1px solid ${color.border}`,
|
|
12524
|
+
boxSizing: "border-box",
|
|
12525
|
+
padding: `${headTop}px 0 6px`,
|
|
12526
|
+
position: "sticky",
|
|
12527
|
+
textAlign: "left",
|
|
12528
|
+
top: 0,
|
|
12529
|
+
zIndex: 1
|
|
12530
|
+
}
|
|
12531
|
+
}), [ cellX, color, headTop ]);
|
|
12532
|
+
}
|
|
12533
|
+
|
|
12534
|
+
function scrollParentOf(el) {
|
|
12535
|
+
for (let node = el.parentElement; node !== null; node = node.parentElement) {
|
|
12536
|
+
const overflowY = getComputedStyle(node).overflowY;
|
|
12537
|
+
if (overflowY === "auto" || overflowY === "scroll") return node;
|
|
12538
|
+
}
|
|
12539
|
+
}
|
|
12540
|
+
|
|
12541
|
+
function useRowWindow(args) {
|
|
12542
|
+
const {element: element, keyAt: keyAt, rowCount: rowCount} = args, [scroller, setScroller] = useState(null);
|
|
12543
|
+
useLayoutEffect(() => {
|
|
12544
|
+
setScroller(element === null ? null : scrollParentOf(element) ?? null);
|
|
12545
|
+
}, [ element ]);
|
|
12546
|
+
const [margin, setMargin] = useState(0);
|
|
12547
|
+
useLayoutEffect(() => {
|
|
12548
|
+
element === null || scroller === null || setMargin(element.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop);
|
|
12549
|
+
}, [ element, rowCount, scroller ]);
|
|
12550
|
+
const virtualizer = useVirtualizer({
|
|
12551
|
+
count: rowCount,
|
|
12552
|
+
estimateSize: () => 44,
|
|
12553
|
+
getItemKey: keyAt,
|
|
12554
|
+
getScrollElement: () => scroller,
|
|
12555
|
+
overscan: 10,
|
|
12556
|
+
scrollMargin: margin
|
|
12557
|
+
}), items = virtualizer.getVirtualItems(), first = items[0], last = items[items.length - 1];
|
|
12558
|
+
return {
|
|
12559
|
+
items: items,
|
|
12560
|
+
measureRow: virtualizer.measureElement,
|
|
12561
|
+
padBottom: last === void 0 ? 0 : virtualizer.getTotalSize() - (last.end - margin),
|
|
12562
|
+
padTop: first === void 0 ? 0 : first.start - margin
|
|
12563
|
+
};
|
|
12564
|
+
}
|
|
12565
|
+
|
|
12566
|
+
function SpacerRow({height: height}) {
|
|
12567
|
+
return height <= 0 ? null : /* @__PURE__ */ jsx("tr", {
|
|
12568
|
+
"aria-hidden": !0,
|
|
12569
|
+
style: {
|
|
12570
|
+
height: height
|
|
12571
|
+
},
|
|
12572
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
12573
|
+
colSpan: 99,
|
|
12574
|
+
style: {
|
|
12575
|
+
border: 0,
|
|
12576
|
+
padding: 0
|
|
12577
|
+
}
|
|
12578
|
+
})
|
|
12579
|
+
});
|
|
12580
|
+
}
|
|
12581
|
+
|
|
12582
|
+
const TABLE_TIME_WIDTH = 112, TABLE_WORKFLOW_WIDTH = {
|
|
12583
|
+
cap: 260,
|
|
12584
|
+
fraction: .18
|
|
12585
|
+
}, TABLE_STAGE_WIDTH = {
|
|
12586
|
+
cap: 260,
|
|
12587
|
+
fraction: .16
|
|
12588
|
+
};
|
|
12589
|
+
|
|
12590
|
+
function SortableHeaderCells({children: children, columns: columns, onSort: onSort, sort: sort, styles: styles, tableWidth: tableWidth, widthOf: widthOf}) {
|
|
12591
|
+
/* @__PURE__ */
|
|
12592
|
+
return jsxs(Fragment, {
|
|
12593
|
+
children: [ columns.map(column => {
|
|
12594
|
+
const width = widthOf(column, tableWidth);
|
|
12595
|
+
/* @__PURE__ */
|
|
12596
|
+
return jsx("th", {
|
|
12597
|
+
style: {
|
|
12598
|
+
...styles.head,
|
|
12599
|
+
...width === void 0 ? {} : {
|
|
12600
|
+
width: width
|
|
12601
|
+
}
|
|
12602
|
+
},
|
|
12603
|
+
children: /* @__PURE__ */ jsx(SortHeaderButton, {
|
|
12604
|
+
active: sort.key === column.key,
|
|
12605
|
+
dir: sort.dir,
|
|
12606
|
+
label: column.label,
|
|
12607
|
+
onSort: () => onSort(column.key)
|
|
12608
|
+
})
|
|
12609
|
+
}, column.key);
|
|
12610
|
+
}), children ]
|
|
12611
|
+
});
|
|
12612
|
+
}
|
|
12613
|
+
|
|
12614
|
+
function VirtualTable({keyAt: keyAt, renderHeader: renderHeader, renderRow: renderRow, rowCount: rowCount}) {
|
|
12615
|
+
const styles = useTableStyles(), [element, setElement] = useState(null), tableWidth = useTableWidth(element), window = useRowWindow({
|
|
12616
|
+
element: element,
|
|
12617
|
+
keyAt: keyAt,
|
|
12618
|
+
rowCount: rowCount
|
|
12619
|
+
});
|
|
12620
|
+
/* @__PURE__ */
|
|
12621
|
+
return jsx("div", {
|
|
12622
|
+
ref: setElement,
|
|
12623
|
+
style: {
|
|
12624
|
+
overflowX: "clip",
|
|
12625
|
+
...tableWidth === void 0 ? {
|
|
12626
|
+
visibility: "hidden"
|
|
12627
|
+
} : {}
|
|
12628
|
+
},
|
|
12629
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
12630
|
+
style: {
|
|
12631
|
+
borderCollapse: "separate",
|
|
12632
|
+
borderSpacing: 0,
|
|
12633
|
+
tableLayout: "fixed",
|
|
12634
|
+
width: "100%"
|
|
12635
|
+
},
|
|
12636
|
+
children: [
|
|
12637
|
+
/* @__PURE__ */ jsx("thead", {
|
|
12638
|
+
children: /* @__PURE__ */ jsx("tr", {
|
|
12639
|
+
children: renderHeader({
|
|
12640
|
+
styles: styles,
|
|
12641
|
+
tableWidth: tableWidth
|
|
12642
|
+
})
|
|
12643
|
+
})
|
|
12644
|
+
}),
|
|
12645
|
+
/* @__PURE__ */ jsxs("tbody", {
|
|
12646
|
+
children: [
|
|
12647
|
+
/* @__PURE__ */ jsx(SpacerRow, {
|
|
12648
|
+
height: window.padTop
|
|
12649
|
+
}), window.items.map(item => renderRow({
|
|
12650
|
+
index: item.index,
|
|
12651
|
+
key: item.key,
|
|
12652
|
+
measureRow: window.measureRow,
|
|
12653
|
+
tableWidth: tableWidth
|
|
12654
|
+
})),
|
|
12655
|
+
/* @__PURE__ */ jsx(SpacerRow, {
|
|
12656
|
+
height: window.padBottom
|
|
12657
|
+
}) ]
|
|
12658
|
+
}) ]
|
|
12659
|
+
})
|
|
12660
|
+
});
|
|
12661
|
+
}
|
|
12662
|
+
|
|
12663
|
+
function SortHeaderButton({active: active, dir: dir, label: label, onSort: onSort}) {
|
|
12664
|
+
/* @__PURE__ */
|
|
12665
|
+
return jsx(Button, {
|
|
12666
|
+
fontSize: 1,
|
|
12667
|
+
mode: "bleed",
|
|
12668
|
+
onClick: onSort,
|
|
12669
|
+
padding: 2,
|
|
12670
|
+
text: `${label}${active ? dir === "asc" ? " ↑" : " ↓" : ""}`
|
|
12671
|
+
});
|
|
12672
|
+
}
|
|
12673
|
+
|
|
12674
|
+
function TableRowCard({children: children, dataIndex: dataIndex, onClick: onClick, onKeyDown: onKeyDown, rowRef: rowRef, selected: selected, selectedRef: selectedRef}) {
|
|
12675
|
+
const setRow = useCallback(element => {
|
|
12676
|
+
rowRef?.(element), selected === !0 && selectedRef?.(element);
|
|
12677
|
+
}, [ rowRef, selected, selectedRef ]);
|
|
12678
|
+
/* @__PURE__ */
|
|
12679
|
+
return jsx(Card, {
|
|
12680
|
+
as: "tr",
|
|
12681
|
+
"data-as": "a",
|
|
12682
|
+
onClick: event => {
|
|
12683
|
+
event.currentTarget.focus(), onClick();
|
|
12684
|
+
},
|
|
12685
|
+
onKeyDown: selected === !0 ? onKeyDown : void 0,
|
|
12686
|
+
style: {
|
|
12687
|
+
cursor: "pointer",
|
|
12688
|
+
display: "table-row"
|
|
12689
|
+
},
|
|
12690
|
+
...dataIndex === void 0 ? {} : {
|
|
12691
|
+
"data-index": dataIndex
|
|
12692
|
+
},
|
|
12693
|
+
...rowRef === void 0 && selectedRef === void 0 ? {} : {
|
|
12694
|
+
ref: setRow
|
|
12695
|
+
},
|
|
12696
|
+
...selected === void 0 ? {} : {
|
|
12697
|
+
"aria-selected": selected,
|
|
12698
|
+
pressed: selected,
|
|
12699
|
+
tabIndex: selected ? 0 : -1
|
|
12700
|
+
},
|
|
12701
|
+
children: children
|
|
12702
|
+
});
|
|
12703
|
+
}
|
|
12704
|
+
|
|
12705
|
+
function resolveColumnWidth(width, tableWidth) {
|
|
12706
|
+
return typeof width != "object" ? width : tableWidth === void 0 ? `${width.fraction * 100}%` : Math.min(width.cap, Math.round(tableWidth * width.fraction));
|
|
12707
|
+
}
|
|
12708
|
+
|
|
12709
|
+
function fillColumnWidth(args) {
|
|
12710
|
+
const {columns: columns, tableWidth: tableWidth, trailingWidth: trailingWidth} = args;
|
|
12711
|
+
if (tableWidth === void 0) return;
|
|
12712
|
+
const fixed = columns.reduce((sum, column) => {
|
|
12713
|
+
const width = resolveColumnWidth(column.width, tableWidth);
|
|
12714
|
+
return typeof width == "number" ? sum + width : sum;
|
|
12715
|
+
}, trailingWidth);
|
|
12716
|
+
return Math.max(160, Math.floor(tableWidth - fixed));
|
|
12717
|
+
}
|
|
12718
|
+
|
|
12719
|
+
function TableSubjectCell({document: document}) {
|
|
12720
|
+
return document === void 0 ? /* @__PURE__ */ jsx(Text, {
|
|
12721
|
+
muted: !0,
|
|
12722
|
+
size: 1,
|
|
12723
|
+
textOverflow: "ellipsis",
|
|
12724
|
+
children: "No document"
|
|
12725
|
+
}) : /* @__PURE__ */ jsx(DocRefFace, {
|
|
12726
|
+
gdr: document
|
|
12727
|
+
});
|
|
12728
|
+
}
|
|
12729
|
+
|
|
12730
|
+
function overdueAttentionHint(documents) {
|
|
12731
|
+
const task = documents === 1 ? "an overdue task" : "overdue tasks";
|
|
12732
|
+
return `${pluralize("document", documents, !0)} ${documents === 1 ? "has" : "have"} ${task}`;
|
|
12733
|
+
}
|
|
12734
|
+
|
|
12735
|
+
function blockedAttentionHint(documents) {
|
|
12736
|
+
return `${pluralize("document", documents, !0)} ${documents === 1 ? "is" : "are"} blocked`;
|
|
12737
|
+
}
|
|
12738
|
+
|
|
12739
|
+
function overdueMark(detail, now) {
|
|
12740
|
+
const spans = overdueSpans(detail.dues, now), longest = spans.length === detail.dues.length ? spans[0]?.span : void 0;
|
|
12741
|
+
return {
|
|
12742
|
+
hint: overdueHint({
|
|
12743
|
+
detail: detail,
|
|
12744
|
+
longest: longest
|
|
12745
|
+
}),
|
|
12746
|
+
value: sharedSpan(spans, detail.dues.length) ?? "overdue"
|
|
12747
|
+
};
|
|
12748
|
+
}
|
|
12749
|
+
|
|
12750
|
+
function overdueHint(args) {
|
|
12751
|
+
const {detail: detail, longest: longest} = args;
|
|
12752
|
+
if (detail.dues.length === 1 && detail.task !== void 0) return `“${detail.task}” — ${longest === void 0 ? "overdue" : `${longest} overdue`}`;
|
|
12753
|
+
const tasks = pluralize("task", detail.dues.length, !0);
|
|
12754
|
+
return longest === void 0 ? `${tasks} overdue` : `${tasks} overdue — the longest by ${longest}`;
|
|
12755
|
+
}
|
|
12756
|
+
|
|
12757
|
+
function sharedSpan(spans, late) {
|
|
12758
|
+
if (spans.length === late) return new Set(spans.map(entry => entry.span)).size === 1 ? spans[0]?.span : void 0;
|
|
12759
|
+
}
|
|
12760
|
+
|
|
12761
|
+
function overdueSpans(dues, now) {
|
|
12762
|
+
return dues.flatMap(due => {
|
|
12763
|
+
const from = parseStoredDateValue(due);
|
|
12764
|
+
return from === void 0 ? [] : [ {
|
|
12765
|
+
elapsed: now.getTime() - from.getTime(),
|
|
12766
|
+
span: _shortSpanOf(from, now)
|
|
12767
|
+
} ];
|
|
12768
|
+
}).sort((a, b) => b.elapsed - a.elapsed);
|
|
12769
|
+
}
|
|
12770
|
+
|
|
12771
|
+
function overdueMarkOpensPanel(tasks) {
|
|
12772
|
+
return tasks.some(task => task.overdueSince !== void 0);
|
|
12773
|
+
}
|
|
12774
|
+
|
|
12775
|
+
function blockedMarkHint(detail) {
|
|
12776
|
+
return detail.kind === "blocked-many" ? `${pluralize("task", detail.count, !0)} were sent back` : detail.kind === "blocked-effect" ? `Automation “${detail.effect}” ${detail.failed ? "failed" : "didn’t finish"}` : detail.task === void 0 ? "A task was sent back" : `“${detail.task}” was sent back`;
|
|
12777
|
+
}
|
|
12778
|
+
|
|
12779
|
+
const ATTENTION_FACES = {
|
|
12780
|
+
blocked: {
|
|
12781
|
+
Icon: ErrorOutlineIcon,
|
|
12782
|
+
tone: "critical"
|
|
12783
|
+
},
|
|
12784
|
+
overdue: LATE_FACE
|
|
12785
|
+
};
|
|
12786
|
+
|
|
12787
|
+
function AttentionMark({detail: detail, now: now, tasks: tasks}) {
|
|
12788
|
+
if (detail.kind === "overdue") {
|
|
12789
|
+
const {hint: hint2, value: value} = overdueMark(detail, now);
|
|
12790
|
+
/* @__PURE__ */
|
|
12791
|
+
return jsx(MetricPair, {
|
|
12792
|
+
Icon: ATTENTION_FACES.overdue.Icon,
|
|
12793
|
+
face: overdueMarkOpensPanel(tasks) ? stageTasksFace({
|
|
12794
|
+
now: now,
|
|
12795
|
+
tasks: tasks
|
|
12796
|
+
}) : {
|
|
12797
|
+
text: hint2
|
|
12798
|
+
},
|
|
12799
|
+
label: hint2,
|
|
12800
|
+
tone: ATTENTION_FACES.overdue.tone,
|
|
12801
|
+
value: value
|
|
12802
|
+
});
|
|
12803
|
+
}
|
|
12804
|
+
const hint = blockedMarkHint(detail);
|
|
12805
|
+
/* @__PURE__ */
|
|
12806
|
+
return jsx(AlertChip, {
|
|
12807
|
+
Icon: ATTENTION_FACES.blocked.Icon,
|
|
12808
|
+
hint: hint,
|
|
12809
|
+
label: hint,
|
|
12810
|
+
tone: ATTENTION_FACES.blocked.tone
|
|
12811
|
+
});
|
|
12812
|
+
}
|
|
12813
|
+
|
|
12814
|
+
function documentRefsOf(instance) {
|
|
12815
|
+
const seen = /* @__PURE__ */ new Map;
|
|
12816
|
+
for (const ref of entryDocRefs(instance.fields)) seen.has(ref.id) || seen.set(ref.id, ref);
|
|
12817
|
+
return [ ...seen.values() ];
|
|
12818
|
+
}
|
|
12819
|
+
|
|
12820
|
+
function rootInstanceOf(instance, byId) {
|
|
12821
|
+
const rootRef = instance.ancestors[0];
|
|
12822
|
+
return rootRef ? byId.get(toBareId(rootRef.id)) ?? instance : instance;
|
|
12823
|
+
}
|
|
12824
|
+
|
|
12825
|
+
function runsScopeOf(row) {
|
|
12826
|
+
return row.endedAt === void 0 ? "open" : "closed";
|
|
12827
|
+
}
|
|
12828
|
+
|
|
12829
|
+
function rowHasTaskHeldBy(row, who) {
|
|
12830
|
+
return row.tasks.some(task => assignmentMatch(task.assignees, who) !== void 0);
|
|
12831
|
+
}
|
|
12832
|
+
|
|
12833
|
+
function runCountsByWorkflow(rows) {
|
|
12834
|
+
return countBy(rows, row => [ row.workflowName ]);
|
|
12835
|
+
}
|
|
12836
|
+
|
|
12837
|
+
function runCountsByAssignee(rows) {
|
|
12838
|
+
return countBy(rows, row => new Set(userIdsOf(row.assignees)));
|
|
12839
|
+
}
|
|
12840
|
+
|
|
12841
|
+
function runCountsByRole(rows) {
|
|
12842
|
+
return countBy(rows, row => new Set(row.assignees.flatMap(assignee => assignee.type === "role" ? [ assignee.role ] : [])));
|
|
12843
|
+
}
|
|
12844
|
+
|
|
12845
|
+
function runAttentionCounts(rows) {
|
|
12846
|
+
let blocked = 0, overdue = 0;
|
|
12847
|
+
for (const row of rows) row.attention === "blocked" && (blocked += 1), row.attention === "overdue" && (overdue += 1);
|
|
12848
|
+
return {
|
|
12849
|
+
blocked: blocked,
|
|
12850
|
+
overdue: overdue
|
|
12851
|
+
};
|
|
12852
|
+
}
|
|
12853
|
+
|
|
12854
|
+
function unassignedRunCount(rows) {
|
|
12855
|
+
return rows.filter(row => row.assignmentStateCounts.unrouted > 0).length;
|
|
12856
|
+
}
|
|
12857
|
+
|
|
12858
|
+
function runCountsByStage(rows) {
|
|
12859
|
+
return countBy(rows, row => [ row.stage ]);
|
|
12860
|
+
}
|
|
12861
|
+
|
|
12862
|
+
function runCountsByRelease(rows) {
|
|
12863
|
+
return countBy(rows, row => new Set(row.releases));
|
|
12864
|
+
}
|
|
12865
|
+
|
|
12866
|
+
function noReleaseRunCount(rows) {
|
|
12867
|
+
return rows.filter(row => row.releases.length === 0).length;
|
|
12868
|
+
}
|
|
12869
|
+
|
|
12870
|
+
function releasesOfPerspective(perspective) {
|
|
12871
|
+
return Array.isArray(perspective) ? perspective.filter(name => name !== "drafts") : [];
|
|
12872
|
+
}
|
|
12873
|
+
|
|
12874
|
+
function runRowsOf(args) {
|
|
12875
|
+
const byId = new Map(args.previews.map(preview => [ preview._id, preview ]));
|
|
12876
|
+
return args.previews.map(preview => runRowOf({
|
|
12877
|
+
byId: byId,
|
|
12878
|
+
definitions: args.definitions,
|
|
12879
|
+
now: args.now,
|
|
12880
|
+
preview: preview
|
|
12881
|
+
}));
|
|
12882
|
+
}
|
|
12883
|
+
|
|
12884
|
+
function runRowOf(args) {
|
|
12885
|
+
const {byId: byId, definitions: definitions, now: now, preview: preview} = args, definition = definitions.get(preview.definition), settled = terminalState(preview) !== "in-flight", held = settled ? NO_ASSIGNEES : openAssignees(preview), attentionDetail = settled ? void 0 : blockedRunDetail({
|
|
12886
|
+
definition: definition,
|
|
12887
|
+
preview: preview
|
|
12888
|
+
}) ?? overdueRunDetail({
|
|
12889
|
+
definition: definition,
|
|
12890
|
+
now: now,
|
|
12891
|
+
preview: preview
|
|
12892
|
+
});
|
|
12893
|
+
return {
|
|
12894
|
+
id: preview._id,
|
|
12895
|
+
document: documentRefsOf(rootInstanceOf(preview, byId))[0],
|
|
12896
|
+
workflowName: preview.definition,
|
|
12897
|
+
workflowTitle: definition?.title ?? preview.definition,
|
|
12898
|
+
stage: preview.currentStage,
|
|
12899
|
+
stageTitle: stageTitle(definition, preview.currentStage),
|
|
12900
|
+
releases: releasesOfPerspective(preview.perspective),
|
|
12901
|
+
startedAt: preview.startedAt,
|
|
12902
|
+
endedAt: settled ? preview.completedAt ?? preview.abortedAt : void 0,
|
|
12903
|
+
outcome: outcomeOf(preview, definition),
|
|
12904
|
+
attention: attentionKindOf(attentionDetail),
|
|
12905
|
+
attentionDetail: attentionDetail,
|
|
12906
|
+
assignees: held.assignees,
|
|
12907
|
+
assignments: held.assignments,
|
|
12908
|
+
assignmentStateCounts: held.counts,
|
|
12909
|
+
tasks: settled ? [] : stageTasksOf({
|
|
12910
|
+
definition: definition,
|
|
12911
|
+
instance: preview,
|
|
12912
|
+
now: now
|
|
12913
|
+
})
|
|
12914
|
+
};
|
|
12915
|
+
}
|
|
12916
|
+
|
|
12917
|
+
function attentionKindOf(detail) {
|
|
12918
|
+
if (detail !== void 0) return detail.kind === "overdue" ? "overdue" : "blocked";
|
|
12919
|
+
}
|
|
12920
|
+
|
|
12921
|
+
function blockedArmOf(detail) {
|
|
12922
|
+
if (!(detail === void 0 || detail.kind === "overdue")) return detail;
|
|
12923
|
+
}
|
|
12924
|
+
|
|
12925
|
+
function overdueArmOf(detail) {
|
|
12926
|
+
return detail?.kind === "overdue" ? detail : void 0;
|
|
12927
|
+
}
|
|
12928
|
+
|
|
12929
|
+
function outcomeOf(preview, definition) {
|
|
12930
|
+
const state = terminalState(preview);
|
|
12931
|
+
if (state !== "in-flight") return state === "aborted" ? "Aborted" : stageTitle(definition, preview.currentStage);
|
|
12932
|
+
}
|
|
12933
|
+
|
|
12934
|
+
function blockedRunDetail(args) {
|
|
12935
|
+
const {definition: definition, preview: preview} = args, {stage: stage, titleOf: titleOf2} = activityTitleResolver(preview, definition), failed = (stage?.activities ?? []).filter(activity => activity.status === "failed");
|
|
12936
|
+
if (failed.length > 1) return {
|
|
12937
|
+
count: failed.length,
|
|
12938
|
+
kind: "blocked-many"
|
|
12939
|
+
};
|
|
12940
|
+
const only = failed[0];
|
|
12941
|
+
if (only !== void 0) return {
|
|
12942
|
+
kind: "blocked",
|
|
12943
|
+
task: titleOf2(only.name)
|
|
12944
|
+
};
|
|
12945
|
+
const stuck = stuckEffectOf({
|
|
12946
|
+
definition: definition,
|
|
12947
|
+
preview: preview,
|
|
12948
|
+
stage: stage
|
|
12949
|
+
});
|
|
12950
|
+
return stuck === void 0 ? void 0 : {
|
|
12951
|
+
effect: stuck.effect.title ?? stuck.effect.name,
|
|
12952
|
+
failed: stuck.failed,
|
|
12953
|
+
kind: "blocked-effect"
|
|
12954
|
+
};
|
|
12955
|
+
}
|
|
12956
|
+
|
|
12957
|
+
function stuckEffectOf(args) {
|
|
12958
|
+
const reported = failedDeclaredEffect(args);
|
|
12959
|
+
if (reported !== void 0) return {
|
|
12960
|
+
effect: reported,
|
|
12961
|
+
failed: !0
|
|
12962
|
+
};
|
|
12963
|
+
const claimed = args.preview.claimedEffects[0];
|
|
12964
|
+
return claimed === void 0 ? void 0 : {
|
|
12965
|
+
effect: claimed,
|
|
12966
|
+
failed: !1
|
|
12967
|
+
};
|
|
12968
|
+
}
|
|
12969
|
+
|
|
12970
|
+
function failedDeclaredEffect(args) {
|
|
12971
|
+
const {definition: definition, preview: preview, stage: stage} = args;
|
|
12972
|
+
if (definition === void 0 || definition.version !== preview.pinnedVersion || stage === void 0) return;
|
|
12973
|
+
const stageNode = findStageNode({
|
|
12974
|
+
definition: definition,
|
|
12975
|
+
stageName: stage.name
|
|
12976
|
+
}), unresolved = new Set(stage.activities.filter(activity => activity.status !== "done" && activity.status !== "skipped").map(activity => activity.name)), declared = new Set((stageNode?.activities ?? []).filter(activity => unresolved.has(activity.name)).flatMap(activity => (activity.actions ?? []).flatMap(action => (action.effects ?? []).map(e => e.name))));
|
|
12977
|
+
return [ ...preview.failedEffects ].reverse().find(effect => declared.has(effect.name));
|
|
12978
|
+
}
|
|
12979
|
+
|
|
12980
|
+
function overdueRunDetail(args) {
|
|
12981
|
+
const {definition: definition, now: now, preview: preview} = args, late = overdueTasks(preview, now);
|
|
12982
|
+
if (late.length === 0) return;
|
|
12983
|
+
const {titleOf: titleOf2} = activityTitleResolver(preview, definition), only = late.length === 1 ? late[0] : void 0;
|
|
12984
|
+
return {
|
|
12985
|
+
dues: late.flatMap(activity => {
|
|
12986
|
+
const due = passedDueOf(activity, now);
|
|
12987
|
+
return due === void 0 ? [] : [ due ];
|
|
12988
|
+
}),
|
|
12989
|
+
kind: "overdue",
|
|
12990
|
+
task: only === void 0 ? void 0 : titleOf2(only.name)
|
|
12991
|
+
};
|
|
12992
|
+
}
|
|
12993
|
+
|
|
12994
|
+
function activityTitleResolver(preview, definition) {
|
|
12995
|
+
const stage = findOpenStageEntry(preview);
|
|
12996
|
+
return {
|
|
12997
|
+
stage: stage,
|
|
12998
|
+
titleOf: activityName => findActivity({
|
|
12999
|
+
activityName: activityName,
|
|
13000
|
+
definition: definition,
|
|
13001
|
+
stageName: stage?.name ?? ""
|
|
13002
|
+
}).title
|
|
13003
|
+
};
|
|
13004
|
+
}
|
|
13005
|
+
|
|
13006
|
+
const NO_ASSIGNEES = {
|
|
13007
|
+
assignees: [],
|
|
13008
|
+
assignments: [],
|
|
13009
|
+
counts: {
|
|
13010
|
+
unrouted: 0,
|
|
13011
|
+
routed: 0,
|
|
13012
|
+
held: 0
|
|
13013
|
+
}
|
|
13014
|
+
};
|
|
13015
|
+
|
|
13016
|
+
function openAssignees(instance) {
|
|
13017
|
+
const users = /* @__PURE__ */ new Map, roles = /* @__PURE__ */ new Map, assignments = openActivityAssignments(instance), counts = {
|
|
13018
|
+
unrouted: 0,
|
|
13019
|
+
routed: 0,
|
|
13020
|
+
held: 0
|
|
13021
|
+
};
|
|
13022
|
+
for (const members of assignments) counts[assignmentState(members)] += 1, recordAssignees(activeAssignmentMembers(members), {
|
|
13023
|
+
users: users,
|
|
13024
|
+
roles: roles
|
|
13025
|
+
});
|
|
13026
|
+
return {
|
|
13027
|
+
assignees: [ ...users.values(), ...roles.values() ],
|
|
13028
|
+
assignments: assignments,
|
|
13029
|
+
counts: counts
|
|
13030
|
+
};
|
|
13031
|
+
}
|
|
13032
|
+
|
|
13033
|
+
function recordAssignees(assignees, maps) {
|
|
13034
|
+
for (const assignee of assignees) (assignee.type === "user" ? maps.users : maps.roles).set(assignee.type === "user" ? assignee.id : assignee.role, assignee);
|
|
13035
|
+
}
|
|
13036
|
+
|
|
13037
|
+
function tasksWidthOf(tableWidth) {
|
|
13038
|
+
return tableWidth === void 0 ? 176 : tableWidth >= 1040 ? 224 : 176;
|
|
13039
|
+
}
|
|
13040
|
+
|
|
13041
|
+
function taskRoomOf(args) {
|
|
13042
|
+
const cell = tasksWidthOf(args.tableWidth) - args.inset * 2;
|
|
13043
|
+
return args.overdue ? cell - 76 - args.gap : cell;
|
|
13044
|
+
}
|
|
13045
|
+
|
|
13046
|
+
const OPEN_COLUMNS = [ {
|
|
13047
|
+
key: "document",
|
|
13048
|
+
label: "Workflow subject"
|
|
13049
|
+
}, {
|
|
13050
|
+
key: "workflow",
|
|
13051
|
+
label: "Workflow",
|
|
13052
|
+
width: TABLE_WORKFLOW_WIDTH
|
|
13053
|
+
}, {
|
|
13054
|
+
key: "stage",
|
|
13055
|
+
label: "Stage",
|
|
13056
|
+
width: TABLE_STAGE_WIDTH
|
|
13057
|
+
}, {
|
|
13058
|
+
key: "started",
|
|
13059
|
+
label: "Started",
|
|
13060
|
+
width: TABLE_TIME_WIDTH
|
|
13061
|
+
} ], CLOSED_COLUMNS = [ {
|
|
13062
|
+
key: "document",
|
|
13063
|
+
label: "Workflow subject"
|
|
13064
|
+
}, {
|
|
13065
|
+
key: "workflow",
|
|
13066
|
+
label: "Workflow",
|
|
13067
|
+
width: TABLE_WORKFLOW_WIDTH
|
|
13068
|
+
}, {
|
|
13069
|
+
key: "outcome",
|
|
13070
|
+
label: "Outcome",
|
|
13071
|
+
width: TABLE_STAGE_WIDTH
|
|
13072
|
+
}, {
|
|
13073
|
+
key: "started",
|
|
13074
|
+
label: "Started",
|
|
13075
|
+
width: TABLE_TIME_WIDTH
|
|
13076
|
+
}, {
|
|
13077
|
+
key: "ended",
|
|
13078
|
+
label: "Closed",
|
|
13079
|
+
width: TABLE_TIME_WIDTH
|
|
13080
|
+
} ];
|
|
13081
|
+
|
|
13082
|
+
function runsTableColumnsOf(args) {
|
|
13083
|
+
const columns = args.scope === "closed" ? CLOSED_COLUMNS : OPEN_COLUMNS;
|
|
13084
|
+
return args.scopedToWorkflow ? columns.filter(column => column.key !== "workflow") : columns;
|
|
13085
|
+
}
|
|
13086
|
+
|
|
13087
|
+
function runsDocumentWidthOf(args) {
|
|
13088
|
+
const trailing = args.scope === "open" ? tasksWidthOf(args.tableWidth) : 0;
|
|
13089
|
+
return fillColumnWidth({
|
|
13090
|
+
columns: args.columns,
|
|
13091
|
+
tableWidth: args.tableWidth,
|
|
13092
|
+
trailingWidth: trailing
|
|
13093
|
+
});
|
|
13094
|
+
}
|
|
13095
|
+
|
|
13096
|
+
const TASKS_CELL_GAP_TOKEN = 3;
|
|
13097
|
+
|
|
13098
|
+
function RunsTable({now: now, onNavigateKey: onNavigateKey, onSelectRun: onSelectRun, onSort: onSort, rows: rows, scope: scope, scopedToWorkflow: scopedToWorkflow, selectedId: selectedId, selectedRef: selectedRef, sort: sort}) {
|
|
13099
|
+
const columns = runsTableColumnsOf({
|
|
13100
|
+
scope: scope,
|
|
13101
|
+
scopedToWorkflow: scopedToWorkflow
|
|
13102
|
+
}), cellInset = useSpaceToken(2), markGap = useSpaceToken(TASKS_CELL_GAP_TOKEN);
|
|
13103
|
+
/* @__PURE__ */
|
|
13104
|
+
return jsx(VirtualTable, {
|
|
13105
|
+
renderHeader: args => /* @__PURE__ */ jsx(RunsHeader, {
|
|
13106
|
+
columns: columns,
|
|
13107
|
+
onSort: onSort,
|
|
13108
|
+
scope: scope,
|
|
13109
|
+
sort: sort,
|
|
13110
|
+
styles: args.styles,
|
|
13111
|
+
tableWidth: args.tableWidth
|
|
13112
|
+
}),
|
|
13113
|
+
keyAt: index => rows[index]?.id ?? String(index),
|
|
13114
|
+
renderRow: ({index: index, key: key, measureRow: measureRow, tableWidth: tableWidth}) => {
|
|
13115
|
+
const row = rows[index];
|
|
13116
|
+
if (row === void 0) return null;
|
|
13117
|
+
const overdue = overdueArmOf(row.attentionDetail);
|
|
13118
|
+
/* @__PURE__ */
|
|
13119
|
+
return jsx(RunTableRow, {
|
|
13120
|
+
dataIndex: index,
|
|
13121
|
+
measureRow: measureRow,
|
|
13122
|
+
now: now,
|
|
13123
|
+
onNavigateKey: onNavigateKey,
|
|
13124
|
+
onSelectRun: onSelectRun,
|
|
13125
|
+
row: row,
|
|
13126
|
+
scope: scope,
|
|
13127
|
+
scopedToWorkflow: scopedToWorkflow,
|
|
13128
|
+
selected: row.id === selectedId,
|
|
13129
|
+
selectedRef: selectedRef,
|
|
13130
|
+
overdue: overdue,
|
|
13131
|
+
taskRoom: taskRoomOf({
|
|
13132
|
+
gap: markGap,
|
|
13133
|
+
inset: cellInset,
|
|
13134
|
+
overdue: overdue !== void 0,
|
|
13135
|
+
tableWidth: tableWidth
|
|
13136
|
+
})
|
|
13137
|
+
}, key);
|
|
13138
|
+
},
|
|
13139
|
+
rowCount: rows.length
|
|
13140
|
+
});
|
|
13141
|
+
}
|
|
13142
|
+
|
|
13143
|
+
function RunsHeader({columns: columns, onSort: onSort, scope: scope, sort: sort, styles: styles, tableWidth: tableWidth}) {
|
|
13144
|
+
/* @__PURE__ */
|
|
13145
|
+
return jsx(SortableHeaderCells, {
|
|
13146
|
+
columns: columns,
|
|
13147
|
+
onSort: onSort,
|
|
13148
|
+
sort: sort,
|
|
13149
|
+
styles: styles,
|
|
13150
|
+
tableWidth: tableWidth,
|
|
13151
|
+
widthOf: (column, width) => column.key === "document" ? runsDocumentWidthOf({
|
|
13152
|
+
columns: columns,
|
|
13153
|
+
scope: scope,
|
|
13154
|
+
tableWidth: width
|
|
13155
|
+
}) : resolveColumnWidth(column.width, width),
|
|
13156
|
+
children: scope === "open" ? /* @__PURE__ */ jsx("th", {
|
|
13157
|
+
style: {
|
|
13158
|
+
...styles.head,
|
|
13159
|
+
width: tasksWidthOf(tableWidth)
|
|
13160
|
+
},
|
|
13161
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
13162
|
+
padding: 2,
|
|
13163
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13164
|
+
muted: !0,
|
|
13165
|
+
size: 1,
|
|
13166
|
+
children: "Tasks"
|
|
13167
|
+
})
|
|
13168
|
+
})
|
|
13169
|
+
}) : null
|
|
13170
|
+
});
|
|
13171
|
+
}
|
|
13172
|
+
|
|
13173
|
+
const RunTableRow = memo(function({dataIndex: dataIndex, measureRow: measureRow, now: now, onNavigateKey: onNavigateKey, onSelectRun: onSelectRun, overdue: overdue, row: row, scope: scope, scopedToWorkflow: scopedToWorkflow, selected: selected, selectedRef: selectedRef, taskRoom: taskRoom}) {
|
|
13174
|
+
const styles = useTableStyles(), documentInset = useSpaceToken(1);
|
|
13175
|
+
/* @__PURE__ */
|
|
13176
|
+
return jsxs(TableRowCard, {
|
|
13177
|
+
dataIndex: dataIndex,
|
|
13178
|
+
onClick: () => onSelectRun(row),
|
|
13179
|
+
onKeyDown: onNavigateKey,
|
|
13180
|
+
rowRef: measureRow,
|
|
13181
|
+
selected: selected,
|
|
13182
|
+
selectedRef: selectedRef,
|
|
13183
|
+
children: [
|
|
13184
|
+
/* @__PURE__ */ jsx("td", {
|
|
13185
|
+
style: {
|
|
13186
|
+
...styles.cell,
|
|
13187
|
+
paddingLeft: documentInset
|
|
13188
|
+
},
|
|
13189
|
+
children: /* @__PURE__ */ jsx(TableSubjectCell, {
|
|
13190
|
+
document: row.document
|
|
13191
|
+
})
|
|
13192
|
+
}), scopedToWorkflow ? null : /* @__PURE__ */ jsx("td", {
|
|
13193
|
+
style: styles.cell,
|
|
13194
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13195
|
+
muted: !0,
|
|
13196
|
+
size: 1,
|
|
13197
|
+
textOverflow: "ellipsis",
|
|
13198
|
+
children: row.workflowTitle
|
|
13199
|
+
})
|
|
13200
|
+
}), scope === "closed" ? /* @__PURE__ */ jsx(ClosedCells, {
|
|
13201
|
+
now: now,
|
|
13202
|
+
row: row
|
|
13203
|
+
}) : /* @__PURE__ */ jsx(OpenCells, {
|
|
13204
|
+
now: now,
|
|
13205
|
+
overdue: overdue,
|
|
13206
|
+
row: row,
|
|
13207
|
+
taskRoom: taskRoom
|
|
13208
|
+
}) ]
|
|
13209
|
+
});
|
|
13210
|
+
});
|
|
13211
|
+
|
|
13212
|
+
function OpenCells({now: now, overdue: overdue, row: row, taskRoom: taskRoom}) {
|
|
13213
|
+
const styles = useTableStyles(), blocked = blockedArmOf(row.attentionDetail);
|
|
13214
|
+
/* @__PURE__ */
|
|
13215
|
+
return jsxs(Fragment, {
|
|
13216
|
+
children: [
|
|
13217
|
+
/* @__PURE__ */ jsx("td", {
|
|
13218
|
+
style: styles.cell,
|
|
13219
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
13220
|
+
align: "center",
|
|
13221
|
+
gap: 2,
|
|
13222
|
+
children: [
|
|
13223
|
+
/* @__PURE__ */ jsx(Text, {
|
|
13224
|
+
size: 1,
|
|
13225
|
+
textOverflow: "ellipsis",
|
|
13226
|
+
children: row.stageTitle
|
|
13227
|
+
}), blocked === void 0 ? null : /* @__PURE__ */ jsx(AttentionMark, {
|
|
13228
|
+
detail: blocked,
|
|
13229
|
+
now: now,
|
|
13230
|
+
tasks: row.tasks
|
|
13231
|
+
}) ]
|
|
13232
|
+
})
|
|
13233
|
+
}),
|
|
13234
|
+
/* @__PURE__ */ jsx("td", {
|
|
13235
|
+
style: styles.cell,
|
|
13236
|
+
children: /* @__PURE__ */ jsx(AgoStamp, {
|
|
13237
|
+
at: row.startedAt,
|
|
13238
|
+
now: now
|
|
13239
|
+
})
|
|
13240
|
+
}),
|
|
13241
|
+
/* @__PURE__ */ jsx("td", {
|
|
13242
|
+
style: {
|
|
13243
|
+
...styles.cell,
|
|
13244
|
+
overflow: "hidden"
|
|
13245
|
+
},
|
|
13246
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
13247
|
+
align: "center",
|
|
13248
|
+
gap: TASKS_CELL_GAP_TOKEN,
|
|
13249
|
+
children: [
|
|
13250
|
+
/* @__PURE__ */ jsx(StageTaskGroups, {
|
|
13251
|
+
now: now,
|
|
13252
|
+
room: taskRoom,
|
|
13253
|
+
tasks: row.tasks
|
|
13254
|
+
}), overdue === void 0 ? null : /* @__PURE__ */ jsx(AttentionMark, {
|
|
13255
|
+
detail: overdue,
|
|
13256
|
+
now: now,
|
|
13257
|
+
tasks: row.tasks
|
|
13258
|
+
}) ]
|
|
13259
|
+
})
|
|
13260
|
+
}) ]
|
|
13261
|
+
});
|
|
13262
|
+
}
|
|
13263
|
+
|
|
13264
|
+
function ClosedCells({now: now, row: row}) {
|
|
13265
|
+
const styles = useTableStyles();
|
|
13266
|
+
/* @__PURE__ */
|
|
13267
|
+
return jsxs(Fragment, {
|
|
13268
|
+
children: [
|
|
13269
|
+
/* @__PURE__ */ jsx("td", {
|
|
13270
|
+
style: styles.cell,
|
|
13271
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13272
|
+
size: 1,
|
|
13273
|
+
textOverflow: "ellipsis",
|
|
13274
|
+
children: row.outcome
|
|
13275
|
+
})
|
|
13276
|
+
}),
|
|
13277
|
+
/* @__PURE__ */ jsx("td", {
|
|
13278
|
+
style: styles.cell,
|
|
13279
|
+
children: /* @__PURE__ */ jsx(AgoStamp, {
|
|
13280
|
+
at: row.startedAt,
|
|
13281
|
+
now: now
|
|
13282
|
+
})
|
|
13283
|
+
}),
|
|
13284
|
+
/* @__PURE__ */ jsx("td", {
|
|
13285
|
+
style: styles.cell,
|
|
13286
|
+
children: row.endedAt === void 0 ? null : /* @__PURE__ */ jsx(AgoStamp, {
|
|
13287
|
+
at: row.endedAt,
|
|
13288
|
+
now: now
|
|
13289
|
+
})
|
|
13290
|
+
}) ]
|
|
13291
|
+
});
|
|
13292
|
+
}
|
|
13293
|
+
|
|
13294
|
+
function DueStamp({due: due, now: now}) {
|
|
13295
|
+
/* @__PURE__ */
|
|
13296
|
+
return jsx(Flex, {
|
|
13297
|
+
align: "center",
|
|
13298
|
+
children: /* @__PURE__ */ jsx(_HoverHint, {
|
|
13299
|
+
text: dueMomentSentence(due, now),
|
|
13300
|
+
children: isDueDatePast(due, now) ? /* @__PURE__ */ jsx(LateSpan, {
|
|
13301
|
+
now: now,
|
|
13302
|
+
since: due
|
|
13303
|
+
}) :
|
|
13304
|
+
/* @__PURE__ */ jsx(Text, {
|
|
13305
|
+
muted: !0,
|
|
13306
|
+
size: 1,
|
|
13307
|
+
style: {
|
|
13308
|
+
whiteSpace: "nowrap"
|
|
13309
|
+
},
|
|
13310
|
+
children: formatDate(due)
|
|
13311
|
+
})
|
|
13312
|
+
})
|
|
13313
|
+
});
|
|
13314
|
+
}
|
|
13315
|
+
|
|
13316
|
+
const TASK_WIDTH = {
|
|
13317
|
+
cap: 280,
|
|
13318
|
+
fraction: .22
|
|
13319
|
+
}, FOR_ME_ATTENTION_WIDTH = 48, FOR_ME_ASSIGNEE_WIDTH = 96, FOR_ME_COLUMNS = [ {
|
|
13320
|
+
key: "document",
|
|
13321
|
+
label: "Workflow subject"
|
|
13322
|
+
}, {
|
|
13323
|
+
key: "task",
|
|
13324
|
+
label: "Task",
|
|
13325
|
+
width: TASK_WIDTH
|
|
13326
|
+
}, {
|
|
13327
|
+
key: "opened",
|
|
13328
|
+
label: "Opened",
|
|
13329
|
+
width: TABLE_TIME_WIDTH
|
|
13330
|
+
}, {
|
|
13331
|
+
key: "workflow",
|
|
13332
|
+
label: "Workflow",
|
|
13333
|
+
width: TABLE_WORKFLOW_WIDTH
|
|
13334
|
+
}, {
|
|
13335
|
+
key: "due",
|
|
13336
|
+
label: "Due",
|
|
13337
|
+
width: TABLE_TIME_WIDTH
|
|
13338
|
+
} ];
|
|
13339
|
+
|
|
13340
|
+
function forMeDocumentWidthOf(tableWidth) {
|
|
13341
|
+
return fillColumnWidth({
|
|
13342
|
+
columns: FOR_ME_COLUMNS,
|
|
13343
|
+
tableWidth: tableWidth,
|
|
13344
|
+
trailingWidth: FOR_ME_ASSIGNEE_WIDTH + FOR_ME_ATTENTION_WIDTH
|
|
13345
|
+
});
|
|
13346
|
+
}
|
|
13347
|
+
|
|
13348
|
+
function ForMeTable({now: now, onNavigateKey: onNavigateKey, onSelect: onSelect, onSort: onSort, rows: rows, selectedId: selectedId, selectedRef: selectedRef, sort: sort}) {
|
|
13349
|
+
/* @__PURE__ */
|
|
13350
|
+
return jsx(VirtualTable, {
|
|
13351
|
+
renderHeader: args => /* @__PURE__ */ jsxs(SortableHeaderCells, {
|
|
13352
|
+
columns: FOR_ME_COLUMNS,
|
|
13353
|
+
onSort: onSort,
|
|
13354
|
+
sort: sort,
|
|
13355
|
+
styles: args.styles,
|
|
13356
|
+
tableWidth: args.tableWidth,
|
|
13357
|
+
widthOf: (column, tableWidth) => column.key === "document" ? forMeDocumentWidthOf(tableWidth) : resolveColumnWidth(column.width, tableWidth),
|
|
13358
|
+
children: [
|
|
13359
|
+
/* @__PURE__ */ jsx("th", {
|
|
13360
|
+
style: {
|
|
13361
|
+
...args.styles.head,
|
|
13362
|
+
width: FOR_ME_ASSIGNEE_WIDTH
|
|
13363
|
+
},
|
|
13364
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
13365
|
+
padding: 2,
|
|
13366
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13367
|
+
muted: !0,
|
|
13368
|
+
size: 1,
|
|
13369
|
+
children: "Assignee"
|
|
13370
|
+
})
|
|
13371
|
+
})
|
|
13372
|
+
}),
|
|
13373
|
+
/* @__PURE__ */ jsx("th", {
|
|
13374
|
+
"aria-label": "Attention",
|
|
13375
|
+
style: {
|
|
13376
|
+
...args.styles.head,
|
|
13377
|
+
width: FOR_ME_ATTENTION_WIDTH
|
|
13378
|
+
}
|
|
13379
|
+
}) ]
|
|
13380
|
+
}),
|
|
13381
|
+
keyAt: index => rows[index]?.id ?? String(index),
|
|
13382
|
+
renderRow: ({index: index, key: key, measureRow: measureRow}) => {
|
|
13383
|
+
const row = rows[index];
|
|
13384
|
+
return row === void 0 ? null : /* @__PURE__ */ jsx(ForMeTableRow, {
|
|
13385
|
+
dataIndex: index,
|
|
13386
|
+
measureRow: measureRow,
|
|
13387
|
+
now: now,
|
|
13388
|
+
onNavigateKey: onNavigateKey,
|
|
13389
|
+
onSelect: onSelect,
|
|
13390
|
+
row: row,
|
|
13391
|
+
selected: row.id === selectedId,
|
|
13392
|
+
selectedRef: selectedRef
|
|
13393
|
+
}, key);
|
|
13394
|
+
},
|
|
13395
|
+
rowCount: rows.length
|
|
13396
|
+
});
|
|
13397
|
+
}
|
|
13398
|
+
|
|
13399
|
+
const ForMeTableRow = memo(function({dataIndex: dataIndex, measureRow: measureRow, now: now, onNavigateKey: onNavigateKey, onSelect: onSelect, row: row, selected: selected, selectedRef: selectedRef}) {
|
|
13400
|
+
const styles = useTableStyles(), documentInset = useSpaceToken(1);
|
|
13401
|
+
/* @__PURE__ */
|
|
13402
|
+
return jsxs(TableRowCard, {
|
|
13403
|
+
dataIndex: dataIndex,
|
|
13404
|
+
onClick: () => onSelect(row),
|
|
13405
|
+
onKeyDown: onNavigateKey,
|
|
13406
|
+
rowRef: measureRow,
|
|
13407
|
+
selected: selected,
|
|
13408
|
+
selectedRef: selectedRef,
|
|
13409
|
+
children: [
|
|
13410
|
+
/* @__PURE__ */ jsx("td", {
|
|
13411
|
+
style: {
|
|
13412
|
+
...styles.cell,
|
|
13413
|
+
paddingLeft: documentInset
|
|
13414
|
+
},
|
|
13415
|
+
children: /* @__PURE__ */ jsx(TableSubjectCell, {
|
|
13416
|
+
document: row.document
|
|
13417
|
+
})
|
|
13418
|
+
}),
|
|
13419
|
+
/* @__PURE__ */ jsx("td", {
|
|
13420
|
+
style: styles.cell,
|
|
13421
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13422
|
+
size: 1,
|
|
13423
|
+
textOverflow: "ellipsis",
|
|
13424
|
+
children: row.title
|
|
13425
|
+
})
|
|
13426
|
+
}),
|
|
13427
|
+
/* @__PURE__ */ jsx("td", {
|
|
13428
|
+
style: styles.cell,
|
|
13429
|
+
children: /* @__PURE__ */ jsx(AgoStamp, {
|
|
13430
|
+
at: row.openedAt,
|
|
13431
|
+
now: now
|
|
13432
|
+
})
|
|
13433
|
+
}),
|
|
13434
|
+
/* @__PURE__ */ jsx("td", {
|
|
13435
|
+
style: styles.cell,
|
|
13436
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13437
|
+
muted: !0,
|
|
13438
|
+
size: 1,
|
|
13439
|
+
textOverflow: "ellipsis",
|
|
13440
|
+
children: row.workflowTitle
|
|
13441
|
+
})
|
|
13442
|
+
}),
|
|
13443
|
+
/* @__PURE__ */ jsx("td", {
|
|
13444
|
+
style: styles.cell,
|
|
13445
|
+
children: row.due === void 0 ? null : /* @__PURE__ */ jsx(DueStamp, {
|
|
13446
|
+
due: row.due,
|
|
13447
|
+
now: now
|
|
13448
|
+
})
|
|
13449
|
+
}),
|
|
13450
|
+
/* @__PURE__ */ jsx("td", {
|
|
13451
|
+
style: {
|
|
13452
|
+
...styles.cell,
|
|
13453
|
+
overflow: "hidden"
|
|
13454
|
+
},
|
|
13455
|
+
children: /* @__PURE__ */ jsx(Flex, {
|
|
13456
|
+
align: "center",
|
|
13457
|
+
children: /* @__PURE__ */ jsx(RowAssignees, {
|
|
13458
|
+
assignees: row.assignees
|
|
13459
|
+
})
|
|
13460
|
+
})
|
|
13461
|
+
}),
|
|
13462
|
+
/* @__PURE__ */ jsx("td", {
|
|
13463
|
+
style: styles.cell,
|
|
13464
|
+
children: /* @__PURE__ */ jsx(ForMeAttentionCell, {
|
|
13465
|
+
now: now,
|
|
13466
|
+
row: row
|
|
13467
|
+
})
|
|
13468
|
+
}) ]
|
|
13469
|
+
});
|
|
13470
|
+
});
|
|
13471
|
+
|
|
13472
|
+
function ForMeAttentionCell({now: now, row: row}) {
|
|
13473
|
+
const blocked = blockedArmOf(row.attentionDetail);
|
|
13474
|
+
return blocked === void 0 ? null : /* @__PURE__ */ jsx(Flex, {
|
|
13475
|
+
align: "center",
|
|
13476
|
+
children: /* @__PURE__ */ jsx(AttentionMark, {
|
|
13477
|
+
detail: blocked,
|
|
13478
|
+
now: now,
|
|
13479
|
+
tasks: []
|
|
13480
|
+
})
|
|
13481
|
+
});
|
|
13482
|
+
}
|
|
13483
|
+
|
|
13484
|
+
function forMeRowId(instanceId, activityName) {
|
|
13485
|
+
return `${instanceId}\t${activityName}`;
|
|
13486
|
+
}
|
|
13487
|
+
|
|
13488
|
+
function forMeTaskRowsOf(args) {
|
|
13489
|
+
const {rows: rows, who: who} = args;
|
|
13490
|
+
return rows.flatMap(row => row.tasks.flatMap(task => {
|
|
13491
|
+
const assignment = assignmentHolding(task.assignees, who);
|
|
13492
|
+
if (assignment === "other") return [];
|
|
13493
|
+
const attentionDetail = taskAttentionDetail({
|
|
13494
|
+
row: row,
|
|
13495
|
+
task: task
|
|
13496
|
+
});
|
|
13497
|
+
return [ {
|
|
13498
|
+
id: forMeRowId(row.id, task.name),
|
|
13499
|
+
instanceId: row.id,
|
|
13500
|
+
activityName: task.name,
|
|
13501
|
+
title: task.title,
|
|
13502
|
+
document: row.document,
|
|
13503
|
+
workflowTitle: row.workflowTitle,
|
|
13504
|
+
releases: row.releases,
|
|
13505
|
+
openedAt: task.openedAt,
|
|
13506
|
+
due: task.due,
|
|
13507
|
+
attention: attentionKindOf(attentionDetail),
|
|
13508
|
+
attentionDetail: attentionDetail,
|
|
13509
|
+
assignees: task.assignees,
|
|
13510
|
+
assignment: assignment
|
|
13511
|
+
} ];
|
|
13512
|
+
}));
|
|
13513
|
+
}
|
|
13514
|
+
|
|
13515
|
+
function forMeSummaryOf(rows) {
|
|
13516
|
+
const documents = new Set(rows.flatMap(row => row.document === void 0 ? [] : [ row.document.id ])), releases = new Set(rows.flatMap(row => row.releases));
|
|
13517
|
+
return {
|
|
13518
|
+
lead: rows.length === 0 ? "No tasks" : pluralize("task", rows.length, !0),
|
|
13519
|
+
subjects: `on ${pluralize("document", documents.size, !0)}, and ${pluralize("release", releases.size, !0)}`
|
|
13520
|
+
};
|
|
13521
|
+
}
|
|
13522
|
+
|
|
13523
|
+
function forMeSectionsOf(rows) {
|
|
13524
|
+
return {
|
|
13525
|
+
assignedToUser: rows.filter(row => row.assignment === "you"),
|
|
13526
|
+
assignedToRoles: rows.filter(row => row.assignment === "role")
|
|
13527
|
+
};
|
|
13528
|
+
}
|
|
13529
|
+
|
|
13530
|
+
function resolveForMeAddress(args) {
|
|
13531
|
+
const {rows: rows, run: run, task: task} = args;
|
|
13532
|
+
if (run === void 0) return;
|
|
13533
|
+
if (task !== void 0) return rows.some(row => row.instanceId === run && row.activityName === task) ? {
|
|
13534
|
+
run: run,
|
|
13535
|
+
task: task
|
|
13536
|
+
} : void 0;
|
|
13537
|
+
const first = rows.find(row => row.instanceId === run);
|
|
13538
|
+
return first === void 0 ? void 0 : {
|
|
13539
|
+
run: first.instanceId,
|
|
13540
|
+
task: first.activityName
|
|
13541
|
+
};
|
|
13542
|
+
}
|
|
13543
|
+
|
|
13544
|
+
function taskAttentionDetail(args) {
|
|
13545
|
+
const {row: row, task: task} = args;
|
|
13546
|
+
if (task.status === "failed") return {
|
|
13547
|
+
kind: "blocked",
|
|
13548
|
+
task: task.title
|
|
13549
|
+
};
|
|
13550
|
+
if (row.attention === "blocked") return row.attentionDetail;
|
|
13551
|
+
if (task.overdueSince !== void 0) return {
|
|
13552
|
+
dues: [ task.overdueSince ],
|
|
13553
|
+
kind: "overdue",
|
|
13554
|
+
task: task.title
|
|
13555
|
+
};
|
|
13556
|
+
}
|
|
13557
|
+
|
|
13558
|
+
export { ATTENTION_FACES, AbortWorkflowDialog, ActivityDetailBody, ActivityDetailDialog, ActivityLog, AlertGlyph, AttentionMark, Breadcrumb, CodeChip, CountedLabel, DismissablePopover, DocPreviewLink, DocRefFace, EmptyState, FOR_ME_SECTION_COPY, ForMeEmptyState, ForMeSectionHeading, ForMeTable, InstanceFaultNote, InstanceSnapshotBody, InvalidDocNotice, LoadingRow, LogEventOnMount, MetaRow, MetricPair, NoteBanner, RUN_SEARCH_PARAM, RunsTable, SectionHeading, SortHeaderButton, SpinnerSlot, StageTaskGroups, TOOL_TABS, TabSwitch, TableRowCard, UNREADABLE_DOCUMENT, UnreadableDocsNote, WORKFLOW_API_VERSION, WorkflowBoardWorkflowSelected, WorkflowDefinitionDetailViewed, WorkflowInstanceDetailViewed, WorkflowTitleSeedDrifted, WorkflowToolOpened, blockedAttentionHint, blockedRunDetail, countBy, definitionFingerprint, definitionsRouteOf, deriveActivityDetail, describeError, documentRefsOf, forMeRowId, forMeSectionsOf, forMeSummaryOf, forMeTaskRowsOf, formatTimeAgo, gdrLocality, identityOf, instanceBreadcrumb, instanceTitle, isEvaluationStale, isLiveEntry, landingState, mappingIssueDetail, namesNoDeployedDefinition, noReleaseRunCount, openActivityGone, openableSchemaType, overdueAttentionHint, overdueRunDetail, readDeployedDefinitions, resolveForMeAddress, rowHasTaskHeldBy, runAttentionCounts, runCountsByAssignee, runCountsByRelease, runCountsByRole, runCountsByStage, runCountsByWorkflow, runRowsOf, runsScopeOf, scrollParentOf, stageTasksOf, stageTitle, tabSelectionNavigates, toolRoute, toolTabState, unassignedRunCount, useAlertChipSize, useAssignmentIdentity, useAvatarSize, useCapTrimFor, useContainerToken, useCurrentUserId, useDefinition, useLogEventOnMount, useMinuteClock, useProjectMembers, useRadiusToken, useReleaseTitles, useSpaceToken, useTableStyles, useTextIconSize, useUserDisplays, useWorkflowContext, useWorkflowInstanceEntry, userIdsOf, workflowDefaultDocumentNode, workflowState, workflowStudioPlugin, workflowsView };
|