@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
package/dist/web/workspaces.js
CHANGED
|
@@ -388,7 +388,8 @@
|
|
|
388
388
|
let revitSourceState = null;
|
|
389
389
|
let revitActiveOperation = null;
|
|
390
390
|
// #1754: what the import of the Revit model on screen left out (the server's leftOut, never { state: 'none' }), or
|
|
391
|
-
// null. The Source step's note says it under every paint while that model is on screen (paintRevitLeftOut).
|
|
391
|
+
// null. The Source step's note says it under every paint while that model is on screen (paintRevitLeftOut). For a
|
|
392
|
+
// Tekla project it is the server's geometryState, only on a properties-only model (#4008).
|
|
392
393
|
let revitShownLeftOut = null;
|
|
393
394
|
// How the Source step's last Cancel or Try again ended, for a chat card that pressed it (modelSourceStep): the route's own answer.
|
|
394
395
|
let sourceControlOutcome = null;
|
|
@@ -777,7 +778,6 @@
|
|
|
777
778
|
if (hadFocus && owner) $landing.querySelector(`[data-kebab="${escapeAttr(owner)}"]`)?.focus({ focusVisible: true });
|
|
778
779
|
};
|
|
779
780
|
|
|
780
|
-
const LS_MODE = 'floless:mode';
|
|
781
781
|
// Per-app Workspaces presentation. The flag (floless.workspace, surfaced on /api/apps) says WHICH
|
|
782
782
|
// apps are workspaces; this map says HOW to render each (presentation is ours — spec §3.2). All
|
|
783
783
|
// first-party today; promote to a .flo-declared descriptor when a user-authored one appears.
|
|
@@ -1165,11 +1165,9 @@
|
|
|
1165
1165
|
/** Whether this project's app has been renamed or duplicated away from its built-in id. The only
|
|
1166
1166
|
* case where naming the live workflow on the card tells the user something they don't know. */
|
|
1167
1167
|
const wsRenamed = (p) => !!(p && p.templateId && p.app && p.app !== p.templateId);
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
if (saved === 'workspaces' || saved === 'agents') mode = saved;
|
|
1172
|
-
} catch { /* private mode */ }
|
|
1168
|
+
const initialPlace = window.flolessStartPlace?.initial;
|
|
1169
|
+
let mode = initialPlace?.mode || 'workspaces';
|
|
1170
|
+
let projectToRestore = initialPlace?.project;
|
|
1173
1171
|
let projects = [];
|
|
1174
1172
|
const registeredRows = new Map();
|
|
1175
1173
|
const registeredCards = new Map();
|
|
@@ -1237,6 +1235,7 @@
|
|
|
1237
1235
|
// The server decides when a "Needs setup" card has a remedy the person can act on (#1965 review);
|
|
1238
1236
|
// the card only renders that sentence, and only on the state it was written for.
|
|
1239
1237
|
const remedyByRoot = new Map();
|
|
1238
|
+
const upgradeAwareRoots = new Set();
|
|
1240
1239
|
for (const capability of capabilities || []) {
|
|
1241
1240
|
if (!capability || typeof capability.templateId !== 'string'
|
|
1242
1241
|
|| capability.appId !== capability.templateId
|
|
@@ -1247,6 +1246,8 @@
|
|
|
1247
1246
|
if (capability.setupChoice === true && ['tekla-parser', 'revit-model'].includes(capability.templateId)) setupChoiceByRoot.add(capability.templateId);
|
|
1248
1247
|
if (capability.status === 'setup-unavailable' && typeof capability.setupRemedy === 'string' && capability.setupRemedy.trim()) {
|
|
1249
1248
|
remedyByRoot.set(capability.templateId, capability.setupRemedy.trim());
|
|
1249
|
+
// #4008: the one remedy whose button does something other than running setup again.
|
|
1250
|
+
if (capability.setupRemedyAction === 'update-aware') upgradeAwareRoots.add(capability.templateId);
|
|
1250
1251
|
}
|
|
1251
1252
|
// A capability row exists only after the server positively found the canonical module. Add
|
|
1252
1253
|
// its presentation entry even when authorization intentionally filtered it out of `apps`.
|
|
@@ -1283,6 +1284,7 @@
|
|
|
1283
1284
|
...(capabilityStatus ? { capabilityStatus } : {}),
|
|
1284
1285
|
...(setupChoiceByRoot.has(root) ? { setupChoice: true } : {}),
|
|
1285
1286
|
...(setupRemedy ? { setupRemedy } : {}),
|
|
1287
|
+
...(upgradeAwareRoots.has(root) ? { setupRemedyAction: 'update-aware' } : {}),
|
|
1286
1288
|
...(missingCoreRoots.has(root) ? { missing: true } : {}),
|
|
1287
1289
|
};
|
|
1288
1290
|
});
|
|
@@ -1415,6 +1417,10 @@
|
|
|
1415
1417
|
label = accepted ? `Approved with findings · v${s.headVersion}` : `Approved · v${s.headVersion}`;
|
|
1416
1418
|
tip = accepted && accepted.note ? `${accepted.note} The working copy matches this version.`
|
|
1417
1419
|
: 'The working copy matches the latest approved version.';
|
|
1420
|
+
// #4012: the approved version keeps the earlier Drawing Filter while the working copy holds a read's: it does not match.
|
|
1421
|
+
if (s.review && s.review.filterKept) {
|
|
1422
|
+
tip = `${accepted && accepted.note ? `${accepted.note} ` : ''}No pending changes to approve. The working copy holds the Drawing Filter of a drawing read that has not been confirmed. Confirm that read to bring it in; if it has ended, read those drawings again.`;
|
|
1423
|
+
}
|
|
1418
1424
|
unavailable = true;
|
|
1419
1425
|
}
|
|
1420
1426
|
$approveBtn.textContent = label;
|
|
@@ -1669,6 +1675,10 @@
|
|
|
1669
1675
|
$spine.hidden = !ws || !current;
|
|
1670
1676
|
window.flolessProjectAccess?.setProject(ws && current ? current : null);
|
|
1671
1677
|
if (!ws && !$projMenu.hidden) closeProjMenu();
|
|
1678
|
+
// Every project open and close ends here. Keep the startup hash until the list can resolve it.
|
|
1679
|
+
if (ws && window.flolessStartPlace && (current || !projectToRestore || openNavSeq)) {
|
|
1680
|
+
window.flolessStartPlace.remember({ mode, project: current?.id });
|
|
1681
|
+
}
|
|
1672
1682
|
if (ws && !current) loadProjects();
|
|
1673
1683
|
// Name the tab after what's actually on screen. aware.js is the single writer of
|
|
1674
1684
|
// document.title; left alone it names the selected WORKFLOW, which is the wrong surface here —
|
|
@@ -1763,8 +1773,10 @@
|
|
|
1763
1773
|
if (sequence !== modeChangeSequence) return;
|
|
1764
1774
|
}
|
|
1765
1775
|
mode = next;
|
|
1766
|
-
|
|
1776
|
+
if (changed) projectToRestore = null;
|
|
1767
1777
|
applyMode();
|
|
1778
|
+
if (mode === 'workflows') bridge.rememberWorkflowPlace?.();
|
|
1779
|
+
else if (mode === 'agents') window.flolessStartPlace?.remember({ mode });
|
|
1768
1780
|
// Real user intent: a mode toggle (not the boot/render applyMode). Only on an actual change.
|
|
1769
1781
|
if (changed) track('workspaces_mode_switched', { mode });
|
|
1770
1782
|
}
|
|
@@ -1857,6 +1869,20 @@
|
|
|
1857
1869
|
// of a blank landing. The repaint below adds the Archived section when it arrives.
|
|
1858
1870
|
if (deferIfBusy()) return;
|
|
1859
1871
|
renderLanding();
|
|
1872
|
+
if (projectToRestore && !projectsLoadError) {
|
|
1873
|
+
const id = projectToRestore;
|
|
1874
|
+
projectToRestore = null;
|
|
1875
|
+
if (!openNavSeq) {
|
|
1876
|
+
if (projects.some((p) => p.id === id)) {
|
|
1877
|
+
await openProject(id);
|
|
1878
|
+
if (mode === 'workspaces' && current?.id === id) window.showStartPlaceToast?.();
|
|
1879
|
+
} else {
|
|
1880
|
+
window.showStartPlaceToast?.('project');
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
if (stale()) return;
|
|
1884
|
+
if (mode === 'workspaces' && !current) window.flolessStartPlace?.remember({ mode });
|
|
1885
|
+
}
|
|
1860
1886
|
// Archived ("Trash") list — never let its failure blank the main workspace, but don't swallow it
|
|
1861
1887
|
// silently either: warn so a broken archive listing is diagnosable (a bare catch here would hide
|
|
1862
1888
|
// a real 500 and leave the "Archived" section invisible with no breadcrumb).
|
|
@@ -2120,6 +2146,9 @@
|
|
|
2120
2146
|
// Sent after the event stream reconnects too (aware.js), with no detail: frames may have been missed, so the
|
|
2121
2147
|
// editor reads again.
|
|
2122
2148
|
if (!e || !e.detail || !Object.keys(e.detail).length) tellModelFrame({ type: 'resync' });
|
|
2149
|
+
// #4086: the same nudge covers the Knowledge step — a knowledge-changed frame lost with the stream
|
|
2150
|
+
// would leave a source row on "syncing…" with nothing to repaint it.
|
|
2151
|
+
if ((!e || !e.detail || !Object.keys(e.detail).length) && current && !$wsKnowledge.hidden) void renderKnowledge();
|
|
2123
2152
|
const m = (e && e.detail) || {};
|
|
2124
2153
|
if (m.kind === 'metadata' && typeof m.registrationId === 'string') {
|
|
2125
2154
|
refreshRegisteredProject(m);
|
|
@@ -2651,10 +2680,18 @@
|
|
|
2651
2680
|
// A remedy the server wrote for this "Needs setup" replaces "setup didn’t finish"; the button
|
|
2652
2681
|
// still re-runs setup, so the person can check again once they have fixed it.
|
|
2653
2682
|
const body = entry.setupChoice !== true && entry.capabilityStatus === 'setup-unavailable' && entry.setupRemedy ? entry.setupRemedy : state.body;
|
|
2683
|
+
// #4008: running setup again cannot fix an AWARE that is too old; the button opens the shared Upgrade AWARE dialog.
|
|
2684
|
+
const upgradeAware = body === entry.setupRemedy && entry.setupRemedyAction === 'update-aware';
|
|
2685
|
+
if (upgradeAware) {
|
|
2686
|
+
state.action = 'Upgrade AWARE';
|
|
2687
|
+
state.aria = `${descriptor.displayName} needs a newer AWARE. Upgrade AWARE`;
|
|
2688
|
+
}
|
|
2654
2689
|
const descriptionId = `ws-${entry.templateId}-${entry.capabilityStatus || 'check-unavailable'}`;
|
|
2655
2690
|
const actionable = !!state.action;
|
|
2656
2691
|
const provisioning = entry.capabilityStatus === 'setup-provisioning';
|
|
2657
|
-
const teklaCommand =
|
|
2692
|
+
const teklaCommand = upgradeAware
|
|
2693
|
+
? 'data-command-id="shell.tekla-upgrade-aware" data-module-remedy-action="update-aware"'
|
|
2694
|
+
: entry.capabilityStatus === 'setup-unavailable'
|
|
2658
2695
|
? 'data-command-id="shell.tekla-retry-setup"'
|
|
2659
2696
|
: entry.capabilityStatus === 'setup-repair-required'
|
|
2660
2697
|
// Its own command, so `?` explains a re-check after a reinstall, not "retry setup".
|
|
@@ -3378,6 +3415,11 @@
|
|
|
3378
3415
|
return;
|
|
3379
3416
|
}
|
|
3380
3417
|
const remedyState = moduleRemedy.dataset.moduleRemedyState;
|
|
3418
|
+
if (moduleRemedy.dataset.moduleRemedyAction === 'update-aware') {
|
|
3419
|
+
if (bridge.openAwareUpdate) bridge.openAwareUpdate('', moduleRemedy);
|
|
3420
|
+
else showToast('Could not open the AWARE update dialog.', 'warn');
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3381
3423
|
if (remedyState === 'setup-unavailable' || remedyState === 'setup-repair-required') {
|
|
3382
3424
|
// A broken installation is re-CHECKED (after a reinstall), never "set up again".
|
|
3383
3425
|
const repair = remedyState === 'setup-repair-required';
|
|
@@ -5217,12 +5259,24 @@
|
|
|
5217
5259
|
if (!note) return;
|
|
5218
5260
|
note.hidden = true;
|
|
5219
5261
|
const leftOut = revitShownLeftOut;
|
|
5220
|
-
if (!leftOut || !current
|
|
5262
|
+
if (!leftOut || !current) return;
|
|
5221
5263
|
const lead = note.querySelector('.ws-source-note-lead');
|
|
5222
5264
|
const list = note.querySelector('.ws-source-note-list');
|
|
5223
5265
|
const why = note.querySelector('.ws-source-note-why');
|
|
5224
5266
|
list.replaceChildren();
|
|
5225
5267
|
list.hidden = true;
|
|
5268
|
+
if (isTeklaParserProject()) {
|
|
5269
|
+
// #4008: every object was read, and none of them can be drawn yet.
|
|
5270
|
+
const { notDrawn, noGeometry } = leftOut;
|
|
5271
|
+
if (leftOut.state !== 'nothing-drawable-yet' || !Number.isSafeInteger(notDrawn) || !Number.isSafeInteger(noGeometry)) return;
|
|
5272
|
+
const total = notDrawn + noGeometry;
|
|
5273
|
+
lead.textContent = 'Properties only: the shapes in this model can’t be drawn yet.';
|
|
5274
|
+
why.textContent = `${total.toLocaleString()} ${total === 1 ? 'object was' : 'objects were'} read, with the properties that could be read. `
|
|
5275
|
+
+ 'Browse them in the Type tree on the Model tab.'
|
|
5276
|
+
+ (noGeometry ? ` ${notDrawn.toLocaleString()} can’t be drawn yet, and the other ${noGeometry.toLocaleString()} ${noGeometry === 1 ? 'has no shape of its own' : 'have no shape of their own'}, such as assemblies.` : '');
|
|
5277
|
+
note.hidden = false;
|
|
5278
|
+
return;
|
|
5279
|
+
}
|
|
5226
5280
|
if (leftOut.state === 'unavailable') {
|
|
5227
5281
|
lead.textContent = 'FloLess couldn’t check whether any elements were left out of this model.';
|
|
5228
5282
|
why.textContent = 'The model imported normally, but FloLess could not read its list of left-out elements. FloLess only ever leaves out elements that have no geometry, so you can keep working with this model.';
|
|
@@ -5456,7 +5510,7 @@
|
|
|
5456
5510
|
// Never replace the newer operation with the older source-state response.
|
|
5457
5511
|
if (revitActiveOperation !== operationAtRequest) return null;
|
|
5458
5512
|
revitSourceState = response.state;
|
|
5459
|
-
revitShownLeftOut = tekla ?
|
|
5513
|
+
revitShownLeftOut = (tekla ? response.state.geometryState : response.state.leftOut) ?? null;
|
|
5460
5514
|
configureReadOnlySourceChrome(current);
|
|
5461
5515
|
revitActiveOperation = response.state.activeImport;
|
|
5462
5516
|
if (revitActiveOperation && !['ready', 'failed', 'cancelled'].includes(revitActiveOperation.state)) {
|
|
@@ -5890,7 +5944,8 @@
|
|
|
5890
5944
|
if (operation.state === 'ready') {
|
|
5891
5945
|
revitActiveOperation = null;
|
|
5892
5946
|
// The import just published is now the model on screen: its own left-out answer is the one to say (#1754).
|
|
5893
|
-
|
|
5947
|
+
const shown = tekla ? operation.geometryState : operation.leftOut;
|
|
5948
|
+
revitShownLeftOut = shown && shown.state !== 'none' ? shown : null;
|
|
5894
5949
|
paintRevitSourceState(tekla ? 'Read-only snapshot ready to review' : 'Model ready to review', 'The model is available on the Model tab. It is not approved yet.');
|
|
5895
5950
|
revitSourceAwaitsApproval = true;
|
|
5896
5951
|
paintRevitSourceActions('imported', true);
|
|
@@ -8387,8 +8442,72 @@
|
|
|
8387
8442
|
: review.base ? `This becomes the next approved version, after approved v${review.base.version}.`
|
|
8388
8443
|
: first ? `This becomes v${first.version}, the first approved version of this model.`
|
|
8389
8444
|
: 'This becomes the first approved version of this model.';
|
|
8445
|
+
// #3680 part C, R5 (X35): the restores since the last approval, as information (the server's line); nothing when none.
|
|
8446
|
+
const restores = review.restoresSinceApproval && typeof review.restoresSinceApproval.line === 'string' ? review.restoresSinceApproval.line : '';
|
|
8390
8447
|
return `<div class="approval-version-card"><b>${escapeHtml(lead)}</b>`
|
|
8391
|
-
+ `<p>${first && first.card ? `${escapeHtml(first.card)} ` : ''}Approved exports and the compiled workflow use the approved version. You can keep editing the working copy afterwards.</p
|
|
8448
|
+
+ `<p>${first && first.card ? `${escapeHtml(first.card)} ` : ''}Approved exports and the compiled workflow use the approved version. You can keep editing the working copy afterwards.</p>`
|
|
8449
|
+
+ (restores ? `<p data-approval-restores>${escapeHtml(restores)} This approval covers what you select below; changes you leave out stay pending.</p>` : '')
|
|
8450
|
+
+ '</div>';
|
|
8451
|
+
}
|
|
8452
|
+
|
|
8453
|
+
/**
|
|
8454
|
+
* #3680 part C (C4 screen): what approving THESE decisions does to each density the approval compares, from the
|
|
8455
|
+
* server's read-only preview of exactly this selection (`approvalDialogState.density`, `refreshApprovalDensity`).
|
|
8456
|
+
* Only for a model with elements. What needs the person's attention comes first; new elements whose values are
|
|
8457
|
+
* already on today's density fold into one line, and an element that stays flagged is never folded away. The row
|
|
8458
|
+
* sentence is the server's, as it is. It says what happens; it never decides: Approve stays the person's.
|
|
8459
|
+
*/
|
|
8460
|
+
function approvalDensityHtml(st, review, groups) {
|
|
8461
|
+
if (typeof review.densitySources !== 'string' || !groups.length) return '';
|
|
8462
|
+
const d = st.density || { status: 'undecided' };
|
|
8463
|
+
// Focusable from script only (tabindex -1), so focus has somewhere to land while an answer replaces the block.
|
|
8464
|
+
const block = (inner) => `<section class="approval-density" data-approval-density tabindex="-1" aria-label="Densities compared with the approved version">${inner}</section>`;
|
|
8465
|
+
const quiet = (words, busy) => block(`<p class="approval-density-quiet">${busy ? '<span class="rtn-spinner" aria-hidden="true"></span>' : ''}${escapeHtml(words)}</p>`);
|
|
8466
|
+
if (d.status === 'loading') return quiet('Checking what approving does to the densities…', true);
|
|
8467
|
+
if (d.status === 'error') {
|
|
8468
|
+
return block('<div class="approval-notice approval-notice-error"><b>FloLess could not check the densities for these decisions.</b> '
|
|
8469
|
+
+ `<p>${d.error ? `${escapeHtml(d.error)} ` : ''}You can still approve: if a density changed, FloLess shows the comparison first and approves nothing.</p>`
|
|
8470
|
+
+ '<div class="approval-notice-actions"><button type="button" class="btn-mini" data-approval-density-retry data-command-id="shell.approval-density-check-again">Check again</button></div></div>');
|
|
8471
|
+
}
|
|
8472
|
+
if (d.status !== 'ready' || !d.preview) return quiet('Decide every change, and approve at least one, to see what approving does to the densities.');
|
|
8473
|
+
const p = d.preview;
|
|
8474
|
+
const refreshed = d.refreshed ? '<div class="approval-notice approval-notice-warn" tabindex="-1" data-approval-density-refreshed>'
|
|
8475
|
+
+ '<b>The catalogue or the model changed after you checked.</b> <p>The comparison below is refreshed. Nothing was approved: check it, then approve again.</p></div>' : '';
|
|
8476
|
+
// E1d (F6): the fit of the candidate this approval records, as the server says it. Informational: it asks for no
|
|
8477
|
+
// tick and changes nothing about Approve; the approval keeps it as its fit snapshot.
|
|
8478
|
+
const fit = (typeof p.fitAssumptionsWarning === 'string' && p.fitAssumptionsWarning
|
|
8479
|
+
? `<div class="approval-notice approval-notice-warn" data-approval-fit-assumptions><p>${escapeHtml(p.fitAssumptionsWarning)}</p></div>` : '')
|
|
8480
|
+
+ (typeof p.fitSummary === 'string' && p.fitSummary
|
|
8481
|
+
? `<p class="approval-density-quiet" data-approval-fit>${escapeHtml(p.fitSummary)}</p>` : '');
|
|
8482
|
+
const droppedRows = Array.isArray(p.recordsDropped) ? p.recordsDropped : [];
|
|
8483
|
+
const dropped = droppedRows.length ? '<h4 class="approval-density-sub">Left out of this approval</h4>'
|
|
8484
|
+
+ `<ul class="approval-density-dropped">${droppedRows.map((r) => `<li>${escapeHtml(String(r && r.sentence || ''))}</li>`).join('')}</ul>` : '';
|
|
8485
|
+
if (p.densityComparison && p.densityComparison.state === 'unavailable') {
|
|
8486
|
+
return block(`${refreshed}<div class="approval-notice approval-notice-warn"><b>${escapeHtml(String(p.densityComparison.label || 'FloLess could not compare the densities with the approved version.'))}</b> `
|
|
8487
|
+
+ `<p>Approving still works; FloLess cannot say which densities changed.</p></div>${dropped}${fit}`);
|
|
8488
|
+
}
|
|
8489
|
+
const changes = Array.isArray(p.densityChanges) ? p.densityChanges : [];
|
|
8490
|
+
if (!changes.length && !droppedRows.length) return block(`${refreshed}<p class="approval-density-quiet">No density changed since the approved version.</p>${fit}`);
|
|
8491
|
+
// The pill words say the outcome; the colour only repeats it (amber for flagged, green for cleared).
|
|
8492
|
+
const PILLS = { cleared: ['ok', 'clears flag'], 'stays-flagged': ['medium', 'stays flagged'], 'no-stored-result': ['low', 'nothing saved yet'] };
|
|
8493
|
+
const ORDER = { 'stays-flagged': 0, 'no-stored-result': 1, cleared: 2 };
|
|
8494
|
+
const kg = (v) => typeof v === 'number' && Number.isFinite(v) ? v.toLocaleString('en-US') : 'none';
|
|
8495
|
+
const row = (c) => {
|
|
8496
|
+
const [tone, word] = PILLS[c.outcome] || PILLS['stays-flagged'];
|
|
8497
|
+
const kind = String(c.kind || 'element');
|
|
8498
|
+
const layers = c.state === 'changed' && Array.isArray(c.layers) && c.layers.length
|
|
8499
|
+
? `<div class="approval-density-layers">${c.layers.map((l) => `<span><span class="approval-density-row-id">${escapeHtml(String(l.catalogId || ''))}</span> ${escapeHtml(kg(l.approved))} <span aria-hidden="true">→</span><span class="sr-only"> to</span> ${escapeHtml(kg(l.today))} kg/m³</span>`).join('')}</div>` : '';
|
|
8500
|
+
return `<li class="approval-density-row" data-density-element="${escapeAttr(String(c.elementId))}" data-density-outcome="${escapeAttr(String(c.outcome))}">`
|
|
8501
|
+
+ `<div class="approval-density-head"><b>${escapeHtml(`${kind.charAt(0).toUpperCase()}${kind.slice(1)} ${c.elementId}`)}</b><span class="approval-risk ${tone}">${word}</span></div>`
|
|
8502
|
+
+ `${layers}<p>${escapeHtml(String(c.sentence || ''))}</p></li>`;
|
|
8503
|
+
};
|
|
8504
|
+
const folded = changes.filter((c) => c.state === 'new' && c.outcome === 'cleared');
|
|
8505
|
+
const shown = changes.filter((c) => !folded.includes(c)).sort((a, b) => (ORDER[a.outcome] ?? 0) - (ORDER[b.outcome] ?? 0));
|
|
8506
|
+
const fold = folded.length ? `<details class="approval-tech approval-density-new"><summary>${folded.length} element${folded.length === 1 ? ' is' : 's are'} new to this approval; approving records today’s densities for ${folded.length === 1 ? 'it' : 'them'}</summary>`
|
|
8507
|
+
+ `<ul class="approval-density-list">${folded.map(row).join('')}</ul></details>` : '';
|
|
8508
|
+
const lead = changes.length ? '<p class="approval-density-lead">Approving records today’s densities for the elements below whose values are worked out on them; an element still on the old values stays flagged.</p>' : '';
|
|
8509
|
+
return block(`${refreshed}<h3 class="approval-density-title">Densities compared with the approved version</h3>${lead}`
|
|
8510
|
+
+ `<div class="approval-density-scroll" tabindex="0" role="region" aria-label="Density comparison">${shown.length ? `<ul class="approval-density-list">${shown.map(row).join('')}</ul>` : ''}${fold}${dropped}</div>${fit}`);
|
|
8392
8511
|
}
|
|
8393
8512
|
|
|
8394
8513
|
const review = approvalDialogState.review;
|
|
@@ -8466,7 +8585,15 @@
|
|
|
8466
8585
|
: '';
|
|
8467
8586
|
const findingsHtml = nothingDrawn ? nothingDrawnHtml(nothingDrawn) : unreadable ? unreadableFindingsHtml(unreadable)
|
|
8468
8587
|
: findings ? importFindingsWarningHtml(findings, !!blockedReason) : '';
|
|
8469
|
-
|
|
8588
|
+
// #4012: the Drawing Filter of a drawing read that has not been confirmed is in the working copy, held out of the review.
|
|
8589
|
+
const nothingPending = review.filterKept
|
|
8590
|
+
? 'No pending changes to approve. The working copy holds the Drawing Filter of a drawing read that has not been confirmed.'
|
|
8591
|
+
: 'No pending changes. The working copy already matches the latest approved version.';
|
|
8592
|
+
// #3680 part C: a model with elements and nothing to approve says what one change could be.
|
|
8593
|
+
const nothingElse = typeof review.densitySources === 'string'
|
|
8594
|
+
? ' <span class="approval-empty-note">An approval needs at least one change. Working the values out again (resolve-save) counts as one.</span>' : '';
|
|
8595
|
+
$approvalBody.innerHTML = refusalHtml + findingsHtml + (groups.length ? approvalVersionCardHtml(review) + approvalDensityHtml(approvalDialogState, review, groups) : '')
|
|
8596
|
+
+ (groupHtml + conflictHtml || `<div class="approval-empty">${nothingPending}${nothingElse}</div>`);
|
|
8470
8597
|
const values = Object.values(decisions);
|
|
8471
8598
|
const approved = values.filter((value) => value === 'approve').length;
|
|
8472
8599
|
const remaining = groups.length - values.length;
|
|
@@ -8485,7 +8612,94 @@
|
|
|
8485
8612
|
$approvalConfirm.textContent = approved && findingsCopy ? findingsCopy.approve
|
|
8486
8613
|
: review.selective === false && groups.length ? 'Approve entire model'
|
|
8487
8614
|
: approved ? `Approve ${approved} change${approved === 1 ? '' : 's'}` : 'Approve selected changes';
|
|
8488
|
-
|
|
8615
|
+
// While the comparison of these exact decisions is on its way, Approve waits for it (the POST sends its digest). A
|
|
8616
|
+
// comparison that could not be had never blocks: the POST then answers with the comparison to check first.
|
|
8617
|
+
const densityChecking = !!(approvalDialogState.density && approvalDialogState.density.status === 'loading');
|
|
8618
|
+
$approvalConfirm.disabled = remaining !== 0 || remainingConflicts !== 0 || approved === 0 || groups.length === 0 || approvalDialogState.stale || densityChecking || !!blockedReason;
|
|
8619
|
+
}
|
|
8620
|
+
|
|
8621
|
+
// #3680 part C (C4 screen): the comparison follows the person's decisions, a short pause after the last change.
|
|
8622
|
+
const APPROVAL_DENSITY_DEBOUNCE_MS = 300;
|
|
8623
|
+
|
|
8624
|
+
/** What the live region says when a comparison arrives: the counts, never the whole list. */
|
|
8625
|
+
function approvalDensitySpoken(density) {
|
|
8626
|
+
if (!density || density.status === 'error') return density ? 'FloLess could not check the densities for these decisions.' : '';
|
|
8627
|
+
if (density.status !== 'ready' || !density.preview) return '';
|
|
8628
|
+
const p = density.preview;
|
|
8629
|
+
if (p.densityComparison && p.densityComparison.state === 'unavailable') return String(p.densityComparison.label || '');
|
|
8630
|
+
const changes = Array.isArray(p.densityChanges) ? p.densityChanges : [];
|
|
8631
|
+
if (!changes.length) return 'No density changed since the approved version.';
|
|
8632
|
+
const count = (outcome) => changes.filter((c) => c.outcome === outcome).length;
|
|
8633
|
+
const words = [
|
|
8634
|
+
[count('cleared'), 'clears its flag', 'clear their flag'],
|
|
8635
|
+
[count('stays-flagged'), 'stays flagged', 'stay flagged'],
|
|
8636
|
+
[count('no-stored-result'), 'has nothing saved yet', 'have nothing saved yet'],
|
|
8637
|
+
].filter(([n]) => n > 0).map(([n, one, many]) => `${n} element${n === 1 ? ` ${one}` : `s ${many}`}`);
|
|
8638
|
+
return `Densities compared: ${words.join(', ')}.`;
|
|
8639
|
+
}
|
|
8640
|
+
|
|
8641
|
+
/**
|
|
8642
|
+
* Ask the server what approving the decisions on screen does to the densities (#3680 part C, C4 screen): the
|
|
8643
|
+
* read-only preview of exactly this selection, after `delayMs`. Only the answer for the latest decisions is kept
|
|
8644
|
+
* (`seq`), and only it gives the `previewDigest` the approval POST sends. A whole-model review approves the whole
|
|
8645
|
+
* draft, so it uses the review's own comparison. An undecided selection asks for nothing; a selection the server
|
|
8646
|
+
* cannot act on reads as undecided; any other failure is said, and Approve stays the person's.
|
|
8647
|
+
*/
|
|
8648
|
+
function refreshApprovalDensity(st, delayMs = APPROVAL_DENSITY_DEBOUNCE_MS) {
|
|
8649
|
+
if (!st) return;
|
|
8650
|
+
const review = st.review || {};
|
|
8651
|
+
const groups = Array.isArray(review.groups) ? review.groups : [];
|
|
8652
|
+
if (st.densityTimer) { clearTimeout(st.densityTimer); st.densityTimer = null; }
|
|
8653
|
+
const seq = ((st.density && st.density.seq) || 0) + 1;
|
|
8654
|
+
st.previewDigest = null;
|
|
8655
|
+
if (typeof review.densitySources !== 'string' || !groups.length) { st.density = { status: 'none', seq }; return; }
|
|
8656
|
+
if (review.selective === false && review.densityPreview && typeof review.densityPreview.previewDigest === 'string') {
|
|
8657
|
+
st.density = { status: 'ready', preview: review.densityPreview, seq };
|
|
8658
|
+
st.previewDigest = review.densityPreview.previewDigest;
|
|
8659
|
+
return;
|
|
8660
|
+
}
|
|
8661
|
+
const decisions = approvalReviewDecisions(review, st.decisions || {});
|
|
8662
|
+
const conflicts = review.moveForward && Array.isArray(review.moveForward.conflicts) ? review.moveForward.conflicts : [];
|
|
8663
|
+
const complete = groups.every((group) => decisions[group.id] === 'approve' || decisions[group.id] === 'leave-pending')
|
|
8664
|
+
&& Object.values(decisions).includes('approve') && conflicts.every((conflict) => !!(st.conflicts || {})[conflict.id]);
|
|
8665
|
+
if (!complete) { st.density = { status: 'undecided', seq }; return; }
|
|
8666
|
+
st.density = { status: 'loading', seq };
|
|
8667
|
+
const body = JSON.stringify({ reviewId: review.reviewId, decisions: { ...decisions }, conflicts: { ...(st.conflicts || {}) } });
|
|
8668
|
+
st.densityTimer = setTimeout(async () => {
|
|
8669
|
+
st.densityTimer = null;
|
|
8670
|
+
let next;
|
|
8671
|
+
try {
|
|
8672
|
+
const res = await api(`/api/projects/${encodeURIComponent(st.projectId)}/approval-review/preview`, { method: 'POST', body });
|
|
8673
|
+
next = res && typeof res.previewDigest === 'string' ? { status: 'ready', preview: res, seq } : { status: 'error', error: '', seq };
|
|
8674
|
+
} catch (error) {
|
|
8675
|
+
const code = error && error.body && error.body.code;
|
|
8676
|
+
next = (error && (error.status === 400 || error.status === 422)) && code !== 'approval-review-stale'
|
|
8677
|
+
? { status: 'undecided', seq }
|
|
8678
|
+
: { status: 'error', error: String((error && error.body && error.body.error) || ''), seq };
|
|
8679
|
+
}
|
|
8680
|
+
if (approvalDialogState !== st || !st.density || st.density.seq !== seq) return;
|
|
8681
|
+
st.density = next;
|
|
8682
|
+
if (next.status === 'ready') st.previewDigest = next.preview.previewDigest;
|
|
8683
|
+
if ($approvalLive) $approvalLive.textContent = approvalDensitySpoken(next);
|
|
8684
|
+
if (st.phase === 'ready') repaintApprovalReviewKeepingFocus();
|
|
8685
|
+
}, Math.max(0, delayMs));
|
|
8686
|
+
st.densityTimer?.unref?.();
|
|
8687
|
+
}
|
|
8688
|
+
|
|
8689
|
+
/** Re-render the review where it stands, keeping the focus on the same control (an answer arrives on its own). */
|
|
8690
|
+
function repaintApprovalReviewKeepingFocus() {
|
|
8691
|
+
const active = document.activeElement;
|
|
8692
|
+
const inside = !!(active && $approvalBody.contains(active));
|
|
8693
|
+
const keys = ['approvalDecision', 'groupId', 'approvalConflict', 'conflictId'];
|
|
8694
|
+
const was = inside && active.dataset ? keys.map((key) => active.dataset[key]) : null;
|
|
8695
|
+
const inDensity = inside && typeof active.closest === 'function' && !!active.closest('[data-approval-density]');
|
|
8696
|
+
renderApprovalReview();
|
|
8697
|
+
if (!inside) return;
|
|
8698
|
+
const again = was && was.some((value) => value !== undefined)
|
|
8699
|
+
? [...$approvalBody.querySelectorAll('button')].find((node) => keys.every((key, index) => node.dataset[key] === was[index])) : null;
|
|
8700
|
+
const target = again || (inDensity ? $approvalBody.querySelector('[data-approval-density] button, [data-approval-density] [tabindex="0"]')
|
|
8701
|
+
|| $approvalBody.querySelector('[data-approval-density]') : null);
|
|
8702
|
+
if (target) target.focus(); else $approvalDialog.focus();
|
|
8489
8703
|
}
|
|
8490
8704
|
|
|
8491
8705
|
function closeApprovalReview() {
|
|
@@ -8494,6 +8708,7 @@
|
|
|
8494
8708
|
if (st && !approvalDismissible(st.phase)) return;
|
|
8495
8709
|
approvalDialogState = null;
|
|
8496
8710
|
if (st && st.ticker) { clearInterval(st.ticker); st.ticker = null; }
|
|
8711
|
+
if (st && st.densityTimer) { clearTimeout(st.densityTimer); st.densityTimer = null; }
|
|
8497
8712
|
// Closing while FloLess checks the result never drops the check: it carries on quietly and the
|
|
8498
8713
|
// outcome arrives as a notice. The remembered operation keeps reopening on this same check.
|
|
8499
8714
|
const undecided = st && !st.checking && st.phase === 'recovery-close' && st.operationId && st.operationToken;
|
|
@@ -9195,6 +9410,8 @@
|
|
|
9195
9410
|
headVersion: approvalHeadVersion(review), error: '' };
|
|
9196
9411
|
renderApprovalHeader();
|
|
9197
9412
|
settleImportedSourceCard(project.id);
|
|
9413
|
+
// #3680 part C: the density comparison of the decisions on screen (restored ones included).
|
|
9414
|
+
refreshApprovalDensity(approvalDialogState, 0);
|
|
9198
9415
|
renderApprovalReview();
|
|
9199
9416
|
if (canRestore) {
|
|
9200
9417
|
approvalDialogState.retryAction = 'approve';
|
|
@@ -9307,6 +9524,9 @@
|
|
|
9307
9524
|
try {
|
|
9308
9525
|
const res = await api(`/api/contract/${encodeURIComponent(project.app)}/approve?project=${encodeURIComponent(project.id)}`, {
|
|
9309
9526
|
method: 'POST', body: JSON.stringify({ mode: st.review.mode || 'head', reviewId: st.review.reviewId, decisions: st.decisions, conflicts: st.conflicts, claimedChannel: 'browser', operationId, operationToken,
|
|
9527
|
+
// #3680 part C: the comparison the person saw for these decisions. None on screen (still being checked, or it
|
|
9528
|
+
// could not be had): the server answers with the comparison to check first, and approves nothing.
|
|
9529
|
+
...(typeof st.previewDigest === 'string' ? { previewDigest: st.previewDigest } : {}),
|
|
9310
9530
|
...(acceptOpenImportFindings ? { acceptOpenImportFindings } : {}) }),
|
|
9311
9531
|
});
|
|
9312
9532
|
await finishApprovalSuccess(res, project);
|
|
@@ -9334,6 +9554,23 @@
|
|
|
9334
9554
|
renderApprovalReview();
|
|
9335
9555
|
setApprovalPhase('ready', `Nothing was approved. ${st.unapprovable ? `${st.unapprovable} ${APPROVAL_LEAVE_PENDING_NOTE}` : approvalRefusalDetail(error.body.error)}`);
|
|
9336
9556
|
($approvalBody.querySelector('[data-approval-decision]:not([disabled])') || $approvalDialog).focus();
|
|
9557
|
+
} else if (approvalDialogState && error && error.body && error.body.code === 'approval-review-stale'
|
|
9558
|
+
&& error.body.densityPreview && typeof error.body.densityPreview.previewDigest === 'string') {
|
|
9559
|
+
// #3680 part C: the review is current, but what approving does to the densities is not what the person saw
|
|
9560
|
+
// (the catalogue or the model changed, or no comparison was on screen). Answered before anything durable was
|
|
9561
|
+
// written, so the operation is forgotten. The refreshed comparison is shown with the same decisions, and the
|
|
9562
|
+
// person approves again with a click of their own: nothing here approves or retries by itself.
|
|
9563
|
+
rememberApprovalOperation(project, null);
|
|
9564
|
+
st.operationId = null;
|
|
9565
|
+
st.operationToken = null;
|
|
9566
|
+
st.decisions = decisionSnapshot.decisions;
|
|
9567
|
+
st.conflicts = decisionSnapshot.conflicts;
|
|
9568
|
+
if (st.densityTimer) { clearTimeout(st.densityTimer); st.densityTimer = null; }
|
|
9569
|
+
st.density = { status: 'ready', preview: error.body.densityPreview, refreshed: true, seq: ((st.density && st.density.seq) || 0) + 1 };
|
|
9570
|
+
st.previewDigest = error.body.densityPreview.previewDigest;
|
|
9571
|
+
renderApprovalReview();
|
|
9572
|
+
setApprovalPhase('ready', 'Nothing was approved. The density comparison was refreshed; check it, then approve again.');
|
|
9573
|
+
($approvalBody.querySelector('[data-approval-density-refreshed]') || $approvalConfirm).focus();
|
|
9337
9574
|
} else if (approvalDialogState && error && error.body && error.body.code === 'approval-review-stale') {
|
|
9338
9575
|
rememberApprovalOperation(project, null);
|
|
9339
9576
|
st.operationId = null;
|
|
@@ -9397,6 +9634,7 @@
|
|
|
9397
9634
|
st.operationToken = null;
|
|
9398
9635
|
rememberApprovalOperation(project, null);
|
|
9399
9636
|
$approvalImpact.textContent = '';
|
|
9637
|
+
refreshApprovalDensity(st, 0);
|
|
9400
9638
|
renderApprovalReview();
|
|
9401
9639
|
setApprovalPhase('ready');
|
|
9402
9640
|
($approvalBody.querySelector('[data-approval-decision]:not([disabled])') || $approvalConfirm).focus();
|
|
@@ -9437,6 +9675,7 @@
|
|
|
9437
9675
|
st.decisions = {};
|
|
9438
9676
|
st.conflicts = {};
|
|
9439
9677
|
reloadModelFromServerTruth();
|
|
9678
|
+
refreshApprovalDensity(st, 0);
|
|
9440
9679
|
renderApprovalReview();
|
|
9441
9680
|
await refreshApprovalState(st.projectId);
|
|
9442
9681
|
showToast(linked.length > 1 ? `Discarded ${linked.length} linked working-copy changes. Nothing was approved.` : 'Discarded the selected working-copy change. Nothing was approved.', 'ok');
|
|
@@ -9466,6 +9705,8 @@
|
|
|
9466
9705
|
for (const conflict of (approvalDialogState.review.moveForward && approvalDialogState.review.moveForward.conflicts) || []) {
|
|
9467
9706
|
if ((conflict.groupIds || []).some((id) => id === group.id)) delete approvalDialogState.conflicts[conflict.id];
|
|
9468
9707
|
}
|
|
9708
|
+
// #3680 part C: a changed decision changes what approving does to the densities; ask again after a pause.
|
|
9709
|
+
refreshApprovalDensity(approvalDialogState);
|
|
9469
9710
|
renderApprovalReview();
|
|
9470
9711
|
// The re-render replaced the clicked button; without this, focus fell to <body> and Esc and the
|
|
9471
9712
|
// dialog's Tab trap (both on the modal) stopped working after a keyboard decision.
|
|
@@ -9474,6 +9715,11 @@
|
|
|
9474
9715
|
return;
|
|
9475
9716
|
}
|
|
9476
9717
|
if (event.target.closest('[data-approval-check-again]')) { checkApprovalAgain(); return; }
|
|
9718
|
+
if (event.target.closest('[data-approval-density-retry]') && approvalDialogState) {
|
|
9719
|
+
refreshApprovalDensity(approvalDialogState, 0);
|
|
9720
|
+
repaintApprovalReviewKeepingFocus();
|
|
9721
|
+
return;
|
|
9722
|
+
}
|
|
9477
9723
|
if (event.target.closest('[data-approval-workflow-update]') && approvalDialogState && approvalDismissible(approvalDialogState.phase)) {
|
|
9478
9724
|
const appId = current?.app;
|
|
9479
9725
|
closeApprovalReview();
|
|
@@ -9491,6 +9737,7 @@
|
|
|
9491
9737
|
const conflict = event.target.closest('[data-approval-conflict]');
|
|
9492
9738
|
if (conflict && approvalDialogState) {
|
|
9493
9739
|
approvalDialogState.conflicts[conflict.dataset.conflictId] = conflict.dataset.approvalConflict;
|
|
9740
|
+
refreshApprovalDensity(approvalDialogState);
|
|
9494
9741
|
renderApprovalReview();
|
|
9495
9742
|
return;
|
|
9496
9743
|
}
|
|
@@ -11544,7 +11791,15 @@
|
|
|
11544
11791
|
knowledgeState = st;
|
|
11545
11792
|
companyKnowledgeState = st.company || null;
|
|
11546
11793
|
paintKnowledge(st);
|
|
11547
|
-
|
|
11794
|
+
// #4086: a connected source that reports syncing also keeps the poll going. Its sync's end reaches this
|
|
11795
|
+
// window as an SSE event (at-most-once, no replay) and as the POST's own repaint; either can be lost or
|
|
11796
|
+
// superseded, and nothing else would ever re-read the row, so it stayed on "syncing…".
|
|
11797
|
+
if (kbPending(st) || kbAnySyncing(st)) startKnowledgePoll(); else stopKnowledgePoll();
|
|
11798
|
+
}
|
|
11799
|
+
|
|
11800
|
+
/** Whether any connected source row is mid-sync, as the server last reported it. */
|
|
11801
|
+
function kbAnySyncing(st) {
|
|
11802
|
+
return !!(st && st.connected && Array.isArray(st.connected.sources) && st.connected.sources.some((c) => c && c.syncing));
|
|
11548
11803
|
}
|
|
11549
11804
|
|
|
11550
11805
|
/** A 404 means EITHER the bytes are gone OR the row itself was deleted server-side. The client can't
|
|
@@ -11894,6 +12149,7 @@
|
|
|
11894
12149
|
'open-integrations': 'Open Integrations', 'open-tools': 'Open Tools', cancel: 'Leave it for now', 'sync-now': 'Sync now',
|
|
11895
12150
|
keep: 'Keep the copy',
|
|
11896
12151
|
rebuild: 'Rebuild the copy',
|
|
12152
|
+
'update-aware': 'Update AWARE',
|
|
11897
12153
|
// #2470 R6.8 slice 3: a Gmail source's own ways on.
|
|
11898
12154
|
'allow-gmail-read': 'Allow reading Gmail', 'prepare-tool': 'Update and continue', 'update-aware': 'Update AWARE', 'not-now': 'Not now',
|
|
11899
12155
|
};
|
|
@@ -11908,6 +12164,9 @@
|
|
|
11908
12164
|
// #2470 R6.8 slice 2: a Trimble Connect project is the third kind: its topics (coordination issues), their comments and
|
|
11909
12165
|
// its ToDos. It has no window; its row says how the copy is kept up to date, from the last sync.
|
|
11910
12166
|
const kbConnIsTrimble = (c) => !!(c && c.scope === 'trimble-project');
|
|
12167
|
+
// #2470 R6.8 slice 4: one channel of a Teams team is the fourth kind. It may wait on the account's channel-reading switch,
|
|
12168
|
+
// Microsoft's permission or an AWARE update (its `hold`); the server words each and names its next step.
|
|
12169
|
+
const kbConnIsChannel = (c) => !!(c && c.scope === 'teams-channel');
|
|
11911
12170
|
|
|
11912
12171
|
/**
|
|
11913
12172
|
* #3412: a connected source's markdown as a person reads it. FloLess writes it (server knowledge-connected-*-render),
|
|
@@ -11936,12 +12195,15 @@
|
|
|
11936
12195
|
// A removed source carries only its kind, so it is named "Gmail source" rather than guessed a label or a search.
|
|
11937
12196
|
const kbConnKindName = (c) => (kbConnIsTrimble(c) ? 'Trimble Connect project'
|
|
11938
12197
|
: kbConnIsGmail(c) ? (!c.gmail ? 'Gmail source' : kbConnGmailIsSearch(c) ? 'Gmail search' : 'Gmail label')
|
|
11939
|
-
: kbConnIsMail(c) ? 'Outlook folder' : 'Teams chat');
|
|
12198
|
+
: kbConnIsMail(c) ? 'Outlook folder' : kbConnIsChannel(c) ? 'Teams channel' : 'Teams chat');
|
|
11940
12199
|
const kbConnService = (c) => (kbConnIsTrimble(c) ? 'Trimble Connect' : kbConnIsGmail(c) ? 'Google Workspace' : 'Microsoft 365');
|
|
11941
|
-
const kbConnThing = (c) => (kbConnIsTrimble(c) ? 'project' : kbConnIsGmail(c) ? (kbConnGmailIsSearch(c) ? 'search' : 'label')
|
|
12200
|
+
const kbConnThing = (c) => (kbConnIsTrimble(c) ? 'project' : kbConnIsGmail(c) ? (kbConnGmailIsSearch(c) ? 'search' : 'label')
|
|
12201
|
+
: kbConnIsMail(c) ? 'folder' : kbConnIsChannel(c) ? 'channel' : 'chat');
|
|
11942
12202
|
// A Gmail source is an envelope with a small G badge, so it reads as mail and is told apart from an Outlook folder.
|
|
11943
12203
|
const kbConnGlyph = (kind) => (kind === 'trimble-project' ? '⚑︎' : kind === 'outlook-folder' ? '✉︎'
|
|
11944
|
-
: kind === 'gmail-mail' ? '✉︎<span class="kb-conn-badge" aria-hidden="true">G</span>' : '◫');
|
|
12204
|
+
: kind === 'gmail-mail' ? '✉︎<span class="kb-conn-badge" aria-hidden="true">G</span>' : kind === 'teams-channel' ? '#︎' : '◫');
|
|
12205
|
+
/** A channel's row and card name: its team and its channel, the way Teams shows them. */
|
|
12206
|
+
const kbConnChannelName = (c) => (c && c.channel && c.channel.teamLabel ? `${c.channel.teamLabel} › ${c.label}` : (c && c.label) || 'Teams channel');
|
|
11945
12207
|
const KB_CONN_REGIONS = [['northAmerica', 'North America'], ['europe', 'Europe'], ['unitedKingdom', 'United Kingdom'], ['asia', 'Asia'], ['australia', 'Australia']];
|
|
11946
12208
|
const kbConnRegionName = (r) => (KB_CONN_REGIONS.find(([v]) => v === r) || [r, r])[1];
|
|
11947
12209
|
// The plan §17 #13 disclosure, word for word as the page and the action card say it.
|
|
@@ -12139,12 +12401,20 @@
|
|
|
12139
12401
|
const kbConnOf = (st, sourceId) => ((st && st.connected && st.connected.sources) || []).find((c) => c.sourceId === sourceId) || null;
|
|
12140
12402
|
const kbConnUrl = (path) => kbUrl(current.id, `/connected${path}`);
|
|
12141
12403
|
function kbConnRepaint() { kbInvalidateRefs(); if (knowledgeState) paintKnowledge(knowledgeState); }
|
|
12404
|
+
/** #3738 F4: a Teams channel switch changed, so a stop a Sync now got for a channel's hold (reading off, Microsoft's
|
|
12405
|
+
* permission, an AWARE update) is dropped: the row's live hold, re-read from the server, says what is true now. Any
|
|
12406
|
+
* other stop, and any other kind of source, is left alone. */
|
|
12407
|
+
function kbConnDropHeldChannelStops(st) {
|
|
12408
|
+
for (const [sourceId, stop] of [...kbConnStops]) {
|
|
12409
|
+
if (stop && stop.code === 'held' && kbConnIsChannel(kbConnOf(st, sourceId))) kbConnStops.delete(sourceId);
|
|
12410
|
+
}
|
|
12411
|
+
}
|
|
12142
12412
|
|
|
12143
|
-
function kbConnStopHtml(sourceId, stop) {
|
|
12413
|
+
function kbConnStopHtml(sourceId, stop, lead = 'Not synced.') {
|
|
12144
12414
|
const buttons = kbConnKnownChoices(stop.choices).map((choice, n) =>
|
|
12145
12415
|
`<button type="button" class="kb-link${n === 0 ? ' kb-conn-primary' : ''}" data-kb-conn-choice="${escapeAttr(choice)}" data-kb-conn-id="${escapeAttr(sourceId)}"` +
|
|
12146
12416
|
` data-command-id="shell.kb-connected-choice#${escapeAttr(choice)}" data-command-instance-label="${escapeAttr(KB_CONN_CHOICES[choice])}">${escapeHtml(KB_CONN_CHOICES[choice])}</button>`).join('');
|
|
12147
|
-
return `<div class="kb-conn-stop" role="status"><b
|
|
12417
|
+
return `<div class="kb-conn-stop" role="status"><b>${escapeHtml(lead)}</b> ${escapeHtml(stop.message)}${buttons ? `<div class="kb-conn-choices">${buttons}</div>` : ''}</div>`;
|
|
12148
12418
|
}
|
|
12149
12419
|
|
|
12150
12420
|
function kbConnRowHtml(s, st, depth) {
|
|
@@ -12152,7 +12422,8 @@
|
|
|
12152
12422
|
const on = !!s.useAsKb;
|
|
12153
12423
|
const sel = kbSel.selected.has(s.sourceId);
|
|
12154
12424
|
const mail = kbConnIsMail(c);
|
|
12155
|
-
const
|
|
12425
|
+
const channel = kbConnIsChannel(c);
|
|
12426
|
+
const name = (channel ? kbConnChannelName(c) : c && c.label) || s.filename || kbConnKindName(c);
|
|
12156
12427
|
const isOpen = viewer.mode === 'file' && viewer.sourceId === s.sourceId;
|
|
12157
12428
|
const syncing = kbConnSyncing.has(s.sourceId) || !!(c && c.syncing);
|
|
12158
12429
|
// When the chat was last read: the newest version, or a later sync that found nothing new (it read the chat too).
|
|
@@ -12164,7 +12435,7 @@
|
|
|
12164
12435
|
const since = Date.parse((c && c.windowStart) || '');
|
|
12165
12436
|
const trimble = kbConnIsTrimble(c);
|
|
12166
12437
|
const scope = trimble ? kbConnRegionName(c.trimble && c.trimble.region) : mail ? `last ${kbConnMailOf(c).windowDays || 90} days`
|
|
12167
|
-
: Number.isFinite(since) ?
|
|
12438
|
+
: Number.isFinite(since) ? `${channel ? 'threads active since' : 'messages since'} ${new Date(since).toLocaleDateString()}` : '';
|
|
12168
12439
|
const unread = !!(st && st.connected && st.connected.unreadable);
|
|
12169
12440
|
const service = c ? kbConnService(c) : 'Connected source';
|
|
12170
12441
|
// Each part its own span (#3425), so the line breaks between parts before it breaks inside one (an email address).
|
|
@@ -12177,9 +12448,18 @@
|
|
|
12177
12448
|
(c && c.organizedPending ? '<span class="kb-chip new" data-tip="Organize again to use what this sync brought in">synced after the last Organize</span>' : '');
|
|
12178
12449
|
const stop = kbConnStops.get(s.sourceId);
|
|
12179
12450
|
const last = c && c.lastSync;
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12451
|
+
// A held channel (slice 4 plan §3.4) says why it was not read and its next step, whether or not a sync has run yet:
|
|
12452
|
+
// "Not read yet." because nothing from it is in the knowledge base until then (designer pass, 2026-11-17).
|
|
12453
|
+
const hold = channel && c.hold && c.hold.message ? c.hold : null;
|
|
12454
|
+
// #3738 F1: the server says reading is off as the switch is now; a channel with an earlier sync leads with the state,
|
|
12455
|
+
// since "Not read yet." would deny the copy its meta line shows (designer pass, 2026-11-25).
|
|
12456
|
+
const readingOff = !!(hold && hold.reason === 'channel-reading-off');
|
|
12457
|
+
const holdLead = readingOff && c.versions > 0 ? 'Reading is off.' : 'Not read yet.';
|
|
12458
|
+
const stopped = stop ? kbConnStopHtml(s.sourceId, stop, hold && (stop.message === hold.message || stop.code === 'held') ? holdLead : 'Not synced.')
|
|
12459
|
+
: hold ? kbConnStopHtml(s.sourceId, { message: hold.message, choices: hold.choices }, holdLead)
|
|
12460
|
+
// A stop from before a reload: the same way on as a fresh one (the choices are this screen's, not stored). A channel
|
|
12461
|
+
// sync refused while reading was off no longer applies once it is back on (#3738 F4): the server says so.
|
|
12462
|
+
: last && last.outcome === 'stopped' && !c.lastSyncSuperseded ? kbConnStopHtml(s.sourceId, { message: `Last sync stopped: ${last.message || ''}`, choices: last.choices }) : '';
|
|
12183
12463
|
const gaps = c && c.gaps === null
|
|
12184
12464
|
? '<div class="kb-conn-note">FloLess could not check whether this copy holds every message. Sync again to check.</div>'
|
|
12185
12465
|
: c && Array.isArray(c.gaps) && c.gaps.length
|
|
@@ -12188,7 +12468,14 @@
|
|
|
12188
12468
|
`<div>Microsoft 365 said more messages may have changed at these times than one sync reads, so some may not be in this copy. Sync more often to keep a busy chat complete.</div>` +
|
|
12189
12469
|
`<ul>${c.gaps.map((g) => `<li>${escapeHtml(new Date(g.from).toLocaleString())} – ${escapeHtml(new Date(g.to).toLocaleString())}</li>`).join('')}</ul></details>`
|
|
12190
12470
|
: '';
|
|
12191
|
-
|
|
12471
|
+
// A channel's partial threads, in the server's own sentences (slice 4 plan §3.3).
|
|
12472
|
+
const channelGaps = channel && c.channel ? (c.channel.gaps === null
|
|
12473
|
+
? '<div class="kb-conn-note">FloLess could not check whether every thread in this copy is complete. Sync again to check.</div>'
|
|
12474
|
+
: Array.isArray(c.channel.gaps) && c.channel.gaps.length
|
|
12475
|
+
? `<details class="kb-conn-gaps" data-kb-conn-gaps="${escapeAttr(`${s.sourceId}:threads`)}"${kbConnGapsOpen.has(`${s.sourceId}:threads`) ? ' open' : ''}>` +
|
|
12476
|
+
`<summary data-command-id="shell.kb-connected-threads#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}">Some threads may be partial (${c.channel.gaps.length})</summary>` +
|
|
12477
|
+
`<ul>${c.channel.gaps.map((g) => `<li>${escapeHtml(g)}</li>`).join('')}</ul></details>` : '') : '';
|
|
12478
|
+
const notes = (mail && !unread ? kbConnMailHtml(s.sourceId, c, name) : '') + (trimble && !unread ? kbConnTrimbleHtml(s.sourceId, c, name) : '') + (unread ? '' : channelGaps) + gaps;
|
|
12192
12479
|
return `<div class="kb-src kb-conn${on ? '' : ' off'}${sel ? ' selected' : ''}" draggable="true"` +
|
|
12193
12480
|
(depth != null ? ` style="--kb-depth:${depth}"` : '') +
|
|
12194
12481
|
` data-source-id="${escapeAttr(s.sourceId)}"${isOpen ? ' aria-current="true"' : ''}>` +
|
|
@@ -12202,10 +12489,12 @@
|
|
|
12202
12489
|
'<span class="kb-conn-ctl">' +
|
|
12203
12490
|
`<button type="button" class="kb-conn-sync" data-kb-conn-sync="${escapeAttr(s.sourceId)}" aria-label="Sync “${escapeAttr(name)}” now"${syncing ? ' aria-busy="true" disabled' : ''}` +
|
|
12204
12491
|
` data-command-id="shell.kb-connected-sync#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}"` +
|
|
12205
|
-
` data-tip="${syncing ? 'Syncing…' : c && c.paused ? 'Paused. Sync now asks to resume it first' :
|
|
12492
|
+
` data-tip="${syncing ? 'Syncing…' : c && c.paused ? 'Paused. Sync now asks to resume it first' : readingOff ? 'Teams channel reading is off. Sync now asks you to switch it on first'
|
|
12493
|
+
: `Sync now: read what changed in this ${kbConnThing(c)}`}"><span aria-hidden="true">⟳</span></button>` +
|
|
12206
12494
|
`<button type="button" class="kb-toggle" role="switch" aria-checked="${on ? 'true' : 'false'}" data-kb-toggle ` +
|
|
12207
12495
|
`aria-label="Use “${escapeAttr(name)}” as knowledge" data-command-id="shell.kb-category-row-toggle#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}" ` +
|
|
12208
|
-
`data-tip="${on ? 'Included in the knowledge base
|
|
12496
|
+
`data-tip="${on ? (readingOff && c.versions > 0 ? 'Included in the knowledge base (copy from the last sync). Click to exclude' : 'Included in the knowledge base — click to exclude')
|
|
12497
|
+
: 'Excluded from the knowledge base — click to include'}"></button>` +
|
|
12209
12498
|
`<button type="button" class="kb-cat-more kb-conn-more" data-kb-conn-menu="${escapeAttr(s.sourceId)}" aria-haspopup="menu" aria-label="More for “${escapeAttr(name)}”"` +
|
|
12210
12499
|
` data-command-id="shell.kb-connected-menu#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}" data-tip="Sync, pause, remove or erase">⋯</button>` +
|
|
12211
12500
|
'</span>' +
|
|
@@ -12257,7 +12546,7 @@
|
|
|
12257
12546
|
} catch (err) {
|
|
12258
12547
|
const body = (err && err.body) || {};
|
|
12259
12548
|
kbConnStops.set(sourceId, { message: err.message, choices: kbConnKnownChoices(body.choices), target: body.target || null,
|
|
12260
|
-
alias: typeof body.alias === 'string' ? body.alias : null, opts });
|
|
12549
|
+
alias: typeof body.alias === 'string' ? body.alias : null, code: typeof body.code === 'string' ? body.code : null, opts });
|
|
12261
12550
|
kbAnnounce(`Not synced. ${err.message}`);
|
|
12262
12551
|
} finally {
|
|
12263
12552
|
kbConnSyncing.delete(sourceId);
|
|
@@ -12375,7 +12664,7 @@
|
|
|
12375
12664
|
for (;;) {
|
|
12376
12665
|
const answer = await kbConnDialog({ title: 'Connect a source', labelId: 'kb-conn-title',
|
|
12377
12666
|
bodyHtml: '<div class="kb-conn-kinds" role="radiogroup" aria-label="What to connect">' +
|
|
12378
|
-
[['teams-chat', 'Teams chat', 'Messages from one chat.'], ['outlook-folder', 'Outlook folder', 'Mail received in one folder.'],
|
|
12667
|
+
[['teams-chat', 'Teams chat', 'Messages from one chat.'], ['teams-channel', 'Teams channel', 'Messages from one channel of a team.'], ['outlook-folder', 'Outlook folder', 'Mail received in one folder.'],
|
|
12379
12668
|
['gmail-mail', 'Gmail', 'Mail with one label, or mail matching a search.'],
|
|
12380
12669
|
['trimble-project', 'Trimble Connect project', 'Topics (coordination issues), their comments and ToDos from one project.']].map(([v, label, line], n) =>
|
|
12381
12670
|
`<label class="kb-conn-kind"><input type="radio" name="kb-conn-kind" value="${v}" data-command-id="shell.kb-connected-kind#${escapeAttr(v)}" data-command-instance-label="${label}"${n === 0 ? ' data-autofocus' : ''}>` +
|
|
@@ -12392,7 +12681,7 @@
|
|
|
12392
12681
|
if (!answer || answer.id !== 'next') return;
|
|
12393
12682
|
const kind = answer.form.querySelector('input[name="kb-conn-kind"]:checked')?.value;
|
|
12394
12683
|
const result = kind === 'outlook-folder' ? await kbConnOpenOutlook() : kind === 'gmail-mail' ? await kbConnOpenGmail()
|
|
12395
|
-
: kind === 'trimble-project' ? await kbConnOpenTrimble() : await kbConnOpenTeams();
|
|
12684
|
+
: kind === 'trimble-project' ? await kbConnOpenTrimble() : kind === 'teams-channel' ? await kbConnOpenChannel() : await kbConnOpenTeams();
|
|
12396
12685
|
if (result !== 'back') return;
|
|
12397
12686
|
}
|
|
12398
12687
|
}
|
|
@@ -13183,11 +13472,192 @@
|
|
|
13183
13472
|
}
|
|
13184
13473
|
}
|
|
13185
13474
|
|
|
13475
|
+
// #2470 R6.8 slice 4 (plan §3.2): why a channel connected now would wait, and the step that lets FloLess read it. Connect
|
|
13476
|
+
// still goes ahead: the source is created waiting, and reads nothing until then.
|
|
13477
|
+
const KB_CONN_CHANNEL_WAITS = {
|
|
13478
|
+
'channel-reading-off': { text: 'Teams channel reading is off for this Microsoft 365 account. You can connect a channel now; FloLess reads it once you switch on “Read Teams channel messages” for the account in Integrations.', act: 'integrations', label: 'Open Integrations' },
|
|
13479
|
+
'permission-missing': { text: 'Microsoft has not given this account permission to read Teams channel messages yet. You can connect a channel now; FloLess reads it once a Microsoft 365 administrator approves it and you sign in again from Integrations.', act: 'integrations', label: 'Open Integrations' },
|
|
13480
|
+
'update-aware': { text: 'The installed AWARE cannot read Teams channels yet. You can connect a channel now; FloLess reads it once AWARE is updated.', act: 'update-aware', label: 'Update AWARE' },
|
|
13481
|
+
};
|
|
13482
|
+
const kbConnChannelUrl = (teamId, target) => kbConnUrl(`/options?${new URLSearchParams({ kind: 'teams-channel', ...(teamId ? { teamId } : {}),
|
|
13483
|
+
...(target && target.principal ? { expectedPrincipal: target.principal } : {}), ...(target && target.tenant ? { expectedTenant: target.tenant } : {}) })}`);
|
|
13484
|
+
const KB_CONN_CHANNEL_TYPE = { standard: 'standard channel', private: 'private channel', shared: 'shared channel', other: 'channel' };
|
|
13485
|
+
|
|
13486
|
+
/** Step 2 for a Teams channel: the account's teams, then one team's channels and how far back, in one dialog (designer
|
|
13487
|
+
* pass: no second modal). Nothing is picked for the person: connecting copies people's messages. */
|
|
13488
|
+
async function kbConnOpenChannel() {
|
|
13489
|
+
const proj = current;
|
|
13490
|
+
if (!proj) return null;
|
|
13491
|
+
let first;
|
|
13492
|
+
for (;;) {
|
|
13493
|
+
try { first = await api(kbConnChannelUrl(null, null), { timeoutMs: 60_000 }); break; }
|
|
13494
|
+
catch (err) { if (await kbConnOptionsFailed(err, 'Connect a Teams channel') !== 'retry') return null; }
|
|
13495
|
+
}
|
|
13496
|
+
const view = { target: first.target, eligibility: first.eligibility || 'ready', teams: first.teams || [], teamsPage: first, team: null,
|
|
13497
|
+
channels: [], channelsPage: null, pickedTeam: null, pickedChannel: null, notice: null, loading: false };
|
|
13498
|
+
const waitHtml = () => {
|
|
13499
|
+
const wait = KB_CONN_CHANNEL_WAITS[view.eligibility];
|
|
13500
|
+
return wait ? `<div class="kb-conn-stop" role="status"><b>Not read yet.</b> ${escapeHtml(wait.text)}<div class="kb-conn-choices">` +
|
|
13501
|
+
`<button type="button" class="kb-link" data-kb-conn-act="${wait.act}" data-command-id="shell.kb-connected-channel-wait#${escapeAttr(wait.act)}" data-command-instance-label="${escapeAttr(wait.label)}">${escapeHtml(wait.label)}</button></div></div>` : '';
|
|
13502
|
+
};
|
|
13503
|
+
const stage = () => {
|
|
13504
|
+
if (view.notice) {
|
|
13505
|
+
return `<div class="kb-conn-stop" role="alert"><b>${escapeHtml(view.notice.title)}</b> ${escapeHtml(view.notice.text)}` +
|
|
13506
|
+
'<div class="kb-conn-choices"><button type="button" class="kb-link kb-conn-primary" data-kb-conn-restart data-command-id="shell.kb-connected-restart">Start again</button></div></div>';
|
|
13507
|
+
}
|
|
13508
|
+
if (!view.team) {
|
|
13509
|
+
const list = view.teams.length
|
|
13510
|
+
? `<div class="kb-conn-chats" role="radiogroup" aria-label="Teams"${view.loading ? ' aria-busy="true"' : ''}>${view.teams.map((t) =>
|
|
13511
|
+
`<label class="kb-conn-chat"><input type="radio" name="kb-conn-team" value="${escapeAttr(t.teamId)}" data-label="${escapeAttr(t.label)}"${view.pickedTeam === t.teamId ? ' checked' : ''}${view.loading ? ' disabled' : ''}` +
|
|
13512
|
+
` data-command-id="shell.kb-connected-team#${escapeAttr(t.teamId)}" data-command-instance-label="${escapeAttr(t.label)}">` +
|
|
13513
|
+
`<span class="kb-conn-chat-name" data-tip="${escapeAttr(t.label)}">${escapeHtml(t.label)}</span>` +
|
|
13514
|
+
`<span class="kb-conn-chat-meta">${t.connectedChannels ? escapeHtml(`${kbConnPlural(t.connectedChannels, 'channel', 'channels')} already connected`) : 'team'}</span></label>`).join('')}</div>`
|
|
13515
|
+
: '<p class="kb-conn-p">This account is not a member of any team FloLess can read.</p>';
|
|
13516
|
+
const notes = [view.teamsPage.more ? 'Showing your first 200 teams.' : '',
|
|
13517
|
+
view.teamsPage.omitted > 0 ? `${kbConnPlural(view.teamsPage.omitted, 'team', 'teams')} could not be listed by Microsoft 365 and ${view.teamsPage.omitted === 1 ? 'is' : 'are'} not shown.` : ''].filter(Boolean);
|
|
13518
|
+
return `${waitHtml()}<div class="kb-conn-field-label">Choose a team</div>${list}${notes.map((n) => `<div class="kb-conn-note">${escapeHtml(n)}</div>`).join('')}`;
|
|
13519
|
+
}
|
|
13520
|
+
const crumbs = `<nav class="kb-conn-crumbs" aria-label="Team"><button type="button" class="kb-link" data-kb-conn-teams data-command-id="shell.kb-connected-teams">Teams</button>` +
|
|
13521
|
+
`<span class="kb-conn-crumb-sep" aria-hidden="true">›</span><span aria-current="location" data-tip="${escapeAttr(view.team.label)}">${escapeHtml(view.team.label)}</span></nav>`;
|
|
13522
|
+
const list = view.loading ? '<p class="kb-conn-p" role="status">Loading channels…</p>'
|
|
13523
|
+
: view.channels.length
|
|
13524
|
+
? `<div class="kb-conn-chats" role="radiogroup" aria-label="Channels in ${escapeAttr(view.team.label)}">${view.channels.map((ch) =>
|
|
13525
|
+
`<label class="kb-conn-chat"><input type="radio" name="kb-conn-channel" value="${escapeAttr(ch.channelId)}" data-label="${escapeAttr(ch.label)}"${ch.connected ? ' data-connected' : ''}${view.pickedChannel === ch.channelId ? ' checked' : ''}` +
|
|
13526
|
+
` data-command-id="shell.kb-connected-channel#${escapeAttr(ch.channelId)}" data-command-instance-label="${escapeAttr(ch.label)}">` +
|
|
13527
|
+
`<span class="kb-conn-chat-name" data-tip="${escapeAttr(ch.label)}">${escapeHtml(ch.label)}</span>` +
|
|
13528
|
+
`<span class="kb-conn-chat-meta"${ch.connected ? ' data-tip="Already a source in this project. Choosing it syncs that source; it keeps its own time range."' : ''}>` +
|
|
13529
|
+
`${escapeHtml(KB_CONN_CHANNEL_TYPE[ch.membershipType] || 'channel')}${ch.connected ? ' · already connected' : ''}</span></label>`).join('')}</div>`
|
|
13530
|
+
: '<p class="kb-conn-p">FloLess found no channels it can read in this team. Choose another team.</p>';
|
|
13531
|
+
const page = view.channelsPage || {};
|
|
13532
|
+
const notes = [page.more ? 'Showing the first 200 channels.' : '',
|
|
13533
|
+
page.omitted > 0 ? `${kbConnPlural(page.omitted, 'channel', 'channels')} could not be listed by Microsoft 365 and ${page.omitted === 1 ? 'is' : 'are'} not shown.` : ''].filter(Boolean);
|
|
13534
|
+
const windows = [7, 30, 90].map((d) => `<label class="kb-conn-window"><input type="radio" name="kb-conn-window" value="${d}" data-command-id="shell.kb-connected-window#${escapeAttr(d)}" data-command-instance-label="${d} days"${d === (view.windowDays || 30) ? ' checked' : ''}><span>${d} days</span></label>`).join('');
|
|
13535
|
+
return `${crumbs}${waitHtml()}${list}${notes.map((n) => `<div class="kb-conn-note">${escapeHtml(n)}</div>`).join('')}` +
|
|
13536
|
+
`<div class="kb-conn-field"><span class="kb-conn-field-label">Read threads active in the last</span><div class="kb-conn-windows" role="radiogroup" aria-label="How far back">${windows}</div></div>` +
|
|
13537
|
+
'<ul class="kb-conn-warn">' +
|
|
13538
|
+
'<li>People’s messages in this channel are copied into this project’s knowledge and used the next time it is organized.</li>' +
|
|
13539
|
+
'<li>Each sync reads the 50 most recently active threads and up to 50 replies in each; a busier thread is marked as partial.</li>' +
|
|
13540
|
+
'<li>A message can still mislead what Organize writes, so pages cite the messages they used.</li>' +
|
|
13541
|
+
'</ul>';
|
|
13542
|
+
};
|
|
13543
|
+
const answer = await kbConnDialog({ title: 'Connect a Teams channel', labelId: 'kb-conn-title',
|
|
13544
|
+
bodyHtml: `<div class="kb-conn-account">Account: <b>${escapeHtml(view.target.label || 'Microsoft 365 account')}</b> · the one chosen in Integrations ` +
|
|
13545
|
+
'<button type="button" class="kb-link" data-kb-conn-act="integrations" data-command-id="shell.kb-connected-open-integrations">Change</button></div>' +
|
|
13546
|
+
`<div data-kb-conn-channels>${stage()}</div><div class="kb-sr" role="status" data-kb-conn-step>Step 1 of 2: choose a team.</div>`,
|
|
13547
|
+
actions: [{ id: 'back', label: 'Back', commandId: 'shell.kb-connected-back' }, { id: 'cancel', label: 'Cancel', commandId: 'shell.kb-connected-cancel' },
|
|
13548
|
+
{ id: 'next', label: 'Next', tone: 'primary', commandId: 'shell.kb-connected-team-next', disabled: true, tip: 'Choose a team first' },
|
|
13549
|
+
{ id: 'connect', label: 'Connect and sync', tone: 'primary', commandId: 'shell.kb-connected-connect', disabled: true, tip: 'Choose a channel first' }],
|
|
13550
|
+
onOpen: (box) => {
|
|
13551
|
+
const host = box.querySelector('[data-kb-conn-channels]');
|
|
13552
|
+
const next = box.querySelector('[data-kb-conn-act="next"]');
|
|
13553
|
+
const connect = box.querySelector('[data-kb-conn-act="connect"]');
|
|
13554
|
+
const step = box.querySelector('[data-kb-conn-step]');
|
|
13555
|
+
const enable = (btn, ok, tip) => { btn.disabled = !ok; if (ok) btn.removeAttribute('data-tip'); else btn.dataset.tip = tip; };
|
|
13556
|
+
const paint = () => {
|
|
13557
|
+
host.innerHTML = stage();
|
|
13558
|
+
const onTeams = !view.team;
|
|
13559
|
+
next.hidden = !onTeams || !!view.notice;
|
|
13560
|
+
connect.hidden = onTeams || !!view.notice;
|
|
13561
|
+
enable(next, !!view.pickedTeam && !view.loading, 'Choose a team first');
|
|
13562
|
+
// The connect label says what happens: a channel that waits is created, not read.
|
|
13563
|
+
connect.textContent = view.eligibility === 'ready' ? 'Connect and sync' : 'Connect';
|
|
13564
|
+
enable(connect, !!view.pickedChannel && !view.loading, 'Choose a channel first');
|
|
13565
|
+
};
|
|
13566
|
+
const showTeams = () => {
|
|
13567
|
+
view.team = null; view.channels = []; view.channelsPage = null; view.pickedChannel = null;
|
|
13568
|
+
paint();
|
|
13569
|
+
step.textContent = 'Step 1 of 2: choose a team.';
|
|
13570
|
+
(host.querySelector('input[name="kb-conn-team"]:checked') || host.querySelector('input[name="kb-conn-team"]'))?.focus();
|
|
13571
|
+
};
|
|
13572
|
+
const openTeam = async () => {
|
|
13573
|
+
const team = view.teams.find((t) => t.teamId === view.pickedTeam);
|
|
13574
|
+
if (!team || view.loading) return;
|
|
13575
|
+
view.team = team; view.loading = true; view.pickedChannel = null;
|
|
13576
|
+
paint();
|
|
13577
|
+
let res;
|
|
13578
|
+
try { res = await api(kbConnChannelUrl(team.teamId, view.target), { timeoutMs: 60_000 }); }
|
|
13579
|
+
catch (err) {
|
|
13580
|
+
view.loading = false;
|
|
13581
|
+
view.notice = { title: 'Channels not listed.', text: err.message };
|
|
13582
|
+
paint();
|
|
13583
|
+
box.querySelector('[data-kb-conn-restart]')?.focus();
|
|
13584
|
+
return;
|
|
13585
|
+
}
|
|
13586
|
+
view.loading = false;
|
|
13587
|
+
if (res.targetChanged) {
|
|
13588
|
+
// The teams shown belong to the other account: none of them may stay selectable.
|
|
13589
|
+
view.target = res.target; view.teams = []; view.team = null; view.pickedTeam = null;
|
|
13590
|
+
view.notice = { title: 'The Microsoft 365 account changed while this was open.', text: 'The teams shown may belong to the other account, so start again.' };
|
|
13591
|
+
box.querySelector('.kb-conn-account b').textContent = res.target.label || 'Microsoft 365 account';
|
|
13592
|
+
paint();
|
|
13593
|
+
box.querySelector('[data-kb-conn-restart]')?.focus();
|
|
13594
|
+
return;
|
|
13595
|
+
}
|
|
13596
|
+
view.eligibility = res.eligibility || view.eligibility;
|
|
13597
|
+
view.channelsPage = res;
|
|
13598
|
+
view.channels = res.channels || [];
|
|
13599
|
+
paint();
|
|
13600
|
+
step.textContent = `Step 2 of 2: choose a channel in ${team.label}. ${kbConnPlural(view.channels.length, 'channel', 'channels')}.`;
|
|
13601
|
+
(host.querySelector('input[name="kb-conn-channel"]') || host.querySelector('[data-kb-conn-teams]'))?.focus();
|
|
13602
|
+
};
|
|
13603
|
+
// Next and Back move between the two steps without closing the dialog; every other action closes it. Caught on the
|
|
13604
|
+
// dialog box, below the backdrop where kbConnDialog resolves, so stopping it keeps the dialog open.
|
|
13605
|
+
box.querySelector('.modal').addEventListener('click', (e) => {
|
|
13606
|
+
const act = e.target.closest('[data-kb-conn-act]');
|
|
13607
|
+
if (act && act.dataset.kbConnAct === 'next') { e.stopPropagation(); void openTeam(); return; }
|
|
13608
|
+
if (act && act.dataset.kbConnAct === 'back' && view.team && !view.notice) { e.stopPropagation(); showTeams(); return; }
|
|
13609
|
+
if (e.target.closest('[data-kb-conn-teams]')) { e.stopPropagation(); showTeams(); return; }
|
|
13610
|
+
if (e.target.closest('[data-kb-conn-restart]')) {
|
|
13611
|
+
e.stopPropagation();
|
|
13612
|
+
view.notice = null; view.loading = true; paint();
|
|
13613
|
+
void api(kbConnChannelUrl(null, null), { timeoutMs: 60_000 }).then((res) => {
|
|
13614
|
+
Object.assign(view, { target: res.target, eligibility: res.eligibility || 'ready', teams: res.teams || [], teamsPage: res, loading: false, pickedTeam: null });
|
|
13615
|
+
box.querySelector('.kb-conn-account b').textContent = res.target.label || 'Microsoft 365 account';
|
|
13616
|
+
showTeams();
|
|
13617
|
+
}, (err) => { view.loading = false; view.notice = { title: 'Teams not listed.', text: err.message }; paint(); });
|
|
13618
|
+
}
|
|
13619
|
+
});
|
|
13620
|
+
host.addEventListener('change', (e) => {
|
|
13621
|
+
if (e.target.name === 'kb-conn-team') { view.pickedTeam = e.target.value; enable(next, true, ''); }
|
|
13622
|
+
else if (e.target.name === 'kb-conn-channel') { view.pickedChannel = e.target.value; enable(connect, true, ''); }
|
|
13623
|
+
else if (e.target.name === 'kb-conn-window') view.windowDays = Number(e.target.value);
|
|
13624
|
+
});
|
|
13625
|
+
// Enter on a chosen team goes on, as Next does.
|
|
13626
|
+
host.addEventListener('keydown', (e) => { if (e.key === 'Enter' && e.target.name === 'kb-conn-team' && view.pickedTeam) { e.preventDefault(); void openTeam(); } });
|
|
13627
|
+
paint();
|
|
13628
|
+
} });
|
|
13629
|
+
if (answer && answer.id === 'back') return 'back';
|
|
13630
|
+
if (answer && answer.id === 'integrations') { if (typeof openIntegrations === 'function') openIntegrations('microsoft-365#channel-reading'); return null; }
|
|
13631
|
+
if (answer && answer.id === 'update-aware') {
|
|
13632
|
+
if (bridge.openAwareUpdate) bridge.openAwareUpdate('', document.activeElement);
|
|
13633
|
+
else showToast('FloLess couldn’t open the AWARE update. Open Tools and update AWARE there.', 'warn');
|
|
13634
|
+
return null;
|
|
13635
|
+
}
|
|
13636
|
+
if (!answer || answer.id !== 'connect' || !current || current.id !== proj.id || !view.team) return null;
|
|
13637
|
+
const picked = view.channels.find((ch) => ch.channelId === view.pickedChannel);
|
|
13638
|
+
if (!picked) return null;
|
|
13639
|
+
const label = `${view.team.label} › ${picked.label}`;
|
|
13640
|
+
try {
|
|
13641
|
+
const res = await api(kbConnUrl(''), { method: 'POST', body: JSON.stringify({ kind: 'teams-channel', teamId: view.team.teamId, teamLabel: view.team.label,
|
|
13642
|
+
channelId: picked.channelId, label: picked.label, windowDays: view.windowDays || 30, expected: view.target }) });
|
|
13643
|
+
await renderKnowledge();
|
|
13644
|
+
if (view.eligibility !== 'ready') { kbAnnounce(`Connected “${label}”. It is not read yet: ${KB_CONN_CHANNEL_WAITS[view.eligibility]?.label || 'see its row'} first.`); return null; }
|
|
13645
|
+
kbAnnounce(picked.connected ? `“${label}” is already connected. Syncing it…` : `Connected “${label}”. Syncing…`);
|
|
13646
|
+
if (res.source && res.source.sourceId) await kbConnSync(res.source.sourceId);
|
|
13647
|
+
} catch (err) {
|
|
13648
|
+
const said = errorText(err, { action: 'connect that channel' });
|
|
13649
|
+
kbAnnounce(said);
|
|
13650
|
+
showToast(said, 'warn');
|
|
13651
|
+
await renderKnowledge();
|
|
13652
|
+
}
|
|
13653
|
+
return null;
|
|
13654
|
+
}
|
|
13655
|
+
|
|
13186
13656
|
async function kbConnErase(sourceId) {
|
|
13187
13657
|
const st = knowledgeState;
|
|
13188
13658
|
const c = kbConnOf(st, sourceId);
|
|
13189
13659
|
const removed = ((st && st.connected && st.connected.removed) || []).find((r) => r.sourceId === sourceId);
|
|
13190
|
-
const name = (c && c.label) || (removed && removed.label) || (kbConnIsMail(c) ? `this ${kbConnThing(c)}` : 'this source');
|
|
13660
|
+
const name = (c && (kbConnIsChannel(c) ? kbConnChannelName(c) : c.label)) || (removed && removed.label) || (kbConnIsMail(c) ? `this ${kbConnThing(c)}` : 'this source');
|
|
13191
13661
|
// Each source names what its own service keeps (a Trimble project keeps its topics), a removed one too: the
|
|
13192
13662
|
// project-wide list is a Teams chat's, so it is only the last resort for a server that sends neither.
|
|
13193
13663
|
const notReached = (c && Array.isArray(c.notReached) && c.notReached)
|
|
@@ -13282,7 +13752,17 @@
|
|
|
13282
13752
|
if (choice === 'cancel' || choice === 'keep') { kbConnStops.delete(sourceId); kbConnRepaint(); return; }
|
|
13283
13753
|
if (choice === 'pause') { void kbConnSetPaused(sourceId, true); return; }
|
|
13284
13754
|
if (choice === 'remove') { kbConnRemove(sourceId); return; }
|
|
13285
|
-
if (choice === 'open-integrations') {
|
|
13755
|
+
if (choice === 'open-integrations') {
|
|
13756
|
+
// A held channel waits on its account's switch or permission: land on that switch (slice 4 plan §3.2).
|
|
13757
|
+
if (typeof openIntegrations === 'function') openIntegrations(kbConnIsChannel(kbConnOf(knowledgeState, sourceId)) ? 'microsoft-365#channel-reading' : undefined);
|
|
13758
|
+
return;
|
|
13759
|
+
}
|
|
13760
|
+
if (choice === 'update-aware') {
|
|
13761
|
+
// Workspaces opens the shared updater; it never starts a second install.
|
|
13762
|
+
if (bridge.openAwareUpdate) bridge.openAwareUpdate('', document.activeElement);
|
|
13763
|
+
else showToast('FloLess couldn’t open the AWARE update. Open Tools and update AWARE there.', 'warn');
|
|
13764
|
+
return;
|
|
13765
|
+
}
|
|
13286
13766
|
if (choice === 'open-tools') {
|
|
13287
13767
|
const c = kbConnOf(knowledgeState, sourceId);
|
|
13288
13768
|
if (typeof openLibrary === 'function') openLibrary(kbConnIsTrimble(c) ? 'trimble-connect' : kbConnIsGmail(c) ? 'google-workspace' : 'microsoft-365', { tab: 'available' });
|
|
@@ -13345,6 +13825,8 @@
|
|
|
13345
13825
|
// the popover out from under them. Bailing is safe: knowledgeState is left untouched, the running
|
|
13346
13826
|
// poll keeps ticking, and the next tick after the confirm closes paints fresh state.
|
|
13347
13827
|
const kbConfirmOpen = () => !!$wsKnowledge.querySelector('.hist-confirm');
|
|
13828
|
+
// #4086: a repaint dropped because a confirm was open, owed once it closes.
|
|
13829
|
+
let kbRenderDeferred = false;
|
|
13348
13830
|
|
|
13349
13831
|
/** The split is built ONCE; the refs column and the viewer then repaint independently. A wholesale
|
|
13350
13832
|
* innerHTML would destroy an open PDF <iframe> on every 3 s poll tick. Recreating the shell must
|
|
@@ -13629,14 +14111,29 @@
|
|
|
13629
14111
|
if (host && viewer.mode === 'graph' && !host.innerHTML) host.innerHTML = kbGraphEmpty(null);
|
|
13630
14112
|
}
|
|
13631
14113
|
|
|
14114
|
+
// #3738 F1: a Teams channel switch saved in Integrations (here, in another window or from AI Chat) changes what an open
|
|
14115
|
+
// Knowledge step's channel rows say, so the step reads its status again instead of keeping the old one.
|
|
14116
|
+
window.addEventListener('floless:channel-reading-changed', () => {
|
|
14117
|
+
if (!current || $wsKnowledge.hidden || !knowledgeState) return;
|
|
14118
|
+
// #3738 F4: a Sync now refused for the old switch keeps no card once the row reads what is true now.
|
|
14119
|
+
kbConnDropHeldChannelStops(knowledgeState);
|
|
14120
|
+
void renderKnowledge();
|
|
14121
|
+
});
|
|
14122
|
+
|
|
13632
14123
|
async function renderKnowledge() {
|
|
13633
14124
|
const proj = current;
|
|
13634
|
-
if (!proj
|
|
14125
|
+
if (!proj) return;
|
|
13635
14126
|
// Poll ticks and verb-triggered loads race; an older /status response must never repaint over a
|
|
13636
|
-
// newer one.
|
|
14127
|
+
// newer one. A repaint skipped for an open confirm still claims the epoch (#4086): otherwise a render
|
|
14128
|
+
// already out stays the newest, and commits what it read BEFORE the change that asked for this one.
|
|
14129
|
+
// The skipped repaint runs when the confirm closes (kbCloseConfirm).
|
|
13637
14130
|
const epoch = ++knowledgeRenderEpoch;
|
|
13638
|
-
|
|
13639
|
-
|
|
14131
|
+
if (kbConfirmOpen()) { kbRenderDeferred = true; return; }
|
|
14132
|
+
const stale = () => {
|
|
14133
|
+
if (epoch !== knowledgeRenderEpoch || !current || current.id !== proj.id || $wsKnowledge.hidden) return true;
|
|
14134
|
+
if (kbConfirmOpen()) { kbRenderDeferred = true; return true; }
|
|
14135
|
+
return false;
|
|
14136
|
+
};
|
|
13640
14137
|
|
|
13641
14138
|
if (!knowledgeState) kbPaintRefsMessage('<div class="kb-empty">Loading…</div>');
|
|
13642
14139
|
|
|
@@ -14517,6 +15014,7 @@
|
|
|
14517
15014
|
const pop = $wsKnowledge.querySelector('.hist-confirm');
|
|
14518
15015
|
if (pop) pop.remove();
|
|
14519
15016
|
document.removeEventListener('mousedown', kbOnDocDown, true);
|
|
15017
|
+
if (kbRenderDeferred) { kbRenderDeferred = false; setTimeout(() => { if (current && !$wsKnowledge.hidden) void renderKnowledge(); }, 0); }
|
|
14520
15018
|
}
|
|
14521
15019
|
function kbOnDocDown(e) {
|
|
14522
15020
|
if (!e.target.closest('.hist-confirm') && !e.target.closest('[data-kb-remove]') && !e.target.closest('[data-kb-ds-clear]')) kbCloseConfirm();
|
|
@@ -15978,6 +16476,24 @@
|
|
|
15978
16476
|
return '';
|
|
15979
16477
|
}
|
|
15980
16478
|
|
|
16479
|
+
/**
|
|
16480
|
+
* #3690 E1d 7.2: the fit this IFC's version's approval recorded, as the server read it from the receipt and
|
|
16481
|
+
* authenticated against its snapshot (`row.fit`: {state, sentence, findings, notMeasured, partialAgainst}). Only a
|
|
16482
|
+
* recorded fit with no open finding AND every check measured takes the receipt's plain tone; anything else (findings
|
|
16483
|
+
* open, a check that could not be measured, a clash check measured without elements FloLess cannot draw, a count the
|
|
16484
|
+
* row does not carry, unreadable, none at approval, exported before fit checks) is partial, so a fit that found nothing
|
|
16485
|
+
* only because it could not measure part of the model never reads as clean.
|
|
16486
|
+
*/
|
|
16487
|
+
function fitReceiptHtml(kind, approved) {
|
|
16488
|
+
if (kind !== 'ifc' || !approved || !exportState || !exportState.ifc) return '';
|
|
16489
|
+
const entry = exportState.ifc;
|
|
16490
|
+
const sources = Array.isArray(entry.variants) && entry.variants.length ? entry.variants : [entry];
|
|
16491
|
+
const fit = (sources.find((source) => source && source.fit && typeof source.fit.sentence === 'string') || {}).fit;
|
|
16492
|
+
if (!fit || !fit.sentence.trim()) return '';
|
|
16493
|
+
const clean = fit.state === 'recorded' && fit.findings === 0 && fit.notMeasured === 0 && fit.partialAgainst === 0;
|
|
16494
|
+
return `<div class="e-receipt${clean ? '' : ' partial'}" data-export-fit="${escapeHtml(String(fit.state || ''))}"><span role="status" aria-live="polite">${escapeHtml(fit.sentence.trim())}</span></div>`;
|
|
16495
|
+
}
|
|
16496
|
+
|
|
15981
16497
|
function omittedHtml(kind, approved) {
|
|
15982
16498
|
if (!approved || !exportState) return '';
|
|
15983
16499
|
const byMember = new Map();
|
|
@@ -18255,6 +18771,8 @@
|
|
|
18255
18771
|
(c.kind === 'send-host' ? '' : omittedHtml(c.kind, approved)) +
|
|
18256
18772
|
// #3296 E1b: walls, slabs and footings the file or pictures leave out, beside the members line.
|
|
18257
18773
|
(c.kind === 'ifc' || c.kind === 'render' ? elementsLeftOutHtml(c.kind, approved) : '') +
|
|
18774
|
+
// #3690 E1d 7.2: the fit the IFC's approval recorded, beside what it leaves out.
|
|
18775
|
+
fitReceiptHtml(c.kind, approved) +
|
|
18258
18776
|
(c.kind === 'ifc' ? customSectionAssumedHtml(approved) + holdUnmarkedHtml(approved) : '') +
|
|
18259
18777
|
(c.kind === 'send-host' ? '' : exportProvenanceHtml(c.kind, approved)) +
|
|
18260
18778
|
// REGISTERED, because #1156a changed what this button DOES. It used to refuse an export outright
|
|
@@ -21200,7 +21718,7 @@
|
|
|
21200
21718
|
return line;
|
|
21201
21719
|
}
|
|
21202
21720
|
|
|
21203
|
-
function proposalRow(p, idx, bucket, { preTicks = false } = {}) {
|
|
21721
|
+
function proposalRow(p, idx, bucket, { preTicks = false, removedIds = new Set() } = {}) {
|
|
21204
21722
|
// A read that only ADDS (marks on a sheet, detail anchors, moment frames) reads as an addition, not as a change.
|
|
21205
21723
|
const addsOnly = isMarksRow(p) || (p.kind === 'model-changed' && (p.key === 'detail_bubbles' || p.key === 'moment_frames'));
|
|
21206
21724
|
const row = revEl('div', 'rev-row ' + (addsOnly ? 'k-added' : (KIND_CLASS[p.kind] || 'k-changed')));
|
|
@@ -21498,6 +22016,18 @@
|
|
|
21498
22016
|
if ((p.omitted || []).length) {
|
|
21499
22017
|
desc.push(revEl('div', 'rev-row-note', `The page image and traced linework come with this sheet (${p.omitted.map(prettyKey).join(', ')}).`));
|
|
21500
22018
|
}
|
|
22019
|
+
// #3820: evidence this read made on the new sheet of members the model already has lands with the sheet or not
|
|
22020
|
+
// at all. Said as what is KEPT, never as what will show: a removal accepted in the same review takes the member
|
|
22021
|
+
// off that evidence, and leaving the sheet out loses it while the file still counts as read.
|
|
22022
|
+
const riders = Array.isArray(p.observations) ? p.observations : [];
|
|
22023
|
+
if (riders.length) {
|
|
22024
|
+
const named = new Set(riders.flatMap((entry) => (entry && entry.observation && entry.observation.binding && entry.observation.binding.memberIds) || []));
|
|
22025
|
+
const n = riders.length, m = named.size;
|
|
22026
|
+
const removing = [...named].some((id) => removedIds.has(id));
|
|
22027
|
+
desc.push(revEl('div', 'rev-row-note', `Accepting this sheet also keeps ${n} piece${n === 1 ? '' : 's'} of drawing evidence from it about ${m} member${m === 1 ? '' : 's'} already in the model.`
|
|
22028
|
+
+ (removing ? ' If you also accept removing one of those members, its evidence stays on record but no longer names it.' : '')
|
|
22029
|
+
+ ' Leave this sheet out and that evidence is not kept. The file still counts as read, so to add it later, attach the drawing again with Attach revised drawings.'));
|
|
22030
|
+
}
|
|
21501
22031
|
const bundled = p.provisionalMembers || [];
|
|
21502
22032
|
if (bundled.length) {
|
|
21503
22033
|
desc.push(revEl('div', 'rev-row-note', 'Accepting this sheet also adds the source-view members and files the drawing evidence listed below in the same step.'));
|
|
@@ -21657,7 +22187,9 @@
|
|
|
21657
22187
|
}
|
|
21658
22188
|
if (props.length) {
|
|
21659
22189
|
const g = group(readOnly ? 'Changes this read proposed' : 'Needs your decision', props.length, 'proposals');
|
|
21660
|
-
|
|
22190
|
+
// #3820: a "Sheet added" row names what accepting a removal in the same review does to the evidence riding on it.
|
|
22191
|
+
const removedIds = new Set(props.filter((p) => p && p.kind === 'member-removed' && typeof p.memberId === 'string').map((p) => p.memberId));
|
|
22192
|
+
props.forEach((p, i) => g.appendChild(proposalRow(p, i, 'proposals', { preTicks: preTicks && !readOnly, removedIds })));
|
|
21661
22193
|
body.appendChild(g);
|
|
21662
22194
|
}
|
|
21663
22195
|
if (binds.length) {
|
|
@@ -22597,8 +23129,14 @@
|
|
|
22597
23129
|
'data-tip="Show the complete member-by-member comparison">' +
|
|
22598
23130
|
'<span class="hd-caret">▸</span><span class="hd-toggle-label">View detailed changes</span></button>'
|
|
22599
23131
|
: '';
|
|
22600
|
-
const detailWarning = `${acceptedImportFindingsHtml(v)}${connectionAssumptionsHtml(v)}${readinessHtml(v)}${detailReconciliationWarningHtml(v)}${trussNotesHtml(v)}${shellAuthoredNoteHtml(v)}${designIssueNoteHtml(v)}`;
|
|
23132
|
+
const detailWarning = `${restoreNotesHtml(v)}${acceptedImportFindingsHtml(v)}${connectionAssumptionsHtml(v)}${readinessHtml(v)}${detailReconciliationWarningHtml(v)}${trussNotesHtml(v)}${shellAuthoredNoteHtml(v)}${designIssueNoteHtml(v)}`;
|
|
22601
23133
|
if (!s || !Array.isArray(s.bullets)) {
|
|
23134
|
+
// #3680 part C, R5 (X34): a restore reads by its record, in the server's words; a row without one keeps its message.
|
|
23135
|
+
const restore = v.restoreSummary && typeof v.restoreSummary.headline === 'string' ? v.restoreSummary : null;
|
|
23136
|
+
if (restore) {
|
|
23137
|
+
const tip = typeof restore.checkpoint === 'string' && restore.checkpoint ? ` data-tip="${escapeAttr(restore.checkpoint)}"` : '';
|
|
23138
|
+
return `<div class="hist-change-head"${tip}>${escapeHtml(restore.headline)}</div>${detailWarning}${toggle}`;
|
|
23139
|
+
}
|
|
22602
23140
|
return `<div class="hist-event">${escapeHtml(v.message)}</div>${detailWarning}${toggle}`;
|
|
22603
23141
|
}
|
|
22604
23142
|
const visible = meta.canDiff ? s.bullets.slice(0, 4) : s.bullets;
|
|
@@ -22635,6 +23173,21 @@
|
|
|
22635
23173
|
escapeHtml(`${covered !== null ? `${covered} of its files were read; ` : ''}${omitted.length} ${omitted.length === 1 ? 'was' : 'were'} left out: ${names}.`) + '</div>';
|
|
22636
23174
|
}
|
|
22637
23175
|
|
|
23176
|
+
/**
|
|
23177
|
+
* #3680 part C, R5 (X34, X35): what a restore did not bring back (a caution: those elements are held until the person
|
|
23178
|
+
* confirms again), the open type choices it did not carry (a note), and on an approval the restores since the previous
|
|
23179
|
+
* one (a note). Every sentence is the server's (`server/restore-history.ts`), so the chat's version list reads the same.
|
|
23180
|
+
*/
|
|
23181
|
+
function restoreNotesHtml(v) {
|
|
23182
|
+
const r = v && v.restoreSummary;
|
|
23183
|
+
const text = (x) => (typeof x === 'string' && x ? x : '');
|
|
23184
|
+
let html = '';
|
|
23185
|
+
if (r && text(r.dropped)) html += `<div class="hist-change-caution" role="note">${escapeHtml(r.dropped)}</div>`;
|
|
23186
|
+
if (r && text(r.notCarried)) html += `<div class="hist-change-note" role="note">${escapeHtml(r.notCarried)}</div>`;
|
|
23187
|
+
if (v && v.kind === 'approve' && text(v.restoresSincePrevious)) html += `<div class="hist-change-note" role="note">${escapeHtml(v.restoresSincePrevious)}</div>`;
|
|
23188
|
+
return html;
|
|
23189
|
+
}
|
|
23190
|
+
|
|
22638
23191
|
/**
|
|
22639
23192
|
* #1840: an approval that accepted open Tekla import findings carries the server's own sentence on
|
|
22640
23193
|
* its History row (one source for every approved surface), in the caution register the readiness
|
|
@@ -24892,6 +25445,7 @@
|
|
|
24892
25445
|
// is bounded generously; a later click frees it at once either way.
|
|
24893
25446
|
const CONNECTION_NAVIGATION_WAIT_MS = 300000;
|
|
24894
25447
|
let connectionRequestSeq = 0;
|
|
25448
|
+
let lockedClashToastDismiss = null;
|
|
24895
25449
|
/** The latest request: `{ id, page }`, `page` being the editor window it was handed to, once it was. */
|
|
24896
25450
|
let connectionRequest = null;
|
|
24897
25451
|
// Every sentence this throws is written for the person; `plain` tells the caller it may show it as is.
|
|
@@ -24908,11 +25462,14 @@
|
|
|
24908
25462
|
const rfi = !!target && !validId(target.jointId) && !member && validId(target.rfiId) && /^RFI-\d{3,16}$/.test(target.rfiId);
|
|
24909
25463
|
// #2521 row 9: or Make precise itself, opened in the editor for the chat's "Open Make precise".
|
|
24910
25464
|
const precise = !!target && !validId(target.jointId) && !member && !rfi && target.makePrecise === true;
|
|
25465
|
+
// #4029: or one clash check result, the project History's "Open result" (the editor shows it in its drawer).
|
|
25466
|
+
const clash = !!target && !validId(target.jointId) && !member && !rfi && !precise && typeof target.clashCheckId === 'string' && /^[0-9a-f]{64}$/.test(target.clashCheckId);
|
|
24911
25467
|
// Sentences say "the member was not shown", but "RFI-007 was not shown".
|
|
24912
|
-
const thing = member ? 'the member' : rfi ? target.rfiId : precise ? 'Make precise' : 'the connection';
|
|
24913
|
-
const again = member ? 'Show in the model' : rfi ? `${target.rfiId} in the chat` : precise ? 'Open Make precise' : 'Open in the model';
|
|
24914
|
-
|
|
24915
|
-
|
|
25468
|
+
const thing = member ? 'the member' : rfi ? target.rfiId : precise ? 'Make precise' : clash ? 'the clash check result' : 'the connection';
|
|
25469
|
+
const again = member ? 'Show in the model' : rfi ? `${target.rfiId} in the chat` : precise ? 'Open Make precise' : clash ? 'Open result' : 'Open in the model';
|
|
25470
|
+
// A clash result opens through History, where its row is: the Model step may be locked, and a locked step must never be what it lands on.
|
|
25471
|
+
const step = rfi ? 'rfis' : clash ? 'history' : 'model';
|
|
25472
|
+
if (!target || !validId(target.projectId) || !(validId(target.jointId) || member || rfi || precise || clash)) throw connectionError(`That ${member ? 'member' : rfi ? 'RFI' : precise ? 'model' : clash ? 'clash check result' : 'connection'} could not be opened. Open its project from Workspaces.`);
|
|
24916
25473
|
const mine = { id: `connection-${++connectionRequestSeq}`, page: null };
|
|
24917
25474
|
withdrawConnectionRequest(connectionRequest);
|
|
24918
25475
|
connectionRequest = mine;
|
|
@@ -24959,12 +25516,26 @@
|
|
|
24959
25516
|
// An RFI's step is RFIs, which in a steel project shows this same editor frame (and the editor may switch to it).
|
|
24960
25517
|
const steps = rfi ? ['model', 'rfis'] : ['model'];
|
|
24961
25518
|
if (!steps.includes(currentStep) && !(pendingPresenceStep && steps.includes(pendingPresenceStep.step))) {
|
|
25519
|
+
// #4029: the project's stages were still being checked when the Model step was asked for, and came back locked.
|
|
25520
|
+
if (clash && typeof stageGateFor === 'function' && stageGateFor('model')) return clashResultLocked();
|
|
24962
25521
|
throw connectionError(rfi ? `The RFIs step is not open, so ${thing} was not shown. Open the RFIs step, then press ${again} again.`
|
|
24963
25522
|
: `The Model step is not open, so ${thing} was not shown. Open the Model step, then press ${again} again.`);
|
|
24964
25523
|
}
|
|
24965
25524
|
if (Date.now() >= until) throw connectionError(`The model did not open in time, so ${thing} was not shown. Open the Model step, then press ${again} again.`);
|
|
24966
25525
|
return null;
|
|
24967
25526
|
};
|
|
25527
|
+
/**
|
|
25528
|
+
* The Model step is locked: the result's headline (the sentence History's own row carries, FloLess's words, not the
|
|
25529
|
+
* model's), why the step is closed, and the way to where a person approves the baseline. Only the person approves.
|
|
25530
|
+
*/
|
|
25531
|
+
const clashResultLocked = () => {
|
|
25532
|
+
const headline = typeof target.clashSummary === 'string' ? target.clashSummary.replace(/\s+/g, ' ').trim().slice(0, 300) : '';
|
|
25533
|
+
const said = `${headline ? `${headline.replace(/[.\s]*$/, '.')} ` : ''}The Model step opens once a baseline is approved. Open Drawing Filter to review and approve it, then press Open result again.`;
|
|
25534
|
+
// Pressing Open result again replaces the earlier message instead of stacking another copy of it.
|
|
25535
|
+
if (typeof lockedClashToastDismiss === 'function') lockedClashToastDismiss(true);
|
|
25536
|
+
lockedClashToastDismiss = showToast(said, 'warn', { persistent: true, action: { label: 'Open Drawing Filter', onClick: () => { if (mode === 'workspaces' && current?.id === target.projectId) setStep('drawings'); } } });
|
|
25537
|
+
return { ok: true, said };
|
|
25538
|
+
};
|
|
24968
25539
|
try {
|
|
24969
25540
|
if ((await navigating(Promise.resolve(setMode('workspaces'))))?.superseded || superseded()) return { superseded: true };
|
|
24970
25541
|
// setMode leaves the person where they were when they chose to stay (an Agent with unsaved changes).
|
|
@@ -24977,9 +25548,17 @@
|
|
|
24977
25548
|
// not available and its dialog is open, another navigation took over): say only what is certain.
|
|
24978
25549
|
if (opened === STAYED_IN_PROJECT) throw connectionError(`That project did not open, so ${thing} was not shown. Open it from Workspaces to see why, then press ${again} again.`);
|
|
24979
25550
|
if (current?.id !== target.projectId) throw connectionError('That project could not be opened. Open it from Workspaces.');
|
|
24980
|
-
} else if (currentStep !== step) {
|
|
25551
|
+
} else if (currentStep !== step && !clash) {
|
|
24981
25552
|
setStep(step);
|
|
24982
25553
|
}
|
|
25554
|
+
// #4029: the Model step is where a clash result is shown. While the project's stages keep it locked (no baseline
|
|
25555
|
+
// approved yet) say so, show the result's own headline, and offer the step where the baseline is approved, rather
|
|
25556
|
+
// than landing on another step. A step still being checked opens by itself once it can, as for every other target.
|
|
25557
|
+
if (clash) {
|
|
25558
|
+
const gate = typeof stageGateFor === 'function' ? stageGateFor('model') : '';
|
|
25559
|
+
if (gate && pendingPresenceStep?.step !== 'model') return clashResultLocked();
|
|
25560
|
+
if (currentStep !== 'model') setStep('model');
|
|
25561
|
+
}
|
|
24983
25562
|
// #2874: a General project's RFIs are the shell's own pane (project-rfis.js), which shows the RFI itself.
|
|
24984
25563
|
if (rfi && !wsApp()?.rfisInEditor) {
|
|
24985
25564
|
if (citedElsewhere()) throw citedGone();
|
|
@@ -25019,7 +25598,7 @@
|
|
|
25019
25598
|
if (citedElsewhere()) throw citedGone();
|
|
25020
25599
|
// The frame's window survives a reload; its DOCUMENT does not. That is what tells a reload apart.
|
|
25021
25600
|
page = child; doc = child.document;
|
|
25022
|
-
answer = child.flolessEditorFocus(member ? { memberId: target.memberId, requestId: mine.id } : precise ? { makePrecise: true, requestId: mine.id } : rfi ? { rfiId: target.rfiId, requestId: mine.id } : { jointId: target.jointId, requestId: mine.id,
|
|
25601
|
+
answer = child.flolessEditorFocus(member ? { memberId: target.memberId, requestId: mine.id } : precise ? { makePrecise: true, requestId: mine.id } : clash ? { clashCheckId: target.clashCheckId, requestId: mine.id } : rfi ? { rfiId: target.rfiId, requestId: mine.id } : { jointId: target.jointId, requestId: mine.id,
|
|
25023
25602
|
// #2450: the readiness card's "Raise an RFI" also opens the editor's review dialog for it.
|
|
25024
25603
|
...(target.raiseRfi === true ? { raiseRfi: true } : {}), ...(validId(target.checkId) ? { checkId: target.checkId } : {}) });
|
|
25025
25604
|
if (!answer || typeof answer.then !== 'function') return { ok: false, said: notTaken };
|
|
@@ -25407,5 +25986,8 @@
|
|
|
25407
25986
|
// #2470 R6.2b: a project kind's name as the person sees it ("Trace", "Drawing Checker"), for labels outside this file.
|
|
25408
25987
|
kindLabelOf: (project) => (project && wsDescOf(project)?.displayName) || null,
|
|
25409
25988
|
};
|
|
25410
|
-
applyMode();
|
|
25989
|
+
applyMode();
|
|
25990
|
+
if (mode === 'agents' && window.flolessStartPlace?.resumed) window.showStartPlaceToast?.();
|
|
25411
25991
|
})();
|
|
25992
|
+
window.__flolessCoreReady = Object.assign(window.__flolessCoreReady || {}, { 'workspaces.js': true });
|
|
25993
|
+
window.flolessBoot?.ready('workspaces.js');
|