@floless/app 0.174.1 → 0.175.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/autostart.mjs +117 -10
- package/dist/floless-server.cjs +2 -2
- package/dist/pdf-engine/floless_pdf/__init__.py +7 -3
- package/dist/pdf-engine/floless_pdf/backend_pdfium.py +292 -13
- package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +25 -3
- package/dist/pdf-engine/floless_pdf/images.py +4 -3
- package/dist/pdf-engine/floless_pdf/pages.py +136 -0
- package/dist/schemas/steel.model.v2.schema.json +44 -1
- package/dist/skills/floless-app-approval/SKILL.md +28 -3
- package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
- package/dist/skills/floless-app-sketches/SKILL.md +71 -0
- package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -1
- package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +11 -6
- package/dist/web/agents.js +1 -1
- package/dist/web/app.css +120 -15
- package/dist/web/app.js +89 -38
- package/dist/web/aware-hold.js +10 -0
- package/dist/web/aware.js +405 -51
- package/dist/web/boot-watchdog.js +249 -0
- package/dist/web/card-details.js +88 -0
- package/dist/web/chat.css +29 -0
- package/dist/web/chat.js +430 -128
- package/dist/web/commands-connection-design.js +23 -0
- package/dist/web/commands-revit.js +3 -0
- package/dist/web/commands-shell.js +226 -10
- package/dist/web/commands-steel.js +93 -4
- package/dist/web/commands-tekla-parser.js +21 -1
- package/dist/web/connection-design-editor.html +71 -0
- package/dist/web/connection-design-editor.js +794 -61
- package/dist/web/connection-design-handles.js +9 -3
- package/dist/web/element-approval.js +74 -0
- package/dist/web/element-context.js +76 -6
- package/dist/web/element-geometry.js +8 -2
- package/dist/web/element-holds.js +68 -5
- package/dist/web/element-type-actions.js +22 -3
- package/dist/web/element-types.js +12 -5
- package/dist/web/element-words.js +15 -11
- package/dist/web/grid-place.js +51 -0
- package/dist/web/guide.js +2 -0
- package/dist/web/index.html +13 -16
- package/dist/web/instructor.js +5 -2
- package/dist/web/missed-routines.js +6 -1
- package/dist/web/model-change-findings.js +100 -30
- package/dist/web/model-change-review.js +411 -27
- package/dist/web/model-clash-check.css +100 -0
- package/dist/web/model-clash-check.js +681 -0
- package/dist/web/model-clip-box.js +204 -0
- package/dist/web/model-clip-list.js +153 -3
- package/dist/web/model-clip-session.js +3 -3
- package/dist/web/model-clip-three-overlay.js +135 -25
- package/dist/web/model-editor.css +2 -0
- package/dist/web/model-elements.js +273 -18
- package/dist/web/model-fit-checks.js +354 -0
- package/dist/web/model-spatial-panel.js +9 -3
- package/dist/web/model-spatial-tools.js +12 -3
- package/dist/web/model-tekla-selection.js +74 -0
- package/dist/web/model-view-query.js +70 -14
- package/dist/web/model-viewport-revit-adapter.js +8 -7
- package/dist/web/model-viewport-toolbar.js +8 -4
- package/dist/web/pages.js +78 -1
- package/dist/web/project-history.js +31 -1
- package/dist/web/revit-editor.css +34 -1
- package/dist/web/revit-editor.js +174 -55
- package/dist/web/run-history.js +8 -0
- package/dist/web/sketch-editor.js +141 -2
- package/dist/web/sketches.js +192 -6
- package/dist/web/start-place.js +46 -0
- package/dist/web/steel-3d-core.js +70 -0
- package/dist/web/steel-3d-view.js +288 -47
- package/dist/web/steel-change-review.css +28 -0
- package/dist/web/steel-custom-connection.js +6 -0
- package/dist/web/steel-editor.html +532 -33
- package/dist/web/steel-filter.html +8 -3
- package/dist/web/steel-model-checks.css +76 -0
- package/dist/web/steel-model-v2-commands.js +17 -0
- package/dist/web/steel-view-generation.js +6 -2
- package/dist/web/teams.js +259 -19
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +6 -0
- package/dist/web/vendor/connection-engine.js +886 -91
- package/dist/web/workspaces.js +630 -48
- package/package.json +2 -1
- package/preferences-file.mjs +27 -0
|
@@ -39,7 +39,7 @@ const SOURCE = {
|
|
|
39
39
|
listFailed: 'The versions of this model could not be listed. Close Review changes, open it again, then try once more.', listing: 'Listing the versions of this model…' },
|
|
40
40
|
};
|
|
41
41
|
/** What the version history says a person did to make a version: never who made the changes in it. */
|
|
42
|
-
const VERSION_VERB = { approve: 'approved', 'import-approval': 'imported', rollback: 'restored', rebake: 'rebuilt', 'revision-read': 're-read', discard: 'discarded' };
|
|
42
|
+
const VERSION_VERB = { approve: 'approved', 'import-approval': 'imported', rollback: 'restored', rebake: 'rebuilt', 'revision-read': 're-read', discard: 'discarded', restore: 'restored' };
|
|
43
43
|
|
|
44
44
|
/** A steel object's id as the server escapes it for an entity id (server/change-review/steel-snapshot.ts), undone. */
|
|
45
45
|
export function unescapeSteelId(escaped) {
|
|
@@ -74,11 +74,24 @@ function el(doc, tag, attrs = {}, ...children) {
|
|
|
74
74
|
return node;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
78
|
+
/**
|
|
79
|
+
* A time as the saved-state names show it ("20 Nov, 07:06 UTC"): the same words as server/change-review/tekla-states.ts, in
|
|
80
|
+
* UTC and English whatever the browser's locale, so one mark reads the same on every Team sharing line, row and title.
|
|
81
|
+
*/
|
|
82
|
+
export function utcDay(iso) {
|
|
83
|
+
const date = new Date(iso);
|
|
84
|
+
if (Number.isNaN(date.getTime())) return String(iso);
|
|
85
|
+
const two = (n) => String(n).padStart(2, '0');
|
|
86
|
+
return `${date.getUTCDate()} ${MONTHS[date.getUTCMonth()]}, ${two(date.getUTCHours())}:${two(date.getUTCMinutes())} UTC`;
|
|
87
|
+
}
|
|
77
88
|
const when = (iso) => {
|
|
78
89
|
if (!iso) return 'save time not known';
|
|
79
90
|
try { return new Date(iso).toLocaleString(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }); }
|
|
80
91
|
catch { return iso; }
|
|
81
92
|
};
|
|
93
|
+
/** What a count of changed objects includes that was not compared, in the server's own words: it sits beside the count. */
|
|
94
|
+
const besideCount = (summary) => (summary?.notCompared ? ` (${summary.notCompared})` : '');
|
|
82
95
|
const plural = (n, one, many = `${one}s`) => `${Number(n).toLocaleString()} ${n === 1 ? one : many}`;
|
|
83
96
|
const shown = (value) => {
|
|
84
97
|
if (value === null || value === undefined) return '—';
|
|
@@ -147,6 +160,9 @@ function statePicker(doc, { id, label, states, value, onChange, S, steel }) {
|
|
|
147
160
|
'aria-disabled': state.comparable ? null : 'true', 'data-key': state.key },
|
|
148
161
|
el(doc, 'strong', { text: state.label }), el(doc, 'span', { text: stateLine(state, steel) }),
|
|
149
162
|
by ? el(doc, 'span', { class: 'tekla-changes-option-note', text: by }) : null,
|
|
163
|
+
// S5: the person's marks on this saved state, read-only here (withdrawn from the Marks list, never from the picker).
|
|
164
|
+
...(state.marks || []).map((mark) => el(doc, 'span', { class: 'tekla-changes-chip tekla-changes-mark-chip',
|
|
165
|
+
text: `${mark.kind === 'team-version' ? 'Team version' : 'Before read-in'} · ${mark.byYou ? 'you' : 'another person on this computer'}` })),
|
|
150
166
|
state.comparable ? null : el(doc, 'span', { class: 'tekla-changes-option-note', text: state.notComparable }));
|
|
151
167
|
const pick = () => {
|
|
152
168
|
if (!state.comparable) return;
|
|
@@ -194,6 +210,59 @@ function statePicker(doc, { id, label, states, value, onChange, S, steel }) {
|
|
|
194
210
|
return { node: wrap, value: () => value };
|
|
195
211
|
}
|
|
196
212
|
|
|
213
|
+
/**
|
|
214
|
+
* S5 (#3749): what a person said when marking a team version, in their words or someone else's. The maker and the
|
|
215
|
+
* statement always come from the same comparison, so another person's statement never reads as "you said".
|
|
216
|
+
*/
|
|
217
|
+
const STATEMENT = {
|
|
218
|
+
'none-of-mine-waiting': { you: 'You said none of your changes were waiting to be written out.', they: 'They said none of their changes were waiting to be written out.' },
|
|
219
|
+
'some-of-mine-waiting': { you: 'You said some of your changes were still waiting to be written out. Changes already in the team version are not listed as new; later differences to them can still appear here.',
|
|
220
|
+
they: 'They said some of their changes were still waiting to be written out. Changes already in the team version are not listed as new; later differences to them can still appear here.' },
|
|
221
|
+
'not-sure': { you: 'You were not sure whether any of your changes were waiting to be written out.', they: 'They were not sure whether any of their changes were waiting to be written out.' },
|
|
222
|
+
};
|
|
223
|
+
const WHO_CANT = 'FloLess can’t tell who made each change.';
|
|
224
|
+
const maker = (mark) => (mark?.byYou ? 'you' : 'another person signed in on this computer');
|
|
225
|
+
/** The line at the top of a review made from a mark, from the mark frozen into that review. */
|
|
226
|
+
export function flowLine(review) {
|
|
227
|
+
const flow = review?.flow;
|
|
228
|
+
if (!flow?.mark) return null;
|
|
229
|
+
const at = utcDay(flow.mark.at);
|
|
230
|
+
if (flow.kind === 'came-in') {
|
|
231
|
+
return `Differences found between the saved state ${maker(flow.mark)} marked before read-in on ${at} and ${review.revised?.label || 'the later saved state'}. They may include changes from a read-in and modelling in between. ${WHO_CANT}`;
|
|
232
|
+
}
|
|
233
|
+
const said = STATEMENT[flow.mark.statement]?.[flow.mark.byYou ? 'you' : 'they'] || '';
|
|
234
|
+
return `Changes since the team version ${maker(flow.mark)} marked on ${at}. ${said} ${WHO_CANT}`.replace(/\s+/g, ' ').trim();
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* What a review made from a mark is "since", named by the mark it used and the time the person made it, never by the
|
|
238
|
+
* label of the saved state: a state a later import replaced can carry both marks, and its label then names only one.
|
|
239
|
+
* `short` is the history row's form. Null when the review was not made from a mark.
|
|
240
|
+
*/
|
|
241
|
+
export function flowTitle(review, short = false) {
|
|
242
|
+
const flow = review?.flow;
|
|
243
|
+
if (!flow?.mark || (flow.kind !== 'my-changes' && flow.kind !== 'came-in')) return null;
|
|
244
|
+
const mine = flow.kind === 'my-changes';
|
|
245
|
+
const lead = mine ? (short ? 'Since the team version' : 'Changes since the team version') : 'What came in since the before-read-in mark';
|
|
246
|
+
return `${lead} (marked ${utcDay(flow.mark.at)}) → ${review.revised.label}`;
|
|
247
|
+
}
|
|
248
|
+
/** The saved state a mark row is about: a replaced one is named by what it is, never by whichever of its marks came first. */
|
|
249
|
+
const markedState = (mark) => (String(mark.state.key).startsWith('m-') ? 'Earlier saved state' : mark.state.label);
|
|
250
|
+
const MARK_NAME = { 'team-version': 'Team version', 'before-read-in': 'Before read-in' };
|
|
251
|
+
const BUSY_PRESS = 'A comparison is still running. Try again when it finishes.';
|
|
252
|
+
const NO_MARK = {
|
|
253
|
+
'my-changes': 'No team version is marked for this model yet, so there is nothing to review your changes against. After your next read-in, save in Tekla, import the model and mark it as the team version; or pick two saved states below.',
|
|
254
|
+
'came-in': 'No saved state is marked before read-in for this model yet. Before your next read-in, save in Tekla, import the model and mark it; or pick two saved states below.',
|
|
255
|
+
};
|
|
256
|
+
const TEAM_TIP = {
|
|
257
|
+
'came-in': 'Compare the saved state you marked before read-in with the working state. It does not say who made each change.',
|
|
258
|
+
'my-changes': 'Compare the latest team version you marked with the working state, before you write out.',
|
|
259
|
+
markTeam: 'Say this saved state is the team version, and whether any of your own changes were still waiting. Only you can do this.',
|
|
260
|
+
markBefore: 'Mark this saved state as the one from before your read-in. Only you can do this.',
|
|
261
|
+
marks: 'Show the team version and before-read-in marks on this model, with who made each and when.',
|
|
262
|
+
withdraw: 'Take this mark back. You are asked to confirm first, and reviews already made keep what they recorded.',
|
|
263
|
+
};
|
|
264
|
+
const KEPT_HERE = 'This mark is kept in this FloLess project on this computer. It is not sent through Model Sharing.';
|
|
265
|
+
|
|
197
266
|
/** A history row's word on the checks: how many findings, never a claim that a review is clean. */
|
|
198
267
|
function checksNote(item) {
|
|
199
268
|
const c = item.checks;
|
|
@@ -209,7 +278,7 @@ function checksNote(item) {
|
|
|
209
278
|
* `{ selected, note }` when it has something to say about what it showed (the steel editor shows the model as it is
|
|
210
279
|
* now, which may not be the version the row came from); it rejects with a plain sentence when it could not.
|
|
211
280
|
*/
|
|
212
|
-
export function mountChangeReview({ host, doc = document, projectId, fetchJson, locate, onStateChanged = () => {}, clipboard = null, source = 'tekla', hasUnsavedEdits = null }) {
|
|
281
|
+
export function mountChangeReview({ host, doc = document, projectId, fetchJson, locate, onStateChanged = () => {}, clipboard = null, source = 'tekla', hasUnsavedEdits = null, reimport = null }) {
|
|
213
282
|
const S = SOURCE[source] || SOURCE.tekla;
|
|
214
283
|
const steel = S === SOURCE.steel;
|
|
215
284
|
const cid = (name) => `${S.commands}.change-review-${name}`;
|
|
@@ -227,13 +296,27 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
227
296
|
let listedOnce = false; // a reload keeps what is on screen; only the first listing shows the loading line
|
|
228
297
|
let listFailed = null; // why the listing failed, while no listing has succeeded yet: its own state, with nothing else beside it
|
|
229
298
|
let message = null;
|
|
299
|
+
let messageNode = null;
|
|
230
300
|
// Steel only: the server's warning before a compare, with the choices it offers; and what its history said.
|
|
231
301
|
let ask = null;
|
|
232
302
|
let focusAsk = false;
|
|
233
303
|
let focusPicker = false;
|
|
304
|
+
/** #4103: the reviews whose save-history disagreement the person chose to keep as recorded (this window only). */
|
|
305
|
+
const witnessKept = new Set();
|
|
306
|
+
let focusWitnessKept = false;
|
|
234
307
|
let ledger = null;
|
|
235
308
|
// The warnings a person may go on past, as the server's listing names them (server/change-review/steel-proceed.ts).
|
|
236
309
|
let proceedReasons = [];
|
|
310
|
+
// S5 (#3749), Tekla only: the server's starting picks for each flow, the marks' own state, the open mark panel, and
|
|
311
|
+
// a note the strip shows (no mark yet, nothing new yet).
|
|
312
|
+
let teamDefaults = null;
|
|
313
|
+
let marksState = { state: 'ok', message: null };
|
|
314
|
+
let teamPanel = null;
|
|
315
|
+
let teamNote = null;
|
|
316
|
+
let busyPress = false; // a Team sharing press that came in while something else was running: told, never dropped
|
|
317
|
+
let busyEcho = false;
|
|
318
|
+
let busyText = BUSY_PRESS; // what is running, in the person's words: the sentence a press during it is answered with
|
|
319
|
+
let focusTeam = null;
|
|
237
320
|
const live = el(doc, 'div', { class: 'tekla-changes-live', role: 'status', 'aria-live': 'polite' });
|
|
238
321
|
/** What the page's `locate` answered, as the ids it selected; anything it has to say is shown as a note. */
|
|
239
322
|
const located = (answer) => {
|
|
@@ -241,14 +324,22 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
241
324
|
if (typeof answer.note === 'string' && answer.note) live.textContent = answer.note;
|
|
242
325
|
return answer.selected;
|
|
243
326
|
};
|
|
327
|
+
// #4008: what an earlier Show in 3D said (in the line or the message) is not true of what is shown now. Any other
|
|
328
|
+
// message stays, and nothing is drawn again, so the open row and the focus stay where they are.
|
|
329
|
+
let locateSaid = '';
|
|
330
|
+
const locateSays = (text) => { live.textContent = locateSaid = text; };
|
|
331
|
+
const shownNow = () => {
|
|
332
|
+
if (live.textContent === locateSaid) live.textContent = '';
|
|
333
|
+
if (message?.located) { message = null; messageNode?.remove(); }
|
|
334
|
+
};
|
|
244
335
|
// S2 (#3461): what the checks found, and the person's decisions on it.
|
|
245
|
-
const findings = createFindings({ doc, el, api: (path, options) => fetchJson(path, options), projectId, live, clipboard, source, cid,
|
|
336
|
+
const findings = createFindings({ locateSays, shownNow, doc, el, api: (path, options) => fetchJson(path, options), projectId, live, clipboard, source, cid,
|
|
246
337
|
locate: async (target) => located(await locate(target)),
|
|
247
338
|
// Steel: the places where members meet at their work point through a connection. Never a clash, never clean.
|
|
248
339
|
zones: () => (steel && Array.isArray(review?.steel?.connectionZones) ? review.steel.connectionZones : [])
|
|
249
340
|
.filter((zone) => zone && typeof zone.label === 'string' && zone.label)
|
|
250
341
|
.map((zone) => ({ label: zone.label, entityIds: (Array.isArray(zone.members) ? zone.members : []).filter((id) => typeof id === 'string' && id).map((id) => steelEntityId('member', id)) })),
|
|
251
|
-
sideState: (side) => sideState(side), rerender: () => render(), focusCompare: () => host.querySelector('.tekla-changes-compare')?.focus() });
|
|
342
|
+
sideState: (side) => sideState(side), parseEntity: parseSteelEntityId, rerender: () => render(), focusCompare: () => host.querySelector('.tekla-changes-compare')?.focus() });
|
|
252
343
|
|
|
253
344
|
const api = (path, options) => fetchJson(path, options);
|
|
254
345
|
// S4 (#3536): the firm's standards, above the findings.
|
|
@@ -263,8 +354,12 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
263
354
|
if (steel && Array.isArray(listed.proceedReasons)) proceedReasons = listed.proceedReasons.filter((name) => typeof name === 'string');
|
|
264
355
|
const comparable = states.filter((state) => state.comparable);
|
|
265
356
|
const usable = (key) => comparable.some((state) => state.key === key);
|
|
266
|
-
if (steel) {
|
|
267
|
-
|
|
357
|
+
if (!steel) {
|
|
358
|
+
teamDefaults = listed.defaults ?? null;
|
|
359
|
+
marksState = listed.marks ?? { state: 'ok', message: null };
|
|
360
|
+
}
|
|
361
|
+
if (listed.defaults) {
|
|
362
|
+
// The server's own starting pair (steel: the last approved version and the draft; Tekla: the working state and the one before).
|
|
268
363
|
if (!usable(picks.revised)) picks.revised = usable(listed.defaults?.revised) ? listed.defaults.revised : comparable.at(-1)?.key ?? null;
|
|
269
364
|
if (!usable(picks.base) || picks.base === picks.revised) {
|
|
270
365
|
picks.base = usable(listed.defaults?.base) && listed.defaults.base !== picks.revised ? listed.defaults.base
|
|
@@ -314,7 +409,7 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
314
409
|
*/
|
|
315
410
|
async function compare(going = null) {
|
|
316
411
|
if (busy || !picks.base || !picks.revised) return;
|
|
317
|
-
busy = true; message = null; ask = null; render();
|
|
412
|
+
busy = true; busyText = BUSY_PRESS; message = null; ask = null; render();
|
|
318
413
|
// If the person picks a review before this finishes, the comparison is listed but neither opened, announced nor
|
|
319
414
|
// reported over that review. Only opening a review moves the pick, so nothing is ever left half open.
|
|
320
415
|
const token = pick;
|
|
@@ -337,8 +432,8 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
337
432
|
focusResult = true;
|
|
338
433
|
const s = reply.review.summary;
|
|
339
434
|
live.textContent = !s ? 'Compared.' : !steel && reply.review.parserParity === 'differs'
|
|
340
|
-
? `Compared, read by different versions of FloLess: ${s.added} only in the later state, ${s.removed} only in the earlier, ${s.changed} may differ.`
|
|
341
|
-
: `Compared: ${s.added} added, ${s.removed} removed, ${s.changed} changed.`;
|
|
435
|
+
? `Compared, read by different versions of FloLess: ${s.added} only in the later state, ${s.removed} only in the earlier, ${s.changed} may differ${besideCount(s)}.`
|
|
436
|
+
: `Compared: ${s.added} added, ${s.removed} removed, ${s.changed} changed${besideCount(s)}.`;
|
|
342
437
|
} catch (error) {
|
|
343
438
|
if (token !== pick) return;
|
|
344
439
|
focusResult = true;
|
|
@@ -350,7 +445,7 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
350
445
|
live.textContent = '';
|
|
351
446
|
} finally {
|
|
352
447
|
busy = false; render(); onStateChanged();
|
|
353
|
-
if (focusResult) host.querySelector('.tekla-changes-
|
|
448
|
+
if (focusResult) host.querySelector('.tekla-changes-review-title')?.focus();
|
|
354
449
|
}
|
|
355
450
|
}
|
|
356
451
|
|
|
@@ -387,6 +482,194 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
387
482
|
return true;
|
|
388
483
|
}
|
|
389
484
|
|
|
485
|
+
/** A press while another flow, mark or withdraw is running is never a silent no-op: say so, in sight and in the live region. */
|
|
486
|
+
function pressedWhileBusy(focusKey) {
|
|
487
|
+
busyPress = true; busyEcho = !busyEcho;
|
|
488
|
+
teamNote = null;
|
|
489
|
+
// The same sentence twice in a row is not announced again, so a repeat press alternates a trailing no-break space.
|
|
490
|
+
live.textContent = busyText + (busyEcho ? ' ' : '');
|
|
491
|
+
focusTeam = focusKey;
|
|
492
|
+
render();
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** S5: "Review my changes" / "What came in": the server compares the latest mark of that kind with the working state. */
|
|
496
|
+
async function runFlow(kind) {
|
|
497
|
+
if (busy) { pressedWhileBusy(kind); return; }
|
|
498
|
+
const flow = kind === 'my-changes' ? teamDefaults?.myChanges : teamDefaults?.cameIn;
|
|
499
|
+
teamPanel = null; message = null;
|
|
500
|
+
if (marksState.state !== 'ok') { teamNote = { kind: 'warning', flow: kind, text: marksState.message || 'Your marks could not be read just now.' }; focusTeam = 'note'; render(); return; }
|
|
501
|
+
if (!flow?.mark) { teamNote = { kind: 'info', flow: kind, text: NO_MARK[kind] }; focusTeam = 'note'; render(); return; }
|
|
502
|
+
teamNote = null; busy = true; busyText = BUSY_PRESS; render();
|
|
503
|
+
const token = pick;
|
|
504
|
+
let focusResult = false;
|
|
505
|
+
live.textContent = kind === 'my-changes' ? 'Reviewing your changes since the team version…' : 'Comparing with your before-read-in mark…';
|
|
506
|
+
try {
|
|
507
|
+
const reply = await api(`/api/change-review/tekla/${encodeURIComponent(projectId)}/flow`, {
|
|
508
|
+
method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ kind, markId: flow.mark.markId }) });
|
|
509
|
+
if (reply.nothingNew) { teamNote = { kind: 'info', flow: kind, text: reply.message }; focusTeam = 'note'; live.textContent = ''; return; }
|
|
510
|
+
if (own(reply.review)) reviews = [reply.review, ...reviews.filter((item) => item.reviewId !== reply.review.reviewId)];
|
|
511
|
+
if (token !== pick || !(await openReview(reply.review))) return;
|
|
512
|
+
focusResult = true;
|
|
513
|
+
const r = reply.review.summary;
|
|
514
|
+
live.textContent = r ? `Reviewed: ${r.added} added, ${r.removed} removed, ${r.changed} changed.` : 'Reviewed.';
|
|
515
|
+
} catch (error) {
|
|
516
|
+
if (token !== pick) return;
|
|
517
|
+
const code = error?.body?.code;
|
|
518
|
+
if (error?.status === 403) refusal = { module: error.body?.module ?? null, code: error.body?.code ?? null, text: error.body?.userMessage || error.message };
|
|
519
|
+
else if (['mark-changed', 'no-mark', 'marks-damaged', 'marks-unreadable', 'state-changed'].includes(code)) {
|
|
520
|
+
await load(); teamNote = { kind: 'warning', flow: kind, text: error.body.userMessage }; focusTeam = 'note';
|
|
521
|
+
} else message = { kind: 'error', text: error?.body?.userMessage || 'The review could not be finished. Try again; if it keeps happening, use Report an issue.' };
|
|
522
|
+
live.textContent = '';
|
|
523
|
+
} finally {
|
|
524
|
+
busy = false; render(); onStateChanged();
|
|
525
|
+
if (focusResult) host.querySelector('.tekla-changes-review-title')?.focus();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** S5: mark the working state (team version with the person's statement, or before read-in). The person's own act. */
|
|
530
|
+
async function makeMark(kind, statement = null) {
|
|
531
|
+
const working = states.find((state) => state.key === teamDefaults?.working);
|
|
532
|
+
if (busy) { pressedWhileBusy(kind === 'team-version' ? 'mark-team' : 'mark-before'); return; }
|
|
533
|
+
if (!working) return;
|
|
534
|
+
busy = true; busyText = 'Your mark is still being saved. Try again when it finishes.'; render();
|
|
535
|
+
try {
|
|
536
|
+
await api(`/api/change-review/tekla/${encodeURIComponent(projectId)}/marks`, {
|
|
537
|
+
method: 'POST', headers: { 'content-type': 'application/json' },
|
|
538
|
+
body: JSON.stringify({ state: working.key, revisionId: working.revisionId, kind, ...(kind === 'team-version' ? { statement } : {}) }) });
|
|
539
|
+
teamPanel = null; teamNote = null;
|
|
540
|
+
live.textContent = kind === 'team-version' ? `Marked ${working.label} as the team version.` : `Marked ${working.label} as before read-in.`;
|
|
541
|
+
await load();
|
|
542
|
+
focusTeam = kind === 'team-version' ? 'my-changes' : 'mark-before';
|
|
543
|
+
} catch (error) {
|
|
544
|
+
teamPanel = { ...teamPanel, error: error?.body?.userMessage || 'The mark could not be saved. Try again; if it keeps happening, use Report an issue.' };
|
|
545
|
+
if (['state-changed', 'state-not-in-project', 'state-not-comparable', 'marks-damaged', 'marks-unreadable'].includes(error?.body?.code)) await load();
|
|
546
|
+
} finally { busy = false; render(); }
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
async function withdrawMark(markId) {
|
|
550
|
+
if (busy) { pressedWhileBusy('marks'); return; }
|
|
551
|
+
busy = true; busyText = 'A mark is still being withdrawn. Try again when it finishes.'; render();
|
|
552
|
+
try {
|
|
553
|
+
await api(`/api/change-review/tekla/${encodeURIComponent(projectId)}/marks/${encodeURIComponent(markId)}/withdraw`, {
|
|
554
|
+
method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });
|
|
555
|
+
teamPanel = null; live.textContent = 'Mark withdrawn. Reviews already made keep the mark they started from.';
|
|
556
|
+
await load(); focusTeam = 'marks';
|
|
557
|
+
} catch (error) {
|
|
558
|
+
teamPanel = { ...teamPanel, error: error?.body?.userMessage || 'The mark could not be withdrawn. Reload the Changes tab and try again.' };
|
|
559
|
+
await load();
|
|
560
|
+
} finally { busy = false; render(); }
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
async function restartMarks() {
|
|
564
|
+
if (busy) { pressedWhileBusy('mark-team'); return; }
|
|
565
|
+
busy = true; busyText = 'The marks are still being restarted. Try again when it finishes.'; render();
|
|
566
|
+
try {
|
|
567
|
+
await api(`/api/change-review/tekla/${encodeURIComponent(projectId)}/marks/restart`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });
|
|
568
|
+
teamPanel = null; live.textContent = 'Marks started again. The old marks are kept beside the new ones.';
|
|
569
|
+
await load(); focusTeam = 'mark-team';
|
|
570
|
+
} catch (error) {
|
|
571
|
+
teamPanel = { ...teamPanel, error: error?.body?.userMessage || 'The marks could not be started again. Try again; if it keeps happening, use Report an issue.' };
|
|
572
|
+
} finally { busy = false; render(); }
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** S5: the "Team sharing" strip above the pickers (Tekla only, so its command ids are the Tekla page's own). Every control explains itself; none is disabled. */
|
|
576
|
+
function renderTeam() {
|
|
577
|
+
const button = (attrs, text, onclick) => el(doc, 'button', { type: 'button', ...attrs, onclick }, text);
|
|
578
|
+
const working = states.find((state) => state.key === teamDefaults?.working) || null;
|
|
579
|
+
const allMarks = states.flatMap((state) => (state.marks || []).map((mark) => ({ ...mark, state })))
|
|
580
|
+
.sort((a, b) => String(a.at).localeCompare(String(b.at)));
|
|
581
|
+
const pairLine = (flow) => {
|
|
582
|
+
const mark = flow?.mark ? allMarks.find((item) => item.markId === flow.mark.markId) : null;
|
|
583
|
+
return mark ? `${utcDay(mark.at)} → ${working ? working.label : 'the working state'}` : 'Not marked yet';
|
|
584
|
+
};
|
|
585
|
+
const flowButton = (kind, label, caption, flow) => el(doc, 'div', { class: 'tekla-changes-team-flow' },
|
|
586
|
+
button({ class: 'tekla-changes-team-run', 'data-command-id': `tekla-parser.change-review-${kind}`, 'data-tip': TEAM_TIP[kind], 'data-team-focus': kind, 'aria-busy': busy ? 'true' : null,
|
|
587
|
+
'aria-describedby': `${S.dom}-${kind}-pair` }, label, () => runFlow(kind)),
|
|
588
|
+
el(doc, 'span', { class: 'tekla-changes-picker-label', text: caption }),
|
|
589
|
+
el(doc, 'span', { class: 'tekla-changes-team-pair', id: `${S.dom}-${kind}-pair`, text: pairLine(flow) }));
|
|
590
|
+
const kids = [
|
|
591
|
+
el(doc, 'strong', { class: 'tekla-changes-team-title', text: 'Team sharing' }),
|
|
592
|
+
el(doc, 'div', { class: 'tekla-changes-team-flows' },
|
|
593
|
+
flowButton('came-in', 'What came in', 'Since your before-read-in mark', teamDefaults?.cameIn),
|
|
594
|
+
flowButton('my-changes', 'Review my changes', 'Since the team version', teamDefaults?.myChanges)),
|
|
595
|
+
];
|
|
596
|
+
if (busy && busyPress) {
|
|
597
|
+
// No role of its own: the live line above carries the announcement, so a screen reader hears it once.
|
|
598
|
+
kids.push(el(doc, 'div', { class: 'tekla-changes-team-note', 'data-team-busy': 'true' }, el(doc, 'span', { text: busyText })));
|
|
599
|
+
}
|
|
600
|
+
if (teamNote) {
|
|
601
|
+
kids.push(el(doc, 'div', { class: `tekla-changes-team-note${teamNote.kind === 'warning' ? ' warn' : ''}`, role: 'status', tabindex: '-1', 'data-team-focus': 'note' },
|
|
602
|
+
el(doc, 'span', { text: teamNote.text }),
|
|
603
|
+
button({ class: 'tekla-changes-team-link', 'data-command-id': 'tekla-parser.change-review-team-pick-two' }, 'Pick two saved states instead', () => { teamNote = null; focusPicker = true; render(); })));
|
|
604
|
+
}
|
|
605
|
+
if (marksState.state === 'unreadable') {
|
|
606
|
+
// Not damage: nothing is set aside, so the only choice is to try reading them again.
|
|
607
|
+
kids.push(el(doc, 'section', { class: 'tekla-changes-banner warn', role: 'note', 'aria-label': 'Marks could not be read just now' },
|
|
608
|
+
el(doc, 'strong', { text: '⚠ Your marks could not be read just now' }), el(doc, 'span', { text: marksState.message || '' }),
|
|
609
|
+
el(doc, 'div', { class: 'tekla-changes-finding-actions' },
|
|
610
|
+
button({ 'data-command-id': 'tekla-parser.change-review-marks-retry', 'data-team-focus': 'mark-team' }, 'Try again', async () => { await load(); focusTeam = 'mark-team'; render(); }))));
|
|
611
|
+
return el(doc, 'section', { class: 'tekla-changes-team', 'aria-label': 'Team sharing' }, kids);
|
|
612
|
+
}
|
|
613
|
+
if (marksState.state === 'damaged') {
|
|
614
|
+
const confirming = teamPanel?.phase === 'restart';
|
|
615
|
+
kids.push(el(doc, 'section', { class: 'tekla-changes-banner warn', role: 'note', 'aria-label': 'Marks could not be read' },
|
|
616
|
+
el(doc, 'strong', { text: '⚠ Your marks could not be read' }), el(doc, 'span', { text: marksState.message || '' }),
|
|
617
|
+
confirming ? el(doc, 'span', { text: 'Start the marks again? Every mark is reset; reviews already made keep the marks they started from.' }) : null,
|
|
618
|
+
teamPanel?.error ? el(doc, 'span', { role: 'alert', text: teamPanel.error }) : null,
|
|
619
|
+
el(doc, 'div', { class: 'tekla-changes-finding-actions' }, confirming
|
|
620
|
+
? [button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-marks-restart-confirm', 'aria-busy': busy ? 'true' : null }, busy ? 'Starting again…' : 'Start the marks again', () => restartMarks()),
|
|
621
|
+
button({ class: 'tekla-changes-cancel', 'data-command-id': 'tekla-parser.change-review-mark-cancel' }, 'Cancel', () => { teamPanel = null; render(); })]
|
|
622
|
+
: button({ 'data-command-id': 'tekla-parser.change-review-marks-restart', 'data-team-focus': 'mark-team' }, 'Start the marks again…', () => { teamPanel = { phase: 'restart' }; render(); }))));
|
|
623
|
+
return el(doc, 'section', { class: 'tekla-changes-team', 'aria-label': 'Team sharing' }, kids);
|
|
624
|
+
}
|
|
625
|
+
if (teamPanel?.phase === 'team' || teamPanel?.phase === 'before') {
|
|
626
|
+
const team = teamPanel.phase === 'team';
|
|
627
|
+
const heading = el(doc, 'h4', { class: 'tekla-changes-standards-heading', id: `${S.dom}-mark-title`, tabindex: '-1',
|
|
628
|
+
text: team ? 'Did you just read in? Are any of your own changes still waiting to be written out?' : 'Mark this saved state as before read-in?' });
|
|
629
|
+
const answers = team
|
|
630
|
+
? Object.entries({ 'none-of-mine-waiting': 'None of mine are waiting', 'some-of-mine-waiting': 'Some of mine are waiting', 'not-sure': 'Not sure' })
|
|
631
|
+
.map(([statement, label]) => button({ class: 'tekla-changes-team-answer', 'data-command-id': 'tekla-parser.change-review-mark-team-answer', 'data-statement': statement,
|
|
632
|
+
'aria-busy': busy ? 'true' : null }, label, () => makeMark('team-version', statement)))
|
|
633
|
+
: [button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-mark-before-confirm', 'aria-busy': busy ? 'true' : null }, busy ? 'Marking…' : 'Mark before read-in', () => makeMark('before-read-in'))];
|
|
634
|
+
const panel = el(doc, 'div', { class: 'tekla-changes-standards-panel tekla-changes-mark-panel', role: 'group', 'aria-labelledby': `${S.dom}-mark-title`,
|
|
635
|
+
onkeydown: (event) => { if (event.key === 'Escape') { event.stopPropagation(); teamPanel = null; focusTeam = team ? 'mark-team' : 'mark-before'; render(); } } },
|
|
636
|
+
heading,
|
|
637
|
+
el(doc, 'p', { class: 'tekla-changes-finding-meta', text: working ? `Marks ${working.label}${working.savedAt ? `, saved ${utcDay(working.savedAt)}` : ''}.` : 'Marks the working state.' }),
|
|
638
|
+
team ? null : el(doc, 'p', { class: 'tekla-changes-finding-meta', text: 'Do this before the read-in: save in Tekla and import the model, mark it, then read in.' }),
|
|
639
|
+
el(doc, 'p', { class: 'tekla-changes-finding-meta', text: KEPT_HERE }),
|
|
640
|
+
teamPanel.error ? el(doc, 'p', { class: 'tekla-changes-finding-text', role: 'alert', text: teamPanel.error }) : null,
|
|
641
|
+
el(doc, 'div', { class: 'tekla-changes-finding-actions' }, ...answers,
|
|
642
|
+
button({ class: 'tekla-changes-cancel', 'data-command-id': 'tekla-parser.change-review-mark-cancel' }, 'Cancel', () => { teamPanel = null; focusTeam = team ? 'mark-team' : 'mark-before'; render(); })));
|
|
643
|
+
kids.push(panel);
|
|
644
|
+
} else {
|
|
645
|
+
kids.push(el(doc, 'div', { class: 'tekla-changes-team-marking' },
|
|
646
|
+
button({ class: 'tekla-changes-team-mark', 'data-command-id': 'tekla-parser.change-review-mark-team-version', 'data-tip': TEAM_TIP.markTeam, 'data-team-focus': 'mark-team' }, 'Mark this as the team version…', () => {
|
|
647
|
+
if (!working) { teamNote = { kind: 'info', text: 'There is no saved state to mark yet. Save your model in Tekla, then import the model folder.' }; render(); return; }
|
|
648
|
+
teamPanel = { phase: 'team' }; teamNote = null; render(); host.querySelector('.tekla-changes-team-answer')?.focus(); }),
|
|
649
|
+
button({ class: 'tekla-changes-team-mark', 'data-command-id': 'tekla-parser.change-review-mark-before-read-in', 'data-tip': TEAM_TIP.markBefore, 'data-team-focus': 'mark-before' }, 'Mark before read-in…', () => {
|
|
650
|
+
if (!working) { teamNote = { kind: 'info', text: 'There is no saved state to mark yet. Save your model in Tekla, then import the model folder.' }; render(); return; }
|
|
651
|
+
teamPanel = { phase: 'before' }; teamNote = null; render(); host.querySelector('.tekla-changes-mark-panel .primary')?.focus(); })));
|
|
652
|
+
}
|
|
653
|
+
if (allMarks.length) {
|
|
654
|
+
const list = el(doc, 'details', { class: 'tekla-changes-marks', open: teamPanel?.phase === 'withdraw' ? true : null },
|
|
655
|
+
el(doc, 'summary', { 'data-command-id': 'tekla-parser.change-review-marks', 'data-tip': TEAM_TIP.marks, 'data-team-focus': 'marks', text: `Marks (${allMarks.length})` }));
|
|
656
|
+
for (const mark of [...allMarks].reverse()) {
|
|
657
|
+
const confirming = teamPanel?.phase === 'withdraw' && teamPanel.markId === mark.markId;
|
|
658
|
+
list.append(el(doc, 'div', { class: 'tekla-changes-mark-row' },
|
|
659
|
+
el(doc, 'strong', { text: `${MARK_NAME[mark.kind]} · ${mark.byYou ? 'you' : 'another person on this computer'} · ${utcDay(mark.at)}` }),
|
|
660
|
+
el(doc, 'span', { text: mark.kind === 'team-version' ? `${markedState(mark)}. ${STATEMENT[mark.statement]?.[mark.byYou ? 'you' : 'they'] || ''}` : markedState(mark) }),
|
|
661
|
+
confirming ? el(doc, 'span', { text: 'Withdraw this mark? Reviews already made keep what they recorded.' }) : null,
|
|
662
|
+
confirming && teamPanel.error ? el(doc, 'span', { role: 'alert', text: teamPanel.error }) : null,
|
|
663
|
+
el(doc, 'div', { class: 'tekla-changes-finding-actions' }, confirming
|
|
664
|
+
? [button({ class: 'primary', 'data-command-id': 'tekla-parser.change-review-mark-withdraw-confirm', 'aria-busy': busy ? 'true' : null }, busy ? 'Withdrawing…' : 'Withdraw', () => withdrawMark(mark.markId)),
|
|
665
|
+
button({ class: 'tekla-changes-cancel', 'data-command-id': 'tekla-parser.change-review-mark-cancel' }, 'Keep', () => { teamPanel = null; render(); })]
|
|
666
|
+
: button({ class: 'tekla-changes-team-link', 'data-command-id': 'tekla-parser.change-review-mark-withdraw', 'data-tip': TEAM_TIP.withdraw }, 'Withdraw…', () => { teamPanel = { phase: 'withdraw', markId: mark.markId }; render(); }))));
|
|
667
|
+
}
|
|
668
|
+
kids.push(list);
|
|
669
|
+
}
|
|
670
|
+
return el(doc, 'section', { class: 'tekla-changes-team', 'aria-label': 'Team sharing' }, kids);
|
|
671
|
+
}
|
|
672
|
+
|
|
390
673
|
function sideState(side) {
|
|
391
674
|
// A steel side is a version or the draft, named by its key; a Tekla side is one imported revision.
|
|
392
675
|
if (steel) return states.find((state) => state.key === review?.[side]?.stateKey) || null;
|
|
@@ -405,6 +688,8 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
405
688
|
const detailId = `${steel ? 'steel' : 'tekla'}-change-${row.status}-${row.identity.replace(/[^A-Za-z0-9_-]/g, '_')}`;
|
|
406
689
|
// #3883: a chip can ellipsize in a narrow row; its whole words stay in its tip.
|
|
407
690
|
const kinds = (row.kinds || []).map((kind) => el(doc, 'span', { class: 'tekla-changes-chip', text: KIND_LABEL[kind] || kind, 'data-tip': KIND_LABEL[kind] || kind }));
|
|
691
|
+
// #4008: a bounding box in one saved state only was not compared: the server says so, and the row never reads as a move.
|
|
692
|
+
if (row.notCompared) kinds.push(el(doc, 'span', { class: 'tekla-changes-chip', text: 'Bounding box not compared', 'data-tip': row.notCompared }));
|
|
408
693
|
const name = rowName(row);
|
|
409
694
|
const toggle = el(doc, 'button', { type: 'button', class: 'tekla-audit-row tekla-changes-row', 'aria-expanded': 'false', 'aria-controls': detailId,
|
|
410
695
|
'data-command-id': cid('row') },
|
|
@@ -425,19 +710,20 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
425
710
|
// The steel editor shows the model as it is now, so it needs no saved state to open: it says so itself when
|
|
426
711
|
// the object is not there (removed, or changed since).
|
|
427
712
|
if ((!target && !steel) || !entityId) {
|
|
428
|
-
message = { kind: 'error', text: `That ${S.noun} is no longer part of this project, so this object cannot be shown in 3D.` }; render(); return;
|
|
713
|
+
message = { located: true, kind: 'error', text: `That ${S.noun} is no longer part of this project, so this object cannot be shown in 3D.` }; render(); return;
|
|
429
714
|
}
|
|
430
715
|
show.disabled = true;
|
|
431
716
|
try {
|
|
432
717
|
const answer = await locate({ state: target, entityId });
|
|
433
718
|
// null: the editor was asked for something else meanwhile, so nothing is said about this one.
|
|
719
|
+
if (shownPick === pick && (answer?.selected ?? answer)?.length) shownNow();
|
|
434
720
|
if (shownPick === pick && steel && answer !== null) { message = null; live.textContent = (!Array.isArray(answer) && answer?.note) || `Showing ${name} in 3D.`; }
|
|
435
721
|
}
|
|
436
722
|
catch (error) {
|
|
437
723
|
if (shownPick === pick) {
|
|
438
724
|
// A sentence the editor wrote for the person (the object was removed, is hidden, is filtered out) is a
|
|
439
725
|
// plain answer, not a fault.
|
|
440
|
-
message = {
|
|
726
|
+
message = { located: true, kind: error?.said ? 'warning' : 'error', text: error?.said || error?.message || `That ${S.noun} could not be opened in 3D.` };
|
|
441
727
|
if (steel) live.textContent = '';
|
|
442
728
|
render();
|
|
443
729
|
}
|
|
@@ -453,6 +739,7 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
453
739
|
el(doc, 'span', { class: 'tekla-changes-after', text: `After: ${shown(field.after)}` })));
|
|
454
740
|
}
|
|
455
741
|
if (row.truncatedFields) detail.append(el(doc, 'p', { class: 'tekla-audit-omissions', text: `${plural(row.truncatedFields, 'more field')} changed and are not listed.` }));
|
|
742
|
+
if (row.notCompared) detail.append(el(doc, 'p', { class: 'tekla-audit-omissions', text: row.notCompared }));
|
|
456
743
|
} else {
|
|
457
744
|
detail.append(el(doc, 'p', { class: 'tekla-audit-omissions', text: row.status === 'added' ? `This object is in the later ${S.noun} only.` : `This object is in the earlier ${S.noun} only.` }));
|
|
458
745
|
}
|
|
@@ -464,6 +751,93 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
464
751
|
return el(doc, 'div', { class: 'tekla-changes-item' }, toggle, detail);
|
|
465
752
|
}
|
|
466
753
|
|
|
754
|
+
/**
|
|
755
|
+
* #4097: Tekla's save-history cross-check as the record classified it. A real disagreement is a warning that names each
|
|
756
|
+
* object, with a way to show it and the person's choices; nothing is held back. A record from before #4097 keeps its
|
|
757
|
+
* own sentence.
|
|
758
|
+
*/
|
|
759
|
+
function witnessNodes(w, banner) {
|
|
760
|
+
if (!Array.isArray(w.objects)) {
|
|
761
|
+
return [el(doc, 'p', { class: 'tekla-audit-omissions',
|
|
762
|
+
text: w.state === 'agrees' ? 'Tekla’s own save history agrees with these changes.' : w.state === 'disagrees' ? `Tekla’s own save history does not agree: ${w.detail}` : w.detail })];
|
|
763
|
+
}
|
|
764
|
+
const nodes = [];
|
|
765
|
+
// #4136: a part folded into its assembly's line is named there, so it is not a second line or a second count.
|
|
766
|
+
const disagreeing = w.objects.filter((object) => object.verdict === 'disagrees' && !object.foldedInto);
|
|
767
|
+
if (w.state === 'disagrees' && disagreeing.length) {
|
|
768
|
+
const section = banner('warn', 'Tekla’s save history does not agree',
|
|
769
|
+
`It does not agree with the comparison on ${plural(disagreeing.length, 'object')}. Check ${disagreeing.length === 1 ? 'it' : 'them'} in Tekla.`);
|
|
770
|
+
section.classList.add('crv-witness');
|
|
771
|
+
const list = el(doc, 'ul', { class: 'crv-witness-objects', 'aria-label': 'Objects the save history does not agree on' });
|
|
772
|
+
for (const object of disagreeing) list.append(el(doc, 'li', {}, el(doc, 'span', { text: object.line || object.guid }), witnessShow(object)));
|
|
773
|
+
section.append(list, witnessChoices());
|
|
774
|
+
// What else is open (an assembly not checked, objects not sorted), in the record's own words.
|
|
775
|
+
const open = Array.isArray(w.open) ? w.open.filter((line) => typeof line === 'string' && line) : [];
|
|
776
|
+
if (open.length) section.append(el(doc, 'span', { class: 'crv-witness-open', text: `Also, ${open.join('; ')}.` }));
|
|
777
|
+
nodes.push(section);
|
|
778
|
+
} else {
|
|
779
|
+
nodes.push(el(doc, 'p', { class: 'tekla-audit-omissions crv-witness', text: w.detail }));
|
|
780
|
+
}
|
|
781
|
+
if (w.notCoveredLine) nodes.push(el(doc, 'p', { class: 'tekla-audit-omissions crv-witness-not-covered', text: w.notCoveredLine }));
|
|
782
|
+
return nodes;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* #4103: the person's three choices on a real disagreement, as buttons: keep the review as recorded (the default),
|
|
787
|
+
* import the model folder again (on the project's Source step, in the FloLess window), or pick two other saved states.
|
|
788
|
+
* Keeping changes nothing: the record already says the history disagrees. Outside the FloLess window there is no
|
|
789
|
+
* Source step to open, so that choice is left out rather than offered as a button that cannot work. Tekla only (a
|
|
790
|
+
* steel review has no save history), so the command ids are the Tekla page's, as the marks' are.
|
|
791
|
+
*/
|
|
792
|
+
function witnessChoices() {
|
|
793
|
+
const id = review?.reviewId;
|
|
794
|
+
if (id && witnessKept.has(id)) {
|
|
795
|
+
return el(doc, 'p', { class: 'tekla-audit-omissions crv-witness-kept', role: 'status', tabindex: '-1',
|
|
796
|
+
text: 'Kept. This review stays recorded with Tekla’s save history disagreeing.' });
|
|
797
|
+
}
|
|
798
|
+
const keep = el(doc, 'button', { type: 'button', class: 'primary crv-choice-go', 'data-command-id': 'tekla-parser.change-review-witness-keep',
|
|
799
|
+
'data-tip': 'Keep this review as it is. It stays recorded as Tekla’s save history disagreeing.', text: 'Keep this review',
|
|
800
|
+
onclick: () => { if (id) witnessKept.add(id); focusWitnessKept = true; render(); } });
|
|
801
|
+
const again = typeof reimport === 'function' ? el(doc, 'button', { type: 'button', class: 'crv-choice-pick', 'data-command-id': 'tekla-parser.change-review-witness-import-again',
|
|
802
|
+
'data-tip': 'Opens this project’s Source step to import the Tekla model folder again. Each import adds a saved state you can compare.',
|
|
803
|
+
text: 'Import the model folder again',
|
|
804
|
+
onclick: async () => {
|
|
805
|
+
again.disabled = true;
|
|
806
|
+
try {
|
|
807
|
+
const answer = await reimport();
|
|
808
|
+
const text = typeof answer === 'string' ? answer : answer && typeof answer.handedOver === 'string' ? answer.handedOver : '';
|
|
809
|
+
if (text) { message = { kind: 'info', text }; render(); }
|
|
810
|
+
} catch (error) { message = { kind: 'error', text: error?.message || 'The project’s Source step could not be opened. Open it from Workspaces.' }; render(); }
|
|
811
|
+
finally { again.disabled = false; }
|
|
812
|
+
} }) : null;
|
|
813
|
+
const other = el(doc, 'button', { type: 'button', class: 'crv-choice-pick', 'data-command-id': 'tekla-parser.change-review-witness-pick-two',
|
|
814
|
+
'data-tip': 'Moves to the saved-state pickers so you can choose two other saved states to compare.', text: `Compare two other ${S.nouns}`,
|
|
815
|
+
onclick: () => { ask = null; focusPicker = true; render(); } });
|
|
816
|
+
return el(doc, 'div', { class: 'crv-choice-actions crv-witness-choices', role: 'group', 'aria-label': 'What to do about the save history' }, keep, again, other);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/** "Show in 3D" for one object the save history does not agree on, in the saved state that has it. */
|
|
820
|
+
function witnessShow(object) {
|
|
821
|
+
const side = object.comparison === 'removed' ? 'base' : 'revised';
|
|
822
|
+
const entityId = side === 'base' ? object.entityIdBase : object.entityIdRevised;
|
|
823
|
+
if (!entityId) return null;
|
|
824
|
+
const shownPick = pick;
|
|
825
|
+
const name = [object.type, object.name].filter(Boolean).join(' ') || 'this object';
|
|
826
|
+
const show = el(doc, 'button', { type: 'button', class: 'tekla-changes-locate', 'data-command-id': cid('locate'),
|
|
827
|
+
'aria-label': `Show ${name} in 3D${side === 'base' ? ' in the earlier saved state' : ''}`,
|
|
828
|
+
text: side === 'base' ? 'Show in earlier state' : 'Show in 3D',
|
|
829
|
+
onclick: async () => {
|
|
830
|
+
if (shownPick !== pick) return;
|
|
831
|
+
const target = sideState(side);
|
|
832
|
+
if (!target) { message = { kind: 'error', text: `That ${S.noun} is no longer part of this project, so this object cannot be shown in 3D.` }; render(); return; }
|
|
833
|
+
show.disabled = true;
|
|
834
|
+
try { await locate({ state: target, entityId }); }
|
|
835
|
+
catch (error) { if (shownPick === pick) { message = { kind: 'error', text: error?.message || `That ${S.noun} could not be opened in 3D.` }; render(); } }
|
|
836
|
+
finally { show.disabled = false; }
|
|
837
|
+
} });
|
|
838
|
+
return show;
|
|
839
|
+
}
|
|
840
|
+
|
|
467
841
|
/** How a steel side reads inside a sentence: "approved version 3", "the current draft". */
|
|
468
842
|
function sideWords(side) {
|
|
469
843
|
const record = review?.[side] || {};
|
|
@@ -474,16 +848,19 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
474
848
|
function renderResult() {
|
|
475
849
|
const out = [];
|
|
476
850
|
const s = review.summary || {};
|
|
477
|
-
const title = el(doc, 'h3', { class: 'tekla-changes-result-title', tabindex: '-1',
|
|
478
|
-
text: steel ? `Changes between ${sideWords('base')} and ${sideWords('revised')}.`
|
|
851
|
+
const title = el(doc, 'h3', { class: 'tekla-changes-result-title tekla-changes-review-title', tabindex: '-1',
|
|
852
|
+
text: steel ? `Changes between ${sideWords('base')} and ${sideWords('revised')}.`
|
|
853
|
+
: flowTitle(review) ? `${flowTitle(review)}.`
|
|
854
|
+
: `Compared ${review.base.label} with ${review.revised.label}.` });
|
|
479
855
|
out.push(title);
|
|
480
856
|
const metrics = el(doc, 'section', { class: `tekla-audit-summary tekla-changes-metrics${steel ? ' crv-metrics' : ''}`, 'aria-label': 'Change counts' });
|
|
481
857
|
// Read by two parser versions, a changed field may be the reading, not the model (plan §2.4): never call it a change.
|
|
482
858
|
const parserDiffers = !steel && review.parserParity === 'differs';
|
|
483
|
-
for (const [value, label] of parserDiffers
|
|
484
|
-
? [[s.added, 'Only in later (may be the reading)'], [s.removed, 'Only in earlier (may be the reading)'], [s.changed, 'May differ']]
|
|
485
|
-
: [[s.added, 'Added'], [s.removed, 'Removed'], [s.changed, 'Changed']]) {
|
|
486
|
-
metrics.append(el(doc, 'div', {}, el(doc, 'strong', { text: Number(value || 0).toLocaleString() }), el(doc, 'span', { text: label })
|
|
859
|
+
for (const [value, label, beside] of parserDiffers
|
|
860
|
+
? [[s.added, 'Only in later (may be the reading)'], [s.removed, 'Only in earlier (may be the reading)'], [s.changed, 'May differ', s.notCompared]]
|
|
861
|
+
: [[s.added, 'Added'], [s.removed, 'Removed'], [s.changed, 'Changed', s.notCompared]]) {
|
|
862
|
+
metrics.append(el(doc, 'div', {}, el(doc, 'strong', { text: Number(value || 0).toLocaleString() }), el(doc, 'span', { text: label }),
|
|
863
|
+
beside ? el(doc, 'span', { text: beside }) : null));
|
|
487
864
|
}
|
|
488
865
|
// A count the review does not give is said as not counted, with why: never as 0, which would read as "none".
|
|
489
866
|
const counted = typeof s.unchanged === 'number' && Number.isFinite(s.unchanged);
|
|
@@ -508,7 +885,9 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
508
885
|
if (by) out.push(el(doc, 'p', { class: 'tekla-audit-omissions crv-version-by', text: by }));
|
|
509
886
|
}
|
|
510
887
|
} else {
|
|
511
|
-
|
|
888
|
+
const line = flowLine(review);
|
|
889
|
+
out.push(line ? el(doc, 'p', { class: 'tekla-changes-flow-line', text: line })
|
|
890
|
+
: el(doc, 'p', { class: 'tekla-audit-omissions', text: 'Whose changes: not known. FloLess compares what was saved, not who changed it.' }));
|
|
512
891
|
out.push(el(doc, 'p', { class: 'tekla-audit-omissions',
|
|
513
892
|
text: `${review.base.label}: ${STATE_LABEL[review.base.capture?.label] || STATE_LABEL['not-recorded']}. ${review.revised.label}: ${STATE_LABEL[review.revised.capture?.label] || STATE_LABEL['not-recorded']}.` }));
|
|
514
893
|
}
|
|
@@ -545,8 +924,7 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
545
924
|
`Only ${Number(s.paired).toLocaleString()} of ${Number(s.base).toLocaleString()} objects could be matched between these ${S.nouns}. The model may have been rebuilt or its components regenerated, so the lists below are not a list of edits. Compare two ${S.nouns} that are closer together.`));
|
|
546
925
|
}
|
|
547
926
|
const w = steel ? null : review.witness;
|
|
548
|
-
if (w) out.push(
|
|
549
|
-
text: w.state === 'agrees' ? 'Tekla’s own save history agrees with these changes.' : w.state === 'disagrees' ? `Tekla’s own save history does not agree: ${w.detail}` : w.detail }));
|
|
927
|
+
if (w) out.push(...witnessNodes(w, banner));
|
|
550
928
|
const notChecked = el(doc, 'section', { class: 'tekla-changes-unchecked', 'aria-label': 'What was not checked' },
|
|
551
929
|
el(doc, 'strong', { text: 'What was not checked' }), ...(review.unchecked || []).map((line) => el(doc, 'p', { class: 'tekla-audit-omissions', text: line })));
|
|
552
930
|
out.push(...findings.nodes());
|
|
@@ -556,9 +934,10 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
556
934
|
const group = rows.filter((row) => row.status === status);
|
|
557
935
|
const total = s[status] || 0;
|
|
558
936
|
const section = el(doc, 'details', { class: 'tekla-changes-group', open: status === 'changed' ? true : null },
|
|
559
|
-
el(doc, 'summary', { text: !parserDiffers ? `${STATUS_HEADING[status]} (${Number(total).toLocaleString()})`
|
|
937
|
+
el(doc, 'summary', { text: (!parserDiffers ? `${STATUS_HEADING[status]} (${Number(total).toLocaleString()})`
|
|
560
938
|
: status === 'changed' ? `Differences that may come from the reading, not the model (${Number(total).toLocaleString()})`
|
|
561
|
-
: `Only in the ${status === 'added' ? 'later' : 'earlier'} saved state, which may be the reading (${Number(total).toLocaleString()})`
|
|
939
|
+
: `Only in the ${status === 'added' ? 'later' : 'earlier'} saved state, which may be the reading (${Number(total).toLocaleString()})`)
|
|
940
|
+
+ (status === 'changed' && s.notCompared ? ` · ${s.notCompared}` : '') }));
|
|
562
941
|
if (!group.length) {
|
|
563
942
|
const none = !parserDiffers ? `Nothing ${STATUS_HEADING[status].toLowerCase()}.`
|
|
564
943
|
: status === 'changed' ? 'No differences.' : `Nothing only in the ${status === 'added' ? 'later' : 'earlier'} saved state.`;
|
|
@@ -628,6 +1007,8 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
628
1007
|
}
|
|
629
1008
|
|
|
630
1009
|
function render() {
|
|
1010
|
+
// The work a press was told to wait for has ended: the note and its live-line sentence go, whichever way it ended.
|
|
1011
|
+
if (!busy && busyPress) { busyPress = false; if (live.textContent.replace(/ /g, '') === busyText) live.textContent = ''; }
|
|
631
1012
|
host.replaceChildren();
|
|
632
1013
|
host.classList.add('tekla-changes-host');
|
|
633
1014
|
if (refusal) {
|
|
@@ -686,9 +1067,10 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
686
1067
|
? { class: 'tekla-changes-banner crv-saved-only crv-unsaved', role: 'status', text: `${SAVED_ONLY} You have edits that are not saved yet, so they are not in this review.` }
|
|
687
1068
|
: { class: 'tekla-audit-omissions crv-saved-only', text: SAVED_ONLY }));
|
|
688
1069
|
}
|
|
1070
|
+
if (!steel && states.length) host.append(renderTeam());
|
|
689
1071
|
host.append(controls, live);
|
|
690
1072
|
if (ask) host.append(renderAsk());
|
|
691
|
-
if (message) host.append(el(doc, 'p', { class: `tekla-changes-message ${message.kind}`, role: message.kind === 'info' ? 'status' : 'alert', text: message.text }));
|
|
1073
|
+
if (message) host.append(messageNode = el(doc, 'p', { class: `tekla-changes-message ${message.kind}`, role: message.kind === 'info' ? 'status' : 'alert', text: message.text }));
|
|
692
1074
|
host.append(...standards.nodes());
|
|
693
1075
|
if (review) host.append(...(opening ? [el(doc, 'p', { class: 'tekla-audit-omissions tekla-changes-opening', role: 'status', text: 'Opening review…' })] : renderResult()));
|
|
694
1076
|
standards.restoreFocus(host);
|
|
@@ -696,16 +1078,18 @@ export function mountChangeReview({ host, doc = document, projectId, fetchJson,
|
|
|
696
1078
|
// A warning that asks takes the focus to the choice that goes on; "pick again" hands it to the first picker.
|
|
697
1079
|
if (focusAsk) { focusAsk = false; host.querySelector('.crv-choice-go, .crv-choice-pick')?.focus(); }
|
|
698
1080
|
if (focusPicker) { focusPicker = false; host.querySelector('.tekla-changes-trigger')?.focus(); }
|
|
1081
|
+
if (focusWitnessKept) { focusWitnessKept = false; host.querySelector('.crv-witness-kept')?.focus(); }
|
|
1082
|
+
if (focusTeam) { const target = focusTeam; focusTeam = null; host.querySelector(`[data-team-focus="${target}"]`)?.focus(); }
|
|
699
1083
|
if (reviews.length) {
|
|
700
1084
|
const history = el(doc, 'details', { class: 'tekla-changes-history' }, el(doc, 'summary', { text: `Earlier reviews (${reviews.length})` }));
|
|
701
1085
|
for (const item of reviews) {
|
|
702
1086
|
const s = item.summary || {};
|
|
703
1087
|
history.append(el(doc, 'button', { type: 'button', class: 'tekla-changes-history-row', 'data-command-id': cid('history'),
|
|
704
1088
|
'aria-current': review?.reviewId === item.reviewId ? 'true' : null, onclick: () => openReview(item) },
|
|
705
|
-
el(doc, 'strong', { text: `${item.base.label} → ${item.revised.label}` }),
|
|
1089
|
+
el(doc, 'strong', { text: flowTitle(item, true) || `${item.base.label} → ${item.revised.label}` }),
|
|
706
1090
|
el(doc, 'span', { text: !steel && item.parserParity === 'differs'
|
|
707
|
-
? `${when(item.createdAt)} · read by different versions of FloLess · ${s.added ?? 0} only in later, ${s.removed ?? 0} only in earlier, ${s.changed ?? 0} may differ`
|
|
708
|
-
: `${when(item.createdAt)} · ${s.added ?? 0} added, ${s.removed ?? 0} removed, ${s.changed ?? 0} changed${item.diagnostic ? ' · check these results' : ''}${checksNote(item)}` })));
|
|
1091
|
+
? `${when(item.createdAt)} · read by different versions of FloLess · ${s.added ?? 0} only in later, ${s.removed ?? 0} only in earlier, ${s.changed ?? 0} may differ${besideCount(s)}`
|
|
1092
|
+
: `${when(item.createdAt)} · ${s.added ?? 0} added, ${s.removed ?? 0} removed, ${s.changed ?? 0} changed${besideCount(s)}${item.diagnostic ? ' · check these results' : ''}${checksNote(item)}` })));
|
|
709
1093
|
}
|
|
710
1094
|
host.append(history);
|
|
711
1095
|
}
|