@nanocollective/roster 0.1.0-beta.21 → 0.1.0-beta.22
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/astryx.css +948 -0
- package/dist/worker/assets/assets/css/base.css +47 -112
- package/dist/worker/assets/assets/css/brain.css +15 -11
- package/dist/worker/assets/assets/css/graph.css +9 -12
- package/dist/worker/assets/assets/css/health.css +4 -7
- package/dist/worker/assets/assets/css/home.css +27 -29
- package/dist/worker/assets/assets/css/layout.css +10 -20
- package/dist/worker/assets/assets/css/markdown.css +1 -1
- package/dist/worker/assets/assets/css/runs.css +5 -3
- package/dist/worker/assets/assets/css/search.css +3 -6
- package/dist/worker/assets/assets/css/setup.css +3 -15
- package/dist/worker/assets/assets/js/app.js +2 -0
- package/dist/worker/assets/assets/js/astryx-ui.js +34 -0
- package/dist/worker/assets/assets/js/icons.js +2 -0
- package/dist/worker/assets/assets/js/select.js +362 -0
- package/dist/worker/assets/assets/js/views/graph.js +67 -28
- package/dist/worker/assets/assets/js/views/home.js +98 -112
- package/dist/worker/assets/assets/js/views/people.js +8 -2
- package/dist/worker/assets/assets/js/views/runs.js +3 -1
- package/dist/worker/assets/docs-images/brain.jpg +0 -0
- package/dist/worker/assets/docs-images/home.jpg +0 -0
- package/dist/worker/assets/docs-images/org.jpg +0 -0
- package/dist/worker/assets/docs-images/prompt.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
- package/dist/worker/assets/docs-images/staff.jpg +0 -0
- package/dist/worker/assets/index.html +8 -1
- package/dist/worker/index.js +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/images/brain.jpg +0 -0
- package/docs/images/home.jpg +0 -0
- package/docs/images/org.jpg +0 -0
- package/docs/images/prompt.jpg +0 -0
- package/docs/images/setup-org.jpg +0 -0
- package/docs/images/setup-plan.jpg +0 -0
- package/docs/images/staff.jpg +0 -0
- package/docs/portal.md +12 -10
- package/package.json +7 -1
- package/templates/portal/css/astryx.css +948 -0
- package/templates/portal/css/base.css +47 -112
- package/templates/portal/css/brain.css +15 -11
- package/templates/portal/css/graph.css +9 -12
- package/templates/portal/css/health.css +4 -7
- package/templates/portal/css/home.css +27 -29
- package/templates/portal/css/layout.css +10 -20
- package/templates/portal/css/markdown.css +1 -1
- package/templates/portal/css/runs.css +5 -3
- package/templates/portal/css/search.css +3 -6
- package/templates/portal/css/setup.css +3 -15
- package/templates/portal/index.html +8 -1
- package/templates/portal/js/app.js +2 -0
- package/templates/portal/js/astryx-ui.js +34 -0
- package/templates/portal/js/icons.js +2 -0
- package/templates/portal/js/select.js +362 -0
- package/templates/portal/js/views/graph.js +67 -28
- package/templates/portal/js/views/home.js +98 -112
- package/templates/portal/js/views/people.js +8 -2
- package/templates/portal/js/views/runs.js +3 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* sheet, the same thread view Trackers has, with the reply box in it. */
|
|
7
7
|
|
|
8
8
|
import { getLive, post } from "../api.js";
|
|
9
|
-
import { sheet } from "../dialog.js";
|
|
9
|
+
import { askText, sheet } from "../dialog.js";
|
|
10
10
|
import { ago, el, skeleton } from "../dom.js";
|
|
11
11
|
import { daysUntil, isFor, sortHome } from "../homesort.js";
|
|
12
12
|
import { mdlite } from "../md.js";
|
|
@@ -56,7 +56,6 @@ export function viewHome(m) {
|
|
|
56
56
|
|
|
57
57
|
const page = el("div", { className: "home" });
|
|
58
58
|
page.append(team(staff));
|
|
59
|
-
page.append(askBox(staff));
|
|
60
59
|
|
|
61
60
|
/* With more than one person, each sees what is on them, plus anything on nobody in
|
|
62
61
|
particular. Everyone's is one click away, so nothing is hidden for good. */
|
|
@@ -75,12 +74,7 @@ export function viewHome(m) {
|
|
|
75
74
|
);
|
|
76
75
|
} else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
if (reporters.length) {
|
|
80
|
-
page.append(section("Progress"));
|
|
81
|
-
page.append(el("div", { className: "homereports" }, reporters.map((s) => reportRow(s, h.reports))));
|
|
82
|
-
}
|
|
83
|
-
|
|
77
|
+
// What is waiting on you, or was asked by you, comes before how the staff say it is going.
|
|
84
78
|
if (h.unread.length) {
|
|
85
79
|
page.append(section("Unread", h.unread.length));
|
|
86
80
|
page.append(listBox(h.unread.map(unreadRow)));
|
|
@@ -91,6 +85,12 @@ export function viewHome(m) {
|
|
|
91
85
|
page.append(listBox(h.requests.map(requestRow)));
|
|
92
86
|
}
|
|
93
87
|
|
|
88
|
+
const reporters = staff.filter((x) => x.brain && x.statusIssue);
|
|
89
|
+
if (reporters.length) {
|
|
90
|
+
page.append(section("Progress"));
|
|
91
|
+
page.append(el("div", { className: "card homereports" }, reporters.map((s) => reportRow(s, h.reports))));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
94
|
if (h.closedToday.length) {
|
|
95
95
|
page.append(section("Closed today", h.closedToday.length));
|
|
96
96
|
page.append(listBox(h.closedToday.map(closedRow)));
|
|
@@ -109,15 +109,15 @@ const openReports = new Set();
|
|
|
109
109
|
const STATUS_TONE = { "on track": "ok", "needs you": "warm", stuck: "hot", blocked: "hot" };
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* One staff member's report
|
|
113
|
-
*
|
|
114
|
-
*
|
|
112
|
+
* One staff member's report, as a row: who, their status, and when it was written; then the
|
|
113
|
+
* one line on how it is going and what is next. What got done, and the rest of the report,
|
|
114
|
+
* open under it. Their status issue is rewritten by every run, so this is always the latest.
|
|
115
115
|
*/
|
|
116
116
|
function reportRow(s, reports) {
|
|
117
117
|
const r = reports.find((x) => x.staff.handle === s.handle);
|
|
118
118
|
const item = r?.item ?? { repo: s.brain, number: s.statusIssue, kind: "issue" };
|
|
119
119
|
const note = el("span", { className: "meta" });
|
|
120
|
-
const ask = el("button", { className: "ghbtn", textContent: "Ask for an update" });
|
|
120
|
+
const ask = el("button", { className: "ghbtn sm", textContent: "Ask for an update" });
|
|
121
121
|
ask.onclick = async () => {
|
|
122
122
|
ask.disabled = true;
|
|
123
123
|
note.className = "meta";
|
|
@@ -140,10 +140,12 @@ function reportRow(s, reports) {
|
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
const full = openReports.has(s.handle);
|
|
143
|
-
const
|
|
143
|
+
const row = el("div", { className: "homereport" + (full ? " full" : "") });
|
|
144
144
|
const issue = el("button", { className: "homereportissue", textContent: "#" + item.number });
|
|
145
145
|
issue.onclick = () => openThread(item);
|
|
146
146
|
const p = r ? parseReport(r.body) : null;
|
|
147
|
+
const needs = p?.sections.needs?.length ?? 0;
|
|
148
|
+
|
|
147
149
|
const head = el("div", { className: "homereporthead" }, [
|
|
148
150
|
el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
|
|
149
151
|
]);
|
|
@@ -151,7 +153,8 @@ function reportRow(s, reports) {
|
|
|
151
153
|
head.append(
|
|
152
154
|
el("span", {
|
|
153
155
|
className: "chip homereportstatus " + (STATUS_TONE[p.status] ?? ""),
|
|
154
|
-
textContent: cap(p.status),
|
|
156
|
+
textContent: cap(p.status) + (needs ? ` · ${needs}` : ""),
|
|
157
|
+
title: needs ? `Waiting on a person: ${needs} thing${needs === 1 ? "" : "s"}` : "",
|
|
155
158
|
}),
|
|
156
159
|
);
|
|
157
160
|
}
|
|
@@ -161,48 +164,53 @@ function reportRow(s, reports) {
|
|
|
161
164
|
issue,
|
|
162
165
|
]),
|
|
163
166
|
);
|
|
164
|
-
|
|
167
|
+
const acts = el("span", { className: "homereportacts" }, [note]);
|
|
168
|
+
if (r) {
|
|
169
|
+
const more = el("button", { className: "ghbtn sm", textContent: full ? "Show less" : "Full report" });
|
|
170
|
+
more.onclick = () => {
|
|
171
|
+
if (openReports.has(s.handle)) openReports.delete(s.handle);
|
|
172
|
+
else openReports.add(s.handle);
|
|
173
|
+
repaintInPlace();
|
|
174
|
+
};
|
|
175
|
+
acts.append(more);
|
|
176
|
+
}
|
|
177
|
+
acts.append(ask);
|
|
178
|
+
head.append(acts);
|
|
179
|
+
row.append(head);
|
|
165
180
|
|
|
166
|
-
if (p)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
181
|
+
if (!p) return row;
|
|
182
|
+
if (p.headline) {
|
|
183
|
+
row.append(el("div", { className: "md homereportline", innerHTML: mdlite(p.headline, { repo: s.brain }) }));
|
|
184
|
+
}
|
|
185
|
+
const next = p.sections.next?.[0];
|
|
186
|
+
if (next && !full) {
|
|
187
|
+
row.append(
|
|
188
|
+
el("div", { className: "homereportnext" }, [
|
|
189
|
+
el("b", { textContent: "Next" }),
|
|
190
|
+
el("span", { className: "md", innerHTML: mdlite(next, { repo: s.brain }) }),
|
|
191
|
+
]),
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
if (full) {
|
|
170
195
|
const cols = [
|
|
171
196
|
["done", "Done"],
|
|
172
197
|
["next", "Next"],
|
|
198
|
+
["needs", "Waiting on a person"],
|
|
173
199
|
].filter(([k]) => p.sections[k]?.length);
|
|
174
|
-
if (cols.length
|
|
175
|
-
|
|
200
|
+
if (cols.length) {
|
|
201
|
+
row.append(
|
|
176
202
|
el(
|
|
177
203
|
"div",
|
|
178
204
|
{ className: "homereportcols" },
|
|
179
|
-
cols.map(([k, label]) => bullets(label, p.sections[k], s.brain,
|
|
205
|
+
cols.map(([k, label]) => bullets(label, p.sections[k], s.brain, 99)),
|
|
180
206
|
),
|
|
181
207
|
);
|
|
208
|
+
} else {
|
|
209
|
+
// A report in the old shape has no sections, so the whole of it stands in.
|
|
210
|
+
row.append(el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) }));
|
|
182
211
|
}
|
|
183
|
-
const needs = p.sections.needs?.length ?? 0;
|
|
184
|
-
if (needs && !full) {
|
|
185
|
-
card.append(
|
|
186
|
-
el("p", {
|
|
187
|
-
className: "homereportneeds",
|
|
188
|
-
textContent: `Waiting on a person: ${needs} thing${needs === 1 ? "" : "s"}.`,
|
|
189
|
-
}),
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
// A report in the old shape has no sections to show, so its opening lines stand in.
|
|
193
|
-
const body = el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) });
|
|
194
|
-
if (full || !cols.length) card.append(body);
|
|
195
|
-
if (!cols.length && !full) body.classList.add("fade");
|
|
196
212
|
}
|
|
197
|
-
|
|
198
|
-
const more = el("button", { className: "ghbtn", textContent: full ? "Show less" : "Read the full report" });
|
|
199
|
-
more.onclick = () => {
|
|
200
|
-
if (openReports.has(s.handle)) openReports.delete(s.handle);
|
|
201
|
-
else openReports.add(s.handle);
|
|
202
|
-
repaintInPlace();
|
|
203
|
-
};
|
|
204
|
-
card.append(el("div", { className: "row homereportacts" }, [...(r ? [more] : []), ask, note]));
|
|
205
|
-
return card;
|
|
213
|
+
return row;
|
|
206
214
|
}
|
|
207
215
|
|
|
208
216
|
/** A short list under a label, with how many more there are once it runs past `max`. */
|
|
@@ -219,72 +227,44 @@ function bullets(label, items, repo, max) {
|
|
|
219
227
|
|
|
220
228
|
/* ------------------------------- asking -------------------------------- */
|
|
221
229
|
|
|
222
|
-
/** What
|
|
223
|
-
const
|
|
230
|
+
/** What each staff member is being asked, kept if the dialog is closed before sending. */
|
|
231
|
+
const askDrafts = {};
|
|
232
|
+
/** When each was last asked, so their card can say so until they pick it up. */
|
|
233
|
+
const askedAt = {};
|
|
224
234
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
rows: 3,
|
|
235
|
-
ariaLabel: "What you need",
|
|
235
|
+
/**
|
|
236
|
+
* Asking one staff member to do something: their card's button opens this, already addressed
|
|
237
|
+
* to them. It becomes a new issue on their tracker that mentions them, which starts a run.
|
|
238
|
+
*/
|
|
239
|
+
async function askStaff(s, error = "") {
|
|
240
|
+
const said = await askText({
|
|
241
|
+
title: `Ask ${s.name}`,
|
|
242
|
+
hint: error,
|
|
243
|
+
value: askDrafts[s.handle] ?? "",
|
|
236
244
|
placeholder: "What do you need? For example: write a post about the new pricing page.",
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
askDraft.text = text.value;
|
|
242
|
-
};
|
|
243
|
-
const send = el("button", { className: "ghbtn primary" });
|
|
244
|
-
const label = () => {
|
|
245
|
-
const s = people.find((x) => x.handle === who.value);
|
|
246
|
-
send.textContent = s ? `Send to ${s.name}` : "Send";
|
|
247
|
-
};
|
|
248
|
-
label();
|
|
249
|
-
who.onchange = () => {
|
|
250
|
-
askDraft.who = who.value;
|
|
251
|
-
label();
|
|
252
|
-
};
|
|
253
|
-
const note = el("span", { className: "meta" });
|
|
254
|
-
send.onclick = async () => {
|
|
255
|
-
const s = staff.find((x) => x.handle === who.value);
|
|
256
|
-
const said = text.value.trim();
|
|
257
|
-
if (!s || !said) {
|
|
258
|
-
text.focus();
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
send.disabled = true;
|
|
262
|
-
note.className = "meta";
|
|
263
|
-
note.textContent = "Sending…";
|
|
264
|
-
try {
|
|
265
|
-
await post({
|
|
266
|
-
action: "create",
|
|
267
|
-
repo: s.brain,
|
|
268
|
-
title: titleOf(said),
|
|
269
|
-
body: `${s.mention ?? "@" + s.handle} ${said}`,
|
|
245
|
+
confirm: "Send",
|
|
246
|
+
decorate: (ta) => {
|
|
247
|
+
ta.addEventListener("input", () => {
|
|
248
|
+
askDrafts[s.handle] = ta.value;
|
|
270
249
|
});
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
if (!said) return;
|
|
253
|
+
try {
|
|
254
|
+
await post({
|
|
255
|
+
action: "create",
|
|
256
|
+
repo: s.brain,
|
|
257
|
+
title: titleOf(said),
|
|
258
|
+
body: `${s.mention ?? "@" + s.handle} ${said}`,
|
|
259
|
+
});
|
|
260
|
+
delete askDrafts[s.handle];
|
|
261
|
+
askedAt[s.handle] = Date.now();
|
|
262
|
+
repaintInPlace();
|
|
263
|
+
refreshSoon();
|
|
264
|
+
} catch (e) {
|
|
265
|
+
askDrafts[s.handle] = said;
|
|
266
|
+
await askStaff(s, String(e.message || e));
|
|
267
|
+
}
|
|
288
268
|
}
|
|
289
269
|
|
|
290
270
|
/** The first line, short enough to be an issue title. */
|
|
@@ -543,6 +523,10 @@ function team(staff) {
|
|
|
543
523
|
} else if (last) {
|
|
544
524
|
line = `Last finished ${ago(last.updatedAt)}`;
|
|
545
525
|
}
|
|
526
|
+
// A run takes about a minute to start, and until then the card would say nothing happened.
|
|
527
|
+
if (!busy && !queued && Date.now() - (askedAt[s.handle] ?? 0) < 120_000) {
|
|
528
|
+
line = "Sent. Starts in about a minute";
|
|
529
|
+
}
|
|
546
530
|
|
|
547
531
|
const issue = (busy || queued) && runs[0].issue && s.brain ? runs[0].issue : null;
|
|
548
532
|
const card = el("div", {
|
|
@@ -567,10 +551,15 @@ function team(staff) {
|
|
|
567
551
|
el("a", { className: "orblog", href: log, target: "_blank", rel: "noopener", textContent: "View log" }),
|
|
568
552
|
);
|
|
569
553
|
}
|
|
554
|
+
if (s.brain) {
|
|
555
|
+
const ask = el("button", { className: "ghbtn orbask", textContent: "Ask a question" });
|
|
556
|
+
ask.onclick = () => askStaff(s);
|
|
557
|
+
card.append(el("span", { className: "orbgap" }), ask);
|
|
558
|
+
}
|
|
570
559
|
if (issue) {
|
|
571
560
|
const open = () => openThread({ repo: s.brain, number: issue, kind: "issue" });
|
|
572
561
|
card.onclick = (ev) => {
|
|
573
|
-
if (!ev.target.closest("a")) open();
|
|
562
|
+
if (!ev.target.closest("a, button")) open();
|
|
574
563
|
};
|
|
575
564
|
card.onkeydown = (ev) => {
|
|
576
565
|
if (ev.target === card && (ev.key === "Enter" || ev.key === " ")) {
|
|
@@ -619,10 +608,7 @@ function poll() {
|
|
|
619
608
|
issuesAt = Date.now();
|
|
620
609
|
refreshSoon(false);
|
|
621
610
|
} else if (changed && S.view === "home" && !document.querySelector("dialog[open]")) {
|
|
622
|
-
|
|
623
|
-
const row = document.querySelector(".hometeam");
|
|
624
|
-
if (row && document.activeElement?.closest?.(".homeaskcard")) row.replaceWith(team(S.data.staff));
|
|
625
|
-
else repaintInPlace();
|
|
611
|
+
repaintInPlace();
|
|
626
612
|
}
|
|
627
613
|
})
|
|
628
614
|
.catch(() => {})
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { post } from "../api.js";
|
|
8
8
|
import { el } from "../dom.js";
|
|
9
|
+
import { icon } from "../icons.js";
|
|
9
10
|
import { refreshAll } from "../refresh.js";
|
|
10
11
|
import { S } from "../state.js";
|
|
11
12
|
|
|
@@ -36,7 +37,7 @@ export function peopleCard() {
|
|
|
36
37
|
el("span", { textContent: "Name" }),
|
|
37
38
|
el("span", { textContent: "GitHub login" }),
|
|
38
39
|
el("span", { textContent: "Looks after" }),
|
|
39
|
-
el("span", { textContent: "Read only" }),
|
|
40
|
+
el("span", { className: "peopleonlyhead", textContent: "Read only" }),
|
|
40
41
|
el("span"),
|
|
41
42
|
]),
|
|
42
43
|
...rows.map((p, i) => row(p, i)),
|
|
@@ -58,7 +59,12 @@ export function peopleCard() {
|
|
|
58
59
|
p.view_only = only.checked;
|
|
59
60
|
stamp();
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
+
// Quiet on purpose: one per row, and a column of red buttons outshouts the list it edits.
|
|
63
|
+
const remove = el("button", {
|
|
64
|
+
className: "iconbtn peopleremove",
|
|
65
|
+
title: "Remove",
|
|
66
|
+
ariaLabel: `Remove ${p.name || "this person"}`,
|
|
67
|
+
}, [icon("trash", "ic")]);
|
|
62
68
|
remove.onclick = () => {
|
|
63
69
|
rows.splice(i, 1);
|
|
64
70
|
paint();
|
|
@@ -142,7 +142,9 @@ function row(r) {
|
|
|
142
142
|
tr.innerHTML =
|
|
143
143
|
'<td title="' + esc(r.createdAt) + '">' + esc(ago(r.createdAt)) + "</td>" +
|
|
144
144
|
"<td>" + esc(r.kind) + "</td>" +
|
|
145
|
-
|
|
145
|
+
(out.tone === "ok"
|
|
146
|
+
? '<td><span class="runok"><i></i>' + esc(out.word) + "</span></td>"
|
|
147
|
+
: '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>") +
|
|
146
148
|
"<td>" + (mins != null ? Math.round(mins) + "m" : "–") + "</td>" +
|
|
147
149
|
"<td>" + (rec.turns ?? "–") + "</td>" +
|
|
148
150
|
"<td>" + (typeof rec.cost_usd === "number" ? "$" + rec.cost_usd.toFixed(2) : "–") + "</td>" +
|