@burdenoff/microfe-calendar 2026.1123.3 → 2026.1124.2
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/dist/components/AgendaView.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +785 -0
- package/dist/generated/wspace-operations.js +250 -84
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +1243 -10
- package/dist/hooks/useSafePermissions.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/providers/CalendarProvider.d.ts +3 -1
- package/dist/providers/CalendarProvider.js +12 -10
- package/dist/providers/CalendarProvider.js.map +1 -1
- package/dist/translations/en.d.ts +351 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/v2/CalendarPageV2.js +92 -14
- package/dist/v2/CalendarPageV2.js.map +1 -1
- package/dist/v2/colors.d.ts +23 -0
- package/dist/v2/colors.js +92 -0
- package/dist/v2/colors.js.map +1 -0
- package/dist/v2/data/enums.d.ts +6 -0
- package/dist/v2/data/enums.js +10 -0
- package/dist/v2/data/enums.js.map +1 -0
- package/dist/v2/data/errors.d.ts +4 -0
- package/dist/v2/data/errors.js +17 -0
- package/dist/v2/data/errors.js.map +1 -0
- package/dist/v2/data/invalidation.js +19 -0
- package/dist/v2/data/invalidation.js.map +1 -0
- package/dist/v2/data/normalize.js +181 -16
- package/dist/v2/data/normalize.js.map +1 -1
- package/dist/v2/data/serialWrites.d.ts +17 -0
- package/dist/v2/data/serialWrites.js +21 -0
- package/dist/v2/data/serialWrites.js.map +1 -0
- package/dist/v2/data/useCalendarsV2.d.ts +10 -1
- package/dist/v2/data/useCalendarsV2.js +68 -16
- package/dist/v2/data/useCalendarsV2.js.map +1 -1
- package/dist/v2/data/useEventActions.d.ts +49 -0
- package/dist/v2/data/useEventActions.js +399 -0
- package/dist/v2/data/useEventActions.js.map +1 -0
- package/dist/v2/data/useEventForPeek.d.ts +17 -0
- package/dist/v2/data/useEventForPeek.js +29 -0
- package/dist/v2/data/useEventForPeek.js.map +1 -0
- package/dist/v2/data/useEventSearchV2.d.ts +15 -0
- package/dist/v2/data/useEventSearchV2.js +80 -0
- package/dist/v2/data/useEventSearchV2.js.map +1 -0
- package/dist/v2/data/useEventsInRangeV2.js +78 -0
- package/dist/v2/data/useEventsInRangeV2.js.map +1 -0
- package/dist/v2/data/useFreeBusy.d.ts +5 -0
- package/dist/v2/data/useFreeBusy.js +83 -0
- package/dist/v2/data/useFreeBusy.js.map +1 -0
- package/dist/v2/data/useKeyedLoad.js +47 -0
- package/dist/v2/data/useKeyedLoad.js.map +1 -0
- package/dist/v2/data/useRoomsV2.d.ts +28 -0
- package/dist/v2/data/useRoomsV2.js +45 -0
- package/dist/v2/data/useRoomsV2.js.map +1 -0
- package/dist/v2/day/DayPanel.d.ts +6 -0
- package/dist/v2/day/DayPanel.js +215 -0
- package/dist/v2/day/DayPanel.js.map +1 -0
- package/dist/v2/day/daySummary.d.ts +37 -0
- package/dist/v2/day/daySummary.js +37 -0
- package/dist/v2/day/daySummary.js.map +1 -0
- package/dist/v2/dialogs/CalendarDialogsV2.d.ts +1 -0
- package/dist/v2/dialogs/CalendarDialogsV2.js +17 -0
- package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -0
- package/dist/v2/dialogs/ShortcutsDialog.d.ts +4 -0
- package/dist/v2/dialogs/ShortcutsDialog.js +42 -0
- package/dist/v2/dialogs/ShortcutsDialog.js.map +1 -0
- package/dist/v2/events/eventLook.d.ts +46 -0
- package/dist/v2/events/eventLook.js +35 -0
- package/dist/v2/events/eventLook.js.map +1 -0
- package/dist/v2/events/eventModel.d.ts +92 -0
- package/dist/v2/events/eventModel.js +116 -0
- package/dist/v2/events/eventModel.js.map +1 -0
- package/dist/v2/events/localChanges.d.ts +4 -0
- package/dist/v2/events/localChanges.js +23 -0
- package/dist/v2/events/localChanges.js.map +1 -0
- package/dist/v2/format.d.ts +67 -0
- package/dist/v2/format.js +112 -0
- package/dist/v2/format.js.map +1 -0
- package/dist/v2/grid/AllDayRow.d.ts +20 -0
- package/dist/v2/grid/AllDayRow.js +94 -0
- package/dist/v2/grid/AllDayRow.js.map +1 -0
- package/dist/v2/grid/EventBlock.d.ts +21 -0
- package/dist/v2/grid/EventBlock.js +112 -0
- package/dist/v2/grid/EventBlock.js.map +1 -0
- package/dist/v2/grid/GridParts.d.ts +40 -0
- package/dist/v2/grid/GridParts.js +210 -0
- package/dist/v2/grid/GridParts.js.map +1 -0
- package/dist/v2/grid/QuickCreate.d.ts +1 -0
- package/dist/v2/grid/QuickCreate.js +175 -0
- package/dist/v2/grid/QuickCreate.js.map +1 -0
- package/dist/v2/grid/TimeGrid.d.ts +1 -0
- package/dist/v2/grid/TimeGrid.js +188 -0
- package/dist/v2/grid/TimeGrid.js.map +1 -0
- package/dist/v2/grid/geometry.d.ts +72 -0
- package/dist/v2/grid/geometry.js +85 -0
- package/dist/v2/grid/geometry.js.map +1 -0
- package/dist/v2/grid/layout.d.ts +24 -0
- package/dist/v2/grid/layout.js +77 -0
- package/dist/v2/grid/layout.js.map +1 -0
- package/dist/v2/grid/useGridDrag.d.ts +42 -0
- package/dist/v2/grid/useGridDrag.js +181 -0
- package/dist/v2/grid/useGridDrag.js.map +1 -0
- package/dist/v2/grid/useSlotCursor.d.ts +32 -0
- package/dist/v2/grid/useSlotCursor.js +57 -0
- package/dist/v2/grid/useSlotCursor.js.map +1 -0
- package/dist/v2/grid/workingHours.d.ts +21 -0
- package/dist/v2/grid/workingHours.js +101 -0
- package/dist/v2/grid/workingHours.js.map +1 -0
- package/dist/v2/hooks/useAvailableHeight.d.ts +2 -0
- package/dist/v2/hooks/useAvailableHeight.js +25 -0
- package/dist/v2/hooks/useAvailableHeight.js.map +1 -0
- package/dist/v2/hooks/useCalendarShortcuts.d.ts +9 -0
- package/dist/v2/hooks/useCalendarShortcuts.js +60 -0
- package/dist/v2/hooks/useCalendarShortcuts.js.map +1 -0
- package/dist/v2/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/v2/hooks/useDebouncedValue.js +12 -0
- package/dist/v2/hooks/useDebouncedValue.js.map +1 -0
- package/dist/v2/hooks/useMediaQuery.d.ts +5 -0
- package/dist/v2/hooks/useMediaQuery.js +17 -0
- package/dist/v2/hooks/useMediaQuery.js.map +1 -0
- package/dist/v2/hooks/useNow.d.ts +2 -0
- package/dist/v2/hooks/useNow.js +31 -0
- package/dist/v2/hooks/useNow.js.map +1 -0
- package/dist/v2/limits.d.ts +6 -0
- package/dist/v2/limits.js +5 -0
- package/dist/v2/limits.js.map +1 -0
- package/dist/v2/list/EventListRow.d.ts +10 -0
- package/dist/v2/list/EventListRow.js +109 -0
- package/dist/v2/list/EventListRow.js.map +1 -0
- package/dist/v2/list/ListViewV2.d.ts +16 -0
- package/dist/v2/list/ListViewV2.js +96 -0
- package/dist/v2/list/ListViewV2.js.map +1 -0
- package/dist/v2/month/MonthView.d.ts +1 -0
- package/dist/v2/month/MonthView.js +328 -0
- package/dist/v2/month/MonthView.js.map +1 -0
- package/dist/v2/month/monthLayout.d.ts +39 -0
- package/dist/v2/month/monthLayout.js +29 -0
- package/dist/v2/month/monthLayout.js.map +1 -0
- package/dist/v2/page/CalendarChrome.d.ts +2 -0
- package/dist/v2/page/CalendarChrome.js +295 -0
- package/dist/v2/page/CalendarChrome.js.map +1 -0
- package/dist/v2/page/CalendarPageContext.d.ts +92 -0
- package/dist/v2/page/CalendarPageContext.js +11 -0
- package/dist/v2/page/CalendarPageContext.js.map +1 -0
- package/dist/v2/page/pageHelpers.d.ts +19 -0
- package/dist/v2/page/pageHelpers.js +39 -0
- package/dist/v2/page/pageHelpers.js.map +1 -0
- package/dist/v2/page/useCalendarPageModel.d.ts +2 -0
- package/dist/v2/page/useCalendarPageModel.js +198 -0
- package/dist/v2/page/useCalendarPageModel.js.map +1 -0
- package/dist/v2/page/viewState.d.ts +70 -0
- package/dist/v2/page/viewState.js +47 -0
- package/dist/v2/page/viewState.js.map +1 -0
- package/dist/v2/peek/EventPeek.d.ts +2 -0
- package/dist/v2/peek/EventPeek.js +92 -0
- package/dist/v2/peek/EventPeek.js.map +1 -0
- package/dist/v2/peek/PeekEvent.d.ts +4 -0
- package/dist/v2/peek/PeekEvent.js +443 -0
- package/dist/v2/peek/PeekEvent.js.map +1 -0
- package/dist/v2/peek/PeekParts.d.ts +14 -0
- package/dist/v2/peek/PeekParts.js +75 -0
- package/dist/v2/peek/PeekParts.js.map +1 -0
- package/dist/v2/prefs/calendarPrefs.d.ts +2 -2
- package/dist/v2/prefs/calendarPrefs.js +35 -34
- package/dist/v2/prefs/calendarPrefs.js.map +1 -1
- package/dist/v2/rail/CalendarRail.d.ts +3 -0
- package/dist/v2/rail/CalendarRail.js +258 -0
- package/dist/v2/rail/CalendarRail.js.map +1 -0
- package/dist/v2/rail/railStatus.d.ts +54 -0
- package/dist/v2/rail/railStatus.js +84 -0
- package/dist/v2/rail/railStatus.js.map +1 -0
- package/dist/v2/rail/syncWords.d.ts +10 -0
- package/dist/v2/rail/syncWords.js +75 -0
- package/dist/v2/rail/syncWords.js.map +1 -0
- package/dist/v2/rail/useMonthEventDates.d.ts +4 -0
- package/dist/v2/rail/useMonthEventDates.js +30 -0
- package/dist/v2/rail/useMonthEventDates.js.map +1 -0
- package/dist/v2/routes.js +4 -1
- package/dist/v2/routes.js.map +1 -1
- package/dist/v2/runs/RunPeek.d.ts +2 -0
- package/dist/v2/runs/RunPeek.js +382 -0
- package/dist/v2/runs/RunPeek.js.map +1 -0
- package/dist/v2/runs/RunPills.d.ts +28 -0
- package/dist/v2/runs/RunPills.js +179 -0
- package/dist/v2/runs/RunPills.js.map +1 -0
- package/dist/v2/runs/RunRows.d.ts +21 -0
- package/dist/v2/runs/RunRows.js +140 -0
- package/dist/v2/runs/RunRows.js.map +1 -0
- package/dist/v2/runs/RunsNotices.d.ts +1 -0
- package/dist/v2/runs/RunsNotices.js +37 -0
- package/dist/v2/runs/RunsNotices.js.map +1 -0
- package/dist/v2/runs/RunsSwitch.d.ts +1 -0
- package/dist/v2/runs/RunsSwitch.js +54 -0
- package/dist/v2/runs/RunsSwitch.js.map +1 -0
- package/dist/v2/runs/WorkflowRunsLayer.d.ts +4 -0
- package/dist/v2/runs/WorkflowRunsLayer.js +82 -0
- package/dist/v2/runs/WorkflowRunsLayer.js.map +1 -0
- package/dist/v2/runs/runAccess.d.ts +37 -0
- package/dist/v2/runs/runAccess.js +14 -0
- package/dist/v2/runs/runAccess.js.map +1 -0
- package/dist/v2/runs/runLayout.d.ts +76 -0
- package/dist/v2/runs/runLayout.js +129 -0
- package/dist/v2/runs/runLayout.js.map +1 -0
- package/dist/v2/runs/runLinks.d.ts +32 -0
- package/dist/v2/runs/runLinks.js +50 -0
- package/dist/v2/runs/runLinks.js.map +1 -0
- package/dist/v2/runs/runModel.d.ts +97 -0
- package/dist/v2/runs/runModel.js +132 -0
- package/dist/v2/runs/runModel.js.map +1 -0
- package/dist/v2/runs/runPeekState.d.ts +53 -0
- package/dist/v2/runs/runPeekState.js +62 -0
- package/dist/v2/runs/runPeekState.js.map +1 -0
- package/dist/v2/runs/runTypes.d.ts +60 -0
- package/dist/v2/runs/runWords.d.ts +23 -0
- package/dist/v2/runs/runWords.js +83 -0
- package/dist/v2/runs/runWords.js.map +1 -0
- package/dist/v2/runs/runsLayerContext.d.ts +26 -0
- package/dist/v2/runs/runsLayerContext.js +33 -0
- package/dist/v2/runs/runsLayerContext.js.map +1 -0
- package/dist/v2/runs/useRunHrefs.d.ts +10 -0
- package/dist/v2/runs/useRunHrefs.js +60 -0
- package/dist/v2/runs/useRunHrefs.js.map +1 -0
- package/dist/v2/runs/useRunLabels.d.ts +6 -0
- package/dist/v2/runs/useRunLabels.js +27 -0
- package/dist/v2/runs/useRunLabels.js.map +1 -0
- package/dist/v2/runs/useRunsAccess.d.ts +2 -0
- package/dist/v2/runs/useRunsAccess.js +14 -0
- package/dist/v2/runs/useRunsAccess.js.map +1 -0
- package/dist/v2/runs/useWorkflowRuns.d.ts +61 -0
- package/dist/v2/runs/useWorkflowRuns.js +119 -0
- package/dist/v2/runs/useWorkflowRuns.js.map +1 -0
- package/dist/v2/search/SearchResults.d.ts +1 -0
- package/dist/v2/search/SearchResults.js +88 -0
- package/dist/v2/search/SearchResults.js.map +1 -0
- package/dist/v2/search/searchModel.d.ts +20 -0
- package/dist/v2/search/searchModel.js +22 -0
- package/dist/v2/search/searchModel.js.map +1 -0
- package/dist/v2/state/calendarV2Store.d.ts +4 -1
- package/dist/v2/state/calendarV2Store.js +3 -1
- package/dist/v2/state/calendarV2Store.js.map +1 -1
- package/dist/v2/state/useCalendarV2Navigation.d.ts +1 -0
- package/dist/v2/state/useCalendarV2Navigation.js +4 -1
- package/dist/v2/state/useCalendarV2Navigation.js.map +1 -1
- package/dist/v2/states/CalendarStates.d.ts +18 -0
- package/dist/v2/states/CalendarStates.js +122 -0
- package/dist/v2/states/CalendarStates.js.map +1 -0
- package/dist/v2/styles.d.ts +32 -0
- package/dist/v2/styles.js +10 -0
- package/dist/v2/styles.js.map +1 -0
- package/dist/v2/time/calendarTime.js +121 -35
- package/dist/v2/time/calendarTime.js.map +1 -1
- package/dist/v2/types.d.ts +22 -2
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { instantToZoned as e } from "../time/calendarTime.js";
|
|
2
|
+
import { addDays as t } from "@burdenoff/fe-libs/ui";
|
|
3
|
+
// src/v2/runs/runModel.ts
|
|
4
|
+
var n = "workflow", r = [
|
|
5
|
+
"DRAFT",
|
|
6
|
+
"PENDING",
|
|
7
|
+
"RUNNING",
|
|
8
|
+
"COMPLETED",
|
|
9
|
+
"FAILED",
|
|
10
|
+
"PAUSED",
|
|
11
|
+
"CANCELLED",
|
|
12
|
+
"DISABLED",
|
|
13
|
+
"ARCHIVED"
|
|
14
|
+
];
|
|
15
|
+
function i(e) {
|
|
16
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
17
|
+
}
|
|
18
|
+
function a(e) {
|
|
19
|
+
return typeof e == "string" && e.trim() !== "" ? e : null;
|
|
20
|
+
}
|
|
21
|
+
function o(e) {
|
|
22
|
+
if (!e) return null;
|
|
23
|
+
let t = new Date(e);
|
|
24
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
25
|
+
}
|
|
26
|
+
function s(e) {
|
|
27
|
+
return r.find((t) => t === e) ?? null;
|
|
28
|
+
}
|
|
29
|
+
function c(e) {
|
|
30
|
+
if (!i(e)) return null;
|
|
31
|
+
let t = a(e.kind), n = a(e.id);
|
|
32
|
+
if (!t || !n) return null;
|
|
33
|
+
let r = {
|
|
34
|
+
kind: t,
|
|
35
|
+
id: n,
|
|
36
|
+
label: a(e.label) ?? n
|
|
37
|
+
}, o = a(e.productId);
|
|
38
|
+
return o && (r.productId = o), i(e.ref) && (r.ref = e.ref), r;
|
|
39
|
+
}
|
|
40
|
+
function l(e) {
|
|
41
|
+
let t = String(e.status);
|
|
42
|
+
return t === "RUNNING" || t === "PENDING" ? "running" : e.success ? "succeeded" : e.willRetry ? "retrying" : t === "FAILED" || e.completedAt ? "failed" : "ended";
|
|
43
|
+
}
|
|
44
|
+
function u(e, t) {
|
|
45
|
+
return `${e}|${t.getTime()}`;
|
|
46
|
+
}
|
|
47
|
+
function d(e, t) {
|
|
48
|
+
if (e.attempt !== t.attempt) return e.attempt > t.attempt;
|
|
49
|
+
let n = e.startedAt.getTime(), r = t.startedAt.getTime();
|
|
50
|
+
return n === r ? e.id > t.id : n > r;
|
|
51
|
+
}
|
|
52
|
+
function f(e) {
|
|
53
|
+
let t = /* @__PURE__ */ new Map();
|
|
54
|
+
for (let n of e) {
|
|
55
|
+
let e = a(n.workflowKey), r = o(n.startedAt);
|
|
56
|
+
if (!e || !r) continue;
|
|
57
|
+
let c = o(n.scheduledTime), f = i(n.metadata) ? n.metadata : {}, p = n.duration, m = {
|
|
58
|
+
id: n.id,
|
|
59
|
+
status: s(String(n.status)) ?? "FAILED",
|
|
60
|
+
success: n.success,
|
|
61
|
+
startedAt: r,
|
|
62
|
+
completedAt: o(n.completedAt),
|
|
63
|
+
durationMs: typeof p == "number" && Number.isFinite(p) && p >= 0 ? p : null,
|
|
64
|
+
errorMessage: a(n.errorMessage),
|
|
65
|
+
attempt: Math.max(0, n.retryAttempt),
|
|
66
|
+
manual: f.manual === !0,
|
|
67
|
+
catchUp: f.catchUp === !0
|
|
68
|
+
}, h = c ? u(n.scheduledJobId, c) : `run:${n.id}`, g = t.get(h);
|
|
69
|
+
(!g?.execution || d(m, g.execution)) && t.set(h, {
|
|
70
|
+
key: h,
|
|
71
|
+
scheduledJobId: n.scheduledJobId,
|
|
72
|
+
name: a(n.workflowName) ?? e,
|
|
73
|
+
workflowKey: e,
|
|
74
|
+
at: m.catchUp || !c ? r : c,
|
|
75
|
+
status: l(n),
|
|
76
|
+
fireAt: c,
|
|
77
|
+
execution: m,
|
|
78
|
+
subject: null,
|
|
79
|
+
timeZone: null
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return [...t.values()];
|
|
83
|
+
}
|
|
84
|
+
function p(e, t) {
|
|
85
|
+
let n = /* @__PURE__ */ new Map();
|
|
86
|
+
for (let r of e) {
|
|
87
|
+
let e = o(r.fireAt), i = c(r.subject);
|
|
88
|
+
if (!e || i?.kind !== "workflow") continue;
|
|
89
|
+
let s = u(r.scheduledJobId, e);
|
|
90
|
+
n.has(s) || n.set(s, {
|
|
91
|
+
key: s,
|
|
92
|
+
scheduledJobId: r.scheduledJobId,
|
|
93
|
+
name: i.label,
|
|
94
|
+
workflowKey: i.id,
|
|
95
|
+
at: e,
|
|
96
|
+
status: e.getTime() < t.getTime() ? "overdue" : "scheduled",
|
|
97
|
+
fireAt: e,
|
|
98
|
+
execution: null,
|
|
99
|
+
subject: i,
|
|
100
|
+
timeZone: a(r.timezone)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return [...n.values()];
|
|
104
|
+
}
|
|
105
|
+
function m(e, t) {
|
|
106
|
+
return e.at.getTime() - t.at.getTime() || e.name.localeCompare(t.name) || (e.key < t.key ? -1 : +(e.key > t.key));
|
|
107
|
+
}
|
|
108
|
+
function h(e, t, n) {
|
|
109
|
+
let r = n.from.getTime(), i = n.to.getTime(), a = (e) => e.getTime() >= r && e.getTime() < i, o = new Set(e.map((e) => e.key)), s = e.map((e) => !a(e.at) && e.execution && a(e.execution.startedAt) ? {
|
|
110
|
+
...e,
|
|
111
|
+
at: e.execution.startedAt
|
|
112
|
+
} : e), c = t.filter((e) => !o.has(e.key));
|
|
113
|
+
return [...s, ...c].filter((e) => a(e.at)).sort(m);
|
|
114
|
+
}
|
|
115
|
+
function g(n, r, i) {
|
|
116
|
+
let a = r.pastCutoff ? t(e(r.pastCutoff, i).date, 1) : null, o = r.upcomingCutoff ? e(r.upcomingCutoff, i).date : null;
|
|
117
|
+
return !a && !o ? {
|
|
118
|
+
runs: [...n],
|
|
119
|
+
pastFrom: a,
|
|
120
|
+
upcomingUntil: o
|
|
121
|
+
} : {
|
|
122
|
+
runs: n.filter((t) => {
|
|
123
|
+
let n = e(t.at, i).date;
|
|
124
|
+
return t.execution ? !a || n >= a : !o || n < o;
|
|
125
|
+
}),
|
|
126
|
+
pastFrom: a,
|
|
127
|
+
upcomingUntil: o
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export { n as WORKFLOW_SUBJECT_KIND, h as mergeRuns, c as parseRunSubject, l as pastRunStatus, f as pastRuns, s as runJobStatus, p as upcomingRuns, g as wholeDaysOnly };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=runModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runModel.js","names":["WORKFLOW_SUBJECT_KIND","JOB_STATUSES","isRecord","value","nonBlank","instant","date","runJobStatus","status","parseRunSubject","kind","id","subject","productId","pastRunStatus","row","fireKey","scheduledJobId","fireAt","laterAttempt","next","current","nextStart","currentStart","pastRuns","byKey","rows","workflowKey","startedAt","metadata","duration","execution","key","upcomingRuns","occurrence","occurrences","now","byTime","a","b","mergeRuns","fromMs","range","toMs","inRange","ran","past","run","placed","toCome","upcoming","wholeDaysOnly","pastFrom","cutoffs","addDays","instantToZoned","timeZone","upcomingUntil","runs","day"],"sources":["../../../src/v2/runs/runModel.ts"],"sourcesContent":["/**\n * The workflow runs layer's runs (BOFF-15698 B5), as the calendar shows them. Pure.\n *\n * - **Past runs** are the scheduler's executions of workflow schedules (`workflowKey` set). A\n * fire the scheduler retried has a row per attempt: it shows once, as its latest attempt.\n * - **Upcoming runs** are the schedules' planned fires (`scheduleOccurrences`). One planned\n * before now that hasn't run yet is \"overdue\": the scheduler runs it when it catches up.\n * - **A fire shows once.** A run is matched to its fire by the schedule and the fire's time\n * (the execution's `scheduledTime`, which is the fire's `fireAt`), so a fire that has run (or\n * is running) shows as the run, never also as still to come.\n * - **Where it sits:** at the fire's time; a catch-up run, at the time it ran (its fire may be\n * days earlier). A run whose fire is outside the range asked for, but which started in it,\n * sits at its start.\n */\nimport { addDays, type DateValue } from '@burdenoff/fe-libs/ui';\nimport type {\n CalendarV2JobExecutionsQuery,\n CalendarV2ScheduleOccurrencesQuery,\n} from '../../generated/wspace-operations';\nimport { instantToZoned } from '../time/calendarTime';\nimport type { CalendarRunJobStatus, CalendarRunSubject } from './runTypes';\n\nexport type RawRunExecution =\n CalendarV2JobExecutionsQuery['workspaceJobExecutions']['executions'][number];\nexport type RawRunOccurrence =\n CalendarV2ScheduleOccurrencesQuery['scheduleOccurrences']['occurrences'][number];\n\n/** The subject kind wspace-workflow-svc stamps on a workflow's schedule. */\nexport const WORKFLOW_SUBJECT_KIND = 'workflow';\n\n/**\n * How a run went, in the Schedules screen's words, or that it is still to come:\n * - `retrying`: it failed and the scheduler tries again;\n * - `ended`: it stopped without succeeding or failing (cancelled before it ran);\n * - `overdue`: planned before now and not run yet.\n */\nexport type RunStatus =\n 'succeeded' | 'failed' | 'retrying' | 'running' | 'ended' | 'overdue' | 'scheduled';\n\n/** What a past run did. */\nexport interface RunExecution {\n id: string;\n status: CalendarRunJobStatus;\n success: boolean;\n startedAt: Date;\n completedAt: Date | null;\n /** How long the run took, in milliseconds; null while it runs. */\n durationMs: number | null;\n errorMessage: string | null;\n /** 0 for the first try, 1 for the first retry, … */\n attempt: number;\n /** Someone ran it by hand (\"Run now\"), outside its schedule. */\n manual: boolean;\n /** It made up for a fire the scheduler missed. */\n catchUp: boolean;\n}\n\nexport interface WorkflowRun {\n /** One per fire: `<schedule>|<fire time>`, or `run:<execution>` for a run without one. */\n key: string;\n scheduledJobId: string;\n /** The workflow's name. */\n name: string;\n workflowKey: string | null;\n /** Where it sits on the calendar. */\n at: Date;\n status: RunStatus;\n /** The fire it stands for; null for a run the scheduler didn't stamp with one. */\n fireAt: Date | null;\n /** What happened, for a run that has started; null for one still to come. */\n execution: RunExecution | null;\n /** An upcoming run's schedule subject (`metadata.subject`); null for past runs. */\n subject: CalendarRunSubject | null;\n /** An upcoming run's schedule time zone. */\n timeZone: string | null;\n}\n\nconst JOB_STATUSES: readonly CalendarRunJobStatus[] = [\n 'DRAFT',\n 'PENDING',\n 'RUNNING',\n 'COMPLETED',\n 'FAILED',\n 'PAUSED',\n 'CANCELLED',\n 'DISABLED',\n 'ARCHIVED',\n];\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction nonBlank(value: unknown): string | null {\n return typeof value === 'string' && value.trim() !== '' ? value : null;\n}\n\n/** The instant an API time names; null when it doesn't parse. */\nfunction instant(value: string | null | undefined): Date | null {\n if (!value) return null;\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\n/** The scheduler's job status, as the host's resolvers take it; null for a value it doesn't know. */\nexport function runJobStatus(value: unknown): CalendarRunJobStatus | null {\n return JOB_STATUSES.find((status) => status === value) ?? null;\n}\n\n/**\n * A job's `metadata.subject` as the host's resolvers take it: a kind and an id, its label (the\n * id when it has none), and its product and details when it carries them. Null when it isn't\n * one.\n */\nexport function parseRunSubject(value: unknown): CalendarRunSubject | null {\n if (!isRecord(value)) return null;\n const kind = nonBlank(value.kind);\n const id = nonBlank(value.id);\n if (!kind || !id) return null;\n const subject: CalendarRunSubject = { kind, id, label: nonBlank(value.label) ?? id };\n const productId = nonBlank(value.productId);\n if (productId) subject.productId = productId;\n if (isRecord(value.ref)) subject.ref = value.ref;\n return subject;\n}\n\n/** How a past run went: the Schedules screen's rule (a failed run tried again is \"retrying\"). */\nexport function pastRunStatus(\n row: Pick<RawRunExecution, 'status' | 'success' | 'willRetry' | 'completedAt'>\n): RunStatus {\n const status = String(row.status);\n if (status === 'RUNNING' || status === 'PENDING') return 'running';\n if (row.success) return 'succeeded';\n if (row.willRetry) return 'retrying';\n if (status === 'FAILED' || row.completedAt) return 'failed';\n return 'ended';\n}\n\nfunction fireKey(scheduledJobId: string, fireAt: Date): string {\n return `${scheduledJobId}|${fireAt.getTime()}`;\n}\n\n/** Whether `next` is a later attempt at the same fire than `current`. */\nfunction laterAttempt(next: RunExecution, current: RunExecution): boolean {\n if (next.attempt !== current.attempt) return next.attempt > current.attempt;\n const nextStart = next.startedAt.getTime();\n const currentStart = current.startedAt.getTime();\n if (nextStart !== currentStart) return nextStart > currentStart;\n return next.id > current.id;\n}\n\n/**\n * Past runs of workflow schedules, one per fire (the latest attempt of a retried one). Rows of\n * other jobs, and rows whose start doesn't parse, are left out.\n */\nexport function pastRuns(rows: readonly RawRunExecution[]): WorkflowRun[] {\n const byKey = new Map<string, WorkflowRun>();\n for (const row of rows) {\n const workflowKey = nonBlank(row.workflowKey);\n const startedAt = instant(row.startedAt);\n if (!workflowKey || !startedAt) continue;\n const fireAt = instant(row.scheduledTime);\n const metadata = isRecord(row.metadata) ? row.metadata : {};\n const duration = row.duration;\n const execution: RunExecution = {\n id: row.id,\n status: runJobStatus(String(row.status)) ?? 'FAILED',\n success: row.success,\n startedAt,\n completedAt: instant(row.completedAt),\n durationMs:\n typeof duration === 'number' && Number.isFinite(duration) && duration >= 0\n ? duration\n : null,\n errorMessage: nonBlank(row.errorMessage),\n attempt: Math.max(0, row.retryAttempt),\n manual: metadata.manual === true,\n catchUp: metadata.catchUp === true,\n };\n const key = fireAt ? fireKey(row.scheduledJobId, fireAt) : `run:${row.id}`;\n const current = byKey.get(key);\n if (current?.execution && !laterAttempt(execution, current.execution)) continue;\n byKey.set(key, {\n key,\n scheduledJobId: row.scheduledJobId,\n name: nonBlank(row.workflowName) ?? workflowKey,\n workflowKey,\n at: execution.catchUp || !fireAt ? startedAt : fireAt,\n status: pastRunStatus(row),\n fireAt,\n execution,\n subject: null,\n timeZone: null,\n });\n }\n return [...byKey.values()];\n}\n\n/**\n * Upcoming runs of workflow schedules from their planned fires: overdue when planned before\n * `now`. A fire listed twice (pages that meet at an instant) is kept once.\n */\nexport function upcomingRuns(occurrences: readonly RawRunOccurrence[], now: Date): WorkflowRun[] {\n const byKey = new Map<string, WorkflowRun>();\n for (const occurrence of occurrences) {\n const fireAt = instant(occurrence.fireAt);\n const subject = parseRunSubject(occurrence.subject);\n if (!fireAt || subject?.kind !== WORKFLOW_SUBJECT_KIND) continue;\n const key = fireKey(occurrence.scheduledJobId, fireAt);\n if (byKey.has(key)) continue;\n byKey.set(key, {\n key,\n scheduledJobId: occurrence.scheduledJobId,\n name: subject.label,\n workflowKey: subject.id,\n at: fireAt,\n status: fireAt.getTime() < now.getTime() ? 'overdue' : 'scheduled',\n fireAt,\n execution: null,\n subject,\n timeZone: nonBlank(occurrence.timezone),\n });\n }\n return [...byKey.values()];\n}\n\nfunction byTime(a: WorkflowRun, b: WorkflowRun): number {\n return (\n a.at.getTime() - b.at.getTime() ||\n a.name.localeCompare(b.name) ||\n (a.key < b.key ? -1 : a.key > b.key ? 1 : 0)\n );\n}\n\n/**\n * The runs in `[from, to)`, in time order: the past runs, and the upcoming ones whose fire\n * hasn't run. A past run whose place falls outside the range but which started in it sits at\n * its start.\n */\nexport function mergeRuns(\n past: readonly WorkflowRun[],\n upcoming: readonly WorkflowRun[],\n range: { from: Date; to: Date }\n): WorkflowRun[] {\n const fromMs = range.from.getTime();\n const toMs = range.to.getTime();\n const inRange = (date: Date) => date.getTime() >= fromMs && date.getTime() < toMs;\n const ran = new Set(past.map((run) => run.key));\n const placed = past.map((run) =>\n !inRange(run.at) && run.execution && inRange(run.execution.startedAt)\n ? { ...run, at: run.execution.startedAt }\n : run\n );\n const toCome = upcoming.filter((run) => !ran.has(run.key));\n return [...placed, ...toCome].filter((run) => inRange(run.at)).sort(byTime);\n}\n\n/** The runs of whole days only, and from which days runs were left out. */\nexport interface WholeDays {\n runs: WorkflowRun[];\n /** Past runs before this day aren't shown; null when none were left out. */\n pastFrom: DateValue | null;\n /** Upcoming runs from this day on aren't shown; null when none were left out. */\n upcomingUntil: DateValue | null;\n}\n\n/**\n * Never a silently partial day: when the past runs stop at `pastCutoff` (the oldest start\n * loaded), the past runs of its day and the days before are left out; when the upcoming ones\n * stop at `upcomingCutoff` (the last fire loaded), the upcoming runs of its day and the days\n * after are. Each day shown then has all of its runs, and the layer names the days without.\n */\nexport function wholeDaysOnly(\n runs: readonly WorkflowRun[],\n cutoffs: { pastCutoff: Date | null; upcomingCutoff: Date | null },\n timeZone: string\n): WholeDays {\n const pastFrom = cutoffs.pastCutoff\n ? addDays(instantToZoned(cutoffs.pastCutoff, timeZone).date, 1)\n : null;\n const upcomingUntil = cutoffs.upcomingCutoff\n ? instantToZoned(cutoffs.upcomingCutoff, timeZone).date\n : null;\n if (!pastFrom && !upcomingUntil) return { runs: [...runs], pastFrom, upcomingUntil };\n const kept = runs.filter((run) => {\n const day = instantToZoned(run.at, timeZone).date;\n if (run.execution) return !pastFrom || day >= pastFrom;\n return !upcomingUntil || day < upcomingUntil;\n });\n return { runs: kept, pastFrom, upcomingUntil };\n}\n"],"mappings":";;;AA4BA,IAAaA,IAAwB,YAiD/BC,IAAgD;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAASC,EAAS,GAAkD;CAClE,OAAO,OAAOC,KAAU,cAAYA,KAAk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,GAAQ,GAAGC,CAAM,CAAC,CAAC,QAAQ,MAAQL,EAAQG,EAAI,EAAE,CAAC,CAAC,CAAC,KAAKV,CAAM;AAC5E;AAiBA,SAAgBc,EACd,GACA,GACA,GACW;CACX,IAAMC,IAAWC,EAAQ,aACrBC,EAAQC,EAAeF,EAAQ,YAAYG,CAAQ,CAAC,CAAC,MAAM,CAAC,IAC5D,MACEC,IAAgBJ,EAAQ,iBAC1BE,EAAeF,EAAQ,gBAAgBG,CAAQ,CAAC,CAAC,OACjD;CAOJ,OANI,CAACJ,KAAY,CAACK,IAAsB;EAAE,MAAM,CAAC,GAAGC,CAAI;EAAG;EAAU;CAAc,IAM5E;EAAE,MALIA,EAAK,QAAQ,MAAQ;GAChC,IAAMC,IAAMJ,EAAeR,EAAI,IAAIS,CAAQ,CAAC,CAAC;GAE7C,OADIT,EAAI,YAAkB,CAACK,KAAYO,KAAOP,IACvC,CAACK,KAAiBE,IAAMF;EACjC,CACe;EAAM;EAAU;CAAc;AAC/C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DateValue } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
import { CalendarV2Dialog } from '../types';
|
|
3
|
+
import { DayRuns, RunGroup } from './runLayout';
|
|
4
|
+
import { WorkflowRun } from './runModel';
|
|
5
|
+
/** What the run peek shows: a run, a busy schedule's day, runs sharing a pill, or a day's runs. */
|
|
6
|
+
export type RunPeekView = {
|
|
7
|
+
kind: 'run';
|
|
8
|
+
run: WorkflowRun;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'group';
|
|
11
|
+
group: RunGroup;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'cluster';
|
|
14
|
+
day: DateValue;
|
|
15
|
+
runs: WorkflowRun[];
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'day';
|
|
18
|
+
day: DayRuns;
|
|
19
|
+
};
|
|
20
|
+
export interface RunPeekState {
|
|
21
|
+
/** What it points at (the pill, the row); null: the middle of the window. */
|
|
22
|
+
anchor: HTMLElement | null;
|
|
23
|
+
/** The views opened, the last one showing; Back goes to the one before. */
|
|
24
|
+
stack: RunPeekView[];
|
|
25
|
+
}
|
|
26
|
+
/** Marks what opens the run peek: a press on another one switches the peek to it. */
|
|
27
|
+
export declare const RUN_OPENER = "data-run-opener";
|
|
28
|
+
/** What identifies the view an opener opens: its run, group, cluster or day. */
|
|
29
|
+
export declare function openerKey(view: RunPeekView): string;
|
|
30
|
+
export interface RunPeekControls {
|
|
31
|
+
peek: RunPeekState | null;
|
|
32
|
+
/** Opens the peek on a view; a second press on the same opener closes it. */
|
|
33
|
+
openPeek: (view: RunPeekView, anchor: HTMLElement | null) => void;
|
|
34
|
+
/** Shows another view in the open peek (Back returns). */
|
|
35
|
+
showInPeek: (view: RunPeekView) => void;
|
|
36
|
+
backInPeek: () => void;
|
|
37
|
+
closePeek: () => void;
|
|
38
|
+
}
|
|
39
|
+
/** What the peek closes on, and what it closes when it opens. */
|
|
40
|
+
export interface RunPeekContext {
|
|
41
|
+
/** The shown days: a change closes it. */
|
|
42
|
+
daysKey: string;
|
|
43
|
+
/** An event's peek is open: one opening closes it; one closing as it opens doesn't. */
|
|
44
|
+
eventOpen: boolean;
|
|
45
|
+
/** A dialog the address names: one opening closes it. */
|
|
46
|
+
dialog: CalendarV2Dialog | null;
|
|
47
|
+
/** The runs show: hiding them closes it. */
|
|
48
|
+
shown: boolean;
|
|
49
|
+
closeEventPeek: () => void;
|
|
50
|
+
/** Set while the quick create is open: it closes as the peek opens. */
|
|
51
|
+
closeQuickCreate: (() => void) | null;
|
|
52
|
+
}
|
|
53
|
+
export declare function useRunPeek(context: RunPeekContext): RunPeekControls;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useCallback as e, useMemo as t, useState as n } from "react";
|
|
2
|
+
// src/v2/runs/runPeekState.ts
|
|
3
|
+
var r = "data-run-opener";
|
|
4
|
+
function i(e) {
|
|
5
|
+
switch (e.kind) {
|
|
6
|
+
case "run": return `run|${e.run.key}`;
|
|
7
|
+
case "group": return `group|${e.group.key}`;
|
|
8
|
+
case "cluster": return `cluster|${e.day}|${e.runs[0]?.key ?? ""}`;
|
|
9
|
+
default: return `day|${e.day.day}`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function a(r) {
|
|
13
|
+
let { daysKey: a, eventOpen: o, dialog: s, shown: c, closeEventPeek: l, closeQuickCreate: u } = r, [d, f] = n(null), p = e((e, t) => {
|
|
14
|
+
o && l(), u?.(), f((n) => {
|
|
15
|
+
let r = n?.stack[0];
|
|
16
|
+
return r && n.anchor === t && i(r) === i(e) ? null : {
|
|
17
|
+
anchor: t,
|
|
18
|
+
stack: [e]
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}, [
|
|
22
|
+
l,
|
|
23
|
+
u,
|
|
24
|
+
o
|
|
25
|
+
]), m = e((e) => f((t) => t && {
|
|
26
|
+
...t,
|
|
27
|
+
stack: [...t.stack, e]
|
|
28
|
+
}), []), h = e(() => f((e) => e && e.stack.length > 1 ? {
|
|
29
|
+
...e,
|
|
30
|
+
stack: e.stack.slice(0, -1)
|
|
31
|
+
} : e), []), g = e(() => f(null), []), [_, v] = n({
|
|
32
|
+
daysKey: a,
|
|
33
|
+
eventOpen: o,
|
|
34
|
+
dialog: s,
|
|
35
|
+
shown: c
|
|
36
|
+
});
|
|
37
|
+
if (_.daysKey !== a || _.eventOpen !== o || _.dialog !== s || _.shown !== c) {
|
|
38
|
+
let e = _.daysKey !== a || o && !_.eventOpen || s !== null && s !== _.dialog || !c && _.shown;
|
|
39
|
+
v({
|
|
40
|
+
daysKey: a,
|
|
41
|
+
eventOpen: o,
|
|
42
|
+
dialog: s,
|
|
43
|
+
shown: c
|
|
44
|
+
}), e && d && f(null);
|
|
45
|
+
}
|
|
46
|
+
return t(() => ({
|
|
47
|
+
peek: d,
|
|
48
|
+
openPeek: p,
|
|
49
|
+
showInPeek: m,
|
|
50
|
+
backInPeek: h,
|
|
51
|
+
closePeek: g
|
|
52
|
+
}), [
|
|
53
|
+
h,
|
|
54
|
+
g,
|
|
55
|
+
p,
|
|
56
|
+
d,
|
|
57
|
+
m
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
export { r as RUN_OPENER, i as openerKey, a as useRunPeek };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=runPeekState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runPeekState.js","names":["RUN_OPENER","openerKey","view","useRunPeek","context","peek","setPeek","useState","openPeek","useCallback","eventOpen","closeEventPeek","closeQuickCreate","first","current","anchor","showInPeek","backInPeek","closePeek","seen","setSeen","daysKey","dialog","shown","closes","useMemo"],"sources":["../../../src/v2/runs/runPeekState.ts"],"sourcesContent":["/**\n * The run peek's state (BOFF-15698 B5): what it shows and what it points at, a stack of views\n * for Back, and when it closes. One peek at a time: opening it closes an event's peek and the\n * quick create; it closes when the days change, an event's peek or a dialog opens, or the runs\n * hide; a second press on what opened it closes it, as an event's block does.\n */\nimport { useCallback, useMemo, useState } from 'react';\nimport type { DateValue } from '@burdenoff/fe-libs/ui';\nimport type { CalendarV2Dialog } from '../types';\nimport type { DayRuns, RunGroup } from './runLayout';\nimport type { WorkflowRun } from './runModel';\n\n/** What the run peek shows: a run, a busy schedule's day, runs sharing a pill, or a day's runs. */\nexport type RunPeekView =\n | { kind: 'run'; run: WorkflowRun }\n | { kind: 'group'; group: RunGroup }\n | { kind: 'cluster'; day: DateValue; runs: WorkflowRun[] }\n | { kind: 'day'; day: DayRuns };\n\nexport interface RunPeekState {\n /** What it points at (the pill, the row); null: the middle of the window. */\n anchor: HTMLElement | null;\n /** The views opened, the last one showing; Back goes to the one before. */\n stack: RunPeekView[];\n}\n\n/** Marks what opens the run peek: a press on another one switches the peek to it. */\nexport const RUN_OPENER = 'data-run-opener';\n\n/** What identifies the view an opener opens: its run, group, cluster or day. */\nexport function openerKey(view: RunPeekView): string {\n switch (view.kind) {\n case 'run':\n return `run|${view.run.key}`;\n case 'group':\n return `group|${view.group.key}`;\n case 'cluster':\n return `cluster|${view.day}|${view.runs[0]?.key ?? ''}`;\n default:\n return `day|${view.day.day}`;\n }\n}\n\nexport interface RunPeekControls {\n peek: RunPeekState | null;\n /** Opens the peek on a view; a second press on the same opener closes it. */\n openPeek: (view: RunPeekView, anchor: HTMLElement | null) => void;\n /** Shows another view in the open peek (Back returns). */\n showInPeek: (view: RunPeekView) => void;\n backInPeek: () => void;\n closePeek: () => void;\n}\n\n/** What the peek closes on, and what it closes when it opens. */\nexport interface RunPeekContext {\n /** The shown days: a change closes it. */\n daysKey: string;\n /** An event's peek is open: one opening closes it; one closing as it opens doesn't. */\n eventOpen: boolean;\n /** A dialog the address names: one opening closes it. */\n dialog: CalendarV2Dialog | null;\n /** The runs show: hiding them closes it. */\n shown: boolean;\n closeEventPeek: () => void;\n /** Set while the quick create is open: it closes as the peek opens. */\n closeQuickCreate: (() => void) | null;\n}\n\nexport function useRunPeek(context: RunPeekContext): RunPeekControls {\n const { daysKey, eventOpen, dialog, shown, closeEventPeek, closeQuickCreate } = context;\n const [peek, setPeek] = useState<RunPeekState | null>(null);\n\n const openPeek = useCallback(\n (view: RunPeekView, anchor: HTMLElement | null) => {\n if (eventOpen) closeEventPeek();\n closeQuickCreate?.();\n setPeek((current) => {\n const first = current?.stack[0];\n const again = first && current.anchor === anchor && openerKey(first) === openerKey(view);\n return again ? null : { anchor, stack: [view] };\n });\n },\n [closeEventPeek, closeQuickCreate, eventOpen]\n );\n const showInPeek = useCallback(\n (view: RunPeekView) =>\n setPeek((current) => (current ? { ...current, stack: [...current.stack, view] } : current)),\n []\n );\n const backInPeek = useCallback(\n () =>\n setPeek((current) =>\n current && current.stack.length > 1\n ? { ...current, stack: current.stack.slice(0, -1) }\n : current\n ),\n []\n );\n const closePeek = useCallback(() => setPeek(null), []);\n\n // Closes on what changed since the last render (worked out while rendering, not in an effect).\n const [seen, setSeen] = useState({ daysKey, eventOpen, dialog, shown });\n const changed =\n seen.daysKey !== daysKey ||\n seen.eventOpen !== eventOpen ||\n seen.dialog !== dialog ||\n seen.shown !== shown;\n if (changed) {\n const closes =\n seen.daysKey !== daysKey ||\n (eventOpen && !seen.eventOpen) ||\n (dialog !== null && dialog !== seen.dialog) ||\n (!shown && seen.shown);\n setSeen({ daysKey, eventOpen, dialog, shown });\n if (closes && peek) setPeek(null);\n }\n\n return useMemo(\n () => ({ peek, openPeek, showInPeek, backInPeek, closePeek }),\n [backInPeek, closePeek, openPeek, peek, showInPeek]\n );\n}\n"],"mappings":";;AA2BA,IAAaA,IAAa;AAG1B,SAAgBC,EAAU,GAA2B;CACnD,QAAQC,EAAK,MAAb;EACE,KAAK,OACH,OAAO,OAAOA,EAAK,IAAI;EACzB,KAAK,SACH,OAAO,SAASA,EAAK,MAAM;EAC7B,KAAK,WACH,OAAO,WAAWA,EAAK,IAAI,GAAGA,EAAK,KAAK,EAAE,EAAE,OAAO;EACrD,SACE,OAAO,OAAOA,EAAK,IAAI;CAC3B;AACF;AA2BA,SAAgBC,EAAW,GAA0C;CACnE,IAAM,EAAE,YAAS,cAAW,WAAQ,UAAO,mBAAgB,wBAAqBC,GAC1E,CAACC,GAAMC,KAAWC,EAA8B,IAAI,GAEpDC,IAAWC,GACd,GAAmB,MAA+B;EAGjD,AAFIC,KAAWC,EAAe,GAC9BC,IAAmB,GACnBN,GAAS,MAAY;GACnB,IAAMO,IAAQC,GAAS,MAAM;GAE7B,OADcD,KAASC,EAAQ,WAAWC,KAAUd,EAAUY,CAAK,MAAMZ,EAAUC,CAAI,IACxE,OAAO;IAAE;IAAQ,OAAO,CAACA,CAAI;GAAE;EAChD,CAAC;CACH,GACA;EAACS;EAAgBC;EAAkBF;CAAS,CAC9C,GACMM,IAAaP,GAChB,MACCH,GAAS,MAAaQ,KAAU;EAAE,GAAGA;EAAS,OAAO,CAAC,GAAGA,EAAQ,OAAOZ,CAAI;CAAE,CAAY,GAC5F,CAAC,CACH,GACMe,IAAaR,QAEfH,GAAS,MACPQ,KAAWA,EAAQ,MAAM,SAAS,IAC9B;EAAE,GAAGA;EAAS,OAAOA,EAAQ,MAAM,MAAM,GAAG,EAAE;CAAE,IAChDA,CACN,GACF,CAAC,CACH,GACMI,IAAYT,QAAkBH,EAAQ,IAAI,GAAG,CAAC,CAAC,GAG/C,CAACa,GAAMC,KAAWb,EAAS;EAAE;EAAS;EAAW;EAAQ;CAAM,CAAC;CAMtE,IAJEY,EAAK,YAAYE,KACjBF,EAAK,cAAcT,KACnBS,EAAK,WAAWG,KAChBH,EAAK,UAAUI,GACJ;EACX,IAAMC,IACJL,EAAK,YAAYE,KAChBX,KAAa,CAACS,EAAK,aACnBG,MAAW,QAAQA,MAAWH,EAAK,UACnC,CAACI,KAASJ,EAAK;EAElB,AADAC,EAAQ;GAAE;GAAS;GAAW;GAAQ;EAAM,CAAC,GACzCI,KAAUnB,KAAMC,EAAQ,IAAI;CAClC;CAEA,OAAOmB,SACE;EAAE;EAAM;EAAU;EAAY;EAAY;CAAU,IAC3D;EAACR;EAAYC;EAAWV;EAAUH;EAAMW;CAAU,CACpD;AACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host passes the workflow runs layer (BOFF-15698 B5) so a run links into it: where a
|
|
3
|
+
* run's workflow opens, and where the run it started opens. The routes are the host's, so the
|
|
4
|
+
* calendar never writes them itself; without them the runs show without links.
|
|
5
|
+
*
|
|
6
|
+
* The shapes are microfe-scheduler's (`SchedulerSubject`, `SchedulerJobRef`,
|
|
7
|
+
* `SchedulerExecutionRef`, `ResolveSubjectHref`, `ResolveExecutionHref`), so a host passes the
|
|
8
|
+
* resolvers it already gives the Schedules screen. FluidGrids:
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // Once, outside the component, so the calendar gets the same object on every render.
|
|
12
|
+
* const WORKFLOW_RUN_LINKS: CalendarRunLinks = {
|
|
13
|
+
* resolveSubjectHref: resolveSchedulerSubjectHref,
|
|
14
|
+
* resolveExecutionHref: resolveSchedulerExecutionHref,
|
|
15
|
+
* };
|
|
16
|
+
* <CalendarRoot {...workspaceBaseProps} calendarRedesign workflowRunLinks={WORKFLOW_RUN_LINKS} />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
/** A scheduled job's status, and a run's (the scheduler's `JobStatus`). */
|
|
20
|
+
export type CalendarRunJobStatus = 'DRAFT' | 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'PAUSED' | 'CANCELLED' | 'DISABLED' | 'ARCHIVED';
|
|
21
|
+
/**
|
|
22
|
+
* What a schedule is for, as the service that made it stamped it on the job's
|
|
23
|
+
* `metadata.subject` (wspace-workflow-svc: `{ kind: 'workflow', id: <workflowKey>, label:
|
|
24
|
+
* <name>, ref: { version, … } }`).
|
|
25
|
+
*/
|
|
26
|
+
export interface CalendarRunSubject {
|
|
27
|
+
/** The producer's kind; the layer shows `workflow` only. */
|
|
28
|
+
kind: string;
|
|
29
|
+
/** The subject's id in its product (a workflow's key). */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Its name. */
|
|
32
|
+
label: string;
|
|
33
|
+
/** The product it belongs to, when the producer said. */
|
|
34
|
+
productId?: string;
|
|
35
|
+
/** The producer's details (a workflow's `version`, …). */
|
|
36
|
+
ref?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/** The scheduled job a run comes from. */
|
|
39
|
+
export interface CalendarRunJobRef {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string | null;
|
|
42
|
+
timezone: string;
|
|
43
|
+
metadata: Record<string, unknown> | null;
|
|
44
|
+
}
|
|
45
|
+
/** A run that happened (the scheduler's execution). */
|
|
46
|
+
export interface CalendarRunExecutionRef {
|
|
47
|
+
id: string;
|
|
48
|
+
scheduledJobId: string;
|
|
49
|
+
status: CalendarRunJobStatus;
|
|
50
|
+
success: boolean;
|
|
51
|
+
/** What the run answered: a workflow's run id is `responseData.triggerWorkflow.runId`. */
|
|
52
|
+
output: Record<string, unknown> | null;
|
|
53
|
+
}
|
|
54
|
+
/** The host's routes for a run, each a path in the host app or null (no link). */
|
|
55
|
+
export interface CalendarRunLinks {
|
|
56
|
+
/** Where a run's workflow opens (FluidGrids: `resolveSchedulerSubjectHref`). */
|
|
57
|
+
resolveSubjectHref?: (subject: CalendarRunSubject, job: CalendarRunJobRef) => string | null | undefined;
|
|
58
|
+
/** Where a past run opens: the run it started (FluidGrids: `resolveSchedulerExecutionHref`). */
|
|
59
|
+
resolveExecutionHref?: (execution: CalendarRunExecutionRef, subject: CalendarRunSubject | null, job: CalendarRunJobRef) => string | null | undefined;
|
|
60
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
import { StatusChipStatus } from '@burdenoff/fe-libs/ui';
|
|
3
|
+
import { Tr } from '../data/useEventActions';
|
|
4
|
+
import { DurationWords } from '../format';
|
|
5
|
+
import { RunSummary } from './runLayout';
|
|
6
|
+
import { RunStatus } from './runModel';
|
|
7
|
+
/** Each status's mark. */
|
|
8
|
+
export declare const RUN_STATUS_ICON: Readonly<Record<RunStatus, LucideIcon>>;
|
|
9
|
+
/** Each status's chip (`StatusChip`): its tone. */
|
|
10
|
+
export declare const RUN_STATUS_CHIP: Readonly<Record<RunStatus, StatusChipStatus>>;
|
|
11
|
+
/** Each status's mark colour on a pill (a failed pill is red all over). */
|
|
12
|
+
export declare const RUN_STATUS_TEXT: Readonly<Record<RunStatus, string>>;
|
|
13
|
+
export declare function runStatusWord(tr: Tr, status: RunStatus): string;
|
|
14
|
+
/** "3 failed", "72 scheduled". */
|
|
15
|
+
export declare function runStatusCountWords(tr: Tr, status: RunStatus, count: number): string;
|
|
16
|
+
/** "1 failed · 30 succeeded · 41 scheduled". */
|
|
17
|
+
export declare function runSummaryWords(tr: Tr, summary: RunSummary): string;
|
|
18
|
+
/** "1 run", "72 runs". */
|
|
19
|
+
export declare function runCountWords(tr: Tr, count: number): string;
|
|
20
|
+
/** "Every 20 min", for runs evenly apart; null otherwise. */
|
|
21
|
+
export declare function runEveryWords(tr: Tr, everyMinutes: number | null, durationWords: DurationWords): string | null;
|
|
22
|
+
/** How long a run took: "850 ms", "4.2 s", "1 min 8 s", "2 h 5 min". */
|
|
23
|
+
export declare function runDurationWords(tr: Tr, ms: number, locale: string | undefined, durationWords: DurationWords): string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { formatDuration as e } from "../format.js";
|
|
2
|
+
import { CircleCheck as t, CircleMinus as n, Clock3 as r, LoaderCircle as i, OctagonAlert as a, RotateCcw as o } from "lucide-react";
|
|
3
|
+
// src/v2/runs/runWords.ts
|
|
4
|
+
var s = {
|
|
5
|
+
succeeded: t,
|
|
6
|
+
failed: a,
|
|
7
|
+
retrying: o,
|
|
8
|
+
running: i,
|
|
9
|
+
ended: n,
|
|
10
|
+
overdue: r,
|
|
11
|
+
scheduled: r
|
|
12
|
+
}, c = {
|
|
13
|
+
succeeded: "ok",
|
|
14
|
+
failed: "bad",
|
|
15
|
+
retrying: "warn",
|
|
16
|
+
running: "info",
|
|
17
|
+
ended: "neutral",
|
|
18
|
+
overdue: "warn",
|
|
19
|
+
scheduled: "waiting"
|
|
20
|
+
}, l = {
|
|
21
|
+
succeeded: "text-status-success-text",
|
|
22
|
+
failed: "text-status-error-text",
|
|
23
|
+
retrying: "text-status-warning-text",
|
|
24
|
+
running: "text-status-info-text",
|
|
25
|
+
ended: "text-text-muted",
|
|
26
|
+
overdue: "text-status-warning-text",
|
|
27
|
+
scheduled: "text-text-muted"
|
|
28
|
+
};
|
|
29
|
+
function u(e, t) {
|
|
30
|
+
switch (t) {
|
|
31
|
+
case "succeeded": return e("calendar.v2.runSucceeded", "Succeeded");
|
|
32
|
+
case "failed": return e("calendar.v2.runFailed", "Failed");
|
|
33
|
+
case "retrying": return e("calendar.v2.runRetrying", "Retrying");
|
|
34
|
+
case "running": return e("calendar.v2.runRunning", "Running");
|
|
35
|
+
case "ended": return e("calendar.v2.runEnded", "Ended");
|
|
36
|
+
case "overdue": return e("calendar.v2.runOverdue", "Overdue");
|
|
37
|
+
default: return e("calendar.v2.runScheduled", "Scheduled");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function d(e, t, n) {
|
|
41
|
+
switch (t) {
|
|
42
|
+
case "succeeded": return e("calendar.v2.runsSucceededCount", "{{count}} succeeded", { count: n });
|
|
43
|
+
case "failed": return e("calendar.v2.runsFailedCount", "{{count}} failed", { count: n });
|
|
44
|
+
case "retrying": return e("calendar.v2.runsRetryingCount", "{{count}} retrying", { count: n });
|
|
45
|
+
case "running": return e("calendar.v2.runsRunningCount", "{{count}} running", { count: n });
|
|
46
|
+
case "ended": return e("calendar.v2.runsEndedCount", "{{count}} ended", { count: n });
|
|
47
|
+
case "overdue": return e("calendar.v2.runsOverdueCount", "{{count}} overdue", { count: n });
|
|
48
|
+
default: return e("calendar.v2.runsScheduledCount", "{{count}} scheduled", { count: n });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var f = [
|
|
52
|
+
"failed",
|
|
53
|
+
"retrying",
|
|
54
|
+
"overdue",
|
|
55
|
+
"running",
|
|
56
|
+
"succeeded",
|
|
57
|
+
"ended",
|
|
58
|
+
"scheduled"
|
|
59
|
+
];
|
|
60
|
+
function p(e, t) {
|
|
61
|
+
return f.filter((e) => t.counts[e] > 0).map((n) => d(e, n, t.counts[n])).join(" · ");
|
|
62
|
+
}
|
|
63
|
+
function m(e, t) {
|
|
64
|
+
return t === 1 ? e("calendar.v2.runsCountOne", "1 run") : e("calendar.v2.runsCount", "{{count}} runs", { count: t });
|
|
65
|
+
}
|
|
66
|
+
function h(t, n, r) {
|
|
67
|
+
return n === null ? null : t("calendar.v2.runsEvery", "Every {{interval}}", { interval: e(n, r) });
|
|
68
|
+
}
|
|
69
|
+
function g(t, n, r, i) {
|
|
70
|
+
if (n < 1e3) return t("calendar.v2.runTookMs", "{{ms}} ms", { ms: Math.max(0, Math.round(n)) });
|
|
71
|
+
if (n < 6e4) return t("calendar.v2.runTookSeconds", "{{seconds}} s", { seconds: new Intl.NumberFormat(r, { maximumFractionDigits: +(n < 1e4) }).format(n / 1e3) });
|
|
72
|
+
if (n < 36e5) {
|
|
73
|
+
let e = Math.round(n / 1e3);
|
|
74
|
+
return t("calendar.v2.runTookMinutes", "{{minutes}} min {{seconds}} s", {
|
|
75
|
+
minutes: Math.floor(e / 60),
|
|
76
|
+
seconds: e % 60
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return e(n / 6e4, i);
|
|
80
|
+
}
|
|
81
|
+
export { c as RUN_STATUS_CHIP, s as RUN_STATUS_ICON, l as RUN_STATUS_TEXT, m as runCountWords, g as runDurationWords, h as runEveryWords, d as runStatusCountWords, u as runStatusWord, p as runSummaryWords };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=runWords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWords.js","names":["RUN_STATUS_ICON","CircleCheck","OctagonAlert","RotateCcw","LoaderCircle","CircleMinus","Clock3","RUN_STATUS_CHIP","RUN_STATUS_TEXT","runStatusWord","status","tr","runStatusCountWords","SUMMARY_ORDER","runSummaryWords","summary","runCountWords","count","runEveryWords","everyMinutes","formatDuration","durationWords","runDurationWords","ms","locale","total"],"sources":["../../../src/v2/runs/runWords.ts"],"sourcesContent":["/**\n * The workflow runs layer's words and marks (BOFF-15698 B5): each status an icon and a word,\n * ✓ succeeded, ⬣ failed, ◷ to come (or under way), in the Schedules screen's words.\n */\nimport {\n CircleCheck,\n CircleMinus,\n Clock3,\n LoaderCircle,\n OctagonAlert,\n RotateCcw,\n type LucideIcon,\n} from 'lucide-react';\nimport type { StatusChipStatus } from '@burdenoff/fe-libs/ui';\nimport type { Tr } from '../data/useEventActions';\nimport { formatDuration, type DurationWords } from '../format';\nimport type { RunSummary } from './runLayout';\nimport type { RunStatus } from './runModel';\n\n/** Each status's mark. */\nexport const RUN_STATUS_ICON: Readonly<Record<RunStatus, LucideIcon>> = {\n succeeded: CircleCheck,\n failed: OctagonAlert,\n retrying: RotateCcw,\n running: LoaderCircle,\n ended: CircleMinus,\n overdue: Clock3,\n scheduled: Clock3,\n};\n\n/** Each status's chip (`StatusChip`): its tone. */\nexport const RUN_STATUS_CHIP: Readonly<Record<RunStatus, StatusChipStatus>> = {\n succeeded: 'ok',\n failed: 'bad',\n retrying: 'warn',\n running: 'info',\n ended: 'neutral',\n overdue: 'warn',\n scheduled: 'waiting',\n};\n\n/** Each status's mark colour on a pill (a failed pill is red all over). */\nexport const RUN_STATUS_TEXT: Readonly<Record<RunStatus, string>> = {\n succeeded: 'text-status-success-text',\n failed: 'text-status-error-text',\n retrying: 'text-status-warning-text',\n running: 'text-status-info-text',\n ended: 'text-text-muted',\n overdue: 'text-status-warning-text',\n scheduled: 'text-text-muted',\n};\n\nexport function runStatusWord(tr: Tr, status: RunStatus): string {\n switch (status) {\n case 'succeeded':\n return tr('calendar.v2.runSucceeded', 'Succeeded');\n case 'failed':\n return tr('calendar.v2.runFailed', 'Failed');\n case 'retrying':\n return tr('calendar.v2.runRetrying', 'Retrying');\n case 'running':\n return tr('calendar.v2.runRunning', 'Running');\n case 'ended':\n return tr('calendar.v2.runEnded', 'Ended');\n case 'overdue':\n return tr('calendar.v2.runOverdue', 'Overdue');\n default:\n return tr('calendar.v2.runScheduled', 'Scheduled');\n }\n}\n\n/** \"3 failed\", \"72 scheduled\". */\nexport function runStatusCountWords(tr: Tr, status: RunStatus, count: number): string {\n switch (status) {\n case 'succeeded':\n return tr('calendar.v2.runsSucceededCount', '{{count}} succeeded', { count });\n case 'failed':\n return tr('calendar.v2.runsFailedCount', '{{count}} failed', { count });\n case 'retrying':\n return tr('calendar.v2.runsRetryingCount', '{{count}} retrying', { count });\n case 'running':\n return tr('calendar.v2.runsRunningCount', '{{count}} running', { count });\n case 'ended':\n return tr('calendar.v2.runsEndedCount', '{{count}} ended', { count });\n case 'overdue':\n return tr('calendar.v2.runsOverdueCount', '{{count}} overdue', { count });\n default:\n return tr('calendar.v2.runsScheduledCount', '{{count}} scheduled', { count });\n }\n}\n\n/** The order a summary names its statuses in: what needs a look first. */\nconst SUMMARY_ORDER: readonly RunStatus[] = [\n 'failed',\n 'retrying',\n 'overdue',\n 'running',\n 'succeeded',\n 'ended',\n 'scheduled',\n];\n\n/** \"1 failed · 30 succeeded · 41 scheduled\". */\nexport function runSummaryWords(tr: Tr, summary: RunSummary): string {\n return SUMMARY_ORDER.filter((status) => summary.counts[status] > 0)\n .map((status) => runStatusCountWords(tr, status, summary.counts[status]))\n .join(' · ');\n}\n\n/** \"1 run\", \"72 runs\". */\nexport function runCountWords(tr: Tr, count: number): string {\n return count === 1\n ? tr('calendar.v2.runsCountOne', '1 run')\n : tr('calendar.v2.runsCount', '{{count}} runs', { count });\n}\n\n/** \"Every 20 min\", for runs evenly apart; null otherwise. */\nexport function runEveryWords(\n tr: Tr,\n everyMinutes: number | null,\n durationWords: DurationWords\n): string | null {\n if (everyMinutes === null) return null;\n return tr('calendar.v2.runsEvery', 'Every {{interval}}', {\n interval: formatDuration(everyMinutes, durationWords),\n });\n}\n\n/** How long a run took: \"850 ms\", \"4.2 s\", \"1 min 8 s\", \"2 h 5 min\". */\nexport function runDurationWords(\n tr: Tr,\n ms: number,\n locale: string | undefined,\n durationWords: DurationWords\n): string {\n if (ms < 1000) {\n return tr('calendar.v2.runTookMs', '{{ms}} ms', { ms: Math.max(0, Math.round(ms)) });\n }\n if (ms < 60_000) {\n const seconds = new Intl.NumberFormat(locale, {\n maximumFractionDigits: ms < 10_000 ? 1 : 0,\n }).format(ms / 1000);\n return tr('calendar.v2.runTookSeconds', '{{seconds}} s', { seconds });\n }\n if (ms < 3_600_000) {\n const total = Math.round(ms / 1000);\n return tr('calendar.v2.runTookMinutes', '{{minutes}} min {{seconds}} s', {\n minutes: Math.floor(total / 60),\n seconds: total % 60,\n });\n }\n return formatDuration(ms / 60_000, durationWords);\n}\n"],"mappings":";;;AAoBA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;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,SAAgBC,EAAgB,GAAQ,GAA6B;CACnE,OAAOD,EAAc,QAAQ,MAAWE,EAAQ,OAAOL,KAAU,CAAC,CAAC,CAChE,KAAK,MAAWE,EAAoBD,GAAID,GAAQK,EAAQ,OAAOL,EAAO,CAAC,CAAC,CACxE,KAAK,KAAK;AACf;AAGA,SAAgBM,EAAc,GAAQ,GAAuB;CAC3D,OAAOC,MAAU,IACbN,EAAG,4BAA4B,OAAO,IACtCA,EAAG,yBAAyB,kBAAkB,EAAE,SAAM,CAAC;AAC7D;AAGA,SAAgBO,EACd,GACA,GACA,GACe;CAEf,OADIC,MAAiB,OAAa,OAC3BR,EAAG,yBAAyB,sBAAsB,EACvD,UAAUS,EAAeD,GAAcE,CAAa,EACtD,CAAC;AACH;AAGA,SAAgBC,EACd,GACA,GACA,GACA,GACQ;CACR,IAAIC,IAAK,KACP,OAAOZ,EAAG,yBAAyB,aAAa,EAAE,IAAI,KAAK,IAAI,GAAG,KAAK,MAAMY,CAAE,CAAC,EAAE,CAAC;CAErF,IAAIA,IAAK,KAIP,OAAOZ,EAAG,8BAA8B,iBAAiB,EAAE,SAH3C,IAAI,KAAK,aAAaa,GAAQ,EAC5C,uBAAuB,MAAK,KAC9B,CAAC,CAAC,CAAC,OAAOD,IAAK,GAC4C,EAAQ,CAAC;CAEtE,IAAIA,IAAK,MAAW;EAClB,IAAME,IAAQ,KAAK,MAAMF,IAAK,GAAI;EAClC,OAAOZ,EAAG,8BAA8B,iCAAiC;GACvE,SAAS,KAAK,MAAMc,IAAQ,EAAE;GAC9B,SAASA,IAAQ;EACnB,CAAC;CACH;CACA,OAAOL,EAAeG,IAAK,KAAQF,CAAa;AAClD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DateValue } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
import { RunsAccess } from './runAccess';
|
|
3
|
+
import { DayRuns } from './runLayout';
|
|
4
|
+
import { RunPeekControls } from './runPeekState';
|
|
5
|
+
import { CalendarRunLinks } from './runTypes';
|
|
6
|
+
import { WorkflowRunsData } from './useWorkflowRuns';
|
|
7
|
+
export interface WorkflowRunsLayerModel extends RunPeekControls {
|
|
8
|
+
/** The person's switch. */
|
|
9
|
+
switchOn: boolean;
|
|
10
|
+
setSwitchOn: (on: boolean) => void;
|
|
11
|
+
access: RunsAccess;
|
|
12
|
+
/** Runs show: switched on, and allowed. */
|
|
13
|
+
shown: boolean;
|
|
14
|
+
data: WorkflowRunsData;
|
|
15
|
+
/** A shown day's runs; undefined when it has none or the layer doesn't show. */
|
|
16
|
+
runsOn: (day: DateValue) => DayRuns | undefined;
|
|
17
|
+
/** Runs on the shown days. */
|
|
18
|
+
shownCount: number;
|
|
19
|
+
/** The host's resolvers; null: no links. */
|
|
20
|
+
links: CalendarRunLinks | null;
|
|
21
|
+
/** Turns the layer off from a run's peek, with Undo on the toast. */
|
|
22
|
+
hideRuns: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const IDLE_RUNS_DATA: WorkflowRunsData;
|
|
25
|
+
export declare const WorkflowRunsContext: import('react').Context<WorkflowRunsLayerModel>;
|
|
26
|
+
export declare function useWorkflowRunsLayer(): WorkflowRunsLayerModel;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createContext as e, use as t } from "react";
|
|
2
|
+
// src/v2/runs/runsLayerContext.ts
|
|
3
|
+
var n = {
|
|
4
|
+
runs: [],
|
|
5
|
+
upcoming: "idle",
|
|
6
|
+
past: "idle",
|
|
7
|
+
upcomingError: null,
|
|
8
|
+
pastError: null,
|
|
9
|
+
pastFrom: null,
|
|
10
|
+
upcomingUntil: null,
|
|
11
|
+
reload: () => void 0
|
|
12
|
+
}, r = e({
|
|
13
|
+
switchOn: !1,
|
|
14
|
+
setSwitchOn: () => void 0,
|
|
15
|
+
access: { kind: "denied" },
|
|
16
|
+
shown: !1,
|
|
17
|
+
data: n,
|
|
18
|
+
runsOn: () => void 0,
|
|
19
|
+
shownCount: 0,
|
|
20
|
+
links: null,
|
|
21
|
+
peek: null,
|
|
22
|
+
openPeek: () => void 0,
|
|
23
|
+
showInPeek: () => void 0,
|
|
24
|
+
backInPeek: () => void 0,
|
|
25
|
+
closePeek: () => void 0,
|
|
26
|
+
hideRuns: () => void 0
|
|
27
|
+
});
|
|
28
|
+
function i() {
|
|
29
|
+
return t(r);
|
|
30
|
+
}
|
|
31
|
+
export { n as IDLE_RUNS_DATA, r as WorkflowRunsContext, i as useWorkflowRunsLayer };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=runsLayerContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runsLayerContext.js","names":["IDLE_RUNS_DATA","WorkflowRunsContext","createContext","useWorkflowRunsLayer","use"],"sources":["../../../src/v2/runs/runsLayerContext.ts"],"sourcesContent":["/**\n * The workflow runs layer's shared model (BOFF-15698 B5), held by `WorkflowRunsLayer`. Outside\n * the layer (search results, tests of one view) `useWorkflowRunsLayer` answers \"off\": no runs,\n * nothing asked for.\n */\nimport { createContext, use } from 'react';\nimport type { DateValue } from '@burdenoff/fe-libs/ui';\nimport type { RunsAccess } from './runAccess';\nimport type { DayRuns } from './runLayout';\nimport type { RunPeekControls } from './runPeekState';\nimport type { CalendarRunLinks } from './runTypes';\nimport type { WorkflowRunsData } from './useWorkflowRuns';\n\nexport interface WorkflowRunsLayerModel extends RunPeekControls {\n /** The person's switch. */\n switchOn: boolean;\n setSwitchOn: (on: boolean) => void;\n access: RunsAccess;\n /** Runs show: switched on, and allowed. */\n shown: boolean;\n data: WorkflowRunsData;\n /** A shown day's runs; undefined when it has none or the layer doesn't show. */\n runsOn: (day: DateValue) => DayRuns | undefined;\n /** Runs on the shown days. */\n shownCount: number;\n /** The host's resolvers; null: no links. */\n links: CalendarRunLinks | null;\n /** Turns the layer off from a run's peek, with Undo on the toast. */\n hideRuns: () => void;\n}\n\nexport const IDLE_RUNS_DATA: WorkflowRunsData = {\n runs: [],\n upcoming: 'idle',\n past: 'idle',\n upcomingError: null,\n pastError: null,\n pastFrom: null,\n upcomingUntil: null,\n reload: () => undefined,\n};\n\nconst OFF: WorkflowRunsLayerModel = {\n switchOn: false,\n setSwitchOn: () => undefined,\n access: { kind: 'denied' },\n shown: false,\n data: IDLE_RUNS_DATA,\n runsOn: () => undefined,\n shownCount: 0,\n links: null,\n peek: null,\n openPeek: () => undefined,\n showInPeek: () => undefined,\n backInPeek: () => undefined,\n closePeek: () => undefined,\n hideRuns: () => undefined,\n};\n\nexport const WorkflowRunsContext = createContext<WorkflowRunsLayerModel>(OFF);\n\nexport function useWorkflowRunsLayer(): WorkflowRunsLayerModel {\n return use(WorkflowRunsContext);\n}\n"],"mappings":";;AA+BA,IAAaA,IAAmC;CAC9C,MAAM,CAAC;CACP,UAAU;CACV,MAAM;CACN,eAAe;CACf,WAAW;CACX,UAAU;CACV,eAAe;CACf,cAAc,KAAA;AAChB,GAmBaC,IAAsBC,EAAsC;CAhBvE,UAAU;CACV,mBAAmB,KAAA;CACnB,QAAQ,EAAE,MAAM,SAAS;CACzB,OAAO;CACP,MAAMF;CACN,cAAc,KAAA;CACd,YAAY;CACZ,OAAO;CACP,MAAM;CACN,gBAAgB,KAAA;CAChB,kBAAkB,KAAA;CAClB,kBAAkB,KAAA;CAClB,iBAAiB,KAAA;CACjB,gBAAgB,KAAA;AAGuD,CAAG;AAE5E,SAAgBG,IAA+C;CAC7D,OAAOC,EAAIH,CAAmB;AAChC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RunHrefs } from './runLinks';
|
|
2
|
+
import { WorkflowRun } from './runModel';
|
|
3
|
+
import { CalendarRunLinks } from './runTypes';
|
|
4
|
+
export interface RunHrefsState {
|
|
5
|
+
/** `none`: the host links nothing. `gone`: the schedule no longer exists. */
|
|
6
|
+
status: 'none' | 'loading' | 'ready' | 'gone' | 'error';
|
|
7
|
+
hrefs: RunHrefs;
|
|
8
|
+
retry: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function useRunHrefs(run: WorkflowRun | null, links: CalendarRunLinks | null): RunHrefsState;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CalendarV2RunOutputDocument as e, CalendarV2RunScheduleDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useKeyedLoad as n } from "../data/useKeyedLoad.js";
|
|
3
|
+
import { NO_HREFS as r, hasRunLinks as i, resolveRunHrefs as a, runJobRef as o } from "./runLinks.js";
|
|
4
|
+
import { runJobStatus as s } from "./runModel.js";
|
|
5
|
+
import { useApolloClient as c } from "@apollo/client/react";
|
|
6
|
+
// src/v2/runs/useRunHrefs.ts
|
|
7
|
+
function l(l, u) {
|
|
8
|
+
let d = c(), f = i(u) ? u : null, p = l?.execution && f?.resolveExecutionHref ? l.execution.id : null, m = l && f ? `${l.scheduledJobId}|${p ?? ""}` : null, h = n(m, async () => {
|
|
9
|
+
if (!l || !f) return r;
|
|
10
|
+
let [n, i] = await Promise.all([d.query({
|
|
11
|
+
query: t,
|
|
12
|
+
variables: { id: l.scheduledJobId },
|
|
13
|
+
fetchPolicy: "network-only"
|
|
14
|
+
}), p ? d.query({
|
|
15
|
+
query: e,
|
|
16
|
+
variables: { id: p },
|
|
17
|
+
fetchPolicy: "network-only"
|
|
18
|
+
}).catch(() => null) : Promise.resolve(null)]);
|
|
19
|
+
if (!n.data) throw Error("The run’s schedule could not be loaded");
|
|
20
|
+
let c = n.data.scheduledJob;
|
|
21
|
+
if (!c) return null;
|
|
22
|
+
let u = i?.data?.jobExecution ?? null, m = u ? s(String(u.status)) : null, h = u && m ? {
|
|
23
|
+
id: u.id,
|
|
24
|
+
scheduledJobId: u.scheduledJobId,
|
|
25
|
+
status: m,
|
|
26
|
+
success: u.success,
|
|
27
|
+
output: u.output ?? null
|
|
28
|
+
} : null;
|
|
29
|
+
return a({
|
|
30
|
+
links: f,
|
|
31
|
+
run: l,
|
|
32
|
+
job: o(c),
|
|
33
|
+
execution: h
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return m === null ? {
|
|
37
|
+
status: "none",
|
|
38
|
+
hrefs: r,
|
|
39
|
+
retry: h.reload
|
|
40
|
+
} : h.error ? {
|
|
41
|
+
status: "error",
|
|
42
|
+
hrefs: r,
|
|
43
|
+
retry: h.reload
|
|
44
|
+
} : h.dataKey !== m || h.data === void 0 ? {
|
|
45
|
+
status: "loading",
|
|
46
|
+
hrefs: r,
|
|
47
|
+
retry: h.reload
|
|
48
|
+
} : h.data === null ? {
|
|
49
|
+
status: "gone",
|
|
50
|
+
hrefs: r,
|
|
51
|
+
retry: h.reload
|
|
52
|
+
} : {
|
|
53
|
+
status: "ready",
|
|
54
|
+
hrefs: h.data,
|
|
55
|
+
retry: h.reload
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export { l as useRunHrefs };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=useRunHrefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRunHrefs.js","names":["useRunHrefs","client","useApolloClient","linked","hasRunLinks","links","executionId","run","key","load","useKeyedLoad","NO_HREFS","schedule","output","CalendarV2RunScheduleDocument","CalendarV2RunOutputDocument","job","answered","status","runJobStatus","execution","resolveRunHrefs","runJobRef"],"sources":["../../../src/v2/runs/useRunHrefs.ts"],"sourcesContent":["/**\n * A run's links, loaded when its peek opens (BOFF-15698 B5): its schedule (`scheduledJob`, for\n * the subject and the job the host's resolvers take) and, for a past run when the host links\n * runs, what it answered (`jobExecution`'s output, for the run it started). Nothing is asked\n * for when the host gave no resolver. A schedule that no longer exists has no links.\n */\nimport { useApolloClient } from '@apollo/client/react';\nimport {\n CalendarV2RunOutputDocument,\n CalendarV2RunScheduleDocument,\n type CalendarV2RunOutputQuery,\n type CalendarV2RunOutputQueryVariables,\n type CalendarV2RunScheduleQuery,\n type CalendarV2RunScheduleQueryVariables,\n} from '../../generated/wspace-operations';\nimport { useKeyedLoad } from '../data/useKeyedLoad';\nimport { hasRunLinks, NO_HREFS, resolveRunHrefs, runJobRef, type RunHrefs } from './runLinks';\nimport { runJobStatus, type WorkflowRun } from './runModel';\nimport type { CalendarRunExecutionRef, CalendarRunLinks } from './runTypes';\n\nexport interface RunHrefsState {\n /** `none`: the host links nothing. `gone`: the schedule no longer exists. */\n status: 'none' | 'loading' | 'ready' | 'gone' | 'error';\n hrefs: RunHrefs;\n retry: () => void;\n}\n\nexport function useRunHrefs(\n run: WorkflowRun | null,\n links: CalendarRunLinks | null\n): RunHrefsState {\n const client = useApolloClient();\n const linked = hasRunLinks(links) ? links : null;\n const executionId = run?.execution && linked?.resolveExecutionHref ? run.execution.id : null;\n const key = run && linked ? `${run.scheduledJobId}|${executionId ?? ''}` : null;\n\n const load = useKeyedLoad<RunHrefs | null>(key, async () => {\n if (!run || !linked) return NO_HREFS;\n const [schedule, output] = await Promise.all([\n client.query<CalendarV2RunScheduleQuery, CalendarV2RunScheduleQueryVariables>({\n query: CalendarV2RunScheduleDocument,\n variables: { id: run.scheduledJobId },\n fetchPolicy: 'network-only',\n }),\n // Without the run's answer there is no run link; the workflow's still shows.\n executionId\n ? client\n .query<CalendarV2RunOutputQuery, CalendarV2RunOutputQueryVariables>({\n query: CalendarV2RunOutputDocument,\n variables: { id: executionId },\n fetchPolicy: 'network-only',\n })\n .catch(() => null)\n : Promise.resolve(null),\n ]);\n if (!schedule.data) throw new Error('The run’s schedule could not be loaded');\n const job = schedule.data.scheduledJob;\n if (!job) return null;\n const answered = output?.data?.jobExecution ?? null;\n const status = answered ? runJobStatus(String(answered.status)) : null;\n const execution: CalendarRunExecutionRef | null =\n answered && status\n ? {\n id: answered.id,\n scheduledJobId: answered.scheduledJobId,\n status,\n success: answered.success,\n output: answered.output ?? null,\n }\n : null;\n return resolveRunHrefs({ links: linked, run, job: runJobRef(job), execution });\n });\n\n if (key === null) return { status: 'none', hrefs: NO_HREFS, retry: load.reload };\n if (load.error) return { status: 'error', hrefs: NO_HREFS, retry: load.reload };\n if (load.dataKey !== key || load.data === undefined) {\n return { status: 'loading', hrefs: NO_HREFS, retry: load.reload };\n }\n if (load.data === null) return { status: 'gone', hrefs: NO_HREFS, retry: load.reload };\n return { status: 'ready', hrefs: load.data, retry: load.reload };\n}\n"],"mappings":";;;;;;AA2BA,SAAgBA,EACd,GACA,GACe;CACf,IAAMC,IAASC,EAAgB,GACzBC,IAASC,EAAYC,CAAK,IAAIA,IAAQ,MACtCC,IAAcC,GAAK,aAAaJ,GAAQ,uBAAuBI,EAAI,UAAU,KAAK,MAClFC,IAAMD,KAAOJ,IAAS,GAAGI,EAAI,eAAe,GAAGD,KAAe,OAAO,MAErEG,IAAOC,EAA8BF,GAAK,YAAY;EAC1D,IAAI,CAACD,KAAO,CAACJ,GAAQ,OAAOQ;EAC5B,IAAM,CAACC,GAAUC,KAAU,MAAM,QAAQ,IAAI,CAC3CZ,EAAO,MAAuE;GAC5E,OAAOa;GACP,WAAW,EAAE,IAAIP,EAAI,eAAe;GACpC,aAAa;EACf,CAAC,GAEDD,IACIL,EACG,MAAmE;GAClE,OAAOc;GACP,WAAW,EAAE,IAAIT,EAAY;GAC7B,aAAa;EACf,CAAC,CAAC,CACD,YAAY,IAAI,IACnB,QAAQ,QAAQ,IAAI,CAC1B,CAAC;EACD,IAAI,CAACM,EAAS,MAAM,MAAU,MAAM,wCAAwC;EAC5E,IAAMI,IAAMJ,EAAS,KAAK;EAC1B,IAAI,CAACI,GAAK,OAAO;EACjB,IAAMC,IAAWJ,GAAQ,MAAM,gBAAgB,MACzCK,IAASD,IAAWE,EAAa,OAAOF,EAAS,MAAM,CAAC,IAAI,MAC5DG,IACJH,KAAYC,IACR;GACE,IAAID,EAAS;GACb,gBAAgBA,EAAS;GACzB;GACA,SAASA,EAAS;GAClB,QAAQA,EAAS,UAAU;EAC7B,IACA;EACN,OAAOI,EAAgB;GAAE,OAAOlB;GAAQ;GAAK,KAAKmB,EAAUN,CAAG;GAAG;EAAU,CAAC;CAC/E,CAAC;CAQD,OANIR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