@rig-c/review 2.8.0 → 2.9.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/docs/PARTS_VIEW.md +103 -66
- package/docs/REVIEW_PACKAGE.md +5 -6
- package/docs/STABILITY.md +6 -1
- package/package.json +3 -3
- package/src/build.ts +10 -2
- package/src/cli.ts +4 -5
- package/src/correction-handoff.ts +27 -4
- package/src/feedback-export.ts +1 -1
- package/src/front.ts +2 -1
- package/src/handoff.ts +1 -1
- package/src/job-act.ts +43 -23
- package/src/job-cli.ts +6 -2
- package/src/job-contract.ts +86 -12
- package/src/job-front.ts +106 -9
- package/src/job-host.ts +5 -0
- package/src/job-session.ts +37 -4
- package/src/manifest.ts +9 -0
- package/src/open-workspace-launch.ts +2 -2
- package/src/open.ts +2 -1
- package/src/parts-comment-crops.ts +126 -31
- package/src/parts-comment.ts +321 -28
- package/src/parts-view.ts +485 -89
- package/src/stage-comment.ts +9 -1
- package/src/stage-parts.ts +5 -1
- package/src/versions.ts +7 -7
- package/web/catalog-en.ts +36 -1
- package/web/catalog-ko.ts +36 -1
- package/web/job-session.ts +353 -83
- package/web/parts-page.ts +217 -0
- package/web/parts-render.ts +26 -19
- package/web/parts-viewport-provider.ts +13 -1
- package/web/parts.css +13 -1
- package/web/parts.html +4 -38
- package/web/parts.ts +644 -267
- package/web/stage-comments.ts +77 -23
- package/web/styles.css +10 -2
- package/web/viewport-controller.ts +13 -4
package/web/job-session.ts
CHANGED
|
@@ -9,6 +9,10 @@ import type {
|
|
|
9
9
|
JobResult,
|
|
10
10
|
JobUISubmission,
|
|
11
11
|
PendingAskV3,
|
|
12
|
+
JobPanelComposition,
|
|
13
|
+
PanelComponent,
|
|
14
|
+
PanelSlot,
|
|
15
|
+
PartsVerdictValue,
|
|
12
16
|
PublicationV3,
|
|
13
17
|
RecordSource,
|
|
14
18
|
SourceV3,
|
|
@@ -23,6 +27,9 @@ import {recordJobRigDraw, freezeJobRigCapture, copyJobRigViewport, createJobRigS
|
|
|
23
27
|
import {advancePlayback} from './playback-clock.ts';
|
|
24
28
|
import {presentJobRigViewport, type JobRigPresentation} from './viewport-capture.ts';
|
|
25
29
|
import {CanvasRenderer} from '@rig-c/play';
|
|
30
|
+
import {JOB_PANEL_COMPOSITION_SCHEMA, JOB_PARTS_VERDICT_ACT_SCHEMA, parsePanelComposition} from '../src/job-contract.ts';
|
|
31
|
+
import type {PartsSource, PartsHost} from './parts.ts';
|
|
32
|
+
import type {PartsIssue} from '../src/parts-comment.ts';
|
|
26
33
|
|
|
27
34
|
/** Imported runtimes may throw arbitrary prose. Only registered refusal copy reaches the window. */
|
|
28
35
|
export function jobWindowRefusal(error: unknown, fallback = 'JOB_WINDOW_FAILED'): string {
|
|
@@ -65,6 +72,7 @@ export interface JobRetainedDraft {
|
|
|
65
72
|
readonly label: string;
|
|
66
73
|
readonly value: unknown;
|
|
67
74
|
}
|
|
75
|
+
export type JobWindowAsk = PendingAskV3 & {readonly act?: ActV3};
|
|
68
76
|
export interface JobWindowState {
|
|
69
77
|
readonly generation: number;
|
|
70
78
|
readonly displayed: DisplayPublicationV3 | null;
|
|
@@ -73,7 +81,7 @@ export interface JobWindowState {
|
|
|
73
81
|
readonly closed: boolean;
|
|
74
82
|
readonly error: string | null;
|
|
75
83
|
readonly previousLabel: string | null;
|
|
76
|
-
readonly pending: readonly
|
|
84
|
+
readonly pending: readonly JobWindowAsk[];
|
|
77
85
|
readonly retainedDrafts: readonly JobRetainedDraft[];
|
|
78
86
|
}
|
|
79
87
|
function unwrap<Value>(result: JobResult<Value>): Value {
|
|
@@ -153,7 +161,7 @@ export function createJobWindow<Prepared>(options: {
|
|
|
153
161
|
initialRetainedDrafts?: readonly JobRetainedDraft[];
|
|
154
162
|
}) {
|
|
155
163
|
const { transport, adapter, pageId } = options;
|
|
156
|
-
const pending = new Map<string,
|
|
164
|
+
const pending = new Map<string, JobWindowAsk>();
|
|
157
165
|
const rigAttempts = new WeakSet<UISubmissionV3>();
|
|
158
166
|
const retainedDrafts: JobRetainedDraft[] = [];
|
|
159
167
|
let initialDrafts: readonly JobRetainedDraft[] | null = options.initialRetainedDrafts
|
|
@@ -301,12 +309,13 @@ export function createJobWindow<Prepared>(options: {
|
|
|
301
309
|
void replace(value.publication);
|
|
302
310
|
}
|
|
303
311
|
else if (value.type === 'pending') {
|
|
304
|
-
pending.
|
|
312
|
+
const previous = pending.get(value.ask.askId);
|
|
313
|
+
pending.set(value.ask.askId, previous?.act ? {...value.ask, status: 'answered', act: previous.act} : value.ask);
|
|
305
314
|
}
|
|
306
315
|
else if (value.type === 'act') {
|
|
307
316
|
const ask = pending.get(value.act.askId);
|
|
308
317
|
if (ask)
|
|
309
|
-
pending.set(ask.askId, { ...ask, status: 'answered' });
|
|
318
|
+
pending.set(ask.askId, { ...ask, status: 'answered', act: value.act });
|
|
310
319
|
}
|
|
311
320
|
else if (value.type === 'closed') {
|
|
312
321
|
closed = true;
|
|
@@ -327,10 +336,46 @@ export function createJobWindow<Prepared>(options: {
|
|
|
327
336
|
}
|
|
328
337
|
// The backend authenticates the actual Request and validates the semantic value.
|
|
329
338
|
if (input.capture !== undefined) rigAttempts.add(input);
|
|
330
|
-
|
|
339
|
+
const result = await transport.submit(input);
|
|
340
|
+
if (result.ok && ask) {
|
|
341
|
+
pending.set(ask.askId, {...ask, status: 'answered', act: result.value});
|
|
342
|
+
changed();
|
|
343
|
+
}
|
|
344
|
+
return result;
|
|
345
|
+
}
|
|
346
|
+
async function submitParts(input: UISubmissionV3, signoffSubmissionId: string): Promise<JobResult<ActV3>> {
|
|
347
|
+
const publicationId = input.publicationId;
|
|
348
|
+
const ask = pending.get(input.askId);
|
|
349
|
+
if (!displayed || displayed.publication.publicationId !== publicationId || !ask ||
|
|
350
|
+
ask.subject.kind !== 'parts-verdict') throw new Error('JOB_ACT_SOURCE_STALE');
|
|
351
|
+
assertJobAskSource(ask, displayed);
|
|
352
|
+
const previous = ask.act;
|
|
353
|
+
const value = (previous?.kind === 'parts-verdict' ? previous.value : input.value) as PartsVerdictValue;
|
|
354
|
+
const signoff = [...pending.values()].find(item => item.publicationId === publicationId &&
|
|
355
|
+
item.subject.kind === 'signoff' && item.subject.stage === 'parts-review' && item.status === 'pending');
|
|
356
|
+
if (value.verdict === 'approved' && !signoff) throw new Error('JOB_PARTS_SIGNOFF_MISSING');
|
|
357
|
+
let result: JobResult<ActV3>;
|
|
358
|
+
if (ask.status === 'pending') {
|
|
359
|
+
result = await submit(input);
|
|
360
|
+
if (!result.ok) return result;
|
|
361
|
+
} else {
|
|
362
|
+
if (!previous || previous.kind !== 'parts-verdict' || previous.schema !== JOB_PARTS_VERDICT_ACT_SCHEMA ||
|
|
363
|
+
value.verdict !== 'approved') throw new Error('JOB_ACT_SOURCE_STALE');
|
|
364
|
+
result = {ok: true, value: previous};
|
|
365
|
+
}
|
|
366
|
+
if (value.verdict !== 'approved') return result;
|
|
367
|
+
// Recheck after the first durable write. A replacement never inherits this signoff.
|
|
368
|
+
const latest = state();
|
|
369
|
+
if (latest.displayed?.publication.publicationId !== publicationId || !latest.receipt || !signoff)
|
|
370
|
+
throw new Error('JOB_ACT_SOURCE_STALE');
|
|
371
|
+
assertJobAskSource(signoff, latest.displayed);
|
|
372
|
+
return submit({kind: 'signoff', publicationId, pageId: input.pageId, askId: signoff.askId,
|
|
373
|
+
expectedGeneration: latest.generation, displayedNonce: latest.receipt.displayedNonce,
|
|
374
|
+
submissionId: signoffSubmissionId,
|
|
375
|
+
value: {stage: 'parts-review', decision: 'approved', words: value.words}});
|
|
331
376
|
}
|
|
332
377
|
return {
|
|
333
|
-
event, replace, submit, state, refresh: changed,
|
|
378
|
+
event, replace, submit, submitParts, state, refresh: changed,
|
|
334
379
|
settled: () => queue,
|
|
335
380
|
stop() { stopped = true; ++intent; controller?.abort(); },
|
|
336
381
|
};
|
|
@@ -614,22 +659,7 @@ type JobInterview = {
|
|
|
614
659
|
})[];
|
|
615
660
|
interview?: JobInterviewDiagnostics | null;
|
|
616
661
|
};
|
|
617
|
-
|
|
618
|
-
sourceHash: string;
|
|
619
|
-
rigSize: [
|
|
620
|
-
number,
|
|
621
|
-
number
|
|
622
|
-
] | null;
|
|
623
|
-
items: {
|
|
624
|
-
name: string;
|
|
625
|
-
index: number;
|
|
626
|
-
x: number;
|
|
627
|
-
y: number;
|
|
628
|
-
w: number;
|
|
629
|
-
h: number;
|
|
630
|
-
imageHash?: string;
|
|
631
|
-
}[];
|
|
632
|
-
}
|
|
662
|
+
type JobPartsInventory = Awaited<ReturnType<PartsSource['view']>>;
|
|
633
663
|
interface JobReferenceView {
|
|
634
664
|
id: string;
|
|
635
665
|
label: string;
|
|
@@ -639,6 +669,43 @@ interface JobReferenceView {
|
|
|
639
669
|
seek(time: number, signal: AbortSignal): Promise<void>;
|
|
640
670
|
}
|
|
641
671
|
|
|
672
|
+
/** Read composition at the host boundary. Unknown IDs remain local to their slot. */
|
|
673
|
+
export function resolveJobPanels(metadata: JobInspectionMetadataV3, source: SourceV3) {
|
|
674
|
+
const parts: JobPanelComposition = {schema: JOB_PANEL_COMPOSITION_SCHEMA, left: ['parts.list'],
|
|
675
|
+
stage: ['parts.canvas'], toolbar: ['parts.layers'], side: ['parts.issues', 'act.submit']};
|
|
676
|
+
const stage: PanelComponent = source.subject === 'image-set' ? 'images.set' :
|
|
677
|
+
isRecordSource(source) ? source.subject === 'plan' ? 'plan.body' : 'interview.picks' :
|
|
678
|
+
source.direction ? 'scene.composite' : 'rig.playback';
|
|
679
|
+
const fallback: JobPanelComposition = metadata.capabilities.preRig ? parts :
|
|
680
|
+
{schema: JOB_PANEL_COMPOSITION_SCHEMA, stage: [stage], side: ['act.submit']};
|
|
681
|
+
const raw: unknown = metadata.manifest?.panels;
|
|
682
|
+
if (raw === undefined) return {composition: fallback, invalid: false};
|
|
683
|
+
try { return {composition: parsePanelComposition(raw), invalid: false}; }
|
|
684
|
+
catch { return {composition: fallback, invalid: true}; }
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/** Derived only from finalized asks, including cursor replay after reload. */
|
|
688
|
+
export function jobPartsReviewState(asks: readonly JobWindowAsk[], publicationId: string) {
|
|
689
|
+
const bound = asks.filter(ask => ask.publicationId === publicationId);
|
|
690
|
+
const verdict = bound.filter(ask => ask.subject.kind === 'parts-verdict').at(-1);
|
|
691
|
+
const act = verdict?.act;
|
|
692
|
+
if (act?.kind !== 'parts-verdict' || act.schema !== JOB_PARTS_VERDICT_ACT_SCHEMA) return 'reviewing';
|
|
693
|
+
if (act.value.verdict === 'changes-requested') return 'sent';
|
|
694
|
+
const approved = bound.some(ask => ask.subject.kind === 'signoff' && ask.subject.stage === 'parts-review' &&
|
|
695
|
+
ask.act?.kind === 'signoff' && ask.act.value.decision === 'approved');
|
|
696
|
+
return approved ? 'approved' : 'retry-signoff';
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/** A declared painting identity takes precedence over manifest reference order. */
|
|
700
|
+
export function jobPartsPainting(prepared: Pick<JobPreparedInspection, 'metadata' | 'display' | 'references'>) {
|
|
701
|
+
const declared = prepared.metadata.sourcePainting;
|
|
702
|
+
if (declared) return prepared.references.find(reference => reference.id === declared.id) ?? null;
|
|
703
|
+
const source = prepared.display.publication.source;
|
|
704
|
+
if (isRecordSource(source)) return null;
|
|
705
|
+
const painting = source.parts?.images.find(image => image.role === 'painting');
|
|
706
|
+
return painting ? prepared.references.find(reference => reference.label === painting.role + ' ' + painting.path) ?? null : null;
|
|
707
|
+
}
|
|
708
|
+
|
|
642
709
|
/** A reference stays off-stage until its seek matches the latest inspection time. */
|
|
643
710
|
export function createJobReferenceSelection<Reference extends Pick<JobReferenceView, 'seek'>>(options: {
|
|
644
711
|
current(): {owner: object | null; time: number};
|
|
@@ -686,6 +753,7 @@ export interface JobPreparedInspection {
|
|
|
686
753
|
interview: JobInterview | null;
|
|
687
754
|
parts: JobPartsInventory | null;
|
|
688
755
|
partImages: Map<string, HTMLImageElement>;
|
|
756
|
+
partPages?: Map<number, HTMLImageElement>;
|
|
689
757
|
interviewImages: Map<string, HTMLImageElement>;
|
|
690
758
|
imageSetImages?: readonly HTMLImageElement[];
|
|
691
759
|
references: JobReferenceView[];
|
|
@@ -829,9 +897,12 @@ export async function prepareJobInspection(display: DisplayPublicationV3, signal
|
|
|
829
897
|
throw new Error('JOB_DISPLAY_MISMATCH');
|
|
830
898
|
}
|
|
831
899
|
const parts = metadata.capabilities.preRig ? await jobJson<JobPartsInventory>(routes.api('stage-parts'), signal) : null;
|
|
900
|
+
if (metadata.sourceHash !== publishedSource.sourceHash || parts && parts.sourceHash !== publishedSource.sourceHash)
|
|
901
|
+
throw new Error('JOB_SOURCE_MISMATCH');
|
|
832
902
|
const references: JobReferenceView[] = [];
|
|
833
903
|
const partImages = new Map<string, HTMLImageElement>();
|
|
834
904
|
const interviewImages = new Map<string, HTMLImageElement>();
|
|
905
|
+
const partPages = new Map<number, HTMLImageElement>();
|
|
835
906
|
const preload: Promise<void>[] = [];
|
|
836
907
|
const imageSetImages: HTMLImageElement[] = [];
|
|
837
908
|
const source = display.publication.source;
|
|
@@ -850,9 +921,12 @@ export async function prepareJobInspection(display: DisplayPublicationV3, signal
|
|
|
850
921
|
}
|
|
851
922
|
}
|
|
852
923
|
for (const reference of metadata.manifest?.references ?? []) {
|
|
924
|
+
if (reference.id === metadata.sourcePainting?.id) continue;
|
|
853
925
|
preload.push((async () => {
|
|
854
926
|
if (reference.type === 'image') {
|
|
855
|
-
const
|
|
927
|
+
const painting = !isRecordSource(source) ? source.parts?.images.find(entry =>
|
|
928
|
+
entry.role === 'painting' && reference.label === entry.role + ' ' + entry.path) : null;
|
|
929
|
+
const element = await image(routes.asset(reference.path), painting?.sha256 ?? metadata.referenceHashes?.[reference.id]);
|
|
856
930
|
element.alt = reference.label;
|
|
857
931
|
references.push({ id: reference.id, label: reference.label, element,
|
|
858
932
|
width: element.naturalWidth, height: element.naturalHeight, seek: async () => { } });
|
|
@@ -957,6 +1031,10 @@ export async function prepareJobInspection(display: DisplayPublicationV3, signal
|
|
|
957
1031
|
preload.push(image(routes.api('stage-parts/image/' + part.index), part.imageHash)
|
|
958
1032
|
.then(element => { element.alt = part.name; partImages.set(part.name, element); }));
|
|
959
1033
|
}
|
|
1034
|
+
for (const page of parts?.pages ?? []) {
|
|
1035
|
+
preload.push(image(routes.api('stage-parts/page/' + page.index))
|
|
1036
|
+
.then(element => { partPages.set(page.index, element); }));
|
|
1037
|
+
}
|
|
960
1038
|
for (const question of interview?.questions ?? [])
|
|
961
1039
|
for (const asset of question.images) {
|
|
962
1040
|
preload.push(image(routes.instance(asset.url)).then(element => { element.alt = asset.name; interviewImages.set(asset.url, element); }));
|
|
@@ -1005,7 +1083,7 @@ export async function prepareJobInspection(display: DisplayPublicationV3, signal
|
|
|
1005
1083
|
const order = [metadata.sourcePainting?.id, ...(metadata.manifest?.references.map(reference => reference.id) ?? [])];
|
|
1006
1084
|
references.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id));
|
|
1007
1085
|
return {
|
|
1008
|
-
display, metadata, interview, parts, partImages, interviewImages, imageSetImages, references, assets, rigRoot,
|
|
1086
|
+
display, metadata, interview, parts, partImages, partPages, interviewImages, imageSetImages, references, assets, rigRoot,
|
|
1009
1087
|
get rigPresentation() { return rigPresentation; },
|
|
1010
1088
|
set rigPresentation(value) {
|
|
1011
1089
|
clearRigPresentation();
|
|
@@ -1216,6 +1294,14 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1216
1294
|
element: HTMLElement;
|
|
1217
1295
|
forms: Map<string, JobForm>;
|
|
1218
1296
|
};
|
|
1297
|
+
const partsPanels = new WeakMap<JobPreparedInspection, {
|
|
1298
|
+
slots: {left: HTMLElement; stage: HTMLElement; toolbar: HTMLElement; side: HTMLElement};
|
|
1299
|
+
composition: JobPanelComposition;
|
|
1300
|
+
output?: Parameters<PartsHost['register']>[0];
|
|
1301
|
+
issues: PartsIssue[];
|
|
1302
|
+
legacy: unknown;
|
|
1303
|
+
dispose?: () => void;
|
|
1304
|
+
}>();
|
|
1219
1305
|
const forms = new Map<string, JobForm>();
|
|
1220
1306
|
const drawn = new WeakMap<JobPreparedInspection, JobRigDraw>();
|
|
1221
1307
|
let drawGeneration = 0;
|
|
@@ -1655,32 +1741,13 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1655
1741
|
submitKey = 'job.saveCheckpoint';
|
|
1656
1742
|
}
|
|
1657
1743
|
else if (subject.kind === 'parts-verdict') {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
const legend = node('legend');
|
|
1666
|
-
legend.textContent = part.name;
|
|
1667
|
-
group.append(legend);
|
|
1668
|
-
const partOutcome = selectValues(['pending', 'clean', 'flagged'], ['Pending', 'Clean', 'Flagged']);
|
|
1669
|
-
const meshOutcome = selectValues(['pending', 'clean', 'flagged'], ['Pending', 'Clean', 'Flagged']);
|
|
1670
|
-
partOutcome.name = 'parts.' + part.name + '.outcome';
|
|
1671
|
-
meshOutcome.name = 'mesh.' + part.name + '.outcome';
|
|
1672
|
-
group.append(inputLabel('Parts', partOutcome));
|
|
1673
|
-
const partNote = textArea(group, 'Note', 'parts.' + part.name + '.note');
|
|
1674
|
-
group.append(inputLabel('Mesh', meshOutcome));
|
|
1675
|
-
const meshNote = textArea(group, 'Note', 'mesh.' + part.name + '.note');
|
|
1676
|
-
fields.append(group);
|
|
1677
|
-
return { partId: part.name, partOutcome, meshOutcome, partNote, meshNote };
|
|
1678
|
-
});
|
|
1679
|
-
read = () => ({ verdict: verdict.value as 'pending' | 'approved' | 'changes-requested', words: note.value,
|
|
1680
|
-
parts: parts.map(part => ({ partId: part.partId,
|
|
1681
|
-
part: { outcome: part.partOutcome.value as 'pending' | 'clean' | 'flagged', note: part.partNote.value },
|
|
1682
|
-
mesh: { outcome: part.meshOutcome.value as 'pending' | 'clean' | 'flagged', note: part.meshNote.value } })) });
|
|
1683
|
-
submitKey = 'job.savePartsVerdict';
|
|
1744
|
+
read = () => {
|
|
1745
|
+
const panel = partsPanels.get(prepared);
|
|
1746
|
+
if (panel?.legacy) throw new Error('JOB_PARTS_LEGACY_DRAFT');
|
|
1747
|
+
if (!panel?.output) throw new Error('JOB_PANEL_OUTPUT_MISSING');
|
|
1748
|
+
return {...panel.output.value(), words: note.value};
|
|
1749
|
+
};
|
|
1750
|
+
submitKey = 'job.partsApprove';
|
|
1684
1751
|
}
|
|
1685
1752
|
else if (subject.kind === 'review-verdict') {
|
|
1686
1753
|
const verdict = selectValues(['pending', 'approved', 'changes-requested'], ['Pending', 'Approved', 'Changes requested']);
|
|
@@ -1742,13 +1809,20 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1742
1809
|
form.append(status);
|
|
1743
1810
|
const entry: JobForm = { form, fieldset: fields, read, submissionId: crypto.randomUUID(), dirty: false,
|
|
1744
1811
|
submitting: false, rigSubmission: createJobRigSubmission() };
|
|
1812
|
+
const signoffSubmissionId = crypto.randomUUID();
|
|
1745
1813
|
try {
|
|
1746
1814
|
const saved = JSON.parse(localStorage.getItem(localDraftKey(prepared.display)) ?? 'null');
|
|
1747
1815
|
if (saved?.publicationId === prepared.display.publication.publicationId &&
|
|
1748
1816
|
saved?.sourceHash === prepared.display.publication.source.sourceHash) {
|
|
1817
|
+
assertJobAskSource({...ask, source: saved.source}, prepared.display);
|
|
1749
1818
|
const original = saved.forms?.find((item: {
|
|
1750
1819
|
askId: string;
|
|
1751
1820
|
}) => item.askId === ask.askId);
|
|
1821
|
+
if (subject.kind === 'parts-verdict') {
|
|
1822
|
+
const panel = partsPanels.get(prepared);
|
|
1823
|
+
if (panel && Array.isArray(original?.value?.issues)) panel.issues = structuredClone(original.value.issues);
|
|
1824
|
+
else if (panel && original?.value?.parts) panel.legacy = original.value;
|
|
1825
|
+
}
|
|
1752
1826
|
for (const input of form.querySelectorAll<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>('input[name],textarea[name],select[name]')) {
|
|
1753
1827
|
const restored = original?.controls?.find((item: {
|
|
1754
1828
|
name: string;
|
|
@@ -1783,7 +1857,9 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1783
1857
|
fields.disabled = true;
|
|
1784
1858
|
const frozen = await pending;
|
|
1785
1859
|
if (entry.submissionId !== frozen.submissionId) throw new Error('JOB_STILL_BINDING_MISMATCH');
|
|
1786
|
-
|
|
1860
|
+
if (subject.kind === 'parts-verdict') window.refresh();
|
|
1861
|
+
const result = subject.kind === 'parts-verdict'
|
|
1862
|
+
? await window.submitParts(frozen, signoffSubmissionId) : await window.submit(frozen);
|
|
1787
1863
|
if (!result.ok)
|
|
1788
1864
|
throw new Error(result.error.code);
|
|
1789
1865
|
entry.submitting = false;
|
|
@@ -1792,6 +1868,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1792
1868
|
status.dataset.jobText = 'job.saved';
|
|
1793
1869
|
status.textContent = t('job.saved');
|
|
1794
1870
|
saveDraft();
|
|
1871
|
+
if (subject.kind === 'parts-verdict') window.refresh();
|
|
1795
1872
|
}
|
|
1796
1873
|
catch (error) {
|
|
1797
1874
|
entry.submitting = false;
|
|
@@ -1799,6 +1876,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1799
1876
|
? error.message : 'JOB_ACT_INVALID';
|
|
1800
1877
|
status.textContent = jobWindowRefusal(error, 'JOB_ACT_INVALID');
|
|
1801
1878
|
fields.disabled = false;
|
|
1879
|
+
if (subject.kind === 'parts-verdict') window.refresh();
|
|
1802
1880
|
}
|
|
1803
1881
|
};
|
|
1804
1882
|
return entry;
|
|
@@ -1809,11 +1887,17 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1809
1887
|
const host = workspace.querySelector<HTMLElement>('[data-job-forms]');
|
|
1810
1888
|
if (!host)
|
|
1811
1889
|
return;
|
|
1890
|
+
const partsPanel = partsPanels.get(current);
|
|
1891
|
+
const partsState = jobPartsReviewState(state.pending, current.display.publication.publicationId);
|
|
1892
|
+
const activeParts = state.pending.filter(ask => ask.publicationId === current!.display.publication.publicationId &&
|
|
1893
|
+
ask.subject.kind === 'parts-verdict').at(-1);
|
|
1812
1894
|
for (const ask of state.pending) {
|
|
1813
1895
|
if (ask.publicationId !== current.display.publication.publicationId)
|
|
1814
1896
|
continue;
|
|
1897
|
+
if (partsPanel && ask.subject.kind === 'signoff' && ask.subject.stage === 'parts-review') continue;
|
|
1898
|
+
if (partsPanel && ask.subject.kind === 'parts-verdict' && ask !== activeParts) continue;
|
|
1815
1899
|
let entry = forms.get(ask.askId);
|
|
1816
|
-
if (!entry && ask.status === 'pending') {
|
|
1900
|
+
if (!entry && (ask.status === 'pending' || partsPanel && ask === activeParts)) {
|
|
1817
1901
|
try {
|
|
1818
1902
|
entry = formFor(ask, current);
|
|
1819
1903
|
forms.set(ask.askId, entry);
|
|
@@ -1825,8 +1909,146 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1825
1909
|
host.append(refusal);
|
|
1826
1910
|
}
|
|
1827
1911
|
}
|
|
1828
|
-
if (entry)
|
|
1829
|
-
|
|
1912
|
+
if (entry) {
|
|
1913
|
+
const partsAsk = partsPanel && ask.subject.kind === 'parts-verdict';
|
|
1914
|
+
entry.fieldset.disabled = entry.submitting || (ask.status !== 'pending' && !(partsAsk && partsState === 'retry-signoff')) ||
|
|
1915
|
+
state.preparing || state.closed || !state.receipt || !access.capability;
|
|
1916
|
+
if (partsAsk) {
|
|
1917
|
+
const button = entry.form.querySelector<HTMLButtonElement>('button[type=submit]')!;
|
|
1918
|
+
const signoff = state.pending.some(item => item.publicationId === ask.publicationId && item.status === 'pending' &&
|
|
1919
|
+
item.subject.kind === 'signoff' && item.subject.stage === 'parts-review');
|
|
1920
|
+
button.dataset.jobText = partsState === 'retry-signoff' ? 'job.partsRetrySignoff' :
|
|
1921
|
+
partsPanel.issues.length ? 'job.partsRequestFixes' : 'job.partsApprove';
|
|
1922
|
+
button.textContent = t(button.dataset.jobText, [partsPanel.issues.length]);
|
|
1923
|
+
button.disabled = !partsPanel.output || !!partsPanel.legacy ||
|
|
1924
|
+
(partsState === 'retry-signoff' || !partsPanel.issues.length) && !signoff;
|
|
1925
|
+
const status = entry.form.querySelector<HTMLElement>('[role=status]')!;
|
|
1926
|
+
if (!partsPanel.output) {
|
|
1927
|
+
status.dataset.jobText = 'JOB_PANEL_OUTPUT_MISSING';
|
|
1928
|
+
status.textContent = t('JOB_PANEL_OUTPUT_MISSING') + ' · ' + ask.subject.kind;
|
|
1929
|
+
} else if (status.dataset.jobText === 'JOB_PANEL_OUTPUT_MISSING') {
|
|
1930
|
+
delete status.dataset.jobText;
|
|
1931
|
+
status.textContent = '';
|
|
1932
|
+
}
|
|
1933
|
+
const words = entry.form.querySelector<HTMLTextAreaElement>('textarea[name=note]');
|
|
1934
|
+
if (words) words.disabled = ask.status !== 'pending';
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
async function mountJobParts(prepared: JobPreparedInspection, signal: AbortSignal): Promise<void> {
|
|
1940
|
+
const panel = partsPanels.get(prepared)!;
|
|
1941
|
+
const [{mountPartsWorkspace}, {parsePartsIssue}] = await Promise.all([
|
|
1942
|
+
import('./parts.ts'), import('../src/parts-comment.ts'),
|
|
1943
|
+
]);
|
|
1944
|
+
if (signal.aborted) throw new Error('JOB_PRELOAD_CANCELLED');
|
|
1945
|
+
const finalized = window.state().pending.filter(ask =>
|
|
1946
|
+
ask.publicationId === prepared.display.publication.publicationId && ask.subject.kind === 'parts-verdict').at(-1)?.act;
|
|
1947
|
+
if (finalized?.kind === 'parts-verdict') {
|
|
1948
|
+
if (finalized.schema === JOB_PARTS_VERDICT_ACT_SCHEMA) panel.issues = [...finalized.value.issues];
|
|
1949
|
+
else panel.legacy = finalized.value;
|
|
1950
|
+
}
|
|
1951
|
+
panel.issues = panel.issues.map(issue => parsePartsIssue(issue, true, false, false));
|
|
1952
|
+
const routes = jobPublicationRoutes(prepared.display, location.origin);
|
|
1953
|
+
const painting = jobPartsPainting(prepared);
|
|
1954
|
+
const lifetime = new AbortController();
|
|
1955
|
+
let rejectPreparation!: (error: unknown) => void;
|
|
1956
|
+
const preparationCancelled = new Promise<never>((_resolve, reject) => {rejectPreparation = reject;});
|
|
1957
|
+
void preparationCancelled.catch(() => {});
|
|
1958
|
+
let mounted: ReturnType<typeof mountPartsWorkspace> | undefined;
|
|
1959
|
+
const cancelPreparation = () => {lifetime.abort(); rejectPreparation(new Error('JOB_PRELOAD_CANCELLED'));};
|
|
1960
|
+
signal.addEventListener('abort', cancelPreparation, {once: true});
|
|
1961
|
+
panel.dispose = () => {
|
|
1962
|
+
signal.removeEventListener('abort', cancelPreparation);
|
|
1963
|
+
lifetime.abort();
|
|
1964
|
+
const instance = mounted;
|
|
1965
|
+
mounted = undefined;
|
|
1966
|
+
instance?.dispose();
|
|
1967
|
+
};
|
|
1968
|
+
const source: PartsSource = {
|
|
1969
|
+
async view() {
|
|
1970
|
+
const view = await jobJson<JobPartsInventory>(routes.api('stage-parts'), lifetime.signal);
|
|
1971
|
+
if (current !== prepared || lifetime.signal.aborted ||
|
|
1972
|
+
view.sourceHash !== prepared.display.publication.source.sourceHash)
|
|
1973
|
+
throw new Error('JOB_ACT_SOURCE_STALE');
|
|
1974
|
+
return {...view, readOnly: false};
|
|
1975
|
+
},
|
|
1976
|
+
async image(index) {
|
|
1977
|
+
const item = prepared.parts?.items.find(item => item.index === index);
|
|
1978
|
+
const image = item && prepared.partImages.get(item.name);
|
|
1979
|
+
if (!image) throw new Error('JOB_VISUAL_UNAVAILABLE');
|
|
1980
|
+
return image;
|
|
1981
|
+
},
|
|
1982
|
+
async page(index) {
|
|
1983
|
+
const page = prepared.partPages?.get(index);
|
|
1984
|
+
if (!page) throw new Error('JOB_VISUAL_UNAVAILABLE');
|
|
1985
|
+
return page;
|
|
1986
|
+
},
|
|
1987
|
+
painting: () => painting?.element instanceof HTMLImageElement ? Promise.resolve(painting.element) : null,
|
|
1988
|
+
async crop(issue) {
|
|
1989
|
+
if (current !== prepared || lifetime.signal.aborted) throw new Error('JOB_ACT_SOURCE_STALE');
|
|
1990
|
+
const response = await fetch(routes.api('stage-parts/comment'), {
|
|
1991
|
+
method: 'POST', signal: lifetime.signal, headers: access.headers({'Content-Type': 'application/json'}),
|
|
1992
|
+
body: JSON.stringify(issue),
|
|
1993
|
+
});
|
|
1994
|
+
const value = await response.json();
|
|
1995
|
+
if (!response.ok) throw new Error(value?.error?.code ?? 'PARTS_COMMENT_UNAVAILABLE');
|
|
1996
|
+
if (current !== prepared || lifetime.signal.aborted) throw new Error('JOB_ACT_SOURCE_STALE');
|
|
1997
|
+
return parsePartsIssue(value.comment);
|
|
1998
|
+
},
|
|
1999
|
+
};
|
|
2000
|
+
const host: PartsHost = {
|
|
2001
|
+
initial: () => panel.issues,
|
|
2002
|
+
changed(issues) {
|
|
2003
|
+
if (current !== prepared || lifetime.signal.aborted) return;
|
|
2004
|
+
panel.issues = issues;
|
|
2005
|
+
for (const [askId, entry] of forms) {
|
|
2006
|
+
if (window.state().pending.find(ask => ask.askId === askId)?.subject.kind !== 'parts-verdict') continue;
|
|
2007
|
+
entry.dirty = true;
|
|
2008
|
+
entry.submissionId = crypto.randomUUID();
|
|
2009
|
+
}
|
|
2010
|
+
saveDraft(); window.refresh();
|
|
2011
|
+
},
|
|
2012
|
+
register(output) {
|
|
2013
|
+
if (current !== prepared || lifetime.signal.aborted) return;
|
|
2014
|
+
if (output.kind === 'parts-verdict' && panel.composition.side?.includes('parts.issues')) panel.output = output;
|
|
2015
|
+
window.refresh();
|
|
2016
|
+
},
|
|
2017
|
+
locked() {
|
|
2018
|
+
if (lifetime.signal.aborted || panel.legacy || window.state().closed) return 'sent';
|
|
2019
|
+
if (current !== prepared || [...forms.values()].some(entry => entry.submitting)) return 'sent';
|
|
2020
|
+
const phase = jobPartsReviewState(window.state().pending, prepared.display.publication.publicationId);
|
|
2021
|
+
return phase === 'reviewing' ? 'open' : phase;
|
|
2022
|
+
},
|
|
2023
|
+
};
|
|
2024
|
+
try {
|
|
2025
|
+
mounted = mountPartsWorkspace(panel.slots, source, host, {defaultView: 'assembled'});
|
|
2026
|
+
if (panel.legacy) {
|
|
2027
|
+
const legacy = node('p', 'JOB_PARTS_LEGACY_DRAFT');
|
|
2028
|
+
const rows = node('pre');
|
|
2029
|
+
rows.className = 'job-source';
|
|
2030
|
+
rows.textContent = JSON.stringify(panel.legacy, null, 2);
|
|
2031
|
+
panel.slots.side.append(legacy, rows);
|
|
2032
|
+
}
|
|
2033
|
+
await Promise.race([mounted.ready, preparationCancelled]);
|
|
2034
|
+
panel.slots.toolbar.querySelector<HTMLButtonElement>('#fit')?.click();
|
|
2035
|
+
await new Promise<void>((resolve, reject) => {
|
|
2036
|
+
let frame = 0;
|
|
2037
|
+
const cancelled = () => {
|
|
2038
|
+
signal.removeEventListener('abort', cancelled);
|
|
2039
|
+
cancelAnimationFrame(frame);
|
|
2040
|
+
reject(new Error('JOB_PRELOAD_CANCELLED'));
|
|
2041
|
+
};
|
|
2042
|
+
signal.addEventListener('abort', cancelled, {once: true});
|
|
2043
|
+
frame = requestAnimationFrame(() => {frame = requestAnimationFrame(() => {
|
|
2044
|
+
signal.removeEventListener('abort', cancelled);
|
|
2045
|
+
resolve();
|
|
2046
|
+
});});
|
|
2047
|
+
if (signal.aborted) cancelled();
|
|
2048
|
+
});
|
|
2049
|
+
if (signal.aborted) throw new Error('JOB_PRELOAD_CANCELLED');
|
|
2050
|
+
} finally {
|
|
2051
|
+
signal.removeEventListener('abort', cancelPreparation);
|
|
1830
2052
|
}
|
|
1831
2053
|
}
|
|
1832
2054
|
function build(prepared: JobPreparedInspection): HTMLElement {
|
|
@@ -1845,6 +2067,51 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1845
2067
|
sourceBinding.textContent = JSON.stringify(prepared.display.publication.source, null, 2);
|
|
1846
2068
|
binding.append(bindingTitle, sourceBinding);
|
|
1847
2069
|
sidebar.append(binding);
|
|
2070
|
+
if (prepared.metadata.capabilities.preRig) {
|
|
2071
|
+
const {composition, invalid} = resolveJobPanels(prepared.metadata, prepared.display.publication.source);
|
|
2072
|
+
root.dataset.jobPartsWorkspace = '';
|
|
2073
|
+
const stage = node('section');
|
|
2074
|
+
stage.className = 'job-stage';
|
|
2075
|
+
const toolbar = node('div');
|
|
2076
|
+
toolbar.className = 'viewbar pv-toolbar';
|
|
2077
|
+
const canvas = node('div');
|
|
2078
|
+
canvas.className = 'job-parts-stage';
|
|
2079
|
+
const left = node('div');
|
|
2080
|
+
const side = node('div');
|
|
2081
|
+
sidebar.prepend(left);
|
|
2082
|
+
const formsHost = node('section');
|
|
2083
|
+
formsHost.className = 'job-forms';
|
|
2084
|
+
formsHost.dataset.jobForms = '';
|
|
2085
|
+
formsHost.append(side);
|
|
2086
|
+
const slots = {left, stage: canvas, toolbar, side};
|
|
2087
|
+
stage.append(toolbar, canvas);
|
|
2088
|
+
root.append(sidebar, stage, formsHost);
|
|
2089
|
+
const components: Record<PanelComponent, PanelSlot | null> = {
|
|
2090
|
+
'parts.list': 'left', 'parts.canvas': 'stage', 'parts.layers': 'toolbar', 'parts.issues': 'side',
|
|
2091
|
+
'act.submit': 'side', 'interview.picks': null, 'plan.body': null, 'rig.playback': null,
|
|
2092
|
+
'scene.composite': null, 'images.set': null,
|
|
2093
|
+
};
|
|
2094
|
+
for (const slot of ['left', 'stage', 'toolbar', 'side'] as const) {
|
|
2095
|
+
const entries = composition[slot] ?? [];
|
|
2096
|
+
slots[slot].hidden = !entries.some(id => components[id] === slot && id !== 'act.submit');
|
|
2097
|
+
for (const id of entries) {
|
|
2098
|
+
if (components[id] === slot) continue;
|
|
2099
|
+
const refusal = node('p');
|
|
2100
|
+
refusal.textContent = t(Object.hasOwn(components, id) ? 'JOB_PANEL_UNAVAILABLE' : 'JOB_PANEL_UNKNOWN', [id]);
|
|
2101
|
+
slots[slot].after(refusal);
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
if (invalid) formsHost.prepend(node('p', 'JOB_PANELS_INVALID'));
|
|
2105
|
+
const history = node('div');
|
|
2106
|
+
history.className = 'job-history';
|
|
2107
|
+
history.dataset.jobHistory = '';
|
|
2108
|
+
formsHost.append(history);
|
|
2109
|
+
const panel = {slots, composition, issues: [] as PartsIssue[], legacy: null, dispose: undefined as (() => void) | undefined};
|
|
2110
|
+
partsPanels.set(prepared, panel);
|
|
2111
|
+
const dispose = prepared.dispose;
|
|
2112
|
+
prepared.dispose = () => {try {panel.dispose?.();} finally {dispose();}};
|
|
2113
|
+
return root;
|
|
2114
|
+
}
|
|
1848
2115
|
const parts = node('select');
|
|
1849
2116
|
parts.id = 'job-part';
|
|
1850
2117
|
parts.disabled = !prepared.metadata.manifest?.model || prepared.metadata.feedbackCatalog.slots === null;
|
|
@@ -1881,16 +2148,6 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
1881
2148
|
if (current === prepared && next) void referenceSelection.select(next);
|
|
1882
2149
|
};
|
|
1883
2150
|
sidebar.append(inputLabel('Reference', referenceSelect));
|
|
1884
|
-
const images = node('div');
|
|
1885
|
-
images.className = 'job-part-images';
|
|
1886
|
-
for (const [name, image] of prepared.partImages) {
|
|
1887
|
-
const label = node('label');
|
|
1888
|
-
const title = node('span');
|
|
1889
|
-
title.textContent = name;
|
|
1890
|
-
label.append(title, image);
|
|
1891
|
-
images.append(label);
|
|
1892
|
-
}
|
|
1893
|
-
sidebar.append(images);
|
|
1894
2151
|
const stage = node('section');
|
|
1895
2152
|
stage.className = 'job-stage';
|
|
1896
2153
|
const controls = node('div');
|
|
@@ -2029,10 +2286,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2029
2286
|
time = value;
|
|
2030
2287
|
pose();
|
|
2031
2288
|
};
|
|
2032
|
-
|
|
2033
|
-
panels.id = 'job-panel';
|
|
2034
|
-
panels.onchange = () => { panel = panels.value; showPanel(); };
|
|
2035
|
-
transport.append(clips, playButton, inputLabel('Repeat', loopInput), inputLabel('job.time', clock), panels);
|
|
2289
|
+
transport.append(clips, playButton, inputLabel('Repeat', loopInput), inputLabel('job.time', clock));
|
|
2036
2290
|
const numeric = node('pre');
|
|
2037
2291
|
numeric.id = 'view-coordinates';
|
|
2038
2292
|
numeric.hidden = true;
|
|
@@ -2188,15 +2442,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2188
2442
|
}
|
|
2189
2443
|
function showPanel(): void {
|
|
2190
2444
|
const direction = workspace.querySelector<HTMLElement>('[data-job-direction]');
|
|
2191
|
-
if (direction)
|
|
2192
|
-
direction.hidden = panel !== '4';
|
|
2193
|
-
for (const [askId, entry] of forms) {
|
|
2194
|
-
const ask = window.state().pending.find(item => item.askId === askId);
|
|
2195
|
-
const currentSubject = current?.display.publication.source.subject;
|
|
2196
|
-
entry.form.hidden = currentSubject !== 'image-set' &&
|
|
2197
|
-
currentSubject !== 'option-set' && currentSubject !== 'plan' &&
|
|
2198
|
-
panel === '2' && ask?.subject.kind !== 'interview-picks';
|
|
2199
|
-
}
|
|
2445
|
+
if (direction) direction.hidden = !current?.metadata.direction;
|
|
2200
2446
|
saveWindowState();
|
|
2201
2447
|
}
|
|
2202
2448
|
function pose(seekReference = true): void {
|
|
@@ -2268,7 +2514,9 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2268
2514
|
const inspection = await prepareJobInspection(display, signal);
|
|
2269
2515
|
try {
|
|
2270
2516
|
const element = build(inspection);
|
|
2271
|
-
const
|
|
2517
|
+
const asks = window.state().pending.filter(ask => !(partsPanels.has(inspection) &&
|
|
2518
|
+
ask.subject.kind === 'signoff' && ask.subject.stage === 'parts-review'));
|
|
2519
|
+
const preparedForms = prepareJobForms(display, asks, ask => formFor(ask, inspection));
|
|
2272
2520
|
return Object.assign(inspection, { element, forms: preparedForms });
|
|
2273
2521
|
}
|
|
2274
2522
|
catch (error) {
|
|
@@ -2279,7 +2527,9 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2279
2527
|
captureDraft() { saveDraft(); const dirty = [...forms].filter(([, item]) => item.dirty); return dirty.length ? dirty.map(([askId, item]) => ({ askId, value: item.read() })) : null; },
|
|
2280
2528
|
commit(prepared, display) {
|
|
2281
2529
|
// Pending asks can arrive while assets load. Finish their forms before the visible replacement.
|
|
2282
|
-
const
|
|
2530
|
+
const asks = window.state().pending.filter(ask => !(partsPanels.has(prepared) &&
|
|
2531
|
+
ask.subject.kind === 'signoff' && ask.subject.stage === 'parts-review'));
|
|
2532
|
+
const nextForms = prepareJobForms(display, asks,
|
|
2283
2533
|
ask => prepared.forms.get(ask.askId) ?? formFor(ask, prepared));
|
|
2284
2534
|
const root = prepared.element;
|
|
2285
2535
|
const formHost = root.querySelector<HTMLElement>('[data-job-forms]');
|
|
@@ -2328,7 +2578,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2328
2578
|
forms.set(id, item);
|
|
2329
2579
|
workspace.replaceChildren(...(previousElement ? [previousElement] : []));
|
|
2330
2580
|
Object.assign(viewportState, navigation.camera);
|
|
2331
|
-
if (current) {
|
|
2581
|
+
if (current && !partsPanels.has(current)) {
|
|
2332
2582
|
el<HTMLSelectElement>('job-reference').value = selectedReference;
|
|
2333
2583
|
syncTransportControls();
|
|
2334
2584
|
viewport.fitCamera();
|
|
@@ -2340,12 +2590,20 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2340
2590
|
forms.clear();
|
|
2341
2591
|
for (const [id, entry] of nextForms) forms.set(id, entry);
|
|
2342
2592
|
workspace.replaceChildren(root);
|
|
2593
|
+
if (partsPanels.has(prepared)) {
|
|
2594
|
+
updateForms(window.state());
|
|
2595
|
+
return {rollback, finalize() {
|
|
2596
|
+
unbindNavigation?.(); resize?.disconnect();
|
|
2597
|
+
unbindNavigation = null; resize = null;
|
|
2598
|
+
previous?.dispose();
|
|
2599
|
+
title.textContent = display.publication.source.package?.id ?? display.publication.label;
|
|
2600
|
+
}};
|
|
2601
|
+
}
|
|
2343
2602
|
el<HTMLSelectElement>('job-part').value = selectedPart;
|
|
2344
2603
|
el<HTMLInputElement>('job-solo').checked = partMode === 'solo';
|
|
2345
2604
|
el<HTMLSelectElement>('job-reference').value = selectedReference;
|
|
2346
2605
|
el<HTMLSelectElement>('job-animation').value = animation;
|
|
2347
2606
|
el<HTMLInputElement>('job-loop').checked = loop;
|
|
2348
|
-
el<HTMLSelectElement>('job-panel').value = panel;
|
|
2349
2607
|
el('rig-empty').hidden = !!prepared.player;
|
|
2350
2608
|
Object.assign(viewportState, navigation.camera, { cameraRestoring: restoringCamera });
|
|
2351
2609
|
showReference();
|
|
@@ -2391,6 +2649,10 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2391
2649
|
}
|
|
2392
2650
|
},
|
|
2393
2651
|
async painted(prepared, signal) {
|
|
2652
|
+
if (partsPanels.has(prepared)) {
|
|
2653
|
+
await mountJobParts(prepared, signal);
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2394
2656
|
for (const image of prepared.imageSetImages ?? []) {
|
|
2395
2657
|
if (!image.isConnected || !image.complete || !image.naturalWidth || !image.naturalHeight)
|
|
2396
2658
|
throw new Error('JOB_VISUAL_UNAVAILABLE');
|
|
@@ -2414,7 +2676,15 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2414
2676
|
notice.textContent = t('job.closed');
|
|
2415
2677
|
else if (state.preparing)
|
|
2416
2678
|
notice.textContent = t('job.preparing');
|
|
2679
|
+
else if (state.displayed && current && partsPanels.has(current)) {
|
|
2680
|
+
const panel = partsPanels.get(current)!;
|
|
2681
|
+
const sending = [...forms.values()].some(entry => entry.submitting);
|
|
2682
|
+
const phase = sending ? 'sending' : jobPartsReviewState(state.pending, state.displayed.publication.publicationId);
|
|
2683
|
+
notice.dataset.jobPartsState = phase;
|
|
2684
|
+
notice.textContent = state.displayed.publication.label + ' · ' + t('job.parts.' + phase, [panel.issues.length]);
|
|
2685
|
+
}
|
|
2417
2686
|
else if (state.displayed) {
|
|
2687
|
+
delete notice.dataset.jobPartsState;
|
|
2418
2688
|
notice.textContent = state.previousLabel
|
|
2419
2689
|
? t('job.updated', [state.previousLabel, state.displayed.publication.label]) : state.displayed.publication.label;
|
|
2420
2690
|
if (compatibilityNotice)
|
|
@@ -2458,7 +2728,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2458
2728
|
for (const element of host.querySelectorAll<HTMLElement>('[data-job-text]'))
|
|
2459
2729
|
element.textContent = t(element.dataset.jobText!);
|
|
2460
2730
|
languages.setAttribute('aria-label', t('interview.language'));
|
|
2461
|
-
if (current)
|
|
2731
|
+
if (current && !partsPanels.has(current))
|
|
2462
2732
|
viewport.renderCameraControls();
|
|
2463
2733
|
window.refresh();
|
|
2464
2734
|
});
|
|
@@ -2487,7 +2757,7 @@ export async function mountJobSession(host: HTMLElement): Promise<() => void> {
|
|
|
2487
2757
|
resolution?.removeEventListener('change', resolutionChanged);
|
|
2488
2758
|
resolution = globalThis.matchMedia(`(resolution:${globalThis.devicePixelRatio || 1}dppx)`);
|
|
2489
2759
|
resolution.addEventListener('change', resolutionChanged);
|
|
2490
|
-
if (current) {
|
|
2760
|
+
if (current && !partsPanels.has(current)) {
|
|
2491
2761
|
drawn.delete(current);
|
|
2492
2762
|
current.rigPresentation = undefined;
|
|
2493
2763
|
viewport.fitCamera();
|