@floless/app 0.133.1 → 0.134.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 +138 -46
- package/dist/web/app.css +101 -0
- package/dist/web/app.js +68 -1
- package/dist/web/aware.js +316 -8
- package/dist/web/commands-shell.js +36 -1
- package/dist/web/commands-steel.js +22 -0
- package/dist/web/commands.js +11 -0
- package/dist/web/index.html +15 -3
- package/dist/web/instructor.js +1 -1
- package/dist/web/steel-3d-core.js +87 -0
- package/dist/web/steel-3d-view.js +363 -6
- package/dist/web/steel-editor.html +179 -19
- package/dist/web/workspaces.js +186 -13
- package/package.json +1 -1
package/dist/web/workspaces.js
CHANGED
|
@@ -487,15 +487,83 @@
|
|
|
487
487
|
$approveBtn.classList.toggle('approval-clean', s.status === 'ready' && !!s.headVersion && s.pendingCount === 0);
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
+
/**
|
|
491
|
+
* Reasons a surface below already words BETTER than the server does, because it can attach the
|
|
492
|
+
* next step: `no-contract` becomes "Nothing to export yet — Go to <Drawings>", and
|
|
493
|
+
* `filter-checkpoint` becomes "read the selected drawing content first". Listing the ones we
|
|
494
|
+
* localise — rather than allow-listing the ones we pass through — is the safe direction: an
|
|
495
|
+
* unrecognised future reason falls through to `approvalRefusalNote` and gets SPOKEN, which is the
|
|
496
|
+
* failure this whole change is about. Swallowing an unknown refusal is how #574 happened.
|
|
497
|
+
*/
|
|
498
|
+
const LOCALLY_WORDED_REFUSALS = ['no-contract', 'filter-checkpoint'];
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* The server's own plain-English refusal for a project that cannot be signed off at all, or `''`
|
|
502
|
+
* when approval is merely unavailable for the moment (loading, a failed probe, nothing read yet).
|
|
503
|
+
*
|
|
504
|
+
* ONE source of truth for the three surfaces that each used to answer this on their own — the
|
|
505
|
+
* header tooltip, the Exports gate, and History. #574 is what the drift looked like: the server
|
|
506
|
+
* wrote "duplicate it from the Workspaces list to sign off", the header eventually learned to
|
|
507
|
+
* repeat it, and the other two went on offering an Approve that could never complete.
|
|
508
|
+
*/
|
|
509
|
+
function approvalRefusalNote() {
|
|
510
|
+
if (approvalState.status !== 'unreviewable') return '';
|
|
511
|
+
if (LOCALLY_WORDED_REFUSALS.includes(approvalState.reason)) return '';
|
|
512
|
+
return approvalState.error || 'This project cannot be approved.';
|
|
513
|
+
}
|
|
514
|
+
|
|
490
515
|
function approvalHeadVersion(review) {
|
|
491
516
|
return review && review.moveForward && Number.isInteger(Number(review.moveForward.toVersion))
|
|
492
517
|
? Number(review.moveForward.toVersion)
|
|
493
518
|
: review && review.base && Number.isInteger(Number(review.base.version)) ? Number(review.base.version) : null;
|
|
494
519
|
}
|
|
495
520
|
|
|
521
|
+
/**
|
|
522
|
+
* Resolves once `approvalState` reflects a FINISHED probe — not merely once the request came back.
|
|
523
|
+
* The distinction is the whole point: a waiter that raced the response would resume before this
|
|
524
|
+
* function had assigned the state it is waiting to read.
|
|
525
|
+
*
|
|
526
|
+
* It exists so a surface whose own request depends on the verdict can wait for the probe already
|
|
527
|
+
* in flight instead of firing a doomed one alongside it (`awaitApprovalVerdict` below).
|
|
528
|
+
*/
|
|
529
|
+
let approvalSettled = null;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Park until the in-flight approval probe has settled, and only while one is actually running.
|
|
533
|
+
*
|
|
534
|
+
* Cheap in the common case — by the time a step is opened the probe started at project-open has
|
|
535
|
+
* long since finished, so this awaits an already-resolved promise. It only ever waits when the
|
|
536
|
+
* surface genuinely cannot answer its own question yet, and in that case it had to wait anyway to
|
|
537
|
+
* paint the right copy.
|
|
538
|
+
*
|
|
539
|
+
* CANNOT DEADLOCK against `refreshApprovalState`, which calls back into `renderHistory` on its
|
|
540
|
+
* refusal branch: every one of its exits assigns a non-`loading` status BEFORE re-rendering, so
|
|
541
|
+
* the guard below is already false by the time it re-enters.
|
|
542
|
+
*/
|
|
543
|
+
async function awaitApprovalVerdict() {
|
|
544
|
+
// Loops because a probe can be SUPERSEDED while a surface is parked on it, and one `await` then
|
|
545
|
+
// resumes on the wrong answer. The revision-read completion path is a live example: it starts a
|
|
546
|
+
// fresh probe and re-renders History on the next line, so the parked render is woken by the OLD
|
|
547
|
+
// probe's release while `approvalState` has already been reset to `loading` by the NEW one. It
|
|
548
|
+
// then reads "no refusal" — from a verdict that does not exist yet — and sends the request this
|
|
549
|
+
// whole mechanism exists to withhold.
|
|
550
|
+
//
|
|
551
|
+
// This is not a poll and cannot spin: each turn parks on a DISTINCT promise, and it only goes
|
|
552
|
+
// round again when `approvalSettled` has been replaced, which only a newer probe does. If the
|
|
553
|
+
// promise we waited on is still the current one, that probe wrote the state and we are done —
|
|
554
|
+
// the identity check is the loop's guarantee of termination, not an optimisation.
|
|
555
|
+
while (approvalState.status === 'loading' && approvalSettled) {
|
|
556
|
+
const pending = approvalSettled;
|
|
557
|
+
await pending;
|
|
558
|
+
if (approvalSettled === pending) break;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
496
562
|
async function refreshApprovalState(projectId = current && current.id) {
|
|
497
563
|
if (!projectId || !current || current.id !== projectId) return null;
|
|
498
564
|
const gen = ++approvalStateGen;
|
|
565
|
+
let settle;
|
|
566
|
+
approvalSettled = new Promise((resolve) => { settle = resolve; });
|
|
499
567
|
approvalState = { status: 'loading', review: null, pendingCount: 0, headVersion: null, error: '' };
|
|
500
568
|
renderApprovalHeader();
|
|
501
569
|
try {
|
|
@@ -511,6 +579,12 @@
|
|
|
511
579
|
renderApprovalHeader();
|
|
512
580
|
syncWorkspaceGuide();
|
|
513
581
|
if (!$wsExports.hidden) paintExports(current.approvedAt);
|
|
582
|
+
// No History re-render here. An earlier cut of this change had one, to repair a History
|
|
583
|
+
// that had painted while the status was still `loading` — but `renderHistory` now parks on
|
|
584
|
+
// `awaitApprovalVerdict()` instead, so it cannot paint from a loading state in the first
|
|
585
|
+
// place. Keeping both would start a SECOND concurrent render racing the parked one for the
|
|
586
|
+
// same DOM. The other callers that legitimately need a repaint (approve, discard, rollback)
|
|
587
|
+
// already call `renderHistory` themselves.
|
|
514
588
|
return null;
|
|
515
589
|
}
|
|
516
590
|
const groups = Array.isArray(review.groups) ? review.groups : [];
|
|
@@ -527,6 +601,10 @@
|
|
|
527
601
|
renderApprovalHeader();
|
|
528
602
|
if (!$wsExports.hidden) paintExports(current.approvedAt);
|
|
529
603
|
return null;
|
|
604
|
+
} finally {
|
|
605
|
+
// EVERY exit below the `loading` assignment, including the staleness returns that leave the
|
|
606
|
+
// state to a newer probe. A waiter must never be stranded on a probe that quietly gave up.
|
|
607
|
+
settle();
|
|
530
608
|
}
|
|
531
609
|
}
|
|
532
610
|
|
|
@@ -1629,6 +1707,19 @@
|
|
|
1629
1707
|
renderStepTabs(); // paint the tab labels for THIS app before the first step shows
|
|
1630
1708
|
frames.model.src = 'about:blank'; frames.drawings.src = 'about:blank'; // reset any previous project
|
|
1631
1709
|
frames.model.dataset.loaded = ''; frames.drawings.dataset.loaded = '';
|
|
1710
|
+
// BEFORE the first step renders, and that order is the fix rather than a tidy-up.
|
|
1711
|
+
//
|
|
1712
|
+
// `initialStep` is not always 'model' — a project re-opened from the picker keeps `currentStep`,
|
|
1713
|
+
// so switching project while standing on History renders History first. Started after
|
|
1714
|
+
// `setStep`, the probe does not exist yet when `renderHistory` reaches `awaitApprovalVerdict()`:
|
|
1715
|
+
// the status is still whatever the PREVIOUS project left behind, the waiter correctly declines
|
|
1716
|
+
// to park on a probe nobody started, and the doomed `/checkpoints` request goes out after all.
|
|
1717
|
+
//
|
|
1718
|
+
// Calling it here is enough on its own: `refreshApprovalState` publishes both the `loading`
|
|
1719
|
+
// status and `approvalSettled` SYNCHRONOUSLY, before its first await, so any render that follows
|
|
1720
|
+
// this line sees a probe to park on. The waiter is deliberately NOT taught to block on a
|
|
1721
|
+
// not-yet-started probe — that would hang any surface rendered outside a project open.
|
|
1722
|
+
refreshApprovalState(p.id).catch((e) => console.error('[workspaces] could not load approval state', e));
|
|
1632
1723
|
setStep(initialStep);
|
|
1633
1724
|
applyMode();
|
|
1634
1725
|
syncWorkspaceGuide(); // point the shared beacon at THIS project's document lifecycle
|
|
@@ -1638,7 +1729,6 @@
|
|
|
1638
1729
|
refreshModelPresence(p.id, p.app).catch((e) => { // gate the header CHECK Approve for THIS project (#490)
|
|
1639
1730
|
console.error('[workspaces] could not resolve model presence', e);
|
|
1640
1731
|
});
|
|
1641
|
-
refreshApprovalState(p.id).catch((e) => console.error('[workspaces] could not load approval state', e));
|
|
1642
1732
|
}
|
|
1643
1733
|
|
|
1644
1734
|
/**
|
|
@@ -1759,6 +1849,10 @@
|
|
|
1759
1849
|
// and the Exports gate link #ws-exports-approve ("Approve this version"). History stays a ledger,
|
|
1760
1850
|
// so approval is deliberately not duplicated there.
|
|
1761
1851
|
//
|
|
1852
|
+
// Every one of them is withheld — not disabled — when `approvalRefusalNote()` speaks: the header
|
|
1853
|
+
// renders a label, and the Exports gate renders the refusal instead of the link. `approveProject`
|
|
1854
|
+
// keeps its own guard regardless, because the refusal can arrive while a control is on screen.
|
|
1855
|
+
//
|
|
1762
1856
|
// What unlocks the Exports gate without a reload is the confirm's refreshApprovalState() +
|
|
1763
1857
|
// renderExports(), which re-read the server's approval state and export sources — NOT the
|
|
1764
1858
|
// `approvedAt` stamp. The gate is `exportSourcesState.status === 'ready' && an explicit source`
|
|
@@ -4481,7 +4575,14 @@
|
|
|
4481
4575
|
|
|
4482
4576
|
function exportSourceHtml() {
|
|
4483
4577
|
if (exportSourcesState.status === 'loading') return '<div class="export-source-status" role="status">Loading export sources…</div>';
|
|
4484
|
-
|
|
4578
|
+
// "Retry by reopening" is the right answer for a transient failure and the WRONG one for a
|
|
4579
|
+
// project whose export-sources route refuses on the same standing condition approval does — it
|
|
4580
|
+
// invites an action that cannot ever succeed. When the refusal is speaking, stay silent and let
|
|
4581
|
+
// the gate below carry the single true sentence rather than stacking a false one above it.
|
|
4582
|
+
if (exportSourcesState.status !== 'ready') {
|
|
4583
|
+
return approvalRefusalNote() ? ''
|
|
4584
|
+
: '<div class="export-source-status unavailable" role="status">Export sources unavailable — retry by reopening Exports.</div>';
|
|
4585
|
+
}
|
|
4485
4586
|
const data = exportSourcesState.data || {};
|
|
4486
4587
|
const options = exportSourceOptions(data);
|
|
4487
4588
|
const selected = currentExportSourceOption();
|
|
@@ -4522,15 +4623,28 @@
|
|
|
4522
4623
|
// approved is selected by default when present; a no-baseline project stays closed until the
|
|
4523
4624
|
// person deliberately chooses its DRAFT working copy/checkpoint.
|
|
4524
4625
|
const approved = projectContractLifecycle === 'model' && exportSourcesState.status === 'ready' && !!currentExportSourceOption();
|
|
4626
|
+
const approvalRefusal = approvalRefusalNote();
|
|
4525
4627
|
let html = exportSourceHtml();
|
|
4526
4628
|
if (!approved) {
|
|
4527
4629
|
// Same split as History's empty state (#490): with a model, Approve is genuinely the unlocking
|
|
4528
4630
|
// action; with none, `POST …/approve` 404s, so pointing at it is a dead end and the real next
|
|
4529
4631
|
// step is to go read a drawing. `stepLabel('drawings')` because that label is per-app.
|
|
4632
|
+
// A project the server refuses to review can never reach sign-off, so "Approve this version"
|
|
4633
|
+
// is REMOVED here rather than left inert — the same reasoning History's empty state records
|
|
4634
|
+
// just below, and the reason the header shows a label instead of an armed button. What
|
|
4635
|
+
// replaces it is the server's own sentence, which already carries cause AND remedy.
|
|
4636
|
+
//
|
|
4637
|
+
// No DRAFT escape hatch is offered, and that is measured rather than assumed:
|
|
4638
|
+
// `GET …/export-sources` refuses a project with no incarnation for the SAME reason approval
|
|
4639
|
+
// does ("has no incarnation UUID"), so `exportSourcesState` never reaches `ready` and the
|
|
4640
|
+
// picker above holds no options at all. Naming a route the pane cannot actually offer would
|
|
4641
|
+
// repeat this bug one line further down.
|
|
4530
4642
|
html += exportSourcesState.data?.defaultUnavailable?.reason === 'refused'
|
|
4531
4643
|
? `<div class="ws-exports-gate refused" role="alert">Exports are paused because the approved snapshot failed its integrity check. <button type="button" data-review-changes>Review approval</button></div>`
|
|
4532
4644
|
: projectContractLifecycle === 'filter-checkpoint'
|
|
4533
4645
|
? '<div class="ws-exports-gate">Drawing Filter saved — read the selected drawing content to build the model before exporting.</div>'
|
|
4646
|
+
: approvalRefusal
|
|
4647
|
+
? `<div class="ws-exports-gate">${escapeHtml(approvalRefusal)}</div>`
|
|
4534
4648
|
: hasModel
|
|
4535
4649
|
? `<div class="ws-exports-gate">Exports go out after sign-off — ` +
|
|
4536
4650
|
`<button type="button" id="ws-exports-approve">Approve this version</button> to enable them.</div>`
|
|
@@ -4674,14 +4788,32 @@
|
|
|
4674
4788
|
if (exportsHasModel !== paintedWith) paintExports(current.approvedAt, restoreKind);
|
|
4675
4789
|
let state = null;
|
|
4676
4790
|
let approvedAt = current.approvedAt; // fallback if the fetch fails (best-known)
|
|
4791
|
+
// Don't ask a question whose answer we already hold. `/export-sources` refuses on exactly the
|
|
4792
|
+
// standing condition the approval probe has already reported, so the request can only come back
|
|
4793
|
+
// 409 — and Chromium prints "Failed to load resource" for EVERY non-2xx regardless of how
|
|
4794
|
+
// cleanly the page handles it. Not asking is the only way to keep the console quiet, and it is
|
|
4795
|
+
// the honest description of the state anyway: there is nothing to select, which is what
|
|
4796
|
+
// `unavailable` already means here. Unknown still asks, so a not-yet-settled probe cannot
|
|
4797
|
+
// suppress a listing that would have succeeded.
|
|
4798
|
+
await awaitApprovalVerdict();
|
|
4799
|
+
if (!current || current.id !== id || $wsExports.hidden) return; // switched away while it settled
|
|
4800
|
+
// EVERY request in this render starts BELOW the wait, and the four of them are followed
|
|
4801
|
+
// immediately by the `allSettled` that handles them — no await may separate the two.
|
|
4802
|
+
//
|
|
4803
|
+
// `exportPromise` used to be started above, which review caught: parking on the verdict left it
|
|
4804
|
+
// in flight with no handler attached, so a failure during the wait crossed a microtask
|
|
4805
|
+
// checkpoint unhandled and the browser logged it — the same defect this PR fixes for
|
|
4806
|
+
// `checkpointPromise`, reintroduced one line up by the wait itself. The `return` on the line
|
|
4807
|
+
// above made it worse: it abandoned the promise outright.
|
|
4808
|
+
const sourcesRefused = !!approvalRefusalNote();
|
|
4677
4809
|
const exportPromise = api(`/api/contract/${encodeURIComponent(app)}/exports?project=${encodeURIComponent(id)}`);
|
|
4678
|
-
const sourcePromise = api(`/api/projects/${encodeURIComponent(id)}/export-sources`);
|
|
4810
|
+
const sourcePromise = sourcesRefused ? null : api(`/api/projects/${encodeURIComponent(id)}/export-sources`);
|
|
4679
4811
|
const readinessPromise = hasHosts ? refreshHostReadiness() : Promise.resolve(null);
|
|
4680
4812
|
const renderReadyPromise = hasRender ? api('/api/render/readiness') : Promise.resolve(null);
|
|
4681
4813
|
const [exportResult, readinessResult, renderReadyResult, sourceResult] = await Promise.allSettled([
|
|
4682
4814
|
exportPromise, readinessPromise, renderReadyPromise, sourcePromise,
|
|
4683
4815
|
]);
|
|
4684
|
-
if (sourceResult.status === 'fulfilled') {
|
|
4816
|
+
if (!sourcesRefused && sourceResult.status === 'fulfilled') {
|
|
4685
4817
|
exportSourcesState.status = 'ready';
|
|
4686
4818
|
exportSourcesState.data = sourceResult.value;
|
|
4687
4819
|
if (!currentExportSourceOption()) exportSourcesState.selected = null;
|
|
@@ -6216,7 +6348,15 @@
|
|
|
6216
6348
|
function savedWorkHtml(checkpoints, unavailable) {
|
|
6217
6349
|
let body;
|
|
6218
6350
|
if (unavailable) {
|
|
6219
|
-
|
|
6351
|
+
// Two very different unavailables, and only one of them is worth retrying. `/checkpoints`
|
|
6352
|
+
// refuses a project with no incarnation on the same standing condition approval does, so
|
|
6353
|
+
// "retry by reopening History" is an instruction that can never succeed — the Exports pane had
|
|
6354
|
+
// the identical false invitation above its gate (#574). The refusal is already stated in the
|
|
6355
|
+
// banner at the top of History, so this says what Saved work itself can never hold and stops
|
|
6356
|
+
// there, rather than repeating the sentence or inviting a pointless retry.
|
|
6357
|
+
body = approvalRefusalNote()
|
|
6358
|
+
? '<div class="saved-work-state" role="status">Checkpoints are kept per project identity, so this project has none.</div>'
|
|
6359
|
+
: '<div class="saved-work-state warn" role="status">Saved work unavailable — retry by reopening History.</div>';
|
|
6220
6360
|
} else if (!checkpoints.length) {
|
|
6221
6361
|
body = '<div class="saved-work-state">No saved work yet. FloLess saves a checkpoint before you switch away from pending edits.</div>';
|
|
6222
6362
|
} else {
|
|
@@ -6238,11 +6378,31 @@
|
|
|
6238
6378
|
const id = current.id;
|
|
6239
6379
|
closeBaseMenu(); // this re-render replaces the History HTML — drop any open base-picker's listener first
|
|
6240
6380
|
$wsHistory.innerHTML = '<div class="hist-note">Loading history…</div>';
|
|
6381
|
+
await awaitApprovalVerdict();
|
|
6382
|
+
if (!current || current.id !== id || $wsHistory.hidden) return; // switched away while it settled
|
|
6241
6383
|
let rows = [];
|
|
6242
6384
|
let approvedAt;
|
|
6243
6385
|
let nextDiffSupported = false;
|
|
6244
6386
|
let nextDiffEligibleVersions = null;
|
|
6245
|
-
|
|
6387
|
+
// The rejection handler is attached HERE, at creation, not at the `await` further down.
|
|
6388
|
+
//
|
|
6389
|
+
// The two requests are deliberately concurrent, but the handler used to go on only after
|
|
6390
|
+
// `/versions` had settled — so whenever `/checkpoints` rejected FIRST, its rejection crossed a
|
|
6391
|
+
// microtask checkpoint with nobody listening and the browser logged it as an uncaught error. It
|
|
6392
|
+
// never showed while `/checkpoints` only failed for transient reasons (rare, and usually slower
|
|
6393
|
+
// than `/versions`); a project with no incarnation makes it refuse INSTANTLY and every time, so
|
|
6394
|
+
// History was quietly printing to the console the very red line #574 exists to get rid of.
|
|
6395
|
+
// Settling to a tagged value instead of leaving it raw keeps the two outcomes explicit and means
|
|
6396
|
+
// no later reader can re-open the same hole by moving an await.
|
|
6397
|
+
// Not asked at all when the project is refused — `/checkpoints` refuses on the same standing
|
|
6398
|
+
// condition, and the browser logs every non-2xx whatever the page does with it. The wait above
|
|
6399
|
+
// is what makes the test trustworthy: without it a project restored straight onto History asks
|
|
6400
|
+
// while the verdict is still `loading`, gets its 409, and logs the very line this removes.
|
|
6401
|
+
// See the matching skip in `renderExports`.
|
|
6402
|
+
const checkpointPromise = approvalRefusalNote()
|
|
6403
|
+
? Promise.resolve({ saved: null })
|
|
6404
|
+
: api(`/api/projects/${encodeURIComponent(id)}/checkpoints`)
|
|
6405
|
+
.then((saved) => ({ saved }), () => ({ saved: null }));
|
|
6246
6406
|
let checkpoints = [];
|
|
6247
6407
|
let checkpointsUnavailable = false;
|
|
6248
6408
|
try {
|
|
@@ -6253,17 +6413,16 @@
|
|
|
6253
6413
|
nextDiffEligibleVersions = hasOwnField(r, 'diffEligibleVersions') ? r.diffEligibleVersions : null;
|
|
6254
6414
|
approvedAt = r.approvedAt || undefined;
|
|
6255
6415
|
} catch (err) {
|
|
6256
|
-
await checkpointPromise
|
|
6416
|
+
await checkpointPromise; // already settled to a tagged value — drained so it cannot outlive this render
|
|
6257
6417
|
showToast('Couldn’t load history: ' + ((err && err.message) || err), 'warn');
|
|
6258
6418
|
if (current && current.id === id && !$wsHistory.hidden) {
|
|
6259
6419
|
$wsHistory.innerHTML = '<div class="hist-empty">History unavailable — try again.</div>';
|
|
6260
6420
|
}
|
|
6261
6421
|
return;
|
|
6262
6422
|
}
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
} catch { checkpointsUnavailable = true; }
|
|
6423
|
+
const { saved } = await checkpointPromise;
|
|
6424
|
+
if (saved === null) checkpointsUnavailable = true;
|
|
6425
|
+
else checkpoints = Array.isArray(saved.checkpoints) ? saved.checkpoints : [];
|
|
6267
6426
|
if (!current || current.id !== id || $wsHistory.hidden) return; // switched away mid-await
|
|
6268
6427
|
histDiffSupported = nextDiffSupported;
|
|
6269
6428
|
histDiffEligibleVersions = nextDiffEligibleVersions;
|
|
@@ -6292,7 +6451,14 @@
|
|
|
6292
6451
|
applyModelPresence(hasModel); // one answer, every surface — History used to keep its own
|
|
6293
6452
|
const empty = document.createElement('div');
|
|
6294
6453
|
empty.className = 'hist-empty';
|
|
6295
|
-
|
|
6454
|
+
const emptyRefusal = approvalRefusalNote();
|
|
6455
|
+
if (emptyRefusal) {
|
|
6456
|
+
// FIRST, because the branch below is the one that lies for a refused project: it points at
|
|
6457
|
+
// "Review & approve in the project header" to create v1, and on a project with no
|
|
6458
|
+
// incarnation that control is permanently a disabled "Review unavailable". A ledger that
|
|
6459
|
+
// will never gain a row should say why, not name the button that cannot add one.
|
|
6460
|
+
empty.append(emptyRefusal);
|
|
6461
|
+
} else if (hasModel === 'model') {
|
|
6296
6462
|
empty.append('No approved versions yet. Review the model, then use Review & approve in the project header to create ');
|
|
6297
6463
|
const v1 = document.createElement('b');
|
|
6298
6464
|
v1.textContent = 'v1';
|
|
@@ -6314,7 +6480,14 @@
|
|
|
6314
6480
|
// rollback) surface it honestly ABOVE the table (not as a fake row) and name the Exports lock.
|
|
6315
6481
|
const headKind = rows.length && rows[0].current ? rows[0].kind : undefined;
|
|
6316
6482
|
const headIsInitialRead = headKind === 'revision-read' && Number(rows[0].n) <= 1;
|
|
6317
|
-
|
|
6483
|
+
// A refused project takes the banner FIRST. Its working copy genuinely is unsigned, but the
|
|
6484
|
+
// pending-changes wording below is unreachable for it (that branch needs `status === 'ready'`),
|
|
6485
|
+
// so History would otherwise print the immutability note and the table with nothing at all
|
|
6486
|
+
// saying why sign-off never happens — silence in the one place a reader goes to ask.
|
|
6487
|
+
const historyRefusal = approvalRefusalNote();
|
|
6488
|
+
const working = historyRefusal
|
|
6489
|
+
? `<div class="hist-working">● <b>Not signed off.</b> ${escapeHtml(historyRefusal)}</div>`
|
|
6490
|
+
: approvalState.status === 'ready' && approvalState.pendingCount > 0
|
|
6318
6491
|
? (headKind === 'revision-read'
|
|
6319
6492
|
? `<div class="hist-working">● <b>The AI read ${headIsInitialRead ? 'the initial' : 'a revised'} drawing set — review it before signing.</b> ` +
|
|
6320
6493
|
`Open <b>${escapeHtml(stepLabel('model'))}</b> to check the change, then use Review & approve in the project header. Exports keep using ${approvalState.headVersion ? `approved v${approvalState.headVersion}` : 'an explicitly selected DRAFT'}.</div>`
|