@burdenoff/microfe-stewards 2026.1201.3 → 2026.1202.1
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/dev/fixturesEditors.d.ts +4 -0
- package/dist/generated/wspace-operations.d.ts +1259 -6
- package/dist/generated/wspace-operations.js +493 -62
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.js +12 -4
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/stewards/StewardsRoutes.d.ts +2 -2
- package/dist/stewards/StewardsRoutes.js +41 -26
- package/dist/stewards/StewardsRoutes.js.map +1 -1
- package/dist/stewards/components/DutyEditor.d.ts +8 -0
- package/dist/stewards/components/DutyEditor.js +151 -0
- package/dist/stewards/components/DutyEditor.js.map +1 -0
- package/dist/stewards/components/FormField.d.ts +8 -0
- package/dist/stewards/components/FormField.js +23 -0
- package/dist/stewards/components/FormField.js.map +1 -0
- package/dist/stewards/components/MemoryDiffView.d.ts +6 -0
- package/dist/stewards/components/MemoryDiffView.js +81 -0
- package/dist/stewards/components/MemoryDiffView.js.map +1 -0
- package/dist/stewards/components/ProposalsQueue.d.ts +5 -0
- package/dist/stewards/components/ProposalsQueue.js +106 -0
- package/dist/stewards/components/ProposalsQueue.js.map +1 -0
- package/dist/stewards/components/TeachRecorder.d.ts +12 -0
- package/dist/stewards/components/TeachRecorder.js +288 -0
- package/dist/stewards/components/TeachRecorder.js.map +1 -0
- package/dist/stewards/i18n/en.d.ts +230 -6
- package/dist/stewards/i18n/en.js +8 -3
- package/dist/stewards/i18n/en.js.map +1 -1
- package/dist/stewards/i18n/enEditors.d.ts +230 -0
- package/dist/stewards/i18n/enEditors.js +233 -0
- package/dist/stewards/i18n/enEditors.js.map +1 -0
- package/dist/stewards/index.js +4 -4
- package/dist/stewards/pages/StewardDutiesPage.d.ts +1 -0
- package/dist/stewards/pages/StewardDutiesPage.js +221 -0
- package/dist/stewards/pages/StewardDutiesPage.js.map +1 -0
- package/dist/stewards/pages/StewardLayout.js +62 -45
- package/dist/stewards/pages/StewardLayout.js.map +1 -1
- package/dist/stewards/pages/StewardMemoryPage.d.ts +1 -0
- package/dist/stewards/pages/StewardMemoryPage.js +294 -0
- package/dist/stewards/pages/StewardMemoryPage.js.map +1 -0
- package/dist/stewards/pages/StewardPlaybooksPage.d.ts +1 -0
- package/dist/stewards/pages/StewardPlaybooksPage.js +360 -0
- package/dist/stewards/pages/StewardPlaybooksPage.js.map +1 -0
- package/dist/stewards/utils/dutyForm.d.ts +37 -0
- package/dist/stewards/utils/dutyForm.js +84 -0
- package/dist/stewards/utils/dutyForm.js.map +1 -0
- package/dist/stewards/utils/memory.d.ts +21 -0
- package/dist/stewards/utils/memory.js +29 -0
- package/dist/stewards/utils/memory.js.map +1 -0
- package/dist/stewards/utils/playbookForm.d.ts +41 -0
- package/dist/stewards/utils/playbookForm.js +67 -0
- package/dist/stewards/utils/playbookForm.js.map +1 -0
- package/dist/stewards/utils/recorder.d.ts +31 -0
- package/dist/stewards/utils/recorder.js +106 -0
- package/dist/stewards/utils/recorder.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Routes relative to the host's mount point (e.g. `/botmanor/stewards/*`):
|
|
3
3
|
* list, `new`, `runs/:runId`, and `:stewardId` with its `charter` and `daybook`
|
|
4
|
-
* tabs
|
|
5
|
-
* work and are not routed here.
|
|
4
|
+
* tabs, plus `duties`, `memory` and `playbooks`. The approvals inbox and live view
|
|
5
|
+
* are other work and are not routed here.
|
|
6
6
|
*/
|
|
7
7
|
export declare function StewardsRoutes(): import('react').JSX.Element;
|
|
@@ -1,54 +1,69 @@
|
|
|
1
1
|
import { StewardCharterPage as e } from "./pages/StewardCharterPage.js";
|
|
2
2
|
import { StewardDaybookPage as t } from "./pages/StewardDaybookPage.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { StewardDutiesPage as n } from "./pages/StewardDutiesPage.js";
|
|
4
|
+
import { StewardLayout as r } from "./pages/StewardLayout.js";
|
|
5
|
+
import { StewardMemoryPage as i } from "./pages/StewardMemoryPage.js";
|
|
6
|
+
import { StewardNewPage as a } from "./pages/StewardNewPage.js";
|
|
7
|
+
import { StewardOverviewPage as o } from "./pages/StewardOverviewPage.js";
|
|
8
|
+
import { StewardPlaybooksPage as s } from "./pages/StewardPlaybooksPage.js";
|
|
9
|
+
import { StewardRunPage as c } from "./pages/StewardRunPage.js";
|
|
10
|
+
import { StewardsListPage as l } from "./pages/StewardsListPage.js";
|
|
11
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
|
+
import { Navigate as f, Route as p, Routes as m } from "react-router";
|
|
10
13
|
// src/stewards/StewardsRoutes.tsx
|
|
11
|
-
function
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
+
function h() {
|
|
15
|
+
return /* @__PURE__ */ d(m, { children: [
|
|
16
|
+
/* @__PURE__ */ u(p, {
|
|
14
17
|
index: !0,
|
|
15
|
-
element: /* @__PURE__ */
|
|
18
|
+
element: /* @__PURE__ */ u(l, {})
|
|
16
19
|
}),
|
|
17
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ u(p, {
|
|
18
21
|
path: "new",
|
|
19
|
-
element: /* @__PURE__ */
|
|
22
|
+
element: /* @__PURE__ */ u(a, {})
|
|
20
23
|
}),
|
|
21
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ u(p, {
|
|
22
25
|
path: "runs/:runId",
|
|
23
|
-
element: /* @__PURE__ */
|
|
26
|
+
element: /* @__PURE__ */ u(c, {})
|
|
24
27
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ d(p, {
|
|
26
29
|
path: ":stewardId",
|
|
27
|
-
element: /* @__PURE__ */
|
|
30
|
+
element: /* @__PURE__ */ u(r, {}),
|
|
28
31
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ u(p, {
|
|
30
33
|
index: !0,
|
|
31
|
-
element: /* @__PURE__ */
|
|
34
|
+
element: /* @__PURE__ */ u(o, {})
|
|
32
35
|
}),
|
|
33
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ u(p, {
|
|
34
37
|
path: "charter",
|
|
35
|
-
element: /* @__PURE__ */
|
|
38
|
+
element: /* @__PURE__ */ u(e, {})
|
|
36
39
|
}),
|
|
37
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ u(p, {
|
|
38
41
|
path: "daybook",
|
|
39
|
-
element: /* @__PURE__ */
|
|
42
|
+
element: /* @__PURE__ */ u(t, {})
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ u(p, {
|
|
45
|
+
path: "duties",
|
|
46
|
+
element: /* @__PURE__ */ u(n, {})
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ u(p, {
|
|
49
|
+
path: "memory",
|
|
50
|
+
element: /* @__PURE__ */ u(i, {})
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ u(p, {
|
|
53
|
+
path: "playbooks",
|
|
54
|
+
element: /* @__PURE__ */ u(s, {})
|
|
40
55
|
})
|
|
41
56
|
]
|
|
42
57
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ u(p, {
|
|
44
59
|
path: "*",
|
|
45
|
-
element: /* @__PURE__ */
|
|
60
|
+
element: /* @__PURE__ */ u(f, {
|
|
46
61
|
to: ".",
|
|
47
62
|
replace: !0
|
|
48
63
|
})
|
|
49
64
|
})
|
|
50
65
|
] });
|
|
51
66
|
}
|
|
52
|
-
export {
|
|
67
|
+
export { h as StewardsRoutes };
|
|
53
68
|
|
|
54
69
|
//# sourceMappingURL=StewardsRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StewardsRoutes.js","names":["StewardsRoutes","Routes","Route","StewardsListPage","StewardNewPage","StewardRunPage","StewardLayout","StewardOverviewPage","StewardCharterPage","StewardDaybookPage","Navigate"],"sources":["../../src/stewards/StewardsRoutes.tsx"],"sourcesContent":["import { Navigate, Route, Routes } from 'react-router';\nimport { StewardCharterPage } from './pages/StewardCharterPage';\nimport { StewardDaybookPage } from './pages/StewardDaybookPage';\nimport { StewardLayout } from './pages/StewardLayout';\nimport { StewardNewPage } from './pages/StewardNewPage';\nimport { StewardOverviewPage } from './pages/StewardOverviewPage';\nimport { StewardRunPage } from './pages/StewardRunPage';\nimport { StewardsListPage } from './pages/StewardsListPage';\n\n/**\n * Routes relative to the host's mount point (e.g. `/botmanor/stewards/*`):\n * list, `new`, `runs/:runId`, and `:stewardId` with its `charter` and `daybook`\n * tabs
|
|
1
|
+
{"version":3,"file":"StewardsRoutes.js","names":["StewardsRoutes","Routes","Route","StewardsListPage","StewardNewPage","StewardRunPage","StewardLayout","StewardOverviewPage","StewardCharterPage","StewardDaybookPage","StewardDutiesPage","StewardMemoryPage","StewardPlaybooksPage","Navigate"],"sources":["../../src/stewards/StewardsRoutes.tsx"],"sourcesContent":["import { Navigate, Route, Routes } from 'react-router';\nimport { StewardCharterPage } from './pages/StewardCharterPage';\nimport { StewardDaybookPage } from './pages/StewardDaybookPage';\nimport { StewardDutiesPage } from './pages/StewardDutiesPage';\nimport { StewardLayout } from './pages/StewardLayout';\nimport { StewardMemoryPage } from './pages/StewardMemoryPage';\nimport { StewardNewPage } from './pages/StewardNewPage';\nimport { StewardOverviewPage } from './pages/StewardOverviewPage';\nimport { StewardPlaybooksPage } from './pages/StewardPlaybooksPage';\nimport { StewardRunPage } from './pages/StewardRunPage';\nimport { StewardsListPage } from './pages/StewardsListPage';\n\n/**\n * Routes relative to the host's mount point (e.g. `/botmanor/stewards/*`):\n * list, `new`, `runs/:runId`, and `:stewardId` with its `charter` and `daybook`\n * tabs, plus `duties`, `memory` and `playbooks`. The approvals inbox and live view\n * are other work and are not routed here.\n */\nexport function StewardsRoutes() {\n return (\n <Routes>\n <Route index element={<StewardsListPage />} />\n <Route path=\"new\" element={<StewardNewPage />} />\n <Route path=\"runs/:runId\" element={<StewardRunPage />} />\n <Route path=\":stewardId\" element={<StewardLayout />}>\n <Route index element={<StewardOverviewPage />} />\n <Route path=\"charter\" element={<StewardCharterPage />} />\n <Route path=\"daybook\" element={<StewardDaybookPage />} />\n <Route path=\"duties\" element={<StewardDutiesPage />} />\n <Route path=\"memory\" element={<StewardMemoryPage />} />\n <Route path=\"playbooks\" element={<StewardPlaybooksPage />} />\n </Route>\n <Route path=\"*\" element={<Navigate to=\".\" replace />} />\n </Routes>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAgBA,IAAiB;CAC/B,OACE,kBAACC,GAAD,EAAA,UAAA;EACE,kBAACC,GAAD;GAAO,OAAA;GAAM,SAAS,kBAACC,GAAD,CAAmB,CAAA;EAAI,CAAA;EAC7C,kBAACD,GAAD;GAAO,MAAK;GAAM,SAAS,kBAACE,GAAD,CAAiB,CAAA;EAAI,CAAA;EAChD,kBAACF,GAAD;GAAO,MAAK;GAAc,SAAS,kBAACG,GAAD,CAAiB,CAAA;EAAI,CAAA;EACxD,kBAACH,GAAD;GAAO,MAAK;GAAa,SAAS,kBAACI,GAAD,CAAgB,CAAA;GAAlD,UAAA;IACE,kBAACJ,GAAD;KAAO,OAAA;KAAM,SAAS,kBAACK,GAAD,CAAsB,CAAA;IAAI,CAAA;IAChD,kBAACL,GAAD;KAAO,MAAK;KAAU,SAAS,kBAACM,GAAD,CAAqB,CAAA;IAAI,CAAA;IACxD,kBAACN,GAAD;KAAO,MAAK;KAAU,SAAS,kBAACO,GAAD,CAAqB,CAAA;IAAI,CAAA;IACxD,kBAACP,GAAD;KAAO,MAAK;KAAS,SAAS,kBAACQ,GAAD,CAAoB,CAAA;IAAI,CAAA;IACtD,kBAACR,GAAD;KAAO,MAAK;KAAS,SAAS,kBAACS,GAAD,CAAoB,CAAA;IAAI,CAAA;IACtD,kBAACT,GAAD;KAAO,MAAK;KAAY,SAAS,kBAACU,GAAD,CAAuB,CAAA;IAAI,CAAA;GACvD;;EACP,kBAACV,GAAD;GAAO,MAAK;GAAI,SAAS,kBAACW,GAAD;IAAU,IAAG;IAAI,SAAA;GAAS,CAAA;EAAI,CAAA;CACjD,EAAA,CAAA;AAEZ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StewardDutyFieldsFragment, StewardPlaybookFieldsFragment } from '../../generated/wspace-operations';
|
|
2
|
+
export declare function DutyEditor({ stewardId, timezone, duty, playbooks, onClose, }: {
|
|
3
|
+
stewardId: string;
|
|
4
|
+
timezone: string;
|
|
5
|
+
duty: StewardDutyFieldsFragment | null;
|
|
6
|
+
playbooks: StewardPlaybookFieldsFragment[];
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { useUpsertBotmanorStewardDutyMutation as e } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { BotmanorStewardDutyKind as t } from "../../generated/wspace-types.js";
|
|
3
|
+
import { useStewardsT as n } from "../i18n/useStewardsT.js";
|
|
4
|
+
import { DUTY_KINDS as r, buildDutyInput as i, dutyToForm as a, emptyDutyForm as o, usesEventType as s, usesSchedule as c, validateDuty as l } from "../utils/dutyForm.js";
|
|
5
|
+
import { FIELD_CLASS as u } from "./fieldClasses.js";
|
|
6
|
+
import { FormField as d } from "./FormField.js";
|
|
7
|
+
import { Alert as f, Button as p, Card as m } from "./ui.js";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { useState as _ } from "react";
|
|
10
|
+
// src/stewards/components/DutyEditor.tsx
|
|
11
|
+
function v({ stewardId: v, timezone: y, duty: b, playbooks: x, onClose: S }) {
|
|
12
|
+
let C = n(), [w, T] = _(() => b ? a(b, y) : o(y)), [E, D] = _(!1), [O, { loading: k, error: A }] = e({
|
|
13
|
+
refetchQueries: ["ListBotmanorStewardDuties"],
|
|
14
|
+
awaitRefetchQueries: !0
|
|
15
|
+
}), j = (e, t) => T((n) => ({
|
|
16
|
+
...n,
|
|
17
|
+
[e]: t
|
|
18
|
+
})), M = l(w), N = (e) => E && M.includes(e) ? C(`stewards.duties.errors.${e}`) : null, P = async () => {
|
|
19
|
+
D(!0);
|
|
20
|
+
let e = i(w, v);
|
|
21
|
+
e && (await O({ variables: { input: e } }), S());
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ h(m, {
|
|
24
|
+
title: C(b ? "stewards.duties.formEdit" : "stewards.duties.formNew"),
|
|
25
|
+
children: /* @__PURE__ */ g("form", {
|
|
26
|
+
className: "flex flex-col gap-3",
|
|
27
|
+
onSubmit: (e) => {
|
|
28
|
+
e.preventDefault(), P().catch(() => void 0);
|
|
29
|
+
},
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ h(d, {
|
|
32
|
+
label: C("stewards.duties.fieldName"),
|
|
33
|
+
error: N("name") ?? N("nameLength"),
|
|
34
|
+
children: /* @__PURE__ */ h("input", {
|
|
35
|
+
className: u,
|
|
36
|
+
maxLength: 255,
|
|
37
|
+
value: w.name,
|
|
38
|
+
onChange: (e) => j("name", e.target.value)
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ h(d, {
|
|
42
|
+
label: C("stewards.duties.fieldKind"),
|
|
43
|
+
children: /* @__PURE__ */ h("select", {
|
|
44
|
+
className: u,
|
|
45
|
+
value: w.kind,
|
|
46
|
+
disabled: b !== null,
|
|
47
|
+
onChange: (e) => j("kind", e.target.value),
|
|
48
|
+
children: r.map((e) => /* @__PURE__ */ h("option", {
|
|
49
|
+
value: e,
|
|
50
|
+
children: C(`stewards.duties.kind.${e}`)
|
|
51
|
+
}, e))
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
c(w.kind) && /* @__PURE__ */ g("div", {
|
|
55
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
56
|
+
children: [/* @__PURE__ */ h(d, {
|
|
57
|
+
label: C("stewards.duties.fieldCron"),
|
|
58
|
+
help: C("stewards.duties.fieldCronHelp"),
|
|
59
|
+
error: N("cron"),
|
|
60
|
+
children: /* @__PURE__ */ h("input", {
|
|
61
|
+
className: "w-full rounded-md border border-(color:--color-border-seam) bg-(--color-bg-surface) px-2 py-1.5 text-sm text-(color:--color-text-primary) placeholder:text-(color:--color-text-placeholder) focus-visible:outline-2 focus-visible:outline-(color:--color-focus-ring) font-mono",
|
|
62
|
+
value: w.cron,
|
|
63
|
+
onChange: (e) => j("cron", e.target.value)
|
|
64
|
+
})
|
|
65
|
+
}), /* @__PURE__ */ h(d, {
|
|
66
|
+
label: C("stewards.duties.fieldTimezone"),
|
|
67
|
+
children: /* @__PURE__ */ h("input", {
|
|
68
|
+
className: "w-full rounded-md border border-(color:--color-border-seam) bg-(--color-bg-surface) px-2 py-1.5 text-sm text-(color:--color-text-primary) placeholder:text-(color:--color-text-placeholder) focus-visible:outline-2 focus-visible:outline-(color:--color-focus-ring)",
|
|
69
|
+
value: w.timezone,
|
|
70
|
+
onChange: (e) => j("timezone", e.target.value)
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
}),
|
|
74
|
+
w.kind === t.Watch && /* @__PURE__ */ h(d, {
|
|
75
|
+
label: C("stewards.duties.fieldUrl"),
|
|
76
|
+
help: C("stewards.duties.fieldUrlHelp"),
|
|
77
|
+
error: N("url"),
|
|
78
|
+
children: /* @__PURE__ */ h("input", {
|
|
79
|
+
className: "w-full rounded-md border border-(color:--color-border-seam) bg-(--color-bg-surface) px-2 py-1.5 text-sm text-(color:--color-text-primary) placeholder:text-(color:--color-text-placeholder) focus-visible:outline-2 focus-visible:outline-(color:--color-focus-ring)",
|
|
80
|
+
type: "url",
|
|
81
|
+
value: w.url,
|
|
82
|
+
onChange: (e) => j("url", e.target.value)
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
s(w.kind) && /* @__PURE__ */ h(d, {
|
|
86
|
+
label: C("stewards.duties.fieldEventType"),
|
|
87
|
+
help: C("stewards.duties.fieldEventTypeHelp"),
|
|
88
|
+
error: N("eventTypeLength"),
|
|
89
|
+
children: /* @__PURE__ */ h("input", {
|
|
90
|
+
className: "w-full rounded-md border border-(color:--color-border-seam) bg-(--color-bg-surface) px-2 py-1.5 text-sm text-(color:--color-text-primary) placeholder:text-(color:--color-text-placeholder) focus-visible:outline-2 focus-visible:outline-(color:--color-focus-ring)",
|
|
91
|
+
value: w.eventType,
|
|
92
|
+
onChange: (e) => j("eventType", e.target.value)
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ h(d, {
|
|
96
|
+
label: C("stewards.duties.fieldPlaybook"),
|
|
97
|
+
children: /* @__PURE__ */ g("select", {
|
|
98
|
+
className: u,
|
|
99
|
+
value: w.playbookId,
|
|
100
|
+
onChange: (e) => j("playbookId", e.target.value),
|
|
101
|
+
children: [/* @__PURE__ */ h("option", {
|
|
102
|
+
value: "",
|
|
103
|
+
children: C("stewards.duties.fieldNoPlaybook")
|
|
104
|
+
}), x.map((e) => /* @__PURE__ */ h("option", {
|
|
105
|
+
value: e.id,
|
|
106
|
+
children: e.name
|
|
107
|
+
}, e.id))]
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ h(d, {
|
|
111
|
+
label: C("stewards.duties.fieldPrompt"),
|
|
112
|
+
help: C("stewards.duties.fieldPromptHelp"),
|
|
113
|
+
error: N("promptOrPlaybook") ?? N("promptLength"),
|
|
114
|
+
children: /* @__PURE__ */ h("textarea", {
|
|
115
|
+
className: `${u} min-h-24`,
|
|
116
|
+
value: w.prompt,
|
|
117
|
+
onChange: (e) => j("prompt", e.target.value)
|
|
118
|
+
})
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ g("label", {
|
|
121
|
+
className: "flex items-center gap-2 text-sm text-(color:--color-text-primary)",
|
|
122
|
+
children: [/* @__PURE__ */ h("input", {
|
|
123
|
+
type: "checkbox",
|
|
124
|
+
checked: w.dryRun,
|
|
125
|
+
onChange: (e) => j("dryRun", e.target.checked)
|
|
126
|
+
}), C("stewards.duties.fieldDryRun")]
|
|
127
|
+
}),
|
|
128
|
+
A && /* @__PURE__ */ g(f, { children: [
|
|
129
|
+
C("stewards.duties.saveError"),
|
|
130
|
+
" ",
|
|
131
|
+
A.message
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ g("div", {
|
|
134
|
+
className: "flex gap-2",
|
|
135
|
+
children: [/* @__PURE__ */ h(p, {
|
|
136
|
+
type: "submit",
|
|
137
|
+
variant: "primary",
|
|
138
|
+
disabled: k,
|
|
139
|
+
children: C(k ? "stewards.duties.saving" : "stewards.duties.save")
|
|
140
|
+
}), /* @__PURE__ */ h(p, {
|
|
141
|
+
onClick: S,
|
|
142
|
+
children: C("stewards.duties.cancel")
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export { v as DutyEditor };
|
|
150
|
+
|
|
151
|
+
//# sourceMappingURL=DutyEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DutyEditor.js","names":["DutyEditor","t","useStewardsT","form","setForm","useState","duty","dutyToForm","timezone","emptyDutyForm","showErrors","setShowErrors","save","useUpsertBotmanorStewardDutyMutation","set","f","key","value","errors","validateDuty","err","code","submit","input","buildDutyInput","stewardId","onClose","Card","FormField","FIELD_CLASS","DUTY_KINDS","k","usesSchedule","BotmanorStewardDutyKind","usesEventType","playbooks","p","error","Alert","Button","loading"],"sources":["../../../src/stewards/components/DutyEditor.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n useUpsertBotmanorStewardDutyMutation,\n type StewardDutyFieldsFragment,\n type StewardPlaybookFieldsFragment,\n} from '../../generated/wspace-operations';\nimport { BotmanorStewardDutyKind } from '../../generated/wspace-types';\nimport { useStewardsT } from '../i18n/useStewardsT';\nimport {\n buildDutyInput,\n DUTY_KINDS,\n dutyToForm,\n emptyDutyForm,\n usesEventType,\n usesSchedule,\n validateDuty,\n type DutyForm,\n} from '../utils/dutyForm';\nimport { FIELD_CLASS } from './fieldClasses';\nimport { FormField } from './FormField';\nimport { Alert, Button, Card } from './ui';\n\nexport function DutyEditor({\n stewardId,\n timezone,\n duty,\n playbooks,\n onClose,\n}: {\n stewardId: string;\n timezone: string;\n duty: StewardDutyFieldsFragment | null;\n playbooks: StewardPlaybookFieldsFragment[];\n onClose: () => void;\n}) {\n const t = useStewardsT();\n const [form, setForm] = useState<DutyForm>(() =>\n duty ? dutyToForm(duty, timezone) : emptyDutyForm(timezone)\n );\n const [showErrors, setShowErrors] = useState(false);\n const [save, { loading, error }] = useUpsertBotmanorStewardDutyMutation({\n refetchQueries: ['ListBotmanorStewardDuties'],\n awaitRefetchQueries: true,\n });\n const set = <K extends keyof DutyForm>(key: K, value: DutyForm[K]) =>\n setForm((f) => ({ ...f, [key]: value }));\n const errors = validateDuty(form);\n const err = (code: (typeof errors)[number]) =>\n showErrors && errors.includes(code) ? t(`stewards.duties.errors.${code}`) : null;\n\n const submit = async () => {\n setShowErrors(true);\n const input = buildDutyInput(form, stewardId);\n if (!input) return;\n await save({ variables: { input } });\n onClose();\n };\n\n return (\n <Card title={duty ? t('stewards.duties.formEdit') : t('stewards.duties.formNew')}>\n <form\n className=\"flex flex-col gap-3\"\n onSubmit={(e) => {\n e.preventDefault();\n void submit().catch(() => undefined);\n }}\n >\n <FormField label={t('stewards.duties.fieldName')} error={err('name') ?? err('nameLength')}>\n <input\n className={FIELD_CLASS}\n maxLength={255}\n value={form.name}\n onChange={(e) => set('name', e.target.value)}\n />\n </FormField>\n <FormField label={t('stewards.duties.fieldKind')}>\n <select\n className={FIELD_CLASS}\n value={form.kind}\n disabled={duty !== null}\n onChange={(e) => set('kind', e.target.value as BotmanorStewardDutyKind)}\n >\n {DUTY_KINDS.map((k) => (\n <option key={k} value={k}>\n {t(`stewards.duties.kind.${k}`)}\n </option>\n ))}\n </select>\n </FormField>\n {usesSchedule(form.kind) && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <FormField\n label={t('stewards.duties.fieldCron')}\n help={t('stewards.duties.fieldCronHelp')}\n error={err('cron')}\n >\n <input\n className={`${FIELD_CLASS} font-mono`}\n value={form.cron}\n onChange={(e) => set('cron', e.target.value)}\n />\n </FormField>\n <FormField label={t('stewards.duties.fieldTimezone')}>\n <input\n className={FIELD_CLASS}\n value={form.timezone}\n onChange={(e) => set('timezone', e.target.value)}\n />\n </FormField>\n </div>\n )}\n {form.kind === BotmanorStewardDutyKind.Watch && (\n <FormField\n label={t('stewards.duties.fieldUrl')}\n help={t('stewards.duties.fieldUrlHelp')}\n error={err('url')}\n >\n <input\n className={FIELD_CLASS}\n type=\"url\"\n value={form.url}\n onChange={(e) => set('url', e.target.value)}\n />\n </FormField>\n )}\n {usesEventType(form.kind) && (\n <FormField\n label={t('stewards.duties.fieldEventType')}\n help={t('stewards.duties.fieldEventTypeHelp')}\n error={err('eventTypeLength')}\n >\n <input\n className={FIELD_CLASS}\n value={form.eventType}\n onChange={(e) => set('eventType', e.target.value)}\n />\n </FormField>\n )}\n <FormField label={t('stewards.duties.fieldPlaybook')}>\n <select\n className={FIELD_CLASS}\n value={form.playbookId}\n onChange={(e) => set('playbookId', e.target.value)}\n >\n <option value=\"\">{t('stewards.duties.fieldNoPlaybook')}</option>\n {playbooks.map((p) => (\n <option key={p.id} value={p.id}>\n {p.name}\n </option>\n ))}\n </select>\n </FormField>\n <FormField\n label={t('stewards.duties.fieldPrompt')}\n help={t('stewards.duties.fieldPromptHelp')}\n error={err('promptOrPlaybook') ?? err('promptLength')}\n >\n <textarea\n className={`${FIELD_CLASS} min-h-24`}\n value={form.prompt}\n onChange={(e) => set('prompt', e.target.value)}\n />\n </FormField>\n <label className=\"flex items-center gap-2 text-sm text-(color:--color-text-primary)\">\n <input\n type=\"checkbox\"\n checked={form.dryRun}\n onChange={(e) => set('dryRun', e.target.checked)}\n />\n {t('stewards.duties.fieldDryRun')}\n </label>\n {error && (\n <Alert>\n {t('stewards.duties.saveError')} {error.message}\n </Alert>\n )}\n <div className=\"flex gap-2\">\n <Button type=\"submit\" variant=\"primary\" disabled={loading}>\n {loading ? t('stewards.duties.saving') : t('stewards.duties.save')}\n </Button>\n <Button onClick={onClose}>{t('stewards.duties.cancel')}</Button>\n </div>\n </form>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAgBA,EAAW,EACzB,cACA,aACA,SACA,cACA,cAOC;CACD,IAAMC,IAAIC,EAAa,GACjB,CAACC,GAAMC,KAAWC,QACtBC,IAAOC,EAAWD,GAAME,CAAQ,IAAIC,EAAcD,CAAQ,CAC5D,GACM,CAACE,GAAYC,KAAiBN,EAAS,EAAK,GAC5C,CAACO,GAAM,EAAE,YAAS,cAAWC,EAAqC;EACtE,gBAAgB,CAAC,2BAA2B;EAC5C,qBAAqB;CACvB,CAAC,GACKC,KAAiC,GAAQ,MAC7CV,GAAS,OAAO;EAAE,GAAGW;GAAIC,IAAMC;CAAM,EAAE,GACnCC,IAASC,EAAahB,CAAI,GAC1BiB,KAAO,MACXV,KAAcQ,EAAO,SAASG,CAAI,IAAIpB,EAAE,0BAA0BoB,GAAM,IAAI,MAExEC,IAAS,YAAY;EACzB,EAAc,EAAI;EAClB,IAAMC,IAAQC,EAAerB,GAAMsB,CAAS;EAC5C,AAAKF,MACL,MAAMX,EAAK,EAAE,WAAW,EAAE,SAAM,EAAE,CAAC,GACnCc,EAAQ;CACV;CAEA,OACE,kBAACC,GAAD;EAAM,OAAc1B,EAAPK,IAAS,6BAAgC,yBAAyB;EAC7E,UAAA,kBAAC,QAAD;GACE,WAAU;GACV,WAAW,MAAM;IAEf,AADA,EAAE,eAAe,GACjBgB,EAA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AAA,UAAA;KACGrC,EAAE,2BAA2B;KAAE;KAAEoC,EAAM;IACnC,EAAA,CAAA;IAET,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAACE,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,UAAUC;MAC/C,UAAUvC,EAAVuC,IAAY,2BAA8B,sBAAsB;KAC3D,CAAA,GACR,kBAACD,GAAD;MAAQ,SAASb;MAAU,UAAAzB,EAAE,wBAAwB;KAAU,CAAA,CAC5D;;GACD;;CACF,CAAA;AAEV"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** A labelled control with optional help and error text. */
|
|
3
|
+
export declare function FormField({ label, help, error, children, }: {
|
|
4
|
+
label: string;
|
|
5
|
+
help?: string;
|
|
6
|
+
error?: string | null;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
// src/stewards/components/FormField.tsx
|
|
3
|
+
function n({ label: n, help: r, error: i, children: a }) {
|
|
4
|
+
return /* @__PURE__ */ t("label", {
|
|
5
|
+
className: "flex flex-col gap-1 text-sm text-(color:--color-text-secondary)",
|
|
6
|
+
children: [
|
|
7
|
+
n,
|
|
8
|
+
a,
|
|
9
|
+
r && /* @__PURE__ */ e("span", {
|
|
10
|
+
className: "text-xs text-(color:--color-text-secondary)",
|
|
11
|
+
children: r
|
|
12
|
+
}),
|
|
13
|
+
i && /* @__PURE__ */ e("span", {
|
|
14
|
+
role: "alert",
|
|
15
|
+
className: "text-xs text-(color:--color-status-error-text)",
|
|
16
|
+
children: i
|
|
17
|
+
})
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { n as FormField };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=FormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.js","names":["FormField","label","children","help","error"],"sources":["../../../src/stewards/components/FormField.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\n/** A labelled control with optional help and error text. */\nexport function FormField({\n label,\n help,\n error,\n children,\n}: {\n label: string;\n help?: string;\n error?: string | null;\n children: ReactNode;\n}) {\n return (\n <label className=\"flex flex-col gap-1 text-sm text-(color:--color-text-secondary)\">\n {label}\n {children}\n {help && <span className=\"text-xs text-(color:--color-text-secondary)\">{help}</span>}\n {error && (\n <span role=\"alert\" className=\"text-xs text-(color:--color-status-error-text)\">\n {error}\n </span>\n )}\n </label>\n );\n}\n"],"mappings":";;AAGA,SAAgBA,EAAU,EACxB,UACA,SACA,UACA,eAMC;CACD,OACE,kBAAC,SAAD;EAAO,WAAU;EAAjB,UAAA;GACGC;GACAC;GACAC,KAAQ,kBAAC,QAAD;IAAM,WAAU;IAA+C,UAAAA;GAAW,CAAA;GAClFC,KACC,kBAAC,QAAD;IAAM,MAAK;IAAQ,WAAU;IAC1B,UAAAA;GACG,CAAA;EAEH;;AAEX"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useBotmanorStewardMemoryDiffQuery as e } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { BotmanorStewardMemoryDiffOp as t } from "../../generated/wspace-types.js";
|
|
3
|
+
import { useStewardsT as n } from "../i18n/useStewardsT.js";
|
|
4
|
+
import { collapseDiff as r } from "../utils/memory.js";
|
|
5
|
+
import { StateMessage as i } from "./ui.js";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
// src/stewards/components/MemoryDiffView.tsx
|
|
8
|
+
var s = {
|
|
9
|
+
[t.Added]: "bg-(--color-status-success-subtle) text-(color:--color-status-success-text)",
|
|
10
|
+
[t.Removed]: "bg-(--color-status-error-subtle) text-(color:--color-status-error-text)",
|
|
11
|
+
[t.Equal]: "text-(color:--color-text-secondary)"
|
|
12
|
+
}, c = {
|
|
13
|
+
[t.Added]: "+",
|
|
14
|
+
[t.Removed]: "-",
|
|
15
|
+
[t.Equal]: " "
|
|
16
|
+
};
|
|
17
|
+
function l({ docId: t, fromRevision: l, toRevision: u }) {
|
|
18
|
+
let d = n(), { data: f, loading: p, error: m } = e({
|
|
19
|
+
variables: {
|
|
20
|
+
docId: t,
|
|
21
|
+
fromRevision: l,
|
|
22
|
+
toRevision: u
|
|
23
|
+
},
|
|
24
|
+
fetchPolicy: "cache-and-network"
|
|
25
|
+
});
|
|
26
|
+
if (m) return /* @__PURE__ */ a(i, {
|
|
27
|
+
kind: "error",
|
|
28
|
+
title: d("stewards.common.errorTitle"),
|
|
29
|
+
body: m.message
|
|
30
|
+
});
|
|
31
|
+
let h = f?.botmanorStewardMemoryDiff;
|
|
32
|
+
if (!h) return /* @__PURE__ */ a(i, {
|
|
33
|
+
kind: "loading",
|
|
34
|
+
title: d("stewards.common.loading")
|
|
35
|
+
});
|
|
36
|
+
let g = r(h.lines);
|
|
37
|
+
return /* @__PURE__ */ o("div", {
|
|
38
|
+
className: "flex flex-col gap-2",
|
|
39
|
+
"aria-busy": p,
|
|
40
|
+
children: [/* @__PURE__ */ o("p", {
|
|
41
|
+
className: "text-sm font-medium text-(color:--color-text-primary)",
|
|
42
|
+
children: [
|
|
43
|
+
d("stewards.memory.diffTitle", {
|
|
44
|
+
from: h.fromRevision,
|
|
45
|
+
to: h.toRevision
|
|
46
|
+
}),
|
|
47
|
+
" ·",
|
|
48
|
+
" ",
|
|
49
|
+
/* @__PURE__ */ a("span", {
|
|
50
|
+
className: "font-normal text-(color:--color-text-secondary)",
|
|
51
|
+
children: d("stewards.memory.diffSummary", {
|
|
52
|
+
added: h.added,
|
|
53
|
+
removed: h.removed
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}), h.added + h.removed === 0 ? /* @__PURE__ */ a("p", {
|
|
58
|
+
className: "text-sm text-(color:--color-text-secondary)",
|
|
59
|
+
children: d("stewards.memory.diffNone")
|
|
60
|
+
}) : /* @__PURE__ */ a("pre", {
|
|
61
|
+
"aria-label": d("stewards.memory.diffTitle", {
|
|
62
|
+
from: h.fromRevision,
|
|
63
|
+
to: h.toRevision
|
|
64
|
+
}),
|
|
65
|
+
className: "overflow-x-auto rounded-md border border-(color:--color-border-seam) bg-(--color-bg-surface) font-mono text-xs",
|
|
66
|
+
children: g.map((e, t) => e.kind === "gap" ? /* @__PURE__ */ a("div", {
|
|
67
|
+
className: "bg-(--color-bg-muted) px-2 py-0.5 text-(color:--color-text-secondary)",
|
|
68
|
+
children: d("stewards.memory.diffGap", { hidden: e.hidden })
|
|
69
|
+
}, `gap-${t}`) : /* @__PURE__ */ o("div", {
|
|
70
|
+
className: `px-2 py-0.5 ${s[e.line.op]}`,
|
|
71
|
+
children: [/* @__PURE__ */ o("span", {
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
children: [c[e.line.op], " "]
|
|
74
|
+
}), e.line.text]
|
|
75
|
+
}, `${t}-${e.line.op}`))
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export { l as MemoryDiffView };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=MemoryDiffView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryDiffView.js","names":["OP_CLASS","BotmanorStewardMemoryDiffOp","OP_MARK","MemoryDiffView","t","useStewardsT","useBotmanorStewardMemoryDiffQuery","error","StateMessage","diff","data","rows","collapseDiff","loading","row","i"],"sources":["../../../src/stewards/components/MemoryDiffView.tsx"],"sourcesContent":["import { useBotmanorStewardMemoryDiffQuery } from '../../generated/wspace-operations';\nimport { BotmanorStewardMemoryDiffOp } from '../../generated/wspace-types';\nimport { useStewardsT } from '../i18n/useStewardsT';\nimport { collapseDiff } from '../utils/memory';\nimport { StateMessage } from './ui';\n\nconst OP_CLASS: Record<BotmanorStewardMemoryDiffOp, string> = {\n [BotmanorStewardMemoryDiffOp.Added]:\n 'bg-(--color-status-success-subtle) text-(color:--color-status-success-text)',\n [BotmanorStewardMemoryDiffOp.Removed]:\n 'bg-(--color-status-error-subtle) text-(color:--color-status-error-text)',\n [BotmanorStewardMemoryDiffOp.Equal]: 'text-(color:--color-text-secondary)',\n};\nconst OP_MARK: Record<BotmanorStewardMemoryDiffOp, string> = {\n [BotmanorStewardMemoryDiffOp.Added]: '+',\n [BotmanorStewardMemoryDiffOp.Removed]: '-',\n [BotmanorStewardMemoryDiffOp.Equal]: ' ',\n};\n\n/** Line diff between two revisions of one memory document. */\nexport function MemoryDiffView({\n docId,\n fromRevision,\n toRevision,\n}: {\n docId: string;\n fromRevision: number;\n toRevision: number;\n}) {\n const t = useStewardsT();\n const { data, loading, error } = useBotmanorStewardMemoryDiffQuery({\n variables: { docId, fromRevision, toRevision },\n fetchPolicy: 'cache-and-network',\n });\n if (error)\n return (\n <StateMessage kind=\"error\" title={t('stewards.common.errorTitle')} body={error.message} />\n );\n const diff = data?.botmanorStewardMemoryDiff;\n if (!diff) return <StateMessage kind=\"loading\" title={t('stewards.common.loading')} />;\n const rows = collapseDiff(diff.lines);\n return (\n <div className=\"flex flex-col gap-2\" aria-busy={loading}>\n <p className=\"text-sm font-medium text-(color:--color-text-primary)\">\n {t('stewards.memory.diffTitle', { from: diff.fromRevision, to: diff.toRevision })} ·{' '}\n <span className=\"font-normal text-(color:--color-text-secondary)\">\n {t('stewards.memory.diffSummary', { added: diff.added, removed: diff.removed })}\n </span>\n </p>\n {diff.added + diff.removed === 0 ? (\n <p className=\"text-sm text-(color:--color-text-secondary)\">\n {t('stewards.memory.diffNone')}\n </p>\n ) : (\n <pre\n aria-label={t('stewards.memory.diffTitle', {\n from: diff.fromRevision,\n to: diff.toRevision,\n })}\n className=\"overflow-x-auto rounded-md border border-(color:--color-border-seam) bg-(--color-bg-surface) font-mono text-xs\"\n >\n {rows.map((row, i) =>\n row.kind === 'gap' ? (\n <div\n key={`gap-${i}`}\n className=\"bg-(--color-bg-muted) px-2 py-0.5 text-(color:--color-text-secondary)\"\n >\n {t('stewards.memory.diffGap', { hidden: row.hidden })}\n </div>\n ) : (\n <div key={`${i}-${row.line.op}`} className={`px-2 py-0.5 ${OP_CLASS[row.line.op]}`}>\n <span aria-hidden=\"true\">{OP_MARK[row.line.op]} </span>\n {row.line.text}\n </div>\n )\n )}\n </pre>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAMA,IAAMA,IAAwD;EAC3DC,EAA4B,QAC3B;EACDA,EAA4B,UAC3B;EACDA,EAA4B,QAAQ;AACvC,GACMC,IAAuD;EAC1DD,EAA4B,QAAQ;EACpCA,EAA4B,UAAU;EACtCA,EAA4B,QAAQ;AACvC;AAGA,SAAgBE,EAAe,EAC7B,UACA,iBACA,iBAKC;CACD,IAAMC,IAAIC,EAAa,GACjB,EAAE,SAAM,YAAS,aAAUC,EAAkC;EACjE,WAAW;GAAE;GAAO;GAAc;EAAW;EAC7C,aAAa;CACf,CAAC;CACD,IAAIC,GACF,OACE,kBAACC,GAAD;EAAc,MAAK;EAAQ,OAAOJ,EAAE,4BAA4B;EAAG,MAAMG,EAAM;CAAU,CAAA;CAE7F,IAAME,IAAOC,GAAM;CACnB,IAAI,CAACD,GAAM,OAAO,kBAACD,GAAD;EAAc,MAAK;EAAU,OAAOJ,EAAE,yBAAyB;CAAI,CAAA;CACrF,IAAMO,IAAOC,EAAaH,EAAK,KAAK;CACpC,OACE,kBAAC,OAAD;EAAK,WAAU;EAAsB,aAAWI;EAAhD,UAAA,CACE,kBAAC,KAAD;GAAG,WAAU;GAAb,UAAA;IACGT,EAAE,6BAA6B;KAAE,MAAMK,EAAK;KAAc,IAAIA,EAAK;IAAW,CAAC;IAAE;IAAG;IACrF,kBAAC,QAAD;KAAM,WAAU;KACb,UAAAL,EAAE,+BAA+B;MAAE,OAAOK,EAAK;MAAO,SAASA,EAAK;KAAQ,CAAC;IAC1E,CAAA;GACL;EACF,CAAA,GAAAA,EAAK,QAAQA,EAAK,YAAY,IAC7B,kBAAC,KAAD;GAAG,WAAU;GACV,UAAAL,EAAE,0BAA0B;EAC5B,CAAA,IAEH,kBAAC,OAAD;GACE,cAAYA,EAAE,6BAA6B;IACzC,MAAMK,EAAK;IACX,IAAIA,EAAK;GACX,CAAC;GACD,WAAU;GAET,UAAAE,EAAK,KAAK,GAAK,MACdG,EAAI,SAAS,QACX,kBAAC,OAAD;IAEE,WAAU;IAET,UAAAV,EAAE,2BAA2B,EAAE,QAAQU,EAAI,OAAO,CAAC;GACjD,GAJE,OAAOC,GAIT,IAEL,kBAAC,OAAD;IAAiC,WAAW,eAAef,EAASc,EAAI,KAAK;IAA7E,UAAA,CACE,kBAAC,QAAD;KAAM,eAAY;KAAlB,UAAA,CAA0BZ,EAAQY,EAAI,KAAK,KAAI,GAAO;IACrD,CAAA,GAAAA,EAAI,KAAK,IACP;GAHK,GAAA,GAAGC,EAAE,GAAGD,EAAI,KAAK,IAGtB,CAET;EACG,CAAA,CAEJ;;AAET"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useAcceptBotmanorStewardProposalMutation as e, useDeclineBotmanorStewardProposalMutation as t, useListBotmanorStewardProposalsQuery as n } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useStewardsT as r } from "../i18n/useStewardsT.js";
|
|
3
|
+
import { relativeTime as i } from "../utils/dates.js";
|
|
4
|
+
import { Alert as a, Badge as o, Button as s, Card as c, StateMessage as l } from "./ui.js";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
// src/stewards/components/ProposalsQueue.tsx
|
|
7
|
+
function f({ stewardId: f, canAct: p }) {
|
|
8
|
+
let m = r(), { data: h, loading: g, error: _ } = n({
|
|
9
|
+
variables: { stewardId: f },
|
|
10
|
+
fetchPolicy: "cache-and-network"
|
|
11
|
+
}), v = ["ListBotmanorStewardProposals", "ListBotmanorStewardDuties"], [y, b] = e({ refetchQueries: v }), [x, S] = t({ refetchQueries: v }), C = h?.listBotmanorStewardRuns ?? [], w = b.loading || S.loading, T = b.error ?? S.error;
|
|
12
|
+
return /* @__PURE__ */ d(c, {
|
|
13
|
+
title: m("stewards.proposals.title"),
|
|
14
|
+
hint: m("stewards.proposals.hint"),
|
|
15
|
+
children: [_ ? /* @__PURE__ */ u(l, {
|
|
16
|
+
kind: "error",
|
|
17
|
+
title: m("stewards.common.errorTitle"),
|
|
18
|
+
body: _.message
|
|
19
|
+
}) : g && C.length === 0 ? /* @__PURE__ */ u(l, {
|
|
20
|
+
kind: "loading",
|
|
21
|
+
title: m("stewards.common.loading")
|
|
22
|
+
}) : C.length === 0 ? /* @__PURE__ */ u("p", {
|
|
23
|
+
className: "text-sm text-(color:--color-text-secondary)",
|
|
24
|
+
children: m("stewards.proposals.empty")
|
|
25
|
+
}) : /* @__PURE__ */ u("ul", {
|
|
26
|
+
className: "flex flex-col gap-3",
|
|
27
|
+
children: C.map((e) => /* @__PURE__ */ d("li", {
|
|
28
|
+
className: "flex flex-col gap-2 rounded-md border border-(color:--color-border-seam) p-3",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ d("div", {
|
|
31
|
+
className: "flex flex-wrap items-center gap-2",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ u(o, {
|
|
34
|
+
tone: "info",
|
|
35
|
+
children: m("stewards.enums.runStatus.PROPOSED")
|
|
36
|
+
}),
|
|
37
|
+
e.duty && /* @__PURE__ */ d("span", {
|
|
38
|
+
className: "text-xs text-(color:--color-text-secondary)",
|
|
39
|
+
children: [
|
|
40
|
+
m("stewards.proposals.from"),
|
|
41
|
+
": ",
|
|
42
|
+
e.duty.name
|
|
43
|
+
]
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ u("span", {
|
|
46
|
+
className: "text-xs text-(color:--color-text-secondary)",
|
|
47
|
+
children: i(e.createdAt)
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
}),
|
|
51
|
+
e.execution?.input != null && /* @__PURE__ */ u("p", {
|
|
52
|
+
className: "text-sm text-(color:--color-text-primary)",
|
|
53
|
+
children: typeof e.execution.input == "string" ? e.execution.input : JSON.stringify(e.execution.input)
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ d("p", {
|
|
56
|
+
className: "text-sm text-(color:--color-text-secondary)",
|
|
57
|
+
children: [
|
|
58
|
+
m("stewards.proposals.reason"),
|
|
59
|
+
":",
|
|
60
|
+
" ",
|
|
61
|
+
e.proposalReason ?? m("stewards.proposals.noReason")
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
p && /* @__PURE__ */ d("div", {
|
|
65
|
+
className: "flex flex-wrap gap-2",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ u(s, {
|
|
68
|
+
variant: "primary",
|
|
69
|
+
disabled: w,
|
|
70
|
+
onClick: () => void y({ variables: {
|
|
71
|
+
id: e.id,
|
|
72
|
+
dryRun: !1
|
|
73
|
+
} }).catch(() => void 0),
|
|
74
|
+
children: m("stewards.proposals.release")
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ u(s, {
|
|
77
|
+
disabled: w,
|
|
78
|
+
onClick: () => void y({ variables: {
|
|
79
|
+
id: e.id,
|
|
80
|
+
dryRun: !0
|
|
81
|
+
} }).catch(() => void 0),
|
|
82
|
+
children: m("stewards.proposals.releaseDry")
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ u(s, {
|
|
85
|
+
variant: "danger",
|
|
86
|
+
disabled: w,
|
|
87
|
+
onClick: () => void x({ variables: { id: e.id } }).catch(() => void 0),
|
|
88
|
+
children: m("stewards.proposals.dismiss")
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}, e.id))
|
|
94
|
+
}), T && /* @__PURE__ */ u("div", {
|
|
95
|
+
className: "mt-3",
|
|
96
|
+
children: /* @__PURE__ */ d(a, { children: [
|
|
97
|
+
m("stewards.proposals.error"),
|
|
98
|
+
" ",
|
|
99
|
+
T.message
|
|
100
|
+
] })
|
|
101
|
+
})]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export { f as ProposalsQueue };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=ProposalsQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProposalsQueue.js","names":["ProposalsQueue","t","useStewardsT","useListBotmanorStewardProposalsQuery","refetchQueries","accept","acceptState","useAcceptBotmanorStewardProposalMutation","decline","declineState","useDeclineBotmanorStewardProposalMutation","proposals","data","busy","failure","Card","error","StateMessage","loading","Badge","p","relativeTime","canAct","Button","Alert"],"sources":["../../../src/stewards/components/ProposalsQueue.tsx"],"sourcesContent":["import {\n useAcceptBotmanorStewardProposalMutation,\n useDeclineBotmanorStewardProposalMutation,\n useListBotmanorStewardProposalsQuery,\n type StewardProposalFieldsFragment,\n} from '../../generated/wspace-operations';\nimport { useStewardsT } from '../i18n/useStewardsT';\nimport { relativeTime } from '../utils/dates';\nimport { Alert, Badge, Button, Card, StateMessage } from './ui';\n\n/** Runs a steward proposed; a person releases (starts) or dismisses each. */\nexport function ProposalsQueue({ stewardId, canAct }: { stewardId: string; canAct: boolean }) {\n const t = useStewardsT();\n const { data, loading, error } = useListBotmanorStewardProposalsQuery({\n variables: { stewardId },\n fetchPolicy: 'cache-and-network',\n });\n const refetchQueries = ['ListBotmanorStewardProposals', 'ListBotmanorStewardDuties'];\n const [accept, acceptState] = useAcceptBotmanorStewardProposalMutation({ refetchQueries });\n const [decline, declineState] = useDeclineBotmanorStewardProposalMutation({ refetchQueries });\n const proposals: StewardProposalFieldsFragment[] = data?.listBotmanorStewardRuns ?? [];\n const busy = acceptState.loading || declineState.loading;\n const failure = acceptState.error ?? declineState.error;\n\n return (\n <Card title={t('stewards.proposals.title')} hint={t('stewards.proposals.hint')}>\n {error ? (\n <StateMessage kind=\"error\" title={t('stewards.common.errorTitle')} body={error.message} />\n ) : loading && proposals.length === 0 ? (\n <StateMessage kind=\"loading\" title={t('stewards.common.loading')} />\n ) : proposals.length === 0 ? (\n <p className=\"text-sm text-(color:--color-text-secondary)\">\n {t('stewards.proposals.empty')}\n </p>\n ) : (\n <ul className=\"flex flex-col gap-3\">\n {proposals.map((p) => (\n <li\n key={p.id}\n className=\"flex flex-col gap-2 rounded-md border border-(color:--color-border-seam) p-3\"\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge tone=\"info\">{t('stewards.enums.runStatus.PROPOSED')}</Badge>\n {p.duty && (\n <span className=\"text-xs text-(color:--color-text-secondary)\">\n {t('stewards.proposals.from')}: {p.duty.name}\n </span>\n )}\n <span className=\"text-xs text-(color:--color-text-secondary)\">\n {relativeTime(p.createdAt)}\n </span>\n </div>\n {p.execution?.input != null && (\n <p className=\"text-sm text-(color:--color-text-primary)\">\n {typeof p.execution.input === 'string'\n ? p.execution.input\n : JSON.stringify(p.execution.input)}\n </p>\n )}\n <p className=\"text-sm text-(color:--color-text-secondary)\">\n {t('stewards.proposals.reason')}:{' '}\n {p.proposalReason ?? t('stewards.proposals.noReason')}\n </p>\n {canAct && (\n <div className=\"flex flex-wrap gap-2\">\n <Button\n variant=\"primary\"\n disabled={busy}\n onClick={() =>\n void accept({ variables: { id: p.id, dryRun: false } }).catch(() => undefined)\n }\n >\n {t('stewards.proposals.release')}\n </Button>\n <Button\n disabled={busy}\n onClick={() =>\n void accept({ variables: { id: p.id, dryRun: true } }).catch(() => undefined)\n }\n >\n {t('stewards.proposals.releaseDry')}\n </Button>\n <Button\n variant=\"danger\"\n disabled={busy}\n onClick={() => void decline({ variables: { id: p.id } }).catch(() => undefined)}\n >\n {t('stewards.proposals.dismiss')}\n </Button>\n </div>\n )}\n </li>\n ))}\n </ul>\n )}\n {failure && (\n <div className=\"mt-3\">\n <Alert>\n {t('stewards.proposals.error')} {failure.message}\n </Alert>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";;;;;;AAWA,SAAgBA,EAAe,EAAE,cAAW,aAAkD;CAC5F,IAAMC,IA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AAE,UAAU,QACZ,KAAK,UAAUA,EAAE,UAAU,KAAK;KACnC,CAAA;KAEL,kBAAC,KAAD;MAAG,WAAU;MAAb,UAAA;OACGnB,EAAE,2BAA2B;OAAE;OAAE;OACjCmB,EAAE,kBAAkBnB,EAAE,6BAA6B;MACnD;;KACFqB,KACC,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA;OACE,kBAACC,GAAD;QACE,SAAQ;QACR,UAAUV;QACV,eACE,KAAKR,EAAO,EAAE,WAAW;SAAE,IAAIe,EAAE;SAAI,QAAQ;QAAM,EAAE,CAAC,CAAC,CAAC,YAAY,KAAA,CAAS;QAG9E,UAAAnB,EAAE,4BAA4B;OACzB,CAAA;OACR,kBAACsB,GAAD;QACE,UAAUV;QACV,eACE,KAAKR,EAAO,EAAE,WAAW;SAAE,IAAIe,EAAE;SAAI,QAAQ;QAAK,EAAE,CAAC,CAAC,CAAC,YAAY,KAAA,CAAS;QAG7E,UAAAnB,EAAE,+BAA+B;OAC5B,CAAA;OACR,kBAACsB,GAAD;QACE,SAAQ;QACR,UAAUV;QACV,eAAe,KAAKL,EAAQ,EAAE,WAAW,EAAE,IAAIY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,YAAY,KAAA,CAAS;QAE7E,UAAAnB,EAAE,4BAA4B;OACzB,CAAA;MACL;;IAEL;GArDG,GAAAmB,EAAE,EAqDL,CACL;EACC,CAAA,GAELN,KACC,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACU,GAAD,EAAA,UAAA;IACGvB,EAAE,0BAA0B;IAAE;IAAEa,EAAQ;GACpC,EAAA,CAAA;EACJ,CAAA,CAEH;;AAEV"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StewardPlaybookFieldsFragment } from '../../generated/wspace-operations';
|
|
2
|
+
/**
|
|
3
|
+
* Teach mode: list the steps of a demonstration and save them as saved steps
|
|
4
|
+
* (a new DRAFT playbook, or a new version of the open one). Typed secrets are
|
|
5
|
+
* never held: a secret step carries only the name of the secret.
|
|
6
|
+
*/
|
|
7
|
+
export declare function TeachRecorder({ stewardId, playbook, onSaved, onClose, }: {
|
|
8
|
+
stewardId: string;
|
|
9
|
+
playbook: StewardPlaybookFieldsFragment | null;
|
|
10
|
+
onSaved: (id: string) => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
}): import('react').JSX.Element;
|