@floless/app 0.113.7 → 0.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +48 -11
- package/dist/web/app.css +55 -1
- package/dist/web/aware.js +176 -38
- package/dist/web/workspaces.js +747 -98
- package/package.json +1 -1
package/dist/web/workspaces.js
CHANGED
|
@@ -113,7 +113,15 @@
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
let exportState = null; // kind → { path, exportedAt } after a successful list; null = unknown/failed
|
|
116
|
-
|
|
116
|
+
// Readiness per CAD destination: host id → the server's readiness object, or {state:'checking'}
|
|
117
|
+
// while probing. Tekla answers from /api/tekla-readiness (a richer probe that can tell "open but
|
|
118
|
+
// no model loaded"); the other three from /api/host-readiness/:host. Same shape either way, which
|
|
119
|
+
// is what lets one row template serve all four.
|
|
120
|
+
let hostReadinessStates = {};
|
|
121
|
+
// The destinations picked last time, per project. A convenience only — re-validated against live
|
|
122
|
+
// readiness every time the chooser opens, so a remembered host that has since gone down cannot
|
|
123
|
+
// come back pre-ticked.
|
|
124
|
+
const hostChoices = new Map();
|
|
117
125
|
// Same shape for the Render card. Rendering needs AWARE >= 0.103.0 AND Blender on the machine,
|
|
118
126
|
// neither of which floless can assume, so the card reports which one to fix rather than offering
|
|
119
127
|
// a button that fails. The server re-checks on POST — this badge can be minutes stale.
|
|
@@ -201,7 +209,12 @@
|
|
|
201
209
|
{ kind: 'bom-csv', ico: '▤', name: 'Bill of materials', fmt: 'CSV', verb: 'Export CSV', file: true, open: true },
|
|
202
210
|
{ kind: 'bom-xlsx', ico: '▦', name: 'Bill of materials', fmt: 'XLSX', verb: 'Export Excel', file: true, open: true },
|
|
203
211
|
{ kind: 'ifc', ico: '◈', name: 'Model', fmt: 'IFC4', verb: 'Export IFC', file: true, open: false },
|
|
204
|
-
|
|
212
|
+
// ONE card for every CAD destination, not one per application. It was Tekla-only while
|
|
213
|
+
// Tekla was the only host that could receive a model; Revit, SketchUp and Rhino now can
|
|
214
|
+
// too, and four cards would mean three permanently "not ready" tiles for tools a given
|
|
215
|
+
// firm may never open — plus four bridge probes on every tab open. The card names the
|
|
216
|
+
// destination it is ready to send to; its button opens the chooser for the rest.
|
|
217
|
+
{ kind: 'send-host', ico: '◧', name: 'CAD model', fmt: 'Native objects', verb: 'Send to a CAD app', file: false },
|
|
205
218
|
// Yields a URL, not a file, so none of the exportState/receipt plumbing applies — its status
|
|
206
219
|
// comes from shareCardState and its result is a link with a Copy button (see cardHtml).
|
|
207
220
|
{ kind: 'share-3d', ico: '↗', name: 'Model', fmt: 'Shareable web link', verb: 'Create share link', file: false },
|
|
@@ -1007,7 +1020,7 @@
|
|
|
1007
1020
|
}
|
|
1008
1021
|
current = p;
|
|
1009
1022
|
exportState = null;
|
|
1010
|
-
|
|
1023
|
+
hostReadinessStates = {};
|
|
1011
1024
|
renderReadinessState = null;
|
|
1012
1025
|
track('workspace_project_opened', { app: p.app }); // a real open (card click or post-create landing)
|
|
1013
1026
|
lastRevState = 'none'; stopRevisionPoll(); closeRevReview(); // fresh project — drop any prior revision-poll state and any open review
|
|
@@ -1045,7 +1058,7 @@
|
|
|
1045
1058
|
function closeProject() {
|
|
1046
1059
|
current = null;
|
|
1047
1060
|
exportState = null;
|
|
1048
|
-
|
|
1061
|
+
hostReadinessStates = {};
|
|
1049
1062
|
renderReadinessState = null;
|
|
1050
1063
|
stopRevisionPoll();
|
|
1051
1064
|
stopKnowledgePoll(); kbCloseConfirm(); kbResetViewer(); knowledgeState = null; // the KB pane is per-project — never carry it across
|
|
@@ -2369,7 +2382,10 @@
|
|
|
2369
2382
|
if (kind === 'ifc') return `${base}/export-ifc${qs}`;
|
|
2370
2383
|
if (kind === 'svg') return `${base}/export-svg${qs}`;
|
|
2371
2384
|
if (kind === 'render') return `${base}/render${qs}`;
|
|
2372
|
-
|
|
2385
|
+
// Sends to a live CAD application do NOT come through here — they are per-destination and go
|
|
2386
|
+
// via hostSendUrl(). Anything reaching this line is a kind nobody wired up; refusing beats
|
|
2387
|
+
// silently POSTing it at whichever route used to be the fallback.
|
|
2388
|
+
throw new Error(`no export route for "${kind}"`);
|
|
2373
2389
|
}
|
|
2374
2390
|
|
|
2375
2391
|
// Every existing card is one button with no options, and the grid's rhythm depends on that — so
|
|
@@ -2454,11 +2470,16 @@
|
|
|
2454
2470
|
: null),
|
|
2455
2471
|
fields: [
|
|
2456
2472
|
{
|
|
2457
|
-
//
|
|
2458
|
-
// a time meant reopening this dialog per angle. Each picked viewpoint becomes its
|
|
2459
|
-
// artifact — they no longer overwrite one another.
|
|
2460
|
-
|
|
2461
|
-
|
|
2473
|
+
// Several angles at once: a drawing pack usually wants more than one, and rendering them
|
|
2474
|
+
// one at a time meant reopening this dialog per angle. Each picked viewpoint becomes its
|
|
2475
|
+
// own artifact — they no longer overwrite one another.
|
|
2476
|
+
//
|
|
2477
|
+
// A CHECKLIST, not a multi-select combo — and that is the app-wide rule now: a field that
|
|
2478
|
+
// takes SEVERAL answers shows tick-boxes, a combo picks exactly one. The two patterns had
|
|
2479
|
+
// drifted apart (viewpoints hidden in a popover, CAD destinations as tick-boxes) and read
|
|
2480
|
+
// as two different products. Seven short angles also fit on screen at once, so the
|
|
2481
|
+
// popover was hiding the whole choice behind a click and buying nothing for it.
|
|
2482
|
+
name: 'viewpoint', label: 'Viewpoints', type: 'checklist', compact: true,
|
|
2462
2483
|
value: (last.viewpoints && last.viewpoints.join(',')) || 'hero',
|
|
2463
2484
|
options: RENDER_VIEWPOINTS,
|
|
2464
2485
|
},
|
|
@@ -2530,7 +2551,10 @@
|
|
|
2530
2551
|
if (!receipt || !receipt.counts) return null;
|
|
2531
2552
|
const c = receipt.counts;
|
|
2532
2553
|
const parts = [`${Number(c.emitted) || 0} emitted`];
|
|
2533
|
-
|
|
2554
|
+
// "N native" is meaningful for a host bake — it separates real native parts from fallback
|
|
2555
|
+
// geometry — and meaningless for a file export, which has no such split. Keyed on the send
|
|
2556
|
+
// kinds (`send:tekla`, `send:revit`, …), so a new destination inherits it without a new branch.
|
|
2557
|
+
if (String(kind).startsWith('send:') && Number.isFinite(Number(c.native))) parts.push(`${Number(c.native)} native`);
|
|
2534
2558
|
if (Number(c.unsupported)) parts.push(`${Number(c.unsupported)} unsupported`);
|
|
2535
2559
|
if (Number(c.warnings)) parts.push(`${Number(c.warnings)} warning${Number(c.warnings) === 1 ? '' : 's'}`);
|
|
2536
2560
|
return {
|
|
@@ -2543,9 +2567,22 @@
|
|
|
2543
2567
|
};
|
|
2544
2568
|
}
|
|
2545
2569
|
|
|
2546
|
-
|
|
2570
|
+
/**
|
|
2571
|
+
* The receipt for `kind` under the CURRENTLY approved version, or null.
|
|
2572
|
+
*
|
|
2573
|
+
* Every consumer — the summary line, the button that offers the details, and the dialog that
|
|
2574
|
+
* shows them — resolves the receipt through here, so they cannot ask subtly different questions
|
|
2575
|
+
* and disagree. A receipt from an older approval describes a model that no longer exists.
|
|
2576
|
+
*/
|
|
2577
|
+
function currentReceipt(kind) {
|
|
2578
|
+
if (!current) return null;
|
|
2547
2579
|
const receipt = exportReceipts.get(receiptKey(kind));
|
|
2548
|
-
|
|
2580
|
+
return receipt && receipt.approvedAt === current.approvedAt ? receipt : null;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
function receiptHtml(kind, approved) {
|
|
2584
|
+
const receipt = approved ? currentReceipt(kind) : null;
|
|
2585
|
+
if (!receipt) return '';
|
|
2549
2586
|
const summary = receiptSummary(receipt, kind);
|
|
2550
2587
|
if (!summary) return '';
|
|
2551
2588
|
return `<div class="e-receipt${summary.partial ? ' partial' : ''}">` +
|
|
@@ -2554,6 +2591,264 @@
|
|
|
2554
2591
|
`</div>`;
|
|
2555
2592
|
}
|
|
2556
2593
|
|
|
2594
|
+
// ── The destination chooser ───────────────────────────────────────────────────────────────────
|
|
2595
|
+
const hostSendUrl = (host, projectId, appId) => {
|
|
2596
|
+
const qs = `?project=${encodeURIComponent(projectId)}`;
|
|
2597
|
+
const base = `/api/contract/${encodeURIComponent(appId)}`;
|
|
2598
|
+
// Tekla keeps its original route (its readiness probe can tell "open but no model loaded",
|
|
2599
|
+
// which the generic one cannot); the other three share the newer one.
|
|
2600
|
+
return host === 'tekla'
|
|
2601
|
+
? `${base}/export-tekla${qs}`
|
|
2602
|
+
: `${base}/export-host/${encodeURIComponent(host)}${qs}`;
|
|
2603
|
+
};
|
|
2604
|
+
|
|
2605
|
+
/** One chooser row, derived from that host's live readiness. */
|
|
2606
|
+
function hostRowOption(host) {
|
|
2607
|
+
const label = hostLabel(host);
|
|
2608
|
+
const st = hostState(host);
|
|
2609
|
+
if (!st || st.state === 'checking') {
|
|
2610
|
+
return { value: host, label, pickable: false, status: { tone: 'checking', text: 'Checking…' } };
|
|
2611
|
+
}
|
|
2612
|
+
if (st.ok && st.state === 'ready') {
|
|
2613
|
+
const v = hostVersion(st);
|
|
2614
|
+
return { value: host, label, pickable: true, status: { tone: 'ready', text: `Ready${v ? ` · ${label} ${v}` : ''}` } };
|
|
2615
|
+
}
|
|
2616
|
+
const recovery = st.recovery || { action: 'retry', label: 'Check again' };
|
|
2617
|
+
// Only offer to DO something we can actually do. Opening an application, loading a model or
|
|
2618
|
+
// closing a duplicate window are the user's to perform — the button that helps there is the one
|
|
2619
|
+
// that re-checks once they have. A bridge install we can genuinely run, so that one keeps its
|
|
2620
|
+
// real label. Labelling a re-check "Open Revit" would be a button that lies about its effect.
|
|
2621
|
+
const installs = recovery.action === 'install-bridge' || recovery.action === 'install-addin';
|
|
2622
|
+
return {
|
|
2623
|
+
value: host,
|
|
2624
|
+
label,
|
|
2625
|
+
pickable: false,
|
|
2626
|
+
status: { tone: 'blocked', text: st.message || `${label} can’t receive this model right now.` },
|
|
2627
|
+
action: { label: installs ? recovery.label : 'Check again' },
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
const hostRowOptions = () => SEND_HOSTS.map((h) => hostRowOption(h.host));
|
|
2632
|
+
|
|
2633
|
+
/** "Tekla Structures, then Rhino" — the destinations in the order they will actually be sent. */
|
|
2634
|
+
function sequenceText(picked) {
|
|
2635
|
+
const names = picked.map(hostLabel);
|
|
2636
|
+
if (names.length === 1) return names[0];
|
|
2637
|
+
return `${names.slice(0, -1).join(', ')}, then ${names[names.length - 1]}`;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Ask which applications should receive this model. Resolves to an array of host ids, or null.
|
|
2642
|
+
*
|
|
2643
|
+
* Every destination is listed, including the ones that cannot take it — a user who has never
|
|
2644
|
+
* installed the Revit bridge would otherwise never learn FloLess can drive Revit at all. The
|
|
2645
|
+
* rows that cannot be ticked carry the reason and, where we can actually perform it, the fix.
|
|
2646
|
+
*/
|
|
2647
|
+
async function askSendDestinations(projectId) {
|
|
2648
|
+
if (!bridge.formModal) {
|
|
2649
|
+
const ready = SEND_HOSTS.map((h) => h.host).filter(hostIsReady);
|
|
2650
|
+
return ready.length === 1 ? ready : null;
|
|
2651
|
+
}
|
|
2652
|
+
const remembered = hostChoices.get(projectId) || [];
|
|
2653
|
+
// Pre-tick the remembered picks that are STILL ready, else the single ready host. This is what
|
|
2654
|
+
// keeps the ordinary one-application case a single click through the dialog.
|
|
2655
|
+
const readyHosts = SEND_HOSTS.map((h) => h.host).filter(hostIsReady);
|
|
2656
|
+
const preTicked = remembered.filter(hostIsReady);
|
|
2657
|
+
const initial = (preTicked.length ? preTicked : readyHosts.slice(0, 1)).join(',');
|
|
2658
|
+
const chosen = await bridge.formModal({
|
|
2659
|
+
title: 'Send to a CAD application',
|
|
2660
|
+
// The deliberate opposite of the Render dialog's "nothing in your model changes". This one
|
|
2661
|
+
// writes into a live document somebody may be looking at, and saying so is the honest half of
|
|
2662
|
+
// sitting next to a button that only reads.
|
|
2663
|
+
sub: 'Creates or replaces these members as native objects in the app you choose — this changes the model open there.',
|
|
2664
|
+
okLabel: 'Send',
|
|
2665
|
+
onChange: (values) => {
|
|
2666
|
+
const picked = String(values.destinations || '').split(',').map((v) => v.trim()).filter(Boolean);
|
|
2667
|
+
if (!picked.length) return 'Pick at least one destination.';
|
|
2668
|
+
// Never "at the same time": the project's lifecycle lock serializes these, so a batch is
|
|
2669
|
+
// several sends in a row. Promising simultaneity we do not have would be a lie about the
|
|
2670
|
+
// one thing the user is waiting on.
|
|
2671
|
+
return picked.length === 1
|
|
2672
|
+
? `Sends to ${sequenceText(picked)} now. This project’s other exports wait until it finishes.`
|
|
2673
|
+
: `Sends to ${sequenceText(picked)} — one at a time. This project’s other exports wait until they all finish.`;
|
|
2674
|
+
},
|
|
2675
|
+
returnFocusTo: $wsExports.querySelector('[data-export="send-host"]'),
|
|
2676
|
+
returnFocusFallback: () => (current && current.id === projectId
|
|
2677
|
+
? $wsExports.querySelector('[data-export="send-host"]')
|
|
2678
|
+
: null),
|
|
2679
|
+
fields: [{
|
|
2680
|
+
name: 'destinations',
|
|
2681
|
+
label: 'Destinations',
|
|
2682
|
+
type: 'checklist',
|
|
2683
|
+
value: initial,
|
|
2684
|
+
options: hostRowOptions(),
|
|
2685
|
+
onAction: async (host) => {
|
|
2686
|
+
const st = hostState(host);
|
|
2687
|
+
const action = st && st.recovery ? st.recovery.action : 'retry';
|
|
2688
|
+
if (action === 'install-bridge' || action === 'install-addin') {
|
|
2689
|
+
try {
|
|
2690
|
+
await api(host === 'tekla'
|
|
2691
|
+
? '/api/tekla-readiness/setup'
|
|
2692
|
+
: `/api/host-readiness/${encodeURIComponent(host)}/setup`, { method: 'POST' });
|
|
2693
|
+
} catch (err) {
|
|
2694
|
+
// Report it and still re-probe: the install may have partly succeeded, and the fresh
|
|
2695
|
+
// readiness is a truer answer than either the old row or this error alone.
|
|
2696
|
+
showToast(err && err.message ? err.message : `Couldn’t install the ${hostLabel(host)} bridge.`, 'warn');
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
hostReadinessStates = { ...hostReadinessStates, [host]: { ok: false, state: 'checking' } };
|
|
2700
|
+
const fresh = await probeHost(host);
|
|
2701
|
+
hostReadinessStates = { ...hostReadinessStates, [host]: fresh };
|
|
2702
|
+
// Deliberately does NOT repaint the card behind the dialog. That repaint restores focus to
|
|
2703
|
+
// the card's own button (restoreExportFocus), which yanks it out of the open modal — the
|
|
2704
|
+
// user pressed a button INSIDE the dialog and focus landed behind it. The card is brought
|
|
2705
|
+
// up to date once the dialog closes instead; see chooseAndSend.
|
|
2706
|
+
return hostRowOptions();
|
|
2707
|
+
},
|
|
2708
|
+
}],
|
|
2709
|
+
});
|
|
2710
|
+
if (!chosen) return null;
|
|
2711
|
+
const picked = String(chosen.destinations || '').split(',').map((v) => v.trim()).filter(Boolean);
|
|
2712
|
+
if (!picked.length) {
|
|
2713
|
+
showToast('Pick at least one destination to send to.', 'warn');
|
|
2714
|
+
return null;
|
|
2715
|
+
}
|
|
2716
|
+
return picked;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* Send to each destination IN TURN.
|
|
2721
|
+
*
|
|
2722
|
+
* Sequential is not a simplification — the project's lifecycle lock already serializes these, so
|
|
2723
|
+
* firing them together would only queue them invisibly. Doing it in the open means the card can
|
|
2724
|
+
* say which one is in flight, and a host that failed can be named.
|
|
2725
|
+
*
|
|
2726
|
+
* Every destination is re-validated immediately before its own send: the chooser's snapshot can
|
|
2727
|
+
* be minutes old by the time a third host's turn comes round, and an application closed since
|
|
2728
|
+
* then must be reported rather than sent into.
|
|
2729
|
+
*/
|
|
2730
|
+
async function sendToHosts(hosts, projectId, app, approvedAt) {
|
|
2731
|
+
const busyKey = `${projectId}:send-host`;
|
|
2732
|
+
if (exportBusy.has(busyKey)) return;
|
|
2733
|
+
exportBusy.add(busyKey);
|
|
2734
|
+
const done = [];
|
|
2735
|
+
const failed = [];
|
|
2736
|
+
const aborted = [];
|
|
2737
|
+
/** Has the sign-off this batch was aimed at moved on? Only answerable while it is still open. */
|
|
2738
|
+
const approvalMoved = () => !!current && current.id === projectId && current.approvedAt !== approvedAt;
|
|
2739
|
+
try {
|
|
2740
|
+
for (let i = 0; i < hosts.length; i++) {
|
|
2741
|
+
const host = hosts[i];
|
|
2742
|
+
// Every destination must receive the SAME approved version. A batch runs for minutes and
|
|
2743
|
+
// each POST picks up whatever is approved when it acquires the project lock, so a sign-off
|
|
2744
|
+
// that lands mid-batch would put version A in Tekla and version B in Revit while both
|
|
2745
|
+
// receipts claimed A. Stop instead: half a model in two versions is worse than none.
|
|
2746
|
+
// (It narrows the window the user can create from this app; it is NOT a compare-and-swap —
|
|
2747
|
+
// the routes take no expected-approval token, so a change landing between the last check
|
|
2748
|
+
// and the POST is still possible. Closing that needs a server-side check under the project
|
|
2749
|
+
// lifecycle lock; see the PR.)
|
|
2750
|
+
//
|
|
2751
|
+
// Asked ONLY while the captured project is still the open one: `current` IS whatever the
|
|
2752
|
+
// user is looking at, so switching projects mid-batch says nothing about this batch's
|
|
2753
|
+
// approval. Treating navigation as a version change aborted perfectly good sends and told
|
|
2754
|
+
// the user their version had changed when it had not.
|
|
2755
|
+
if (approvalMoved()) { aborted.push(...hosts.slice(i)); break; }
|
|
2756
|
+
sendProgress = { host, index: i + 1, total: hosts.length };
|
|
2757
|
+
if (current && current.id === projectId && !$wsExports.hidden) paintExports(approvedAt);
|
|
2758
|
+
const fresh = await probeHost(host);
|
|
2759
|
+
hostReadinessStates = { ...hostReadinessStates, [host]: fresh };
|
|
2760
|
+
if (!fresh.ok) {
|
|
2761
|
+
failed.push({ host, error: fresh.message || `${hostLabel(host)} isn’t ready.` });
|
|
2762
|
+
continue;
|
|
2763
|
+
}
|
|
2764
|
+
// Again, immediately before dispatch: the probe above can take seconds against a cold
|
|
2765
|
+
// bridge, and that is the longest gap in this loop.
|
|
2766
|
+
if (approvalMoved()) { aborted.push(...hosts.slice(i)); break; }
|
|
2767
|
+
try {
|
|
2768
|
+
const res = await api(hostSendUrl(host, projectId, app), { method: 'POST' });
|
|
2769
|
+
track('workspace_export', { app, kind: `send:${host}` });
|
|
2770
|
+
let summary = null;
|
|
2771
|
+
if (res.counts) {
|
|
2772
|
+
exportReceipts.set(`${projectId}:send:${host}`, {
|
|
2773
|
+
counts: res.counts,
|
|
2774
|
+
warnings: res.warnings || [],
|
|
2775
|
+
unsupported: res.receipt && Array.isArray(res.receipt.unsupported) ? res.receipt.unsupported : [],
|
|
2776
|
+
approvedAt,
|
|
2777
|
+
});
|
|
2778
|
+
summary = receiptSummary(exportReceipts.get(`${projectId}:send:${host}`), `send:${host}`);
|
|
2779
|
+
}
|
|
2780
|
+
hostSends.set(`${projectId}:${host}`, { at: new Date().toISOString(), approvedAt });
|
|
2781
|
+
done.push({ host, partial: !!(summary && summary.partial), text: summary && summary.text });
|
|
2782
|
+
} catch (err) {
|
|
2783
|
+
const detail = (err && err.body && err.body.error) || (err && err.message) || String(err);
|
|
2784
|
+
failed.push({ host, error: detail });
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
} finally {
|
|
2788
|
+
sendProgress = null;
|
|
2789
|
+
exportBusy.delete(busyKey);
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
// One toast for the whole run, naming what landed and what did not. A per-host toast storm
|
|
2793
|
+
// would bury the one line that matters when three destinations were picked.
|
|
2794
|
+
//
|
|
2795
|
+
// Built per DESTINATION rather than per outcome-bucket. Summarising by bucket lost the two
|
|
2796
|
+
// things a mixed run most needs to say: a destination that landed WITH GAPS read as a plain
|
|
2797
|
+
// "Sent to Revit" the moment any other destination failed, and with several partial runs only
|
|
2798
|
+
// the first one's counts appeared, attached to no host at all.
|
|
2799
|
+
const clean = done.filter((d) => !d.partial);
|
|
2800
|
+
const partial = done.filter((d) => d.partial);
|
|
2801
|
+
if (done.length || failed.length || aborted.length) {
|
|
2802
|
+
const sentence = [
|
|
2803
|
+
clean.length ? `Sent to ${sequenceText(clean.map((d) => d.host))}.` : '',
|
|
2804
|
+
...partial.map((d) => `${hostLabel(d.host)} took it with gaps — ${d.text}.`),
|
|
2805
|
+
...failed.map((f) => `${hostLabel(f.host)} didn’t — ${reasonFragment(humanSendError(f.error))}.`),
|
|
2806
|
+
// The abort rides in the SAME sentence rather than firing its own toast: two toasts about
|
|
2807
|
+
// one action is exactly the storm this single-line report replaced.
|
|
2808
|
+
aborted.length
|
|
2809
|
+
? `This version changed, so ${sequenceText(aborted)} ${aborted.length === 1 ? 'wasn’t' : 'weren’t'} sent — approve again and re-send.`
|
|
2810
|
+
: '',
|
|
2811
|
+
].filter(Boolean).join(' ');
|
|
2812
|
+
showToast(sentence, partial.length || failed.length || aborted.length ? 'warn' : 'ok');
|
|
2813
|
+
}
|
|
2814
|
+
if (current && current.id === projectId && !$wsExports.hidden) {
|
|
2815
|
+
// Re-reads the listing AND re-probes every host, so the card reflects the machine as it is
|
|
2816
|
+
// now — including a host that went down during the run.
|
|
2817
|
+
return renderExports('send-host').catch(() => paintExports(approvedAt, 'send-host'));
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
/** The Send card's whole action: ask, then send. */
|
|
2822
|
+
async function chooseAndSend() {
|
|
2823
|
+
if (!current) return;
|
|
2824
|
+
const projectId = current.id, app = current.app, approvedAt = current.approvedAt;
|
|
2825
|
+
// The busy button stays `aria-disabled` + `aria-busy` rather than natively disabled (so a
|
|
2826
|
+
// screen reader can still reach it and hear the progress), and the click delegate lets that
|
|
2827
|
+
// combination through on purpose. Without this it opened the whole destination dialog on top of
|
|
2828
|
+
// a running send, took the user's picks, and threw them away against the busy key below —
|
|
2829
|
+
// a complete decision discarded in silence.
|
|
2830
|
+
if (exportBusy.has(`${projectId}:send-host`)) { showToast(sendBusyText(), 'info'); return; }
|
|
2831
|
+
const picked = await askSendDestinations(projectId);
|
|
2832
|
+
// The dialog's per-row re-checks update readiness but deliberately leave the card alone while it
|
|
2833
|
+
// is open (focus). Bring it up to date now, on EVERY exit including cancel — otherwise a user
|
|
2834
|
+
// who re-checked, saw a host come up, then cancelled would be left looking at a stale card.
|
|
2835
|
+
//
|
|
2836
|
+
// A row's probe can still be in flight when the dialog is dismissed (Esc during "Checking…").
|
|
2837
|
+
// Its continuation is discarded — it would be writing into a dialog that no longer exists — so
|
|
2838
|
+
// painting the state as it stands leaves that host stuck on "Checking…" behind a natively
|
|
2839
|
+
// disabled button, with nothing left to move it. Re-probe in that case only: doing it on every
|
|
2840
|
+
// exit would cost four bridge round-trips on a plain Cancel, which this flow exists to avoid.
|
|
2841
|
+
if (current && current.id === projectId && !$wsExports.hidden) {
|
|
2842
|
+
if (SEND_HOSTS.some((h) => (hostState(h.host) || {}).state === 'checking')) renderExports();
|
|
2843
|
+
else paintExports(current.approvedAt);
|
|
2844
|
+
}
|
|
2845
|
+
if (!picked) return;
|
|
2846
|
+
hostChoices.set(projectId, picked);
|
|
2847
|
+
// The user may have switched projects while the dialog was open — the send must not land on
|
|
2848
|
+
// whatever is open NOW. Everything below is keyed to the captured project.
|
|
2849
|
+
return sendToHosts(picked, projectId, app, approvedAt);
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2557
2852
|
// Links created this session, per project: `${projectId}:share-3d` -> { url, approvedAt }. Held in
|
|
2558
2853
|
// memory only — the server keeps no record of what a project has shared, and inventing a durable
|
|
2559
2854
|
// one here would imply a revoke story that does not exist yet.
|
|
@@ -2605,7 +2900,7 @@
|
|
|
2605
2900
|
}
|
|
2606
2901
|
|
|
2607
2902
|
/**
|
|
2608
|
-
* The Render card's state — same {meta, disabled, tip} shape as
|
|
2903
|
+
* The Render card's state — same {meta, disabled, tip} shape as sendHostCardState/shareCardState.
|
|
2609
2904
|
*
|
|
2610
2905
|
* Two things make it unlike the others. It reads TWO export kinds (a still and a turntable are
|
|
2611
2906
|
* different deliverables, and last-wins would claim "rendered 14:41" while a 14:32 still also sat
|
|
@@ -2638,9 +2933,12 @@
|
|
|
2638
2933
|
if (readiness && !readiness.ok) {
|
|
2639
2934
|
const recovery = readiness.recovery || { action: 'retry', label: 'Check again' };
|
|
2640
2935
|
return {
|
|
2641
|
-
meta: `<span class="e-readiness blocked" role="status" aria-live="polite">${escapeHtml(readiness.message || 'Rendering is not available on this computer.')}</span>` +
|
|
2936
|
+
meta: `<span class="e-readiness blocked" id="e-why-render" role="status" aria-live="polite">${escapeHtml(readiness.message || 'Rendering is not available on this computer.')}</span>` +
|
|
2642
2937
|
`<button type="button" class="e-recovery" data-render-recovery="${escapeAttr(recovery.action)}">${escapeHtml(recovery.label)}</button>`,
|
|
2643
2938
|
disabled: true,
|
|
2939
|
+
// Keeps the button reachable so the reason above is discoverable by keyboard — see the
|
|
2940
|
+
// `softBlock` branch in cardHtml.
|
|
2941
|
+
blockedBy: 'e-why-render',
|
|
2644
2942
|
tip: readiness.message || 'Resolve the rendering requirements first',
|
|
2645
2943
|
};
|
|
2646
2944
|
}
|
|
@@ -2701,12 +2999,12 @@
|
|
|
2701
2999
|
// whose content overflows also needs to be focusable for someone scrolling WITHOUT tabbing
|
|
2702
3000
|
// through every link — hence tabindex + the group label.
|
|
2703
3001
|
return {
|
|
2704
|
-
meta: `<div class="e-renders" role="group" aria-label="Rendered files"
|
|
3002
|
+
meta: `<div class="e-renders" role="group" aria-label="Rendered files">${rows}</div>`,
|
|
2705
3003
|
disabled: false, tip: '', rendered: true,
|
|
2706
3004
|
};
|
|
2707
3005
|
}
|
|
2708
3006
|
|
|
2709
|
-
// The share card's state, same {meta, disabled, tip} shape as
|
|
3007
|
+
// The share card's state, same {meta, disabled, tip} shape as sendHostCardState. It is the second
|
|
2710
3008
|
// file:false export kind, and the first whose RESULT is a URL rather than a file.
|
|
2711
3009
|
function shareCardState(approved) {
|
|
2712
3010
|
if (!approved) return {
|
|
@@ -2735,35 +3033,278 @@
|
|
|
2735
3033
|
return { meta: '<span class="e-status">not created yet</span>', disabled: false, tip: '' };
|
|
2736
3034
|
}
|
|
2737
3035
|
|
|
2738
|
-
|
|
3036
|
+
// ── CAD destinations ──────────────────────────────────────────────────────────────────────────
|
|
3037
|
+
// Every application a model can be sent to, in the order the chooser lists them. Tekla leads: it
|
|
3038
|
+
// is the deepest integration and the one users arrive expecting. Adding a host is one row here
|
|
3039
|
+
// plus a server-side materializer — nothing in the card or the chooser is per-host.
|
|
3040
|
+
const SEND_HOSTS = [
|
|
3041
|
+
{ host: 'tekla', label: 'Tekla Structures' },
|
|
3042
|
+
{ host: 'revit', label: 'Revit' },
|
|
3043
|
+
{ host: 'sketchup', label: 'SketchUp' },
|
|
3044
|
+
{ host: 'rhino', label: 'Rhino' },
|
|
3045
|
+
];
|
|
3046
|
+
const hostLabel = (host) => (SEND_HOSTS.find((h) => h.host === host) || {}).label || host;
|
|
3047
|
+
// Tekla keeps its own probe: it can distinguish "open but no model loaded", which the generic
|
|
3048
|
+
// `list-instances` cannot. Same envelope out, so the row template does not care which answered.
|
|
3049
|
+
const hostReadinessUrl = (host) => (host === 'tekla'
|
|
3050
|
+
? '/api/tekla-readiness'
|
|
3051
|
+
: `/api/host-readiness/${encodeURIComponent(host)}`);
|
|
3052
|
+
// Sends completed this browser session: `${projectId}:${host}` → { at, approvedAt }. In memory
|
|
3053
|
+
// only, exactly like share links — the server keeps no record of which applications a project has
|
|
3054
|
+
// been pushed into, and inventing a durable one here would imply a history that does not exist.
|
|
3055
|
+
const hostSends = new Map();
|
|
3056
|
+
// Sequential send progress for the open project: { host, index, total } — a multi-destination
|
|
3057
|
+
// send is several minutes of silence otherwise, and "Sending…" alone cannot say which one.
|
|
3058
|
+
let sendProgress = null;
|
|
3059
|
+
|
|
3060
|
+
/** The readiness of a host, or null when it has not been asked about yet. */
|
|
3061
|
+
const hostState = (host) => hostReadinessStates[host] || null;
|
|
3062
|
+
const hostIsReady = (host) => {
|
|
3063
|
+
const st = hostState(host);
|
|
3064
|
+
return !!(st && st.ok && st.state === 'ready');
|
|
3065
|
+
};
|
|
3066
|
+
/** The version to show beside a ready host — Tekla nests it under `host`, the others under `session`. */
|
|
3067
|
+
function hostVersion(st) {
|
|
3068
|
+
if (!st) return '';
|
|
3069
|
+
const v = (st.session && st.session.version) || (st.host && typeof st.host === 'object' && st.host.version) || '';
|
|
3070
|
+
return v ? String(v) : '';
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
/**
|
|
3074
|
+
* Probe ONE destination. A probe that fails is recorded as "couldn't check" WITH a retry — never
|
|
3075
|
+
* as "not open", which would be a definite negative the server never gave us.
|
|
3076
|
+
*/
|
|
3077
|
+
async function probeHost(host) {
|
|
3078
|
+
try {
|
|
3079
|
+
return (await api(hostReadinessUrl(host))).readiness;
|
|
3080
|
+
} catch (err) {
|
|
3081
|
+
return {
|
|
3082
|
+
host,
|
|
3083
|
+
ok: false,
|
|
3084
|
+
state: 'error',
|
|
3085
|
+
message: err && err.message
|
|
3086
|
+
? err.message
|
|
3087
|
+
: `Couldn’t check whether ${hostLabel(host)} is ready.`,
|
|
3088
|
+
recovery: { action: 'retry', label: 'Check again' },
|
|
3089
|
+
};
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
/**
|
|
3094
|
+
* Refresh every destination: the cheap process scan first, then the expensive per-host probe for
|
|
3095
|
+
* only those it found.
|
|
3096
|
+
*
|
|
3097
|
+
* This ordering is what lets the chooser list all four applications without the Exports tab
|
|
3098
|
+
* paying four bridge round-trips every time it opens. The shortcut is sound in ONE direction
|
|
3099
|
+
* only: a host the scan did not see is painted closed **solely when the scan actually ran**. If
|
|
3100
|
+
* the scan could not run (`scanned:false` — not Windows, PowerShell unavailable) we know nothing,
|
|
3101
|
+
* so every host is probed rather than four applications being declared shut on the strength of a
|
|
3102
|
+
* look that never happened.
|
|
3103
|
+
*/
|
|
3104
|
+
async function refreshHostReadiness() {
|
|
3105
|
+
const hosts = SEND_HOSTS.map((h) => h.host);
|
|
3106
|
+
hostReadinessStates = Object.fromEntries(hosts.map((h) => [h, { ok: false, state: 'checking' }]));
|
|
3107
|
+
let scan = null;
|
|
3108
|
+
try {
|
|
3109
|
+
scan = await api('/api/hosts/running');
|
|
3110
|
+
} catch {
|
|
3111
|
+
scan = null; // unknown — fall through to probing everything
|
|
3112
|
+
}
|
|
3113
|
+
// Null is NOT "none running": it means the scan did not answer, and the difference decides
|
|
3114
|
+
// whether a row may claim an application is closed. Never assert a negative we did not observe.
|
|
3115
|
+
const runningHosts = scan && scan.scanned && Array.isArray(scan.hosts) ? scan.hosts : null;
|
|
3116
|
+
const probe = runningHosts ? hosts.filter((h) => runningHosts.includes(h)) : hosts;
|
|
3117
|
+
const closed = hosts.filter((h) => !probe.includes(h));
|
|
3118
|
+
const next = {};
|
|
3119
|
+
for (const host of closed) {
|
|
3120
|
+
next[host] = {
|
|
3121
|
+
host,
|
|
3122
|
+
ok: false,
|
|
3123
|
+
state: 'host-closed',
|
|
3124
|
+
// An OBSERVATION, not a verdict. The scan matches four exact process names, so an
|
|
3125
|
+
// application running under any other one is unseen rather than shut — and telling a user
|
|
3126
|
+
// with Tekla open on screen that Tekla is closed is precisely the failure this readiness
|
|
3127
|
+
// machinery exists to prevent. The chooser's own per-row "Check again" probes the bridge
|
|
3128
|
+
// directly, bypassing the scan, so the authoritative answer is always one click away.
|
|
3129
|
+
message: `We didn’t see ${hostLabel(host)} running. Start it, then check again.`,
|
|
3130
|
+
recovery: { action: 'retry', label: 'Check again' },
|
|
3131
|
+
};
|
|
3132
|
+
}
|
|
3133
|
+
const probed = await Promise.all(probe.map((host) => probeHost(host).then((r) => [host, r])));
|
|
3134
|
+
for (const [host, readiness] of probed) next[host] = readiness;
|
|
3135
|
+
return next;
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
/**
|
|
3139
|
+
* A send failure in words a detailer can act on.
|
|
3140
|
+
*
|
|
3141
|
+
* The reconciliation refusal is the one that actually reaches people, and it arrives as
|
|
3142
|
+
* `receipt omitted 333 scene record(s): bp-S-202-colx20:plate-hole0, …` — a sentence about our
|
|
3143
|
+
* internal bookkeeping, listing ids nobody outside this codebase can read. It is restated as what
|
|
3144
|
+
* was OBSERVED (the application reported back on fewer parts than the model holds) and what
|
|
3145
|
+
* FOLLOWED (nothing was sent). Deliberately does NOT name a cause: the check knows only that
|
|
3146
|
+
* records went unaccounted for, and asserting "holes aren't supported there" would be inventing a
|
|
3147
|
+
* diagnosis the evidence does not carry. Anything else passes through unchanged — the server's
|
|
3148
|
+
* own words are usually the better ones.
|
|
3149
|
+
*/
|
|
3150
|
+
/**
|
|
3151
|
+
* A readiness/error message reshaped to sit INSIDE a sentence.
|
|
3152
|
+
*
|
|
3153
|
+
* They arrive as complete sentences, often already opening "Couldn’t send — ", so dropping one
|
|
3154
|
+
* straight into "Revit didn’t — <reason>." produced "Revit didn’t — Couldn’t send — … again..".
|
|
3155
|
+
*/
|
|
3156
|
+
function reasonFragment(text) {
|
|
3157
|
+
return String(text || '').trim()
|
|
3158
|
+
.replace(/^Couldn’t send\s*[—-]\s*/i, '')
|
|
3159
|
+
.replace(/[.!]+$/, '');
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
function humanSendError(raw) {
|
|
3163
|
+
const text = String(raw || '').trim();
|
|
3164
|
+
const omitted = text.match(/^receipt omitted (\d+) scene record/);
|
|
3165
|
+
if (omitted) {
|
|
3166
|
+
return `it reported back on ${omitted[1]} fewer parts than this model contains, so nothing was sent — a half-built model is worse than none`;
|
|
3167
|
+
}
|
|
3168
|
+
return text || 'the send failed';
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
/** What the last send to `host` under this approval reported, or null if it reported nothing. */
|
|
3172
|
+
function hostSendSummary(host) {
|
|
3173
|
+
return receiptSummary(currentReceipt(`send:${host}`), `send:${host}`);
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
function sendBusyText() {
|
|
3177
|
+
if (!sendProgress) return 'Sending…';
|
|
3178
|
+
const where = hostLabel(sendProgress.host);
|
|
3179
|
+
return sendProgress.total > 1
|
|
3180
|
+
? `Sending to ${where} (${sendProgress.index} of ${sendProgress.total})…`
|
|
3181
|
+
: `Sending to ${where}…`;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
/**
|
|
3185
|
+
* The CAD card's state — same {meta, disabled, tip} contract as renderCardState/shareCardState.
|
|
3186
|
+
*
|
|
3187
|
+
* Unlike the Tekla card it replaces, it is NOT disabled when nothing is ready. Its button opens
|
|
3188
|
+
* the chooser, and the chooser is precisely where a user learns why each application is out and
|
|
3189
|
+
* what would fix it. A dead button teaches nothing; this one always leads somewhere.
|
|
3190
|
+
*/
|
|
3191
|
+
function sendHostCardState(approved) {
|
|
2739
3192
|
if (!approved) return {
|
|
2740
3193
|
meta: '<span class="e-status">Available after approval</span>',
|
|
2741
3194
|
disabled: true,
|
|
2742
3195
|
tip: 'Approve this version first',
|
|
2743
3196
|
};
|
|
2744
|
-
|
|
2745
|
-
if (!readiness || readiness.state === 'checking') return {
|
|
2746
|
-
meta: '<span class="e-readiness checking" role="status" aria-live="polite"><span class="rtn-spinner" aria-hidden="true"></span> Checking Tekla readiness…</span>',
|
|
2747
|
-
disabled: true,
|
|
2748
|
-
tip: 'Checking AWARE, the Tekla bridge, and the open model',
|
|
2749
|
-
};
|
|
2750
|
-
if (readiness.ok && readiness.state === 'ready') {
|
|
2751
|
-
const version = readiness.host && readiness.host.version ? ` · Tekla ${readiness.host.version}` : '';
|
|
3197
|
+
if (exportBusy.has(`${current.id}:send-host`)) {
|
|
2752
3198
|
return {
|
|
2753
|
-
meta:
|
|
2754
|
-
|
|
2755
|
-
|
|
3199
|
+
meta: '<span class="e-readiness checking" role="status" aria-live="polite">' +
|
|
3200
|
+
`<span class="rtn-spinner" aria-hidden="true"></span>${escapeHtml(sendBusyText())}</span>`,
|
|
3201
|
+
disabled: true,
|
|
3202
|
+
tip: sendBusyText(),
|
|
2756
3203
|
};
|
|
2757
3204
|
}
|
|
2758
|
-
const
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
return {
|
|
2763
|
-
meta: `<span class="e-readiness blocked" role="status" aria-live="polite">${escapeHtml(readiness.message || 'Tekla readiness could not be verified.')}</span>` +
|
|
2764
|
-
`<button type="button" class="e-recovery" data-tekla-recovery="${escapeAttr(recovery.action)}">${escapeHtml(label)}</button>`,
|
|
3205
|
+
const states = SEND_HOSTS.map((h) => hostState(h.host));
|
|
3206
|
+
if (states.some((st) => !st || st.state === 'checking')) return {
|
|
3207
|
+
meta: '<span class="e-readiness checking" role="status" aria-live="polite">' +
|
|
3208
|
+
'<span class="rtn-spinner" aria-hidden="true"></span> Checking which CAD apps are open…</span>',
|
|
2765
3209
|
disabled: true,
|
|
2766
|
-
tip:
|
|
3210
|
+
tip: 'Checking AWARE, the bridges, and the open applications',
|
|
3211
|
+
};
|
|
3212
|
+
|
|
3213
|
+
// What was sent from THIS approved version — one row per destination, like the render card's
|
|
3214
|
+
// per-artifact rows. A send under an older approval is not shown: it no longer describes what
|
|
3215
|
+
// is in that model.
|
|
3216
|
+
const sent = SEND_HOSTS
|
|
3217
|
+
.map((h) => ({ host: h.host, rec: hostSends.get(`${current.id}:${h.host}`) }))
|
|
3218
|
+
.filter((r) => r.rec && r.rec.approvedAt === current.approvedAt)
|
|
3219
|
+
.sort((a, b) => String(b.rec.at).localeCompare(String(a.rec.at)));
|
|
3220
|
+
|
|
3221
|
+
const ready = SEND_HOSTS.filter((h) => hostIsReady(h.host));
|
|
3222
|
+
let head;
|
|
3223
|
+
if (ready.length === 1) {
|
|
3224
|
+
const v = hostVersion(hostState(ready[0].host));
|
|
3225
|
+
head = `<span class="e-readiness ready" role="status" aria-live="polite">Ready · ${escapeHtml(hostLabel(ready[0].host))}${v ? ` ${escapeHtml(v)}` : ''}</span>`;
|
|
3226
|
+
} else if (ready.length > 1) {
|
|
3227
|
+
head = `<span class="e-readiness ready" role="status" aria-live="polite">${ready.length} apps ready</span>`;
|
|
3228
|
+
} else {
|
|
3229
|
+
// Deliberately NOT one arbitrary host's message: with four destinations out for four
|
|
3230
|
+
// different reasons, promoting one of them to the card would misrepresent the other three.
|
|
3231
|
+
// The count is honest and the chooser carries every reason, each with its own way out.
|
|
3232
|
+
//
|
|
3233
|
+
// One exception, because it is not one host's problem at all: an AWARE below the required
|
|
3234
|
+
// version blocks every destination for the SAME reason, and re-checking can never clear it.
|
|
3235
|
+
// That needs the updater, and the chooser cannot open it (it would stack a second modal over
|
|
3236
|
+
// itself), so the way out belongs here. Without it the user re-checks forever — which is what
|
|
3237
|
+
// the old Tekla card's `update-aware` route existed to prevent, and this card had lost.
|
|
3238
|
+
//
|
|
3239
|
+
// `some`, not `every`: only a host that was actually PROBED can report update-aware, and the
|
|
3240
|
+
// readiness refresh short-circuits any host the process scan did not see straight to "not
|
|
3241
|
+
// running" without asking the server. Requiring all four to say it meant the button appeared
|
|
3242
|
+
// only with all four applications open at once — never in the ordinary case of one. This
|
|
3243
|
+
// branch already knows nothing is ready, so one host reporting it is the whole story.
|
|
3244
|
+
const awareState = states.find((st) => st && st.recovery && st.recovery.action === 'update-aware');
|
|
3245
|
+
head = '<span class="e-readiness blocked" role="status" aria-live="polite">' +
|
|
3246
|
+
(awareState
|
|
3247
|
+
// That host's own words: the required floor differs per destination, so a message borrowed
|
|
3248
|
+
// from a different one would quote the wrong version.
|
|
3249
|
+
? escapeHtml(awareState.message || 'AWARE needs updating before any CAD app can receive this model.')
|
|
3250
|
+
: 'No CAD app is ready to receive this model.') +
|
|
3251
|
+
'</span>' +
|
|
3252
|
+
(awareState
|
|
3253
|
+
? '<button type="button" class="e-recovery" data-host-recovery="update-aware">Update AWARE</button>'
|
|
3254
|
+
: '<button type="button" class="e-recovery" data-host-recheck="1">Check again</button>');
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
// No row-count guess at whether this list needs a tab stop — markScrollable measures it after
|
|
3258
|
+
// paint, because a destination reporting gaps is two or three lines depending on how its
|
|
3259
|
+
// counts wrap.
|
|
3260
|
+
const rows = sent.length
|
|
3261
|
+
? `<div class="e-renders e-sent-list" role="group" aria-label="Sent to">` +
|
|
3262
|
+
sent.map((r) => {
|
|
3263
|
+
// Asked of the receipt HERE rather than remembered as a flag at send time. The two
|
|
3264
|
+
// drifted: a clean send stored "has details" and then opened an empty dialog, because
|
|
3265
|
+
// what the button offers and what the dialog can show must be the same question.
|
|
3266
|
+
const summary = hostSendSummary(r.host);
|
|
3267
|
+
// A ✓ with nothing under it reads as a perfect send. When the model went in with parts
|
|
3268
|
+
// the application could not represent, the row has to say so where the eye lands — the
|
|
3269
|
+
// toast that said it at send time is long gone, and this card is what the user comes back
|
|
3270
|
+
// to. Same wording and amber as the file exports' receipt line, so "gaps" means the same
|
|
3271
|
+
// thing everywhere in this tab.
|
|
3272
|
+
//
|
|
3273
|
+
// A CLEAN send stays one line. The file cards do print their counts unconditionally, but
|
|
3274
|
+
// they report ONE artifact; this card can hold four destinations at once, and a permanent
|
|
3275
|
+
// green counts line on each is completeness nobody needs when nothing went wrong. Here the
|
|
3276
|
+
// absence of a second line is what says "all of it landed".
|
|
3277
|
+
//
|
|
3278
|
+
// The line and the button are gated separately, exactly as receiptHtml gates them: a
|
|
3279
|
+
// receipt can be partial by its counts yet carry no itemisable rows, and that must still
|
|
3280
|
+
// show the warning — just without a button that would open an empty box.
|
|
3281
|
+
const receipt = summary && summary.partial
|
|
3282
|
+
? `<div class="e-receipt partial">` +
|
|
3283
|
+
`<span>With gaps · ${escapeHtml(summary.text)}</span>` +
|
|
3284
|
+
(summary.details && summary.details.trim()
|
|
3285
|
+
? `<button type="button" class="e-receipt-details" data-export-details="send:${escapeAttr(r.host)}" data-tip="What landed, and what didn’t">Details</button>`
|
|
3286
|
+
: '') +
|
|
3287
|
+
`</div>`
|
|
3288
|
+
: '';
|
|
3289
|
+
// One entry per destination. The wrapper's tighter internal gap is what ties a row to its
|
|
3290
|
+
// OWN receipt: spaced by the list's 6px like everything else, the gap above a receipt
|
|
3291
|
+
// would read exactly like the gap between two unrelated destinations.
|
|
3292
|
+
return `<div class="e-render-entry">` +
|
|
3293
|
+
`<div class="e-render-row">` +
|
|
3294
|
+
`<span class="e-done"><span class="chk">✓</span> sent to ${escapeHtml(hostLabel(r.host))} <span class="t">${escapeHtml(hhmm(r.rec.at))}</span></span>` +
|
|
3295
|
+
`</div>` + receipt +
|
|
3296
|
+
`</div>`;
|
|
3297
|
+
}).join('') +
|
|
3298
|
+
`</div>`
|
|
3299
|
+
: '';
|
|
3300
|
+
|
|
3301
|
+
return {
|
|
3302
|
+
meta: head + rows,
|
|
3303
|
+
disabled: false,
|
|
3304
|
+
tip: ready.length
|
|
3305
|
+
? `Create native objects in the open ${ready.length === 1 ? hostLabel(ready[0].host) : 'CAD'} model`
|
|
3306
|
+
: 'See which applications can receive this model, and what to fix',
|
|
3307
|
+
sent: sent.length > 0,
|
|
2767
3308
|
};
|
|
2768
3309
|
}
|
|
2769
3310
|
|
|
@@ -2772,7 +3313,7 @@
|
|
|
2772
3313
|
const busy = exportBusy.has(`${current.id}:${c.kind}`);
|
|
2773
3314
|
// The two file:false kinds resolve their own status; everything else uses the file/receipt path
|
|
2774
3315
|
// below. `special` keeps the branches from growing a third arm each time a kind is added.
|
|
2775
|
-
const special = c.kind === '
|
|
3316
|
+
const special = c.kind === 'send-host' ? sendHostCardState(approved)
|
|
2776
3317
|
: c.kind === 'share-3d' ? shareCardState(approved)
|
|
2777
3318
|
: c.kind === 'render' ? renderCardState(approved) : null;
|
|
2778
3319
|
if (special) {
|
|
@@ -2799,9 +3340,15 @@
|
|
|
2799
3340
|
// in-memory record rather than exportState, which only ever tracks file exports.
|
|
2800
3341
|
const shared = approved && c.kind === 'share-3d' && shareLinks.has(`${current.id}:share-3d`);
|
|
2801
3342
|
const rendered = approved && c.kind === 'render' && special && special.rendered;
|
|
2802
|
-
const
|
|
3343
|
+
const sentSomewhere = approved && c.kind === 'send-host' && special && special.sent;
|
|
3344
|
+
const busyLabel = c.kind === 'send-host' ? sendBusyText() : c.kind === 'share-3d' ? 'Creating…'
|
|
2803
3345
|
: c.kind === 'render' ? 'Rendering…' : 'Exporting…';
|
|
3346
|
+
// The CAD card's button NEVER names a destination, even when only one application is ready.
|
|
3347
|
+
// Choosing where a model goes is always a deliberate step: a button reading "Send to Tekla"
|
|
3348
|
+
// promises a direct send, and the next thing it does is open a dialog — and it would rename
|
|
3349
|
+
// itself as applications open and close, so the same control never reads the same twice.
|
|
2804
3350
|
const label = busy ? busyLabel
|
|
3351
|
+
: c.kind === 'send-host' ? (sentSomewhere ? 'Send again' : c.verb)
|
|
2805
3352
|
: (exported || shared || rendered
|
|
2806
3353
|
? (c.kind === 'share-3d' ? 'Create new link' : c.kind === 'render' ? 'Re-render' : 'Re-export')
|
|
2807
3354
|
: c.verb);
|
|
@@ -2811,25 +3358,39 @@
|
|
|
2811
3358
|
// explanation. Say what is happening instead of letting it hang.
|
|
2812
3359
|
const renderHolding = c.kind !== 'render' && exportBusy.has(`${current.id}:render`);
|
|
2813
3360
|
const disabled = renderHolding || (special ? special.disabled : !approved);
|
|
2814
|
-
const busyTip = c.kind === '
|
|
3361
|
+
const busyTip = c.kind === 'send-host' ? sendBusyText()
|
|
2815
3362
|
: c.kind === 'share-3d' ? 'Rendering the model and uploading the link'
|
|
2816
3363
|
: c.kind === 'render' ? renderBusyText()
|
|
2817
3364
|
: 'Export in progress';
|
|
2818
3365
|
const tip = busy ? busyTip
|
|
2819
3366
|
: renderHolding ? 'Waiting for the render to finish — it holds this project while it runs'
|
|
2820
3367
|
: special ? special.tip : (approved ? '' : 'Approve this version first');
|
|
2821
|
-
|
|
3368
|
+
// A button blocked by a DURABLE, card-specific reason is `aria-disabled`, never `disabled`: a
|
|
3369
|
+
// natively disabled control leaves the tab order, so a keyboard or screen-reader user can
|
|
3370
|
+
// neither reach it nor discover why it is out — and `data-tip` is hover-only, so it never
|
|
3371
|
+
// reaches them either. `aria-describedby` points at the reason already printed on the card.
|
|
3372
|
+
// The click handler refuses the action and speaks the reason instead.
|
|
3373
|
+
// Not applied to the un-approved state: that is the whole pane's condition, and the gate banner
|
|
3374
|
+
// above the grid states it once with its own focusable Approve button (the #roRibbon pattern).
|
|
3375
|
+
const softBlock = disabled && !busy && special && special.blockedBy;
|
|
3376
|
+
const dis = `${softBlock ? ` aria-disabled="true" aria-describedby="${escapeAttr(special.blockedBy)}"` : ''}` +
|
|
3377
|
+
`${disabled && !busy && !softBlock ? ' disabled' : ''}` +
|
|
3378
|
+
`${busy ? ' aria-disabled="true" aria-busy="true"' : ''}${tip ? ` data-tip="${escapeAttr(tip)}"` : ''}`;
|
|
2822
3379
|
return `<div class="ecard">` +
|
|
2823
3380
|
`<div class="e-top"><div class="e-ico">${escapeHtml(c.ico)}</div>` +
|
|
2824
3381
|
`<div><div class="e-name">${escapeHtml(c.name)}</div><div class="e-fmt">${escapeHtml(c.fmt)}</div></div></div>` +
|
|
2825
|
-
`<div class="e-meta${special ? ' e-meta-
|
|
3382
|
+
`<div class="e-meta${special ? ' e-meta-stacked' : ''}">${meta}</div>` +
|
|
2826
3383
|
// Only the still gets a preview: an MP4 has no frame to show without decoding one, and a
|
|
2827
3384
|
// card is not a video player. Click opens it exactly like ⧉ Open — no lightbox.
|
|
2828
3385
|
(c.kind === 'render' && approved && exportState && exportState['render-png']
|
|
2829
3386
|
&& exportState['render-png'].exportedAt
|
|
2830
3387
|
? `<button type="button" class="e-thumb" data-render-thumb data-openfile="render-png" data-tip="Open the rendered image"><img alt=""></button>`
|
|
2831
3388
|
: '') +
|
|
2832
|
-
|
|
3389
|
+
// The CAD card is deliberately NOT here: its receipts are per destination
|
|
3390
|
+
// (`<project>:send:tekla`), so this card-kind lookup can only ever miss — and a call that
|
|
3391
|
+
// silently returns '' is exactly what hid a missing receipt line once already. Each
|
|
3392
|
+
// destination prints its own, in sendHostCardState.
|
|
3393
|
+
(c.kind === 'send-host' ? '' : receiptHtml(c.kind, approved)) +
|
|
2833
3394
|
`<div class="e-act"><button type="button" data-export="${escapeAttr(c.kind)}"${dis}>↗ ${escapeHtml(label)}</button></div>` +
|
|
2834
3395
|
`</div>`;
|
|
2835
3396
|
}
|
|
@@ -2839,7 +3400,8 @@
|
|
|
2839
3400
|
'data-openfile',
|
|
2840
3401
|
'data-reveal',
|
|
2841
3402
|
'data-export-details',
|
|
2842
|
-
'data-
|
|
3403
|
+
'data-host-recheck',
|
|
3404
|
+
'data-host-recovery',
|
|
2843
3405
|
'data-render-recovery',
|
|
2844
3406
|
'data-open-exports-folder', // the note's `exports` button — survives the repaint an export triggers
|
|
2845
3407
|
'data-copyshare', // the share-link Copy button — omitted here, a repaint mid-render steals its focus
|
|
@@ -2871,7 +3433,13 @@
|
|
|
2871
3433
|
}
|
|
2872
3434
|
|
|
2873
3435
|
function paintExports(approvedAt, requestedRestoreKind) {
|
|
2874
|
-
|
|
3436
|
+
// An explicit kind says "put them back on the button they pressed" — but only if they are still
|
|
3437
|
+
// here. A send runs for minutes and its refresh repaints at the END; honouring the request
|
|
3438
|
+
// unconditionally would reach across and yank focus out of whatever they had moved on to, which
|
|
3439
|
+
// is the opposite of restoring it. Body means focus was lost (the state this exists to repair);
|
|
3440
|
+
// inside this pane means they are still working here.
|
|
3441
|
+
const stillHere = document.activeElement === document.body || $wsExports.contains(document.activeElement);
|
|
3442
|
+
const restoreIdentity = requestedRestoreKind && stillHere
|
|
2875
3443
|
? { attr: 'data-export', value: requestedRestoreKind, cardKind: requestedRestoreKind }
|
|
2876
3444
|
: exportFocusIdentity(document.activeElement);
|
|
2877
3445
|
const approved = !!approvedAt;
|
|
@@ -2893,9 +3461,38 @@
|
|
|
2893
3461
|
html += '<div class="export-grid">' + cards.map((c) => cardHtml(c, approved)).join('') + '</div>';
|
|
2894
3462
|
$wsExports.innerHTML = html;
|
|
2895
3463
|
paintRenderThumb();
|
|
3464
|
+
// Both capped lists, so two lists in the same pane cannot answer the same question differently.
|
|
3465
|
+
$wsExports.querySelectorAll('.e-renders').forEach(markScrollable);
|
|
2896
3466
|
restoreExportFocus(restoreIdentity);
|
|
2897
3467
|
}
|
|
2898
3468
|
|
|
3469
|
+
/**
|
|
3470
|
+
* Give a scroll container a tab stop only while it actually scrolls.
|
|
3471
|
+
*
|
|
3472
|
+
* Guessing from a row count is what this replaces, and the guess was wrong: a destination that
|
|
3473
|
+
* reports gaps is two or three lines depending on how its counts wrap, so "how many entries
|
|
3474
|
+
* before it overflows" is not a number that can be written down — it moves with the copy.
|
|
3475
|
+
* Measuring after paint is exact. Content scrolled out of reach with no way to scroll to it is
|
|
3476
|
+
* content a keyboard user cannot read; a tab stop on a container that fits is a dead one.
|
|
3477
|
+
*/
|
|
3478
|
+
function markScrollable(el) {
|
|
3479
|
+
if (!el) return;
|
|
3480
|
+
if (el.scrollHeight > el.clientHeight) el.setAttribute('tabindex', '0');
|
|
3481
|
+
else el.removeAttribute('tabindex');
|
|
3482
|
+
}
|
|
3483
|
+
|
|
3484
|
+
// A resize is not a repaint, but it is the other thing that decides whether these lists overflow:
|
|
3485
|
+
// narrow the window and a receipt's counts wrap onto another line. Without this, a list that
|
|
3486
|
+
// started to scroll because the window changed would keep the answer it was given at paint time.
|
|
3487
|
+
// Debounced, so dragging a window edge does not re-measure on every frame.
|
|
3488
|
+
let scrollMarkTimer = null;
|
|
3489
|
+
window.addEventListener('resize', () => {
|
|
3490
|
+
clearTimeout(scrollMarkTimer);
|
|
3491
|
+
scrollMarkTimer = setTimeout(() => {
|
|
3492
|
+
if (!$wsExports.hidden) $wsExports.querySelectorAll('.e-renders').forEach(markScrollable);
|
|
3493
|
+
}, 150);
|
|
3494
|
+
});
|
|
3495
|
+
|
|
2899
3496
|
/**
|
|
2900
3497
|
* Wire up the render card's preview after the card markup lands.
|
|
2901
3498
|
*
|
|
@@ -2921,19 +3518,30 @@
|
|
|
2921
3518
|
+ `?project=${encodeURIComponent(current.id)}&v=${encodeURIComponent(stamp)}`;
|
|
2922
3519
|
}
|
|
2923
3520
|
|
|
2924
|
-
|
|
3521
|
+
/**
|
|
3522
|
+
* `restoreKind` names the card whose button the user just pressed.
|
|
3523
|
+
*
|
|
3524
|
+
* Without it a refresh loses their place: the first paint here puts every host back to
|
|
3525
|
+
* "Checking…", which renders the send button natively disabled, so focus cannot be restored to
|
|
3526
|
+
* it — and by the time the authoritative paint runs, `document.activeElement` is the body and
|
|
3527
|
+
* there is no identity left to restore. Carrying the kind through both paints means pressing
|
|
3528
|
+
* Send leaves you on Send.
|
|
3529
|
+
*/
|
|
3530
|
+
async function renderExports(restoreKind) {
|
|
2925
3531
|
if (!current) return;
|
|
2926
3532
|
const id = current.id, app = current.app;
|
|
2927
3533
|
const cards = (wsApp() && wsApp().exports) || [];
|
|
2928
|
-
const
|
|
3534
|
+
const hasHosts = cards.some((card) => card.kind === 'send-host');
|
|
2929
3535
|
const hasRender = cards.some((card) => card.kind === 'render');
|
|
2930
|
-
|
|
3536
|
+
hostReadinessStates = hasHosts
|
|
3537
|
+
? Object.fromEntries(SEND_HOSTS.map((h) => [h.host, { ok: false, state: 'checking' }]))
|
|
3538
|
+
: {};
|
|
2931
3539
|
renderReadinessState = hasRender ? { ok: false, state: 'checking' } : null;
|
|
2932
|
-
paintExports(current.approvedAt);
|
|
3540
|
+
paintExports(current.approvedAt, restoreKind);
|
|
2933
3541
|
let state = null;
|
|
2934
3542
|
let approvedAt = current.approvedAt; // fallback if the fetch fails (best-known)
|
|
2935
3543
|
const exportPromise = api(`/api/contract/${encodeURIComponent(app)}/exports?project=${encodeURIComponent(id)}`);
|
|
2936
|
-
const readinessPromise =
|
|
3544
|
+
const readinessPromise = hasHosts ? refreshHostReadiness() : Promise.resolve(null);
|
|
2937
3545
|
const renderReadyPromise = hasRender ? api('/api/render/readiness') : Promise.resolve(null);
|
|
2938
3546
|
const [exportResult, readinessResult, renderReadyResult] = await Promise.allSettled([
|
|
2939
3547
|
exportPromise, readinessPromise, renderReadyPromise,
|
|
@@ -2968,27 +3576,35 @@
|
|
|
2968
3576
|
showToast('Couldn’t load export status: ' + (err && err.message || err), 'warn');
|
|
2969
3577
|
state = null;
|
|
2970
3578
|
}
|
|
2971
|
-
if (
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
3579
|
+
if (hasHosts) {
|
|
3580
|
+
// refreshHostReadiness already converts a per-host probe failure into "couldn't check +
|
|
3581
|
+
// retry". This outer branch only covers it throwing outright, which would otherwise strand
|
|
3582
|
+
// every row on "Checking…" forever with no way to retry.
|
|
3583
|
+
hostReadinessStates = readinessResult.status === 'fulfilled' && readinessResult.value
|
|
3584
|
+
? readinessResult.value
|
|
3585
|
+
: Object.fromEntries(SEND_HOSTS.map((h) => [h.host, {
|
|
3586
|
+
host: h.host,
|
|
2975
3587
|
ok: false,
|
|
2976
3588
|
state: 'error',
|
|
2977
3589
|
message: readinessResult.reason && readinessResult.reason.message
|
|
2978
3590
|
? readinessResult.reason.message
|
|
2979
|
-
:
|
|
3591
|
+
: `Couldn’t check whether ${h.label} is ready.`,
|
|
2980
3592
|
recovery: { action: 'retry', label: 'Check again' },
|
|
2981
|
-
};
|
|
3593
|
+
}]));
|
|
2982
3594
|
}
|
|
2983
3595
|
// The user may have switched project/step during the await — don't paint stale.
|
|
2984
3596
|
if (!current || current.id !== id || $wsExports.hidden) return;
|
|
2985
3597
|
exportState = state;
|
|
2986
3598
|
syncWorkspaceGuide(); // fresh approve/export state → tick the Export (and re-sync Approve) guide rows
|
|
2987
|
-
paintExports(approvedAt);
|
|
3599
|
+
paintExports(approvedAt, restoreKind);
|
|
2988
3600
|
}
|
|
2989
3601
|
|
|
2990
3602
|
async function doExport(kind) {
|
|
2991
3603
|
if (!current) return;
|
|
3604
|
+
// Sending to a CAD application is its own flow end to end: it asks WHERE first, then performs
|
|
3605
|
+
// one lock-holding send per destination with its own re-validation and its own receipt. None of
|
|
3606
|
+
// the file/receipt machinery below applies to it.
|
|
3607
|
+
if (kind === 'send-host') return chooseAndSend();
|
|
2992
3608
|
const app = current.app, projectId = current.id, approvedAt = current.approvedAt, projectName = current.name; // capture — the user may switch projects, or leave, during the await
|
|
2993
3609
|
const busyKey = `${projectId}:${kind}`;
|
|
2994
3610
|
if (exportBusy.has(busyKey)) return;
|
|
@@ -3094,17 +3710,10 @@
|
|
|
3094
3710
|
approvedAt,
|
|
3095
3711
|
});
|
|
3096
3712
|
const summary = receiptSummary(exportReceipts.get(`${projectId}:${kind}`), kind);
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
summary && summary.partial ? 'warn' : 'ok');
|
|
3102
|
-
} else {
|
|
3103
|
-
showToast(summary && summary.partial
|
|
3104
|
-
? `Exported with gaps — ${summary.text}`
|
|
3105
|
-
: `Exported — ${res.filename || kind}`,
|
|
3106
|
-
summary && summary.partial ? 'warn' : 'ok');
|
|
3107
|
-
}
|
|
3713
|
+
showToast(summary && summary.partial
|
|
3714
|
+
? `Exported with gaps — ${summary.text}`
|
|
3715
|
+
: `Exported — ${res.filename || kind}`,
|
|
3716
|
+
summary && summary.partial ? 'warn' : 'ok');
|
|
3108
3717
|
refreshing = true;
|
|
3109
3718
|
// The catch is what makes the finally's skip safe: if the refresh itself throws, nothing else
|
|
3110
3719
|
// would repaint and the card would sit in its busy state forever, with exportBusy already
|
|
@@ -3117,8 +3726,6 @@
|
|
|
3117
3726
|
// The durable export listing may still show the previously published file, but its in-session
|
|
3118
3727
|
// receipt must not masquerade as the result of this failed attempt.
|
|
3119
3728
|
exportReceipts.delete(`${projectId}:${kind}`);
|
|
3120
|
-
const needsTekla = err && err.body && err.body.needsTekla;
|
|
3121
|
-
if (kind === 'tekla' && err && err.body && err.body.readiness) teklaReadinessState = err.body.readiness;
|
|
3122
3729
|
// The render route ships machine-readable readiness on its 409 precisely so the card can
|
|
3123
3730
|
// show WHICH dependency broke. Dropping it left the card looking ready with an enabled
|
|
3124
3731
|
// button, and the only trace of the refusal was a toast that evaporates.
|
|
@@ -3134,8 +3741,7 @@
|
|
|
3134
3741
|
got > 0
|
|
3135
3742
|
? `${err && err.message ? err.message : 'Rendering failed'} — ${got} viewpoint${got === 1 ? '' : 's'} did finish and ${got === 1 ? 'is' : 'are'} saved.`
|
|
3136
3743
|
: (err && err.message ? err.message : String(err)),
|
|
3137
|
-
|
|
3138
|
-
if (kind === 'tekla' && current && current.id === projectId) paintExports(current.approvedAt);
|
|
3744
|
+
'warn');
|
|
3139
3745
|
} finally {
|
|
3140
3746
|
exportBusy.delete(busyKey);
|
|
3141
3747
|
if (kind === 'render') {
|
|
@@ -3153,12 +3759,34 @@
|
|
|
3153
3759
|
|
|
3154
3760
|
function showExportReceiptDetails(kind, returnFocusTo) {
|
|
3155
3761
|
const projectId = current && current.id;
|
|
3156
|
-
const
|
|
3157
|
-
|
|
3158
|
-
|
|
3762
|
+
const summary = receiptSummary(currentReceipt(kind), kind);
|
|
3763
|
+
// `.trim()`: a details string of nothing but whitespace still passed a truthiness test and
|
|
3764
|
+
// opened a dialog with an empty box in it.
|
|
3765
|
+
if (!summary || !summary.details || !summary.details.trim() || !bridge.formModal) {
|
|
3766
|
+
// The button and the dialog resolve the receipt the same way, so reaching here means the
|
|
3767
|
+
// receipt went away UNDER the button — the sign-off was cleared by an edit or a revision read
|
|
3768
|
+
// while this pane sat open. Never answer that with silence: say what happened and repaint,
|
|
3769
|
+
// which is what removes the row the click came from.
|
|
3770
|
+
// This function serves the file cards' receipts as well as the per-destination CAD ones, so
|
|
3771
|
+
// the copy has to know which it is — "that send" about an IFC export is a sentence about
|
|
3772
|
+
// something that never happened.
|
|
3773
|
+
if (projectId && !summary) {
|
|
3774
|
+
showToast(String(kind).startsWith('send:')
|
|
3775
|
+
? 'That send described an earlier version of this project — approve again to send it.'
|
|
3776
|
+
: 'That export described an earlier version of this project — approve again to export it.',
|
|
3777
|
+
'info');
|
|
3778
|
+
if (!$wsExports.hidden) renderExports();
|
|
3779
|
+
}
|
|
3780
|
+
return;
|
|
3781
|
+
}
|
|
3782
|
+
// A send names its destination ("Revit send details"); everything else that reaches here is the
|
|
3783
|
+
// IFC export. The old two-way branch predates a kind resolving to four different applications.
|
|
3784
|
+
const sentTo = String(kind).startsWith('send:') ? hostLabel(String(kind).slice(5)) : null;
|
|
3159
3785
|
bridge.formModal({
|
|
3160
|
-
title: `${
|
|
3161
|
-
sub:
|
|
3786
|
+
title: sentTo ? `${sentTo} send details` : 'IFC export details',
|
|
3787
|
+
sub: sentTo
|
|
3788
|
+
? 'Details from the last send to this application for this approved version.'
|
|
3789
|
+
: 'Details from the last successful export for this approved version.',
|
|
3162
3790
|
fields: [{ name: 'details', label: 'Receipt details', type: 'note', value: summary.details }],
|
|
3163
3791
|
okLabel: 'Close',
|
|
3164
3792
|
hideCancel: true,
|
|
@@ -3233,29 +3861,30 @@
|
|
|
3233
3861
|
if (current) paintExports(current.approvedAt);
|
|
3234
3862
|
}
|
|
3235
3863
|
|
|
3236
|
-
|
|
3864
|
+
/**
|
|
3865
|
+
* The CAD card's "Check again" — re-probe every destination.
|
|
3866
|
+
*
|
|
3867
|
+
* There is deliberately no per-ACTION branch here as the Tekla card had: with four destinations
|
|
3868
|
+
* out for four different reasons the card refuses to promote one of them, so the only thing it
|
|
3869
|
+
* can honestly offer is a re-check. The per-host fixes live on their own rows in the chooser,
|
|
3870
|
+
* where each sits beside the reason it addresses.
|
|
3871
|
+
*/
|
|
3872
|
+
async function recheckHosts() {
|
|
3237
3873
|
if (!current) return;
|
|
3238
|
-
|
|
3239
|
-
return renderExports();
|
|
3240
|
-
}
|
|
3241
|
-
if (action === 'update-aware') {
|
|
3242
|
-
if (bridge.openAwareUpdate) bridge.openAwareUpdate('', document.activeElement);
|
|
3243
|
-
else showToast('Could not open the AWARE update dialog.', 'warn');
|
|
3244
|
-
return;
|
|
3245
|
-
}
|
|
3246
|
-
teklaReadinessState = { ok: false, state: 'checking' };
|
|
3874
|
+
hostReadinessStates = Object.fromEntries(SEND_HOSTS.map((h) => [h.host, { ok: false, state: 'checking' }]));
|
|
3247
3875
|
paintExports(current.approvedAt);
|
|
3248
|
-
try {
|
|
3249
|
-
if (action === 'install-bridge') {
|
|
3250
|
-
await api('/api/tekla-readiness/setup', { method: 'POST' });
|
|
3251
|
-
}
|
|
3252
|
-
showToast('Tekla bridge installed.', 'ok');
|
|
3253
|
-
} catch (err) {
|
|
3254
|
-
showToast(err && err.message ? err.message : String(err), 'warn');
|
|
3255
|
-
}
|
|
3256
3876
|
return renderExports();
|
|
3257
3877
|
}
|
|
3258
3878
|
|
|
3879
|
+
/** The card's own recovery — today only the AWARE updater, which no per-host row can open. */
|
|
3880
|
+
function recoverHosts(action) {
|
|
3881
|
+
if (action !== 'update-aware') return;
|
|
3882
|
+
// Workspaces opens the shared updater; it never starts an install itself. Same route the render
|
|
3883
|
+
// card and the old Tekla card use.
|
|
3884
|
+
if (bridge.openAwareUpdate) bridge.openAwareUpdate('', document.activeElement);
|
|
3885
|
+
else showToast('Could not open the AWARE update dialog.', 'warn');
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3259
3888
|
/**
|
|
3260
3889
|
* `kind` may carry a variant as `kind:variant` (a render viewpoint), because a kind can now hold
|
|
3261
3890
|
* several artifacts and Open/Reveal has to reach the one whose row was clicked — not merely the
|
|
@@ -3299,12 +3928,27 @@
|
|
|
3299
3928
|
if (e.target.closest('[data-open-exports-folder]')) { openExportsFolder(); return; }
|
|
3300
3929
|
const details = e.target.closest('[data-export-details]');
|
|
3301
3930
|
if (details) { showExportReceiptDetails(details.dataset.exportDetails, details); return; }
|
|
3302
|
-
const
|
|
3303
|
-
if (
|
|
3931
|
+
const recheck = e.target.closest('[data-host-recheck]');
|
|
3932
|
+
if (recheck) { recheckHosts(); return; }
|
|
3933
|
+
const hostFix = e.target.closest('[data-host-recovery]');
|
|
3934
|
+
if (hostFix) { recoverHosts(hostFix.dataset.hostRecovery); return; }
|
|
3304
3935
|
const renderFix = e.target.closest('[data-render-recovery]');
|
|
3305
3936
|
if (renderFix) { recoverRender(renderFix.dataset.renderRecovery); return; }
|
|
3306
3937
|
const exp = e.target.closest('[data-export]');
|
|
3307
|
-
if (exp && !exp.disabled) {
|
|
3938
|
+
if (exp && !exp.disabled) {
|
|
3939
|
+
// `aria-disabled` does NOT stop a click the way the native attribute does — that is the whole
|
|
3940
|
+
// point of using it (the control stays reachable so its reason is discoverable). So the
|
|
3941
|
+
// refusal has to be made here, and it must SAY something: silently swallowing the click is
|
|
3942
|
+
// the dead-button behaviour this pattern replaced.
|
|
3943
|
+
if (exp.getAttribute('aria-disabled') === 'true' && !exp.hasAttribute('aria-busy')) {
|
|
3944
|
+
const card = exp.closest('.ecard');
|
|
3945
|
+
const why = card && card.querySelector('.e-readiness.blocked');
|
|
3946
|
+
showToast((why && why.textContent) || exp.getAttribute('data-tip') || 'Not available yet.', 'warn');
|
|
3947
|
+
return;
|
|
3948
|
+
}
|
|
3949
|
+
doExport(exp.dataset.export);
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3308
3952
|
const open = e.target.closest('[data-openfile]');
|
|
3309
3953
|
if (open) { fileAction('/api/open-file', open.dataset.openfile, 'Couldn’t open the file'); return; }
|
|
3310
3954
|
const rev = e.target.closest('[data-reveal]');
|
|
@@ -3458,6 +4102,11 @@
|
|
|
3458
4102
|
if (tip && tip.kind === 'revision-read' && tip.n > revBaseVersion) {
|
|
3459
4103
|
current.approvedAt = vr.approvedAt || undefined; // the AI read cleared the sign-off (exports re-lock)
|
|
3460
4104
|
if (!$wsHistory.hidden) renderHistory();
|
|
4105
|
+
// …and the Exports pane, if it is the one showing. "Exports re-lock" was the intent, but
|
|
4106
|
+
// nothing repainted them: the pane kept its live buttons and its per-destination Details
|
|
4107
|
+
// rows describing a version that had just been superseded. Clicking Details then resolved
|
|
4108
|
+
// no receipt and did nothing at all — a control that answers a click with silence.
|
|
4109
|
+
if (!$wsExports.hidden) renderExports();
|
|
3461
4110
|
showToast('Revision read complete — a new version is on History', 'ok');
|
|
3462
4111
|
}
|
|
3463
4112
|
}
|