@popcorn245/cornfield 0.49.0 → 0.50.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/explorer/css/review.css +49 -0
- package/explorer/decision-model.js +6 -0
- package/explorer/engine/layout.js +8 -3
- package/explorer/engine/sheets.js +40 -7
- package/explorer/engine/topology.js +126 -0
- package/explorer/focus-room.js +1 -7
- package/explorer/focusables.js +1 -1
- package/explorer/forge-panel.js +36 -2630
- package/explorer/index.html +15 -147
- package/explorer/instance-state.js +0 -7
- package/explorer/instance.js +21 -2
- package/explorer/page-pieces.js +21 -2
- package/explorer/page.js +3 -3
- package/explorer/panels.js +1 -5
- package/explorer/pieces/changes.js +2 -9
- package/explorer/pieces/decision.js +10 -3
- package/explorer/pieces/layers.js +1 -0
- package/explorer/pieces/map.js +4 -23
- package/explorer/pieces/node-panel.js +15 -5
- package/explorer/pieces/proposal.js +9 -0
- package/explorer/pieces/review.js +280 -0
- package/explorer/pieces/work-agent.js +211 -0
- package/explorer/pieces/work-common.js +88 -0
- package/explorer/pieces/work-confirm.js +169 -0
- package/explorer/pieces/work-data.js +178 -0
- package/explorer/pieces/work-deploys.js +104 -0
- package/explorer/pieces/work-events.js +285 -0
- package/explorer/pieces/work-issues.js +43 -0
- package/explorer/pieces/work-markup.js +155 -0
- package/explorer/pieces/work-notes.js +177 -0
- package/explorer/pieces/work-paint.js +312 -0
- package/explorer/pieces/work-prs.js +253 -0
- package/explorer/pieces/work-runs.js +387 -0
- package/explorer/pieces/work-specs.js +71 -0
- package/explorer/pieces/work-threads.js +309 -0
- package/explorer/pieces/work.js +285 -0
- package/explorer/proposal.js +1 -2
- package/explorer/runs-map.js +108 -103
- package/explorer/runs-view.js +8 -6
- package/explorer/strings.js +1 -1
- package/explorer/view.js +6 -59
- package/explorer/waiting-model.js +12 -12
- package/explorer/waiting-view.js +6 -6
- package/package.json +1 -1
- package/explorer/feedback.js +0 -15
- package/explorer/waiting-line.js +0 -14
package/explorer/view.js
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { state, touchScene, pageInstance } from './state.js';
|
|
9
|
-
import { computeDegreeCentrality
|
|
9
|
+
import { computeDegreeCentrality } from './layout.js';
|
|
10
|
+
import { layoutMap } from './engine/topology.js';
|
|
10
11
|
import { buildDataFlow } from './flows.js';
|
|
11
12
|
import { render, fitGraphToViewport, fitPadding, ensureFlowLoop } from './render.js';
|
|
12
|
-
import { orderAddedLast
|
|
13
|
+
import { orderAddedLast } from './proposal-model.js';
|
|
13
14
|
import { renderLayerToggles } from './layers.js';
|
|
14
15
|
import { clearScenario } from './scenario-ui.js';
|
|
15
16
|
import { measureParams } from './bench.js';
|
|
@@ -80,64 +81,10 @@ export function setMap(nodes, edges) {
|
|
|
80
81
|
renderLayerToggles();
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
/** Where the nodes sit: the House view's plan here (house-model.js, PHY-11), every other view the engine's one layout (engine/topology.js `layoutMap`) */
|
|
83
85
|
function applyLayout() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (state.view === 'dataflow') {
|
|
87
|
-
state.flow.tiers.forEach((t) => t.nodes.forEach((n) => { n.r = Math.min(n.r, 13); })); // ... all small in the lanes
|
|
88
|
-
if (!(state.proposal && laneLayoutAround())) computeLaneLayout(state.flow);
|
|
89
|
-
} else if (state.proposal || state.nodes.some((n) => n.live)) {
|
|
90
|
-
layoutOrbitAround(); // the code map keeps its places; what a proposal adds and the live layer are placed beside it
|
|
91
|
-
} else {
|
|
92
|
-
layoutOrbit();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* The data-flow lanes while a proposal is open: the base map is laid out on its own and pinned, and
|
|
98
|
-
* the added nodes take free cells (pinLanes). False when that cannot be done, and the lanes are laid out afresh.
|
|
99
|
-
*/
|
|
100
|
-
function laneLayoutAround() {
|
|
101
|
-
const applied = { nodes: state.nodes, edges: state.edges };
|
|
102
|
-
const laid = state.baseNodes.map((n) => ({ ...n }));
|
|
103
|
-
state.nodes = laid;
|
|
104
|
-
state.edges = state.baseEdges;
|
|
105
|
-
computeDegreeCentrality();
|
|
106
|
-
const baseFlow = buildDataFlow(laid, state.baseEdges);
|
|
107
|
-
baseFlow.tiers.forEach((t) => t.nodes.forEach((n) => { n.r = Math.min(n.r, 13); }));
|
|
108
|
-
computeLaneLayout(baseFlow);
|
|
109
|
-
state.nodes = applied.nodes;
|
|
110
|
-
state.edges = applied.edges;
|
|
111
|
-
const pinned = pinLanes(state.flow, baseFlow);
|
|
112
|
-
touchScene();
|
|
113
|
-
return pinned;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* The orbit layout while a proposal is open: the base map is laid out on its own, exactly as it is
|
|
118
|
-
* with no proposal, and the nodes that were there keep those places and sizes; only the added ones
|
|
119
|
-
* are placed, next to their parent (placeAddedNodes). So opening a proposal, switching between
|
|
120
|
-
* Before, Diff and After, and closing it never move a node that was already on the map.
|
|
121
|
-
*/
|
|
122
|
-
function layoutOrbitAround() {
|
|
123
|
-
const applied = { nodes: state.nodes, edges: state.edges };
|
|
124
|
-
const laid = state.baseNodes.map((n) => ({ ...n }));
|
|
125
|
-
state.nodes = laid;
|
|
126
|
-
state.edges = state.baseEdges;
|
|
127
|
-
computeDegreeCentrality();
|
|
128
|
-
layoutOrbit(); // also sets the rings
|
|
129
|
-
const at = new Map(laid.map((n) => [n.id, n]));
|
|
130
|
-
|
|
131
|
-
state.nodes = applied.nodes;
|
|
132
|
-
state.edges = applied.edges;
|
|
133
|
-
computeDegreeCentrality();
|
|
134
|
-
state.nodes.forEach((n) => {
|
|
135
|
-
const was = at.get(n.id);
|
|
136
|
-
if (was) { n.x = was.x; n.y = was.y; n.r = was.r; }
|
|
137
|
-
});
|
|
138
|
-
placeAddedNodes(state.nodes, state.edges);
|
|
139
|
-
placeLiveNodes(state.nodes, state.edges);
|
|
140
|
-
touchScene();
|
|
86
|
+
if (state.view === 'house') { computeDegreeCentrality(); applyHouseLayout(state); return; }
|
|
87
|
+
layoutMap(pageInstance(), { placeLive: placeLiveNodes }); // the live layer is the page's (live-model.js): the engine places it with this
|
|
141
88
|
}
|
|
142
89
|
|
|
143
90
|
/** Switches between 'orbit' and 'dataflow'; the camera refits and the preset button follows */
|
|
@@ -36,26 +36,26 @@ export const RUN_GROUPS = Object.freeze([
|
|
|
36
36
|
]);
|
|
37
37
|
|
|
38
38
|
/** The words of a Specs group's header (a repo may say them in its own voice: `strings`) */
|
|
39
|
-
export function specGroupTitle(key) {
|
|
39
|
+
export function specGroupTitle(key, say = t) {
|
|
40
40
|
switch (key) {
|
|
41
|
-
case 'decide': return
|
|
42
|
-
case 'agent': return
|
|
43
|
-
case 'approved': return
|
|
44
|
-
default: return
|
|
41
|
+
case 'decide': return say('toDecide');
|
|
42
|
+
case 'agent': return say('withAgent');
|
|
43
|
+
case 'approved': return say('approvedGroup');
|
|
44
|
+
default: return say('drafts');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/** The words of a Runs group's header */
|
|
49
|
-
export function runGroupTitle(key) {
|
|
49
|
+
export function runGroupTitle(key, say = t) {
|
|
50
50
|
switch (key) {
|
|
51
|
-
case 'needs': return
|
|
52
|
-
case 'motion': return
|
|
53
|
-
default: return
|
|
51
|
+
case 'needs': return say('needsYou');
|
|
52
|
+
case 'motion': return say('inMotion');
|
|
53
|
+
default: return say('finished');
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** The words of the proposal bar's button that goes to the run waiting on the proposal */
|
|
58
|
-
export const answerWord = () =>
|
|
58
|
+
export const answerWord = (say = t) => say('answer');
|
|
59
59
|
|
|
60
60
|
/** Drafts past this many rows are collapsed behind their header (D3) */
|
|
61
61
|
export const DRAFTS_OPEN_MAX = 10;
|
|
@@ -230,10 +230,10 @@ export function waiting({ specs, runs } = {}) {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/** "3 waiting on you" (the Work button's name, spoken: "Work, 3 waiting on you"), or '' when nothing waits */
|
|
233
|
-
export const waitingWords = (n) => (n > 0 ? `${n} ${
|
|
233
|
+
export const waitingWords = (n, say = t) => (n > 0 ? `${n} ${say('waitingOnYou')}` : '');
|
|
234
234
|
|
|
235
235
|
/** The Work button's accessible name: its label, then what waits ("Work, 3 waiting on you") */
|
|
236
|
-
export const workButtonName = (label, n) => (n > 0 ? `${label}, ${waitingWords(n)}` : label);
|
|
236
|
+
export const workButtonName = (label, n, say = t) => (n > 0 ? `${label}, ${waitingWords(n, say)}` : label);
|
|
237
237
|
|
|
238
238
|
/** What a group's header says: "To decide · 2", or "To decide · 2 of 6" while a search narrows it */
|
|
239
239
|
export const groupCountWords = (g) => (g.shown === g.total ? String(g.total) : `${g.shown} of ${g.total}`);
|
package/explorer/waiting-view.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* headings. Pure: no DOM, no clock of its own. Every word from the forge is escaped (a row's own markup is proposal-model.js `specRowHtml`).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { escHtml } from '
|
|
8
|
+
import { escapeHtml as escHtml } from '../core/text.js';
|
|
9
9
|
import { specRowHtml } from './proposal-model.js';
|
|
10
10
|
import { specGroupTitle, runGroupTitle, groupCountWords } from './waiting-model.js';
|
|
11
11
|
|
|
@@ -13,12 +13,12 @@ import { specGroupTitle, runGroupTitle, groupCountWords } from './waiting-model.
|
|
|
13
13
|
* The Specs tab's groups, each a heading with its count and its rows. Drafts past ten rows are folded behind a button on the header
|
|
14
14
|
* (`draftsOpen` says whether the person opened it). With a search, a group's count reads "2 of 6".
|
|
15
15
|
* @param {ReturnType<import('./waiting-model.js').specGroups>} groups
|
|
16
|
-
* @param {{ current?: { slug: string, source: string } | null, nowMs?: number, draftsOpen?: boolean | null }} [opts]
|
|
16
|
+
* @param {{ current?: { slug: string, source: string } | null, nowMs?: number, draftsOpen?: boolean | null, say?: (key: string) => string }} [opts]
|
|
17
17
|
*/
|
|
18
|
-
export function specGroupsHtml(groups, { current = null, nowMs = Date.now(), draftsOpen = null } = {}) {
|
|
18
|
+
export function specGroupsHtml(groups, { current = null, nowMs = Date.now(), draftsOpen = null, say } = {}) {
|
|
19
19
|
return groups.map((g) => {
|
|
20
20
|
const id = `spec-group-${g.key}`;
|
|
21
|
-
const words = `${specGroupTitle(g.key)} · ${groupCountWords(g)}`;
|
|
21
|
+
const words = `${specGroupTitle(g.key, say)} · ${groupCountWords(g)}`;
|
|
22
22
|
const foldable = g.key === 'drafts' && g.total > 10 && g.shown === g.total; // not while a search narrows it: then it is open
|
|
23
23
|
const folded = foldable && (draftsOpen === null ? g.collapsed : !draftsOpen);
|
|
24
24
|
const title = foldable
|
|
@@ -31,7 +31,7 @@ export function specGroupsHtml(groups, { current = null, nowMs = Date.now(), dra
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** The heading that starts a group of the Runs list: "Needs you · 1". It is an item of the flat list (a run's card is never moved into a section) */
|
|
34
|
-
export function runGroupHeadingHtml(g) {
|
|
34
|
+
export function runGroupHeadingHtml(g, say) {
|
|
35
35
|
const id = `run-group-${g.key}`;
|
|
36
|
-
return `<li class="hx-run-heading" data-key="${id}" data-corn="run-group" data-group="${escHtml(g.key)}"><h4 class="hx-forge-gtitle" id="${id}">${escHtml(`${runGroupTitle(g.key)} · ${g.count}`)}</h4></li>`;
|
|
36
|
+
return `<li class="hx-run-heading" data-key="${id}" data-corn="run-group" data-group="${escHtml(g.key)}"><h4 class="hx-forge-gtitle" id="${id}">${escHtml(`${runGroupTitle(g.key, say)} · ${g.count}`)}</h4></li>`;
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcorn245/cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"description": "A self-hostable dev dashboard with the topology map at its centre: proposals on the map, scenarios, outages and what-if edits, for any repo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "popcorn245 (https://github.com/popcorn245)",
|
package/explorer/feedback.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module explorer/feedback
|
|
3
|
-
*
|
|
4
|
-
* A bridge (spec 0011 D2, step 4): the results of actions now live on the instance (engine/feedback.js). This file keeps the old names for the
|
|
5
|
-
* modules that are not yet on an instance (forge-panel.js), bound to the page's instance. It goes when forge-panel.js is converted.
|
|
6
|
-
*/
|
|
7
|
-
import { pageInstance } from './state.js';
|
|
8
|
-
import * as F from './engine/feedback.js';
|
|
9
|
-
|
|
10
|
-
export { RESULT_MS } from './engine/feedback.js';
|
|
11
|
-
export const sayResult = (key, text, ok = true) => F.sayResult(pageInstance(), key, text, ok);
|
|
12
|
-
export const resultOf = (key) => F.resultOf(pageInstance(), key);
|
|
13
|
-
export const clearResult = (key) => F.clearResult(pageInstance(), key);
|
|
14
|
-
export const showResultIn = (el, key) => F.showResultIn(pageInstance(), el, key);
|
|
15
|
-
export const resetFeedbackForTests = () => F.resetFeedback(pageInstance());
|
package/explorer/waiting-line.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module explorer/waiting-line
|
|
3
|
-
*
|
|
4
|
-
* A bridge (spec 0011 D3, step 5): the one line under the proposal bar's buttons when a run is waiting on the open proposal (spec 0010 D2) is part of the
|
|
5
|
-
* proposal's bar (pieces/proposal.js). This file keeps the old names for the Work panel, bound to the page's instance.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { pageInstance } from './state.js';
|
|
9
|
-
import { ensurePagePieces } from './page-pieces.js';
|
|
10
|
-
|
|
11
|
-
/** Shows the line for `run` (the run waiting on the open proposal), or hides it for null; `key` is what the line is about (the proposal), so a run is said once for it */
|
|
12
|
-
export function paintWaitingLine(run, key) { ensurePagePieces(); pageInstance().emit('proposal:waiting', { run, key }); }
|
|
13
|
-
/** For tests: forget the line */
|
|
14
|
-
export function resetWaitingLineForTests() { pageInstance().emit('proposal:waiting-reset'); }
|