@nanocollective/roster 0.1.0-beta.30 → 0.1.0-beta.32
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/worker/assets/assets/css/brain.css +2 -0
- package/dist/worker/assets/assets/css/home.css +17 -4
- package/dist/worker/assets/assets/css/routines.css +3 -0
- package/dist/worker/assets/assets/css/setup.css +5 -0
- package/dist/worker/assets/assets/js/app.js +3 -0
- package/dist/worker/assets/assets/js/mention.js +2 -1
- package/dist/worker/assets/assets/js/readiness.js +42 -0
- package/dist/worker/assets/assets/js/refresh.js +4 -0
- package/dist/worker/assets/assets/js/views/connectors.js +5 -0
- package/dist/worker/assets/assets/js/views/health.js +11 -5
- package/dist/worker/assets/assets/js/views/hire.js +1 -1
- package/dist/worker/assets/assets/js/views/home.js +117 -4
- package/dist/worker/assets/assets/js/views/inbox.js +14 -1
- package/dist/worker/assets/assets/js/views/notready.js +70 -0
- package/dist/worker/assets/assets/js/views/org.js +14 -1
- package/dist/worker/assets/assets/js/views/routines.js +19 -2
- package/dist/worker/assets/assets/js/views/runonce.js +5 -0
- package/dist/worker/assets/assets/js/views/runs.js +11 -1
- package/dist/worker/assets/assets/js/views/staff.js +44 -4
- package/package.json +1 -1
- package/templates/portal/css/brain.css +2 -0
- package/templates/portal/css/home.css +17 -4
- package/templates/portal/css/routines.css +3 -0
- package/templates/portal/css/setup.css +5 -0
- package/templates/portal/js/app.js +3 -0
- package/templates/portal/js/mention.js +2 -1
- package/templates/portal/js/readiness.js +42 -0
- package/templates/portal/js/refresh.js +4 -0
- package/templates/portal/js/views/connectors.js +5 -0
- package/templates/portal/js/views/health.js +11 -5
- package/templates/portal/js/views/hire.js +1 -1
- package/templates/portal/js/views/home.js +117 -4
- package/templates/portal/js/views/inbox.js +14 -1
- package/templates/portal/js/views/notready.js +70 -0
- package/templates/portal/js/views/org.js +14 -1
- package/templates/portal/js/views/routines.js +19 -2
- package/templates/portal/js/views/runonce.js +5 -0
- package/templates/portal/js/views/runs.js +11 -1
- package/templates/portal/js/views/staff.js +44 -4
|
@@ -9,7 +9,10 @@ import { post } from "../api.js";
|
|
|
9
9
|
import { sheet } from "../dialog.js";
|
|
10
10
|
import { el, grow } from "../dom.js";
|
|
11
11
|
import { icon } from "../icons.js";
|
|
12
|
+
import { canRun, whatsLeft } from "../readiness.js";
|
|
12
13
|
import { render } from "../router.js";
|
|
14
|
+
import { S } from "../state.js";
|
|
15
|
+
import { commandLine, notReadyNote, whenKnown } from "./notready.js";
|
|
13
16
|
|
|
14
17
|
/* The last answer, so a repaint after Save does not flash an empty screen. */
|
|
15
18
|
let last = null;
|
|
@@ -36,7 +39,8 @@ function draw(body, d, add) {
|
|
|
36
39
|
add.onclick = () => edit(d, null, null);
|
|
37
40
|
add.disabled = !d.staff.length;
|
|
38
41
|
if (!d.staff.length) {
|
|
39
|
-
body.append(el("p", { className: "sub", textContent: "Hire a staff member first." }));
|
|
42
|
+
body.append(el("p", { className: "sub", textContent: S.hosted ? "Hire a staff member first, on your machine:" : "Hire a staff member first, under Staff." }));
|
|
43
|
+
if (S.hosted) body.append(commandLine("hire cto --apply"));
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
42
46
|
for (const s of d.staff) {
|
|
@@ -46,7 +50,9 @@ function draw(body, d, add) {
|
|
|
46
50
|
const more = el("button", { className: "routadd" }, [icon("plus"), el("span", { textContent: "Add a routine for " + s.name })]);
|
|
47
51
|
more.onclick = () => edit(d, s, null);
|
|
48
52
|
list.append(more);
|
|
49
|
-
|
|
53
|
+
// Routines run on the same App and credential as everything else, so they wait on setup too.
|
|
54
|
+
const who = whole(s);
|
|
55
|
+
body.append(el("h2", { className: "connhead", textContent: s.name }), whenKnown(who, () => notReadyNote(who)), list);
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -66,6 +72,12 @@ function dailyRow(s, d) {
|
|
|
66
72
|
function routineRow(s, r, d) {
|
|
67
73
|
const run = el("button", { className: "ghbtn", textContent: "Run now" });
|
|
68
74
|
run.onclick = () => runNow(s, r, run);
|
|
75
|
+
const who = whole(s);
|
|
76
|
+
whatsLeft(who).then(() => {
|
|
77
|
+
if (canRun(s.handle)) return;
|
|
78
|
+
run.disabled = true;
|
|
79
|
+
run.title = `${s.name} is not set up yet`;
|
|
80
|
+
}, () => {});
|
|
69
81
|
const change = el("button", { className: "ghbtn", textContent: "Edit" });
|
|
70
82
|
change.onclick = () => edit(d, s, r);
|
|
71
83
|
const remove = el("button", { className: "ghbtn", textContent: "Remove" });
|
|
@@ -81,6 +93,11 @@ function routineRow(s, r, d) {
|
|
|
81
93
|
]);
|
|
82
94
|
}
|
|
83
95
|
|
|
96
|
+
/** The staff member as the org export has them, which is what readiness reads. */
|
|
97
|
+
function whole(s) {
|
|
98
|
+
return (S.data?.staff ?? []).find((x) => x.handle === s.handle) ?? s;
|
|
99
|
+
}
|
|
100
|
+
|
|
84
101
|
async function runNow(s, r, btn) {
|
|
85
102
|
btn.disabled = true;
|
|
86
103
|
btn.textContent = "Starting…";
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import { runStatus, startRun } from "../api.js";
|
|
8
8
|
import { askYes } from "../dialog.js";
|
|
9
9
|
import { el } from "../dom.js";
|
|
10
|
+
import { whatsLeft } from "../readiness.js";
|
|
11
|
+
import { S } from "../state.js";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* @param {{staff: string, name: string, onDone?: (ok: boolean) => void}} opts
|
|
@@ -86,6 +88,9 @@ export function runOnce(opts) {
|
|
|
86
88
|
for (const f of now.failedAt ?? []) done.append(el("p", { className: "sub", textContent: "Failed at " + f }));
|
|
87
89
|
if (!ok) done.append(el("p", { className: "sub", textContent: "Troubleshooting, in the docs, has what each failure usually means." }));
|
|
88
90
|
out.replaceChildren(done);
|
|
91
|
+
// "Run once" is done now, and every screen that said otherwise should stop saying it.
|
|
92
|
+
const who = (S.data?.staff ?? []).find((x) => x.handle === opts.staff);
|
|
93
|
+
if (ok && who) whatsLeft(who, true).catch(() => {});
|
|
89
94
|
opts.onDone?.(ok);
|
|
90
95
|
};
|
|
91
96
|
tick();
|
|
@@ -7,6 +7,7 @@ import { getRuns } from "../api.js";
|
|
|
7
7
|
import { ago, el, esc, skeleton } from "../dom.js";
|
|
8
8
|
import { render } from "../router.js";
|
|
9
9
|
import { S } from "../state.js";
|
|
10
|
+
import { notReadyNote, whenKnown } from "./notready.js";
|
|
10
11
|
|
|
11
12
|
/** How many runs a staff member's table shows. The spend covers all of the last 30 days. */
|
|
12
13
|
const SHOWN = 15;
|
|
@@ -89,6 +90,9 @@ function paint(m, data) {
|
|
|
89
90
|
}, 3000);
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
if (!(data.staff ?? []).length) {
|
|
94
|
+
m.append(el("p", { className: "hnote", textContent: "Nobody hired yet, so nothing has run. Home says what is left." }));
|
|
95
|
+
}
|
|
92
96
|
for (const s of data.staff ?? []) m.append(...staffSection(s));
|
|
93
97
|
|
|
94
98
|
m.append(
|
|
@@ -111,7 +115,13 @@ function staffSection(s) {
|
|
|
111
115
|
const body = el("div", { className: "hbody runs" });
|
|
112
116
|
for (const e of s.errors ?? []) body.append(el("p", { className: "hnote err", textContent: e }));
|
|
113
117
|
if (!(s.runs ?? []).length) {
|
|
114
|
-
|
|
118
|
+
// "No runs" read as idle, when the truth was that they could not run at all.
|
|
119
|
+
const who = (S.data?.staff ?? []).find((x) => x.handle === s.handle) ?? s;
|
|
120
|
+
body.append(
|
|
121
|
+
whenKnown(who, () =>
|
|
122
|
+
notReadyNote(who) ?? el("p", { className: "hnote", textContent: "No runs in the last 30 days." }),
|
|
123
|
+
),
|
|
124
|
+
);
|
|
115
125
|
return [head, body];
|
|
116
126
|
}
|
|
117
127
|
|
|
@@ -9,10 +9,11 @@ import { post } from "../api.js";
|
|
|
9
9
|
import { askYes, sheet } from "../dialog.js";
|
|
10
10
|
import { pending } from "../inflight.js";
|
|
11
11
|
import { ago, el, esc } from "../dom.js";
|
|
12
|
-
import { sentence, staffProgress, whatsLeft } from "../readiness.js";
|
|
12
|
+
import { IN_PORTAL, sentence, staffProgress, stepCommand, whatsLeft } from "../readiness.js";
|
|
13
13
|
import { refreshAll } from "../refresh.js";
|
|
14
14
|
import { S } from "../state.js";
|
|
15
|
-
import { hireFlow, line, rolePicker } from "./hire.js";
|
|
15
|
+
import { charterModes, hireFlow, line, rolePicker } from "./hire.js";
|
|
16
|
+
import { commandLine } from "./notready.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Resolves once nothing is loading and `node` has stopped changing for a moment, or after a few
|
|
@@ -50,7 +51,15 @@ let current = null;
|
|
|
50
51
|
export function viewStaff(m, o = {}) {
|
|
51
52
|
m.append(el("h1", { textContent: "Staff" }));
|
|
52
53
|
const empty = !S.data.staff.length;
|
|
53
|
-
|
|
54
|
+
/* Hosted, the picker led to a hire that only the server on your machine can do, and it
|
|
55
|
+
failed there. The command is the way in. */
|
|
56
|
+
if (empty && S.hosted) {
|
|
57
|
+
m.append(
|
|
58
|
+
el("p", { className: "sub", textContent: "No staff yet. Hiring creates repos and an App, so it is done on your machine:" }),
|
|
59
|
+
commandLine("hire cto --apply"),
|
|
60
|
+
el("p", { className: "sub", textContent: "cmo and support are the other roles, or any handle with --name." }),
|
|
61
|
+
);
|
|
62
|
+
} else if (empty) m.append(el("p", { className: "sub", textContent: "No staff yet. Pick a role to hire your first." }));
|
|
54
63
|
|
|
55
64
|
const pane = el("div", { className: "hirepane" });
|
|
56
65
|
|
|
@@ -83,7 +92,11 @@ export function viewStaff(m, o = {}) {
|
|
|
83
92
|
if (current) current.close();
|
|
84
93
|
else pane.replaceChildren();
|
|
85
94
|
S.staffOpen = null;
|
|
86
|
-
if (empty) pick();
|
|
95
|
+
if (empty && !S.hosted) pick();
|
|
96
|
+
// Home's "Write it here" on a charter lands here with the dialog open.
|
|
97
|
+
const asked = S.writeCharter && S.data.staff.find((s) => s.handle === S.writeCharter);
|
|
98
|
+
S.writeCharter = null;
|
|
99
|
+
if (asked) writeCharter(asked);
|
|
87
100
|
}
|
|
88
101
|
|
|
89
102
|
// With nobody hired the roles are the page. After that they are a dialog behind Hire someone.
|
|
@@ -196,6 +209,21 @@ export function viewStaff(m, o = {}) {
|
|
|
196
209
|
warn.textContent =
|
|
197
210
|
"Not ready to run. " + (p ? `${p.done} of ${p.total} done. ` : "") +
|
|
198
211
|
"Still to do: " + sentence(left) + ".";
|
|
212
|
+
/* Hosted has no Finish setting up. The charter is writing, which works from here; the
|
|
213
|
+
rest is wiring, which needs your machine, so each of those comes with its command. */
|
|
214
|
+
if (S.hosted) {
|
|
215
|
+
const cmds = [
|
|
216
|
+
...new Set(left.filter((x) => !IN_PORTAL.has(x)).map((x) => stepCommand(x, s.handle)).filter(Boolean)),
|
|
217
|
+
];
|
|
218
|
+
warn.classList.add("notready");
|
|
219
|
+
warn.replaceChildren(el("span", { textContent: warn.textContent }));
|
|
220
|
+
if (left.includes("write the charter")) {
|
|
221
|
+
const write = el("button", { className: "ghbtn primary", textContent: "Write the charter" });
|
|
222
|
+
write.onclick = () => writeCharter(s);
|
|
223
|
+
warn.append(el("div", { className: "row" }, [write]));
|
|
224
|
+
}
|
|
225
|
+
warn.append(...cmds.map(commandLine));
|
|
226
|
+
}
|
|
199
227
|
});
|
|
200
228
|
d.append(warn);
|
|
201
229
|
|
|
@@ -210,6 +238,18 @@ export function viewStaff(m, o = {}) {
|
|
|
210
238
|
|
|
211
239
|
/* ------------------------------- retiring ------------------------------- */
|
|
212
240
|
|
|
241
|
+
/** The charter's three ways in, in the dialog: the same ones hiring offers. */
|
|
242
|
+
function writeCharter(s) {
|
|
243
|
+
const host = el("div", { className: "charterpane" }, [el("h2", { textContent: s.name + "'s charter" })]);
|
|
244
|
+
host.append(
|
|
245
|
+
charterModes(s, undefined, () => {
|
|
246
|
+
dismiss();
|
|
247
|
+
refreshAll();
|
|
248
|
+
}),
|
|
249
|
+
);
|
|
250
|
+
present(host);
|
|
251
|
+
}
|
|
252
|
+
|
|
213
253
|
async function retireForm(host, s, cardStatus) {
|
|
214
254
|
cardStatus.textContent = "planning…";
|
|
215
255
|
cardStatus.className = "meta";
|