Make resolver workflow model selection survive analysis timing

Queue workflow model reference selection requests in the dialog, wait for
workflow analysis to complete before attempting selection, and handle
superseded or timed-out requests gracefully.

- Track pending selection requests on the dialog with status fields
- Apply queued selections from lifecycle graph methods after analysis
- Await loadWorkflowData/loadLoadedModels so the caller can proceed
  after tab content is actually ready
- Add timeout handling with user-visible warnings when selection cannot
  complete
- Cover queueing, superseding, waiting, and completion in JS tests
This commit is contained in:
Dariusz L
2026-07-24 16:00:10 +02:00
parent d368a6dffc
commit 668cecea2d
6 changed files with 138 additions and 21 deletions
@@ -508,6 +508,36 @@ export const missingBrowserMethods = {
};
},
queueWorkflowModelReferenceSelection(reference = {}) {
if (this.pendingWorkflowModelSelection?.status === 'pending') {
this.pendingWorkflowModelSelection.status = 'superseded';
}
const request = {
id: `workflow-model-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
reference: { ...reference },
status: 'pending',
selected: null
};
this.pendingWorkflowModelSelection = request;
return request;
},
applyPendingWorkflowModelSelection(data = this.cachedAnalysisData || {}) {
const request = this.pendingWorkflowModelSelection;
if (!request || request.status !== 'pending') return null;
const selected = this.selectWorkflowModelReference(request.reference, data);
if (!selected) return null;
request.status = 'selected';
request.selected = selected;
if (this.pendingWorkflowModelSelection === request) {
this.pendingWorkflowModelSelection = null;
}
return selected;
},
selectWorkflowModelReference(reference = {}, data = this.cachedAnalysisData || {}) {
const selected = this.getResolvedWorkflowModels(data)
.find(model => matchesWorkflowModelReference(model, reference));