@floless/app 0.169.0 → 0.171.0
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/floless-server.cjs +65531 -43728
- package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
- package/dist/schemas/steel.model.v2.schema.json +196 -4
- package/dist/skills/floless-app-bridge/SKILL.md +3 -3
- package/dist/skills/floless-app-knowledge/SKILL.md +46 -15
- package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
- package/dist/skills/floless-app-onboarding/SKILL.md +5 -4
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +0 -3
- package/dist/skills/floless-app-queue/SKILL.md +2 -3
- package/dist/skills/floless-app-report-issue/SKILL.md +2 -2
- package/dist/skills/floless-app-routines/SKILL.md +2 -2
- package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
- package/dist/skills/floless-app-steel-model/SKILL.md +42 -39
- package/dist/skills/floless-app-steel-model/references/custom-connections.md +47 -0
- package/dist/skills/floless-app-steel-model/references/custom-sections.md +32 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
- package/dist/skills/floless-app-ui/SKILL.md +71 -126
- package/dist/skills/floless-app-workflows/SKILL.md +22 -3
- package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
- package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
- package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
- package/dist/web/add-ons.js +407 -0
- package/dist/web/agent-steps.js +89 -18
- package/dist/web/agents.js +32 -22
- package/dist/web/analytics.js +1 -1
- package/dist/web/app.css +331 -190
- package/dist/web/app.js +33 -13
- package/dist/web/aware.js +926 -218
- package/dist/web/chat.css +6 -1
- package/dist/web/chat.js +316 -112
- package/dist/web/checkpoint-standard.js +5 -3
- package/dist/web/commands-drawing-check.js +1 -0
- package/dist/web/commands-filter.js +23 -0
- package/dist/web/commands-shell.js +479 -78
- package/dist/web/commands-steel.js +69 -2
- package/dist/web/commands-tekla-parser.js +23 -0
- package/dist/web/connections.js +14 -3
- package/dist/web/drawing-check-editor.js +352 -88
- package/dist/web/failure-copy.js +33 -2
- package/dist/web/filter-ai-proposal.js +11 -8
- package/dist/web/flo-3d.js +1 -1
- package/dist/web/guide.js +36 -29
- package/dist/web/index.html +98 -57
- package/dist/web/instructor.js +101 -17
- package/dist/web/kb-categories.js +64 -7
- package/dist/web/left-pane.js +4 -1
- package/dist/web/local-discovery.js +8 -7
- package/dist/web/missed-routines.js +239 -0
- package/dist/web/model-change-findings.js +430 -0
- package/dist/web/model-change-review.js +414 -0
- package/dist/web/model-editor-steel-adapter.js +2 -2
- package/dist/web/model-measure.js +6 -0
- package/dist/web/model-spatial-panel.js +19 -4
- package/dist/web/model-spatial-tools.js +3 -3
- package/dist/web/model-viewport-revit-adapter.js +3 -3
- package/dist/web/origin-rule.js +155 -0
- package/dist/web/project-access.js +1 -1
- package/dist/web/project-history.js +7 -1
- package/dist/web/project-modules.js +2 -2
- package/dist/web/project-rfis.js +6 -1
- package/dist/web/project-workflows.js +2 -2
- package/dist/web/revit-editor.css +85 -0
- package/dist/web/revit-editor.js +58 -9
- package/dist/web/run-history.js +12 -1
- package/dist/web/sha256-sync.js +62 -0
- package/dist/web/steel-3d-core.js +46 -9
- package/dist/web/steel-3d-flo.js +153 -7
- package/dist/web/steel-3d-view.js +33 -5
- package/dist/web/steel-ai-marks.js +3 -1
- package/dist/web/steel-custom-connection.js +161 -0
- package/dist/web/steel-custom-sections.js +1796 -0
- package/dist/web/steel-editor.html +732 -161
- package/dist/web/steel-environments.js +297 -0
- package/dist/web/steel-filter-usage.js +299 -0
- package/dist/web/steel-filter.html +104 -6
- package/dist/web/steel-model-v2-client-validation.js +11 -1
- package/dist/web/steel-model-v2-commands.js +116 -13
- package/dist/web/steel-model-v2-projection.js +1 -1
- package/dist/web/steel-read-confidence.js +1 -56
- package/dist/web/step-rename.js +3 -2
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +1 -1
- package/dist/web/tool-updates.js +7 -6
- package/dist/web/workspaces.js +1968 -138
- package/launch.mjs +87 -9
- package/package.json +4 -1
- package/dist/web/panels.js +0 -831
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change review S2 (#3461): the Findings section of the Changes tab. What the checks found on the objects a review
|
|
3
|
+
* compared, and the person's three choices for each finding: fix it in Tekla, raise an RFI, or go ahead on a stated
|
|
4
|
+
* assumption (plan §6, UX review 2026-11-11). Presentation only: the checks ran in AWARE, the server keeps the record
|
|
5
|
+
* and the decisions, and the gate line is the server's. Nothing here decides for the person, and no control is ever
|
|
6
|
+
* shown disabled: a choice that is not ready yet is simply not shown, with a line saying what it needs.
|
|
7
|
+
*
|
|
8
|
+
* Words are for detailers: never "fingerprint", "key", "transition" or an identity.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const STATUS = {
|
|
12
|
+
open: { text: 'Needs a decision', tone: 'danger' },
|
|
13
|
+
reopened: { text: 'Reopened', tone: 'danger' },
|
|
14
|
+
'fix-pending': { text: 'Being fixed in Tekla', tone: 'accent' },
|
|
15
|
+
rfi: { text: 'RFI raised', tone: 'accent' },
|
|
16
|
+
accepted: { text: 'Accepted on an assumption', tone: 'neutral' },
|
|
17
|
+
};
|
|
18
|
+
const NOTE = {
|
|
19
|
+
'changed-since-accepted': 'Changed since it was accepted',
|
|
20
|
+
'reopened-after-fixed': 'Came back after it was fixed',
|
|
21
|
+
'still-present-after-fix': 'Still there after it was marked to be fixed',
|
|
22
|
+
};
|
|
23
|
+
const NOT_RUN = {
|
|
24
|
+
'aware-too-old': 'The checking engine on this computer (AWARE) is too old to run them. Update FloLess’s tools from the footer, then compare again.',
|
|
25
|
+
'check-failed': 'The checks could not be finished. Compare again; if it keeps happening, use Report an issue.',
|
|
26
|
+
'concurrent-review': 'Another review of this model was saved at the same moment. Compare again.',
|
|
27
|
+
};
|
|
28
|
+
const NOT_RECHECKED = {
|
|
29
|
+
diagnostic: 'Not found again, but one of the saved states may not be a clean copy, so this does not prove it was fixed.',
|
|
30
|
+
'not-applicable': 'The check no longer applies to this object, so it was not checked again.',
|
|
31
|
+
excluded: 'This object could not be told apart from another one, so it was not checked again.',
|
|
32
|
+
'not-evaluated': 'This check could not run on it this time.',
|
|
33
|
+
incomplete: 'The check results were cut short, so it was not checked again.',
|
|
34
|
+
};
|
|
35
|
+
const FILTERS = [
|
|
36
|
+
['decide', 'Needs a decision', (f) => f.status === 'open' || f.status === 'reopened'],
|
|
37
|
+
['fixing', 'Being fixed', (f) => f.status === 'fix-pending'],
|
|
38
|
+
['rfi', 'RFI raised', (f) => f.status === 'rfi'],
|
|
39
|
+
['accepted', 'Accepted', (f) => f.status === 'accepted'],
|
|
40
|
+
['all', 'All', () => true],
|
|
41
|
+
];
|
|
42
|
+
const ORDER = { reopened: 0, open: 1, 'fix-pending': 2, rfi: 3, accepted: 4 };
|
|
43
|
+
const LIMIT = 50;
|
|
44
|
+
|
|
45
|
+
const plural = (n, one, many = `${one}s`) => `${Number(n).toLocaleString()} ${n === 1 ? one : many}`;
|
|
46
|
+
const day = (iso) => {
|
|
47
|
+
try { return new Date(iso).toLocaleString(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }); }
|
|
48
|
+
catch { return iso; }
|
|
49
|
+
};
|
|
50
|
+
const objectLine = (finding) => finding.participants.map((p) => `${p.type || 'Object'} · ${typeof p.name === 'string' && p.name.trim() ? p.name : '(no name)'}`).join(', ');
|
|
51
|
+
const keyOf = (finding) => finding.correspondenceKey;
|
|
52
|
+
/** A finding that is gone names its object as it was when found: its name then, or that it had none. */
|
|
53
|
+
const wasLine = (entry) => entry.participants.map((p) => `${p.type || 'Object'}${typeof p.name === 'string' && p.name.trim() ? ` ${p.name}` : ' that had no name'}`).join(', ');
|
|
54
|
+
const who = (decision) => (decision.via === 'chat' ? 'recorded from AI Chat, not by you' : 'recorded by you');
|
|
55
|
+
const viaChat = (decision) => decision?.via === 'chat';
|
|
56
|
+
|
|
57
|
+
/** `clipboard`: optional `(text) => Promise` for copying; the browser's clipboard otherwise. */
|
|
58
|
+
export function createFindings({ doc, el, api, projectId, live, locate, sideState, rerender, focusCompare, clipboard = null }) {
|
|
59
|
+
const copyText = (text) => (clipboard ? clipboard(text) : doc.defaultView.navigator.clipboard.writeText(text));
|
|
60
|
+
let data = null;
|
|
61
|
+
let reviewId = null;
|
|
62
|
+
let loading = false;
|
|
63
|
+
// Every load of findings takes the next number. A reply, a control or an announcement belongs to the load it came
|
|
64
|
+
// from, and counts only while that load is still the latest: reopening the same review is a new load too.
|
|
65
|
+
let gen = 0;
|
|
66
|
+
// The load the controls being built belong to ({ reviewId, gen }): each control keeps it, and does nothing once it is stale.
|
|
67
|
+
let renderingFor = null;
|
|
68
|
+
const current = (shown) => Boolean(shown) && shown.gen === gen && !loading;
|
|
69
|
+
let failed = null;
|
|
70
|
+
let filter = null;
|
|
71
|
+
let openKey = null;
|
|
72
|
+
const openChoice = {};
|
|
73
|
+
const drafts = { assumption: {}, rfi: {} };
|
|
74
|
+
let confirmRestart = false;
|
|
75
|
+
let busy = false;
|
|
76
|
+
let shown = LIMIT;
|
|
77
|
+
let focusAfter = null;
|
|
78
|
+
let focusChoice = null;
|
|
79
|
+
let copied = null;
|
|
80
|
+
let copiedMark = null;
|
|
81
|
+
|
|
82
|
+
const project = () => `/api/change-review/${encodeURIComponent(projectId)}`;
|
|
83
|
+
const base = () => `${project()}/reviews/${reviewId}`;
|
|
84
|
+
|
|
85
|
+
/** Load a review's findings. Resolves true when this load is still the latest one. */
|
|
86
|
+
async function load(review) {
|
|
87
|
+
const g = ++gen;
|
|
88
|
+
const id = review?.reviewId ?? null;
|
|
89
|
+
reviewId = id; data = null; failed = null; loading = Boolean(id);
|
|
90
|
+
if (!id) return true;
|
|
91
|
+
const path = `${base()}/findings`;
|
|
92
|
+
// A reply for a load that is no longer the latest is dropped, error or not.
|
|
93
|
+
try { const reply = await api(path); if (g === gen) data = reply; }
|
|
94
|
+
catch (error) { if (g === gen) failed = error?.body?.userMessage || 'The findings of this review could not be opened. Compare the saved states again.'; }
|
|
95
|
+
finally { if (g === gen) loading = false; }
|
|
96
|
+
return g === gen;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function views() { return data?.view?.findings ?? []; }
|
|
100
|
+
|
|
101
|
+
function counts() {
|
|
102
|
+
const out = {};
|
|
103
|
+
for (const [id, , test] of FILTERS) out[id] = views().filter(test).length;
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function pickFilter() {
|
|
108
|
+
const c = counts();
|
|
109
|
+
if (!filter || (c[filter] === 0 && filter !== 'decide' && filter !== 'all')) filter = c.decide > 0 ? 'decide' : 'all';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Record a decision for the review the control was shown for: never for whichever review is on screen by then. */
|
|
113
|
+
async function act(shown, path, body, said, key) {
|
|
114
|
+
if (busy || !current(shown)) return;
|
|
115
|
+
busy = true;
|
|
116
|
+
try {
|
|
117
|
+
const url = path.startsWith('/') ? path : `${project()}/reviews/${shown.reviewId}/${path}`;
|
|
118
|
+
const reply = await api(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
|
|
119
|
+
// If the person opened a review meanwhile (even this one again), nothing about this decision is said or shown over it.
|
|
120
|
+
if (shown.gen !== gen) return;
|
|
121
|
+
if (!(await load({ reviewId: shown.reviewId }))) return;
|
|
122
|
+
const left = counts().decide;
|
|
123
|
+
const text = typeof said === 'function' ? said(reply) : said;
|
|
124
|
+
live.textContent = failed
|
|
125
|
+
? `${text} The findings could not be shown again: reload the review to see where they stand.`
|
|
126
|
+
: typeof said === 'function' ? text : `${text}${left ? ` ${plural(left, 'finding')} still ${left === 1 ? 'needs' : 'need'} a decision.` : ''}`;
|
|
127
|
+
if (key) { openKey = key; delete openChoice[key]; focusAfter = key; }
|
|
128
|
+
} catch (error) {
|
|
129
|
+
if (shown.gen === gen) live.textContent = error?.body?.userMessage || 'That could not be recorded. Reload the review and try again.';
|
|
130
|
+
} finally { busy = false; rerender(); }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const button = (attrs, text, onclick) => el(doc, 'button', { type: 'button', ...attrs, text, onclick });
|
|
134
|
+
|
|
135
|
+
function gate() {
|
|
136
|
+
const forReview = renderingFor;
|
|
137
|
+
const out = [];
|
|
138
|
+
const banner = (tone, warn, lead, sub, extra = []) => el(doc, 'section', { class: `tekla-changes-banner tekla-changes-gate ${tone}`, role: 'note', 'aria-label': lead },
|
|
139
|
+
el(doc, 'strong', { text: `${warn ? '⚠ ' : ''}${lead}` }), sub ? el(doc, 'span', { text: sub }) : null, ...extra);
|
|
140
|
+
if (failed) return [banner('danger', true, 'The findings could not be opened', failed)];
|
|
141
|
+
const checks = data?.checks ?? null;
|
|
142
|
+
if (!checks) return [banner('neutral', false, 'No checks were run on this review', 'It was made before FloLess checked the changes, or its source is not checked yet. Compare the saved states again to run the checks.')];
|
|
143
|
+
if (checks.state === 'not-run') return [banner('neutral', false, 'No checks were run on this review', NOT_RUN[checks.reason] || NOT_RUN['check-failed'])];
|
|
144
|
+
const view = data.view;
|
|
145
|
+
if (view.decisionsState === 'damaged') {
|
|
146
|
+
const restart = confirmRestart
|
|
147
|
+
? el(doc, 'div', { class: 'tekla-changes-finding-actions' },
|
|
148
|
+
el(doc, 'span', { text: 'This sets aside every earlier decision on this model’s findings (the old history is kept). Start again?' }),
|
|
149
|
+
button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-decisions-restart' }, 'Yes, start again', () => {
|
|
150
|
+
confirmRestart = false;
|
|
151
|
+
act(forReview, `${project()}/decisions/restart`, {}, (reply) => (reply?.restarted === false
|
|
152
|
+
? 'The decision history could be verified again, so nothing was set aside.'
|
|
153
|
+
: 'The decision history was started again; the old one is kept. Every finding needs a decision.'));
|
|
154
|
+
}),
|
|
155
|
+
button({ class: 'tekla-changes-cancel', 'data-command-id': 'tekla-parser.change-review-decisions-restart' }, 'Cancel', () => { confirmRestart = false; rerender(); }))
|
|
156
|
+
: button({ class: 'tekla-changes-locate', 'data-command-id': 'tekla-parser.change-review-decisions-restart' }, 'Start the decision history again', () => { confirmRestart = true; rerender(); });
|
|
157
|
+
out.push(banner('danger', true, 'The record of decisions on this model could not be verified',
|
|
158
|
+
'Earlier decisions are not applied, so every finding shows as needing a decision. You can start the decision history again; the old one is kept.', [restart]));
|
|
159
|
+
}
|
|
160
|
+
if (view.decisionsTorn) {
|
|
161
|
+
out.push(banner('danger', true, 'The last decision was not finished being saved',
|
|
162
|
+
'It is not applied, so its finding shows as it was before. Make that decision again if it is missing.'));
|
|
163
|
+
}
|
|
164
|
+
const g = view.gate;
|
|
165
|
+
if (g.kind === 'incomplete') out.push(banner('danger', true, `Incomplete: only ${g.listed.toLocaleString()} of ${g.total.toLocaleString()} findings are listed`, 'The rest could not be listed, so treat this review as unfinished. Fix the listed ones and compare again.'));
|
|
166
|
+
else if (g.kind === 'needs-decision') out.push(banner('danger', true, `${plural(g.count, 'finding')} ${g.count === 1 ? 'needs' : 'need'} a decision`, 'Decide each one below. You can always go ahead, and your choice is recorded.'));
|
|
167
|
+
else if (g.kind === 'outstanding') {
|
|
168
|
+
const parts = [g.fixPending ? `${g.fixPending} being fixed in Tekla` : null, g.rfi ? `${g.rfi} waiting on an RFI` : null].filter(Boolean);
|
|
169
|
+
const fromChat = views().filter((v) => (v.status === 'fix-pending' || v.status === 'rfi') && viaChat(v.decision)).length;
|
|
170
|
+
const next = g.fixPending
|
|
171
|
+
? 'Fix them in Tekla, import the model folder again and compare with the same earlier saved state to check them.'
|
|
172
|
+
: 'When the RFI is answered, fix the model or go ahead on an assumption, then compare again.';
|
|
173
|
+
out.push(banner('accent', false, parts.join(', '), `${next}${fromChat ? ` ${plural(fromChat, 'of these decisions was', 'of these decisions were')} recorded from AI Chat, not by you.` : ''}`));
|
|
174
|
+
} else if (g.kind === 'proceeds-on-assumptions') out.push(banner('neutral', false, `Proceeds on ${plural(g.count, 'stated assumption')}`, 'Each assumption is recorded with the finding below.'));
|
|
175
|
+
else if (g.kind === 'no-open-findings') out.push(banner('neutral', false, 'No open findings in what was checked', 'This does not cover everything: see “What the checks covered” below.'));
|
|
176
|
+
if (checks.predecessorIncompatible) out.push(banner('neutral', false, 'Earlier findings were not carried over', checks.predecessorIncompatible.reason));
|
|
177
|
+
if (checks.orderUnproven) out.push(banner('neutral', false, 'Not compared with the last review', checks.orderUnproven.reason));
|
|
178
|
+
if (data.live?.matchesReviewed === 'different') {
|
|
179
|
+
out.push(banner('neutral', false, 'The model has been saved again since this review',
|
|
180
|
+
'Decisions here apply to the saved states this review compared, not the latest one. Import the folder and compare again to check the latest.',
|
|
181
|
+
[button({ class: 'tekla-changes-linkbtn', 'data-command-id': 'tekla-parser.change-review-compare' }, 'Compare again', () => focusCompare())]));
|
|
182
|
+
}
|
|
183
|
+
return out;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function chip(text, tone, tip) {
|
|
187
|
+
return el(doc, 'span', { class: `tekla-changes-chip${tone && tone !== 'neutral' ? ` ${tone}` : ''}`, text, 'data-tip': tip || null });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function choice(key, id, title, sub, body) {
|
|
191
|
+
const open = openChoice[key] === id;
|
|
192
|
+
const shown = renderingFor;
|
|
193
|
+
const panelId = `tekla-finding-${id}-${key.slice(0, 12)}`;
|
|
194
|
+
const head = button({ class: 'tekla-changes-choice', 'aria-expanded': String(open), 'aria-controls': panelId, 'data-command-id': `tekla-parser.change-review-finding-choose-${id}`, 'data-finding': key, 'data-choice': id },
|
|
195
|
+
null, () => { if (!current(shown)) return; openChoice[key] = open ? null : id; focusChoice = { key, id }; rerender(); });
|
|
196
|
+
head.append(el(doc, 'strong', { text: title }), el(doc, 'span', { text: sub }));
|
|
197
|
+
return el(doc, 'div', { class: 'tekla-changes-choice-wrap' }, head, open ? el(doc, 'div', { class: 'tekla-changes-choice-body', id: panelId }, ...body()) : null);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function showButton(view) {
|
|
201
|
+
const forReview = renderingFor;
|
|
202
|
+
const p = view.finding.participants[0];
|
|
203
|
+
return button({ class: 'tekla-changes-locate', 'data-command-id': 'tekla-parser.change-review-finding-locate', 'aria-label': `Show ${p?.name || p?.type || 'the object'} in 3D` }, 'Show in 3D', async () => {
|
|
204
|
+
if (!current(forReview)) return;
|
|
205
|
+
const state = sideState('revised');
|
|
206
|
+
if (!state || !p?.entityIdRevised) { live.textContent = 'That saved state is no longer part of this project, so this object cannot be shown in 3D.'; return; }
|
|
207
|
+
try { await locate({ state, entityId: p.entityIdRevised }); }
|
|
208
|
+
catch (error) {
|
|
209
|
+
console.warn('[change-review] Show in 3D failed:', error);
|
|
210
|
+
if (forReview.gen === gen) live.textContent = 'That saved state could not be opened in 3D. Open the Model tab and try again.';
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function decided(view) {
|
|
216
|
+
const forReview = renderingFor;
|
|
217
|
+
const d = view.decision;
|
|
218
|
+
const key = keyOf(view.finding);
|
|
219
|
+
const withdraw = (label) => button({ class: 'tekla-changes-linkbtn', 'data-command-id': 'tekla-parser.change-review-finding-withdraw' }, label,
|
|
220
|
+
() => act(forReview, 'withdraw', { decisionId: d.decisionId }, `${label === 'Undo' ? 'Undone' : 'Withdrawn'}. “${view.words.title}” needs a decision again.`, key));
|
|
221
|
+
const lines = [];
|
|
222
|
+
if (d.kind === 'fix') lines.push(el(doc, 'p', { class: 'tekla-changes-finding-record', text: `${viaChat(d) ? 'AI Chat recorded that this will be fixed in Tekla' : 'You said you’d fix this in Tekla'} (${who(d)}, ${day(d.at)}). To check it, save in Tekla, import the model folder again and compare with the same earlier saved state.` }), withdraw('Undo'));
|
|
223
|
+
if (d.kind === 'rfi') lines.push(el(doc, 'p', { class: 'tekla-changes-finding-record', text: `RFI ${d.rfiReference} raised (${who(d)}, ${day(d.at)}).` }), withdraw('Withdraw'));
|
|
224
|
+
if (d.kind === 'accept') lines.push(el(doc, 'p', { class: 'tekla-changes-finding-record' }, el(doc, 'span', { text: 'Going ahead on this assumption: ' }), el(doc, 'q', { text: d.assumption })),
|
|
225
|
+
el(doc, 'p', { class: 'tekla-changes-finding-meta', text: `Recorded by you, ${day(d.at)}. The review now says it proceeds on this assumption.` }), withdraw('Withdraw'));
|
|
226
|
+
if (d.live?.matchesReviewed === 'different') lines.push(el(doc, 'p', { class: 'tekla-changes-finding-meta', text: 'Decided while the model had a newer saved state than the one reviewed.' }));
|
|
227
|
+
return lines;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function choices(view) {
|
|
231
|
+
const forReview = renderingFor;
|
|
232
|
+
const f = view.finding;
|
|
233
|
+
const key = keyOf(f);
|
|
234
|
+
const words = view.words;
|
|
235
|
+
return [
|
|
236
|
+
choice(key, 'fix', 'Fix it in Tekla', 'Change the model, then import and compare again.', () => [
|
|
237
|
+
el(doc, 'p', { class: 'tekla-changes-finding-text', text: words.fix }),
|
|
238
|
+
showButton(view),
|
|
239
|
+
button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-finding-fix-record' }, 'I’ll fix it in Tekla',
|
|
240
|
+
() => act(forReview, 'decisions', { correspondenceKey: key, evidenceFingerprint: f.evidenceFingerprint, kind: 'fix' }, `Recorded: you’re fixing “${words.title}” in Tekla.`, key)),
|
|
241
|
+
el(doc, 'p', { class: 'tekla-changes-finding-meta', text: 'This records that you are fixing it; only a later review can show it fixed.' }),
|
|
242
|
+
]),
|
|
243
|
+
choice(key, 'rfi', 'Raise an RFI', 'Ask the design team, then record the RFI number here.', () => {
|
|
244
|
+
const ref = drafts.rfi[key] ?? '';
|
|
245
|
+
const inputId = `tekla-rfi-ref-${key.slice(0, 12)}`;
|
|
246
|
+
const input = el(doc, 'input', { type: 'text', id: inputId, class: 'tekla-changes-input', maxlength: '80', placeholder: 'e.g. RFI-012', value: ref,
|
|
247
|
+
'data-command-id': 'tekla-parser.change-review-finding-rfi-reference', autocomplete: 'off' });
|
|
248
|
+
const record = () => act(forReview, 'decisions', { correspondenceKey: key, evidenceFingerprint: f.evidenceFingerprint, kind: 'rfi', rfiReference: input.value.trim() },
|
|
249
|
+
`${input.value.trim()} recorded for “${words.title}”.`, key);
|
|
250
|
+
const slot = el(doc, 'div', { class: 'tekla-changes-finding-slot' });
|
|
251
|
+
const paint = () => {
|
|
252
|
+
slot.replaceChildren(input.value.trim()
|
|
253
|
+
? button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-finding-rfi-record' }, 'Record RFI', record)
|
|
254
|
+
: el(doc, 'p', { class: 'tekla-changes-finding-meta', text: 'Raise the RFI with your team, then type its number here.' }));
|
|
255
|
+
};
|
|
256
|
+
input.addEventListener('input', () => { drafts.rfi[key] = input.value; paint(); });
|
|
257
|
+
input.addEventListener('keydown', (event) => { if (event.key === 'Enter' && input.value.trim()) { event.preventDefault(); record(); } });
|
|
258
|
+
paint();
|
|
259
|
+
const copy = button({ class: 'tekla-changes-locate', 'data-command-id': 'tekla-parser.change-review-finding-rfi-copy' }, copied === key ? 'Copied' : 'Copy request', async () => {
|
|
260
|
+
if (!current(forReview)) return;
|
|
261
|
+
let ok = false;
|
|
262
|
+
try { await copyText(view.rfiRequest); ok = true; }
|
|
263
|
+
catch { /* said below */ }
|
|
264
|
+
// Opened another review meanwhile: the copy still happened, but nothing is said or changed over that review.
|
|
265
|
+
if (forReview.gen !== gen) return;
|
|
266
|
+
const mark = {};
|
|
267
|
+
if (ok) { copied = key; copiedMark = mark; }
|
|
268
|
+
live.textContent = ok ? 'Request text copied. Paste it into AI Chat.' : 'The request could not be copied. Select the text and copy it.';
|
|
269
|
+
rerender();
|
|
270
|
+
// Only the latest copy puts the label back.
|
|
271
|
+
if (ok) setTimeout(() => { if (copiedMark === mark) { copied = null; copiedMark = null; rerender(); } }, 2000);
|
|
272
|
+
});
|
|
273
|
+
return [
|
|
274
|
+
el(doc, 'span', { class: 'tekla-changes-picker-label', text: 'Request text for your AI chat' }),
|
|
275
|
+
el(doc, 'pre', { class: 'tekla-changes-request', tabindex: '0', text: view.rfiRequest }),
|
|
276
|
+
copy,
|
|
277
|
+
el(doc, 'label', { class: 'tekla-changes-picker-label', for: inputId, text: 'RFI reference' }), input, slot,
|
|
278
|
+
];
|
|
279
|
+
}),
|
|
280
|
+
choice(key, 'accept', 'Go ahead on an assumption', 'Record what you are assuming and carry on.', () => {
|
|
281
|
+
const text = drafts.assumption[key] ?? '';
|
|
282
|
+
const areaId = `tekla-assume-${key.slice(0, 12)}`;
|
|
283
|
+
const area = el(doc, 'textarea', { id: areaId, class: 'tekla-changes-input tekla-changes-textarea', rows: '3', maxlength: '500',
|
|
284
|
+
'data-command-id': 'tekla-parser.change-review-finding-assumption' });
|
|
285
|
+
area.value = text;
|
|
286
|
+
const countEl = el(doc, 'span', { class: 'tekla-changes-count', text: `${text.length} / 500` });
|
|
287
|
+
const slot = el(doc, 'div', { class: 'tekla-changes-finding-slot' });
|
|
288
|
+
const record = () => act(forReview, 'accept', { correspondenceKey: key, evidenceFingerprint: f.evidenceFingerprint, assumption: area.value.trim() },
|
|
289
|
+
`Going ahead on your assumption for “${words.title}”.`, key);
|
|
290
|
+
const paint = () => {
|
|
291
|
+
countEl.textContent = area.value.length >= 500 ? '500 characters is the limit.' : `${area.value.length} / 500`;
|
|
292
|
+
countEl.classList.toggle('limit', area.value.length >= 500);
|
|
293
|
+
slot.replaceChildren(area.value.trim()
|
|
294
|
+
? button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-finding-accept' }, 'Proceed on this assumption', record)
|
|
295
|
+
: el(doc, 'p', { class: 'tekla-changes-finding-meta', text: 'Write what you are assuming to continue.' }));
|
|
296
|
+
};
|
|
297
|
+
area.addEventListener('input', () => { drafts.assumption[key] = area.value; paint(); });
|
|
298
|
+
area.addEventListener('keydown', (event) => { if (event.key === 'Enter' && (event.ctrlKey || event.metaKey) && area.value.trim()) { event.preventDefault(); record(); } });
|
|
299
|
+
paint();
|
|
300
|
+
return [
|
|
301
|
+
el(doc, 'label', { class: 'tekla-changes-picker-label', for: areaId, text: 'What are you assuming?' }), area, countEl,
|
|
302
|
+
el(doc, 'p', { class: 'tekla-changes-finding-meta', text: 'This is written into the review as your assumption, with your name and the time.' }), slot,
|
|
303
|
+
];
|
|
304
|
+
}),
|
|
305
|
+
];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function card(view) {
|
|
309
|
+
const f = view.finding;
|
|
310
|
+
const key = keyOf(f);
|
|
311
|
+
const open = openKey === key;
|
|
312
|
+
const detailId = `tekla-finding-${key.slice(0, 16)}`;
|
|
313
|
+
const status = STATUS[view.status] || STATUS.open;
|
|
314
|
+
const statusText = view.status === 'rfi' && view.decision?.rfiReference ? `RFI raised (${view.decision.rfiReference})` : status.text;
|
|
315
|
+
const head = button({ class: 'tekla-audit-row tekla-changes-row tekla-changes-finding-head', 'aria-expanded': String(open), 'aria-controls': detailId,
|
|
316
|
+
'data-command-id': 'tekla-parser.change-review-finding', 'data-finding': key }, null, () => {
|
|
317
|
+
// Keep a card with a half-written assumption or reference open: never lose what the person typed.
|
|
318
|
+
if (openKey && openKey !== key && (drafts.assumption[openKey] || drafts.rfi[openKey])) { openKey = key; rerender(); return; }
|
|
319
|
+
openKey = open ? null : key; focusAfter = key; rerender();
|
|
320
|
+
});
|
|
321
|
+
head.append(el(doc, 'strong', { text: view.words.title, 'data-tip': view.words.title }), el(doc, 'span', { text: objectLine(f) }),
|
|
322
|
+
...(view.note ? [el(doc, 'span', { class: 'tekla-changes-finding-note', text: `• ${NOTE[view.note]}` })] : []),
|
|
323
|
+
el(doc, 'span', { class: 'tekla-changes-chips' }, chip(statusText, status.tone, statusText),
|
|
324
|
+
chip(f.presence === 'introduced' ? 'New in this change' : 'Already in the earlier saved state', 'neutral')));
|
|
325
|
+
const detail = open ? el(doc, 'div', { class: 'tekla-changes-detail tekla-changes-finding-detail', id: detailId },
|
|
326
|
+
el(doc, 'p', { class: 'tekla-changes-finding-text muted', text: view.words.why }),
|
|
327
|
+
el(doc, 'p', { class: 'tekla-changes-finding-text' }, el(doc, 'strong', { text: 'What we found: ' }), el(doc, 'span', { text: view.words.evidence })),
|
|
328
|
+
...(view.decision ? [...decided(view), showButton(view)] : [el(doc, 'strong', { class: 'tekla-changes-finding-ask', text: 'What do you want to do?' }), ...choices(view)])) : null;
|
|
329
|
+
if (open) {
|
|
330
|
+
detail.addEventListener('keydown', (event) => {
|
|
331
|
+
if (event.key !== 'Escape') return;
|
|
332
|
+
delete openChoice[key]; focusAfter = key; rerender();
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
return el(doc, 'div', { class: 'tekla-changes-item tekla-changes-finding' }, head, detail);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function gone() {
|
|
339
|
+
const absent = data?.view?.absent ?? [];
|
|
340
|
+
if (!absent.length) return null;
|
|
341
|
+
const section = el(doc, 'details', { class: 'tekla-changes-group' }, el(doc, 'summary', { text: `No longer a finding (${absent.length})` }));
|
|
342
|
+
for (const [transition, heading] of [['fixed', 'Fixed since the last review'], ['resolved-removed', 'Removed with the object'], ['not-rechecked', 'Not checked again']]) {
|
|
343
|
+
const rows = absent.filter((entry) => entry.transition === transition);
|
|
344
|
+
if (!rows.length) continue;
|
|
345
|
+
section.append(el(doc, 'strong', { class: 'tekla-changes-gone-heading', text: heading }));
|
|
346
|
+
for (const entry of rows) {
|
|
347
|
+
section.append(el(doc, 'div', { class: 'tekla-changes-unpaired' },
|
|
348
|
+
el(doc, 'strong', { text: `${transition === 'not-rechecked' ? 'Not checked again: ' : ''}${entry.words.title} — ${wasLine(entry)}` }),
|
|
349
|
+
transition === 'not-rechecked' ? el(doc, 'span', { text: NOT_RECHECKED[entry.reason] || NOT_RECHECKED['not-evaluated'] }) : null));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return section;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** What the checks looked at and what they left out, in full: the review's coverage, never implied. */
|
|
356
|
+
function coverage() {
|
|
357
|
+
if (!data?.view) return null;
|
|
358
|
+
const s = data.scope;
|
|
359
|
+
const lines = [];
|
|
360
|
+
if (s) {
|
|
361
|
+
// The groups can overlap (a changed object can also be re-checked), so no total is claimed.
|
|
362
|
+
lines.push(`Looked at ${plural(s.added, 'added object')} and ${plural(s.changed, 'changed object')}${s.focus ? `, and re-checked ${plural(s.focus, 'object')} from earlier findings` : ''}: ${plural(s.evaluated, 'object was', 'objects were')} checked.`);
|
|
363
|
+
if (s.notApplicable) lines.push(`${plural(s.notApplicable, 'object was', 'objects were')} not the kind these checks apply to.`);
|
|
364
|
+
if (s.excluded) lines.push(`${plural(s.excluded, 'object was', 'objects were')} left out of the checks.`);
|
|
365
|
+
}
|
|
366
|
+
const rules = s?.rules || [];
|
|
367
|
+
for (const line of data.unchecked || []) {
|
|
368
|
+
// AWARE names the check set by its id; say which checks ran instead.
|
|
369
|
+
const m = /^Only the (\d+) rule\(s\) of check profile '[^']*' were run; (.*)$/.exec(line);
|
|
370
|
+
lines.push(m ? `Only ${plural(Number(m[1]), 'check')} ran${rules.length ? ` (${rules.join(', ')})` : ''}; anything ${Number(m[1]) === 1 ? 'it does' : 'they do'} not test was not checked.` : line);
|
|
371
|
+
}
|
|
372
|
+
if (!lines.length) return null;
|
|
373
|
+
return el(doc, 'details', { class: 'tekla-changes-group tekla-changes-coverage' }, el(doc, 'summary', { text: 'What the checks covered' }),
|
|
374
|
+
el(doc, 'ul', { class: 'tekla-audit-omissions' }, ...lines.map((text) => el(doc, 'li', { text }))));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function nodes() {
|
|
378
|
+
// While a review opens nothing is shown for it: no earlier review's controls, and no label it has not earned yet.
|
|
379
|
+
if (!reviewId || loading) return [];
|
|
380
|
+
renderingFor = { reviewId, gen };
|
|
381
|
+
const out = [...gate()];
|
|
382
|
+
const cover = coverage();
|
|
383
|
+
if (cover) out.push(cover);
|
|
384
|
+
const list = views();
|
|
385
|
+
if (data?.view && list.length) {
|
|
386
|
+
pickFilter();
|
|
387
|
+
const c = counts();
|
|
388
|
+
const filters = FILTERS.filter(([id]) => id === 'decide' || id === 'all' || c[id] > 0);
|
|
389
|
+
if (filters.length > 1 && !(filters.length === 2 && c.decide === 0)) {
|
|
390
|
+
out.push(el(doc, 'div', { class: 'tekla-audit-filters tekla-changes-finding-filters', role: 'group', 'aria-label': 'Show findings' },
|
|
391
|
+
...filters.map(([id, label]) => button({ class: 'tekla-audit-filter', 'aria-pressed': String(filter === id), 'data-command-id': 'tekla-parser.change-review-finding-filter' },
|
|
392
|
+
`${label} (${c[id]})`, () => { filter = id; shown = LIMIT; rerender(); }))));
|
|
393
|
+
} else filter = 'all';
|
|
394
|
+
const test = FILTERS.find(([id]) => id === filter)[2];
|
|
395
|
+
// A card decided a moment ago stays in view under its filter until the person moves on.
|
|
396
|
+
const visible = list.filter((v) => test(v) || keyOf(v.finding) === focusAfter || keyOf(v.finding) === openKey)
|
|
397
|
+
.sort((a, b) => (ORDER[a.status] - ORDER[b.status]) || ((a.finding.presence === 'introduced' ? 0 : 1) - (b.finding.presence === 'introduced' ? 0 : 1)));
|
|
398
|
+
if (list.length === 1 && openKey === null && !visible[0]?.decision) openKey = keyOf(list[0].finding);
|
|
399
|
+
const section = el(doc, 'section', { class: 'tekla-audit-list tekla-changes-list tekla-changes-findings', 'aria-label': 'Findings' });
|
|
400
|
+
if (!visible.length) {
|
|
401
|
+
section.append(el(doc, 'p', { class: 'tekla-audit-omissions', text: `Nothing needs a decision. ${plural(list.length, 'finding')} ${list.length === 1 ? 'is' : 'are'} being fixed or have a recorded decision.` }),
|
|
402
|
+
button({ class: 'tekla-changes-linkbtn', 'data-command-id': 'tekla-parser.change-review-finding-filter' }, 'Show all', () => { filter = 'all'; rerender(); }));
|
|
403
|
+
}
|
|
404
|
+
for (const view of visible.slice(0, shown)) section.append(card(view));
|
|
405
|
+
if (visible.length > shown) {
|
|
406
|
+
section.append(el(doc, 'p', { class: 'tekla-audit-omissions', text: `Showing ${shown} of ${visible.length}.` }),
|
|
407
|
+
button({ class: 'tekla-changes-linkbtn', 'data-command-id': 'tekla-parser.change-review-finding-more' }, 'Show 25 more', () => { shown += 25; rerender(); }));
|
|
408
|
+
}
|
|
409
|
+
out.push(section);
|
|
410
|
+
}
|
|
411
|
+
const g = gone();
|
|
412
|
+
if (g) out.push(g);
|
|
413
|
+
return out;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** After a render: put focus back on the card the person just decided (its header), never the top of the panel. */
|
|
417
|
+
function restoreFocus(host) {
|
|
418
|
+
// A choice opened or closed keeps focus on that choice, so Escape and Tab carry on from there.
|
|
419
|
+
const choiceTarget = focusChoice && [...host.querySelectorAll('.tekla-changes-choice')]
|
|
420
|
+
.find((node) => node.dataset.finding === focusChoice.key && node.dataset.choice === focusChoice.id);
|
|
421
|
+
focusChoice = null;
|
|
422
|
+
if (choiceTarget) { focusAfter = null; choiceTarget.focus(); return; }
|
|
423
|
+
if (!focusAfter) return;
|
|
424
|
+
const target = [...host.querySelectorAll('.tekla-changes-finding-head')].find((node) => node.dataset.finding === focusAfter);
|
|
425
|
+
focusAfter = null;
|
|
426
|
+
target?.focus();
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return { load, nodes, restoreFocus, reset: () => { data = null; reviewId = null; failed = null; filter = null; openKey = null; }, state: () => ({ findings: views().length, gate: data?.view?.gate?.kind ?? data?.checks?.state ?? null }) };
|
|
430
|
+
}
|