@morscherlab/mint-sdk 1.4.0-beta.17 → 1.4.0-beta.19
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/README.md +14 -3
- package/dist/{AlertBox-SnsbVow-.js → AlertBox-CzLg0UaL.js} +2 -2
- package/dist/{AlertBox-SnsbVow-.js.map → AlertBox-CzLg0UaL.js.map} +1 -1
- package/dist/{AppSidebar-CB0-RQ4m.js → AppSidebar-6oTT-gPO.js} +43 -13
- package/dist/AppSidebar-6oTT-gPO.js.map +1 -0
- package/dist/{ExperimentPopover-ChKCrklH.js → ExperimentPopover-9l4QZlvQ.js} +2 -2
- package/dist/{ExperimentPopover-ChKCrklH.js.map → ExperimentPopover-9l4QZlvQ.js.map} +1 -1
- package/dist/{ExperimentSelectorModal-BqifjNaN.js → ExperimentSelectorModal-pR5fK3pA.js} +3 -3
- package/dist/{ExperimentSelectorModal-BqifjNaN.js.map → ExperimentSelectorModal-pR5fK3pA.js.map} +1 -1
- package/dist/{SegmentedControl-hOgBVdju.js → SegmentedControl-CJ7EAmOq.js} +2 -2
- package/dist/{SegmentedControl-hOgBVdju.js.map → SegmentedControl-CJ7EAmOq.js.map} +1 -1
- package/dist/{SettingsModal-CoZK3EDN.js → SettingsModal-Dyitgzfp.js} +6 -6
- package/dist/{SettingsModal-CoZK3EDN.js.map → SettingsModal-Dyitgzfp.js.map} +1 -1
- package/dist/components/AppTopBar.vue.d.ts +7 -0
- package/dist/components/JobsStatusTray.vue.d.ts +15 -4
- package/dist/components/PluginWorkspaceView.props.d.ts +3 -0
- package/dist/components/PluginWorkspaceView.vue.d.ts +3 -0
- package/dist/components/internal/WorkspaceShellInternal.vue.d.ts +8 -0
- package/dist/composables/useJobCenter.d.ts +41 -3
- package/dist/{controlSchemaModel-CIH5Hqpw.js → controlSchemaModel-DCUOx8ll.js} +2 -2
- package/dist/{controlSchemaModel-CIH5Hqpw.js.map → controlSchemaModel-DCUOx8ll.js.map} +1 -1
- package/dist/{data-OZ94DhVC.js → data-DBnmeBZX.js} +9 -9
- package/dist/{data-OZ94DhVC.js.map → data-DBnmeBZX.js.map} +1 -1
- package/dist/data.js +7 -7
- package/dist/index.js +16 -16
- package/dist/{install-BKgb5qZw.js → install-C5psB1H0.js} +13 -13
- package/dist/{install-BKgb5qZw.js.map → install-C5psB1H0.js.map} +1 -1
- package/dist/install.js +1 -1
- package/dist/{lab-ZDKlx1Oo.js → lab-BHVT1qN2.js} +9 -9
- package/dist/{lab-ZDKlx1Oo.js.map → lab-BHVT1qN2.js.map} +1 -1
- package/dist/lab.js +4 -4
- package/dist/{records-B4yl2oIu.js → records-CR_pYzIP.js} +62 -62
- package/dist/{records-B4yl2oIu.js.map → records-CR_pYzIP.js.map} +1 -1
- package/dist/{runtime-Cz1GJa_O.js → runtime-CoHhBP10.js} +398 -31
- package/dist/runtime-CoHhBP10.js.map +1 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +6 -6
- package/dist/{shell-kq9p4VsX.js → shell-BDuZf2zb.js} +4 -4
- package/dist/{shell-kq9p4VsX.js.map → shell-BDuZf2zb.js.map} +1 -1
- package/dist/shell.js +4 -4
- package/dist/styles.css +151 -307
- package/dist/types/components.d.ts +2 -0
- package/dist/{useExperimentSamples-BLx29CkM.js → useExperimentSamples-Dno1fFMq.js} +3 -3
- package/dist/{useExperimentSamples-BLx29CkM.js.map → useExperimentSamples-Dno1fFMq.js.map} +1 -1
- package/dist/{useListReorder-C_8RYeVP.js → useListReorder-CQ9OCScc.js} +76 -76
- package/dist/useListReorder-CQ9OCScc.js.map +1 -0
- package/dist/{useRackEditor-BhYlXKFM.js → useRackEditor-wL3kPrRT.js} +6 -6
- package/dist/{useRackEditor-BhYlXKFM.js.map → useRackEditor-wL3kPrRT.js.map} +1 -1
- package/dist/useRealtime-C3whhVvb.js +508 -0
- package/dist/useRealtime-C3whhVvb.js.map +1 -0
- package/dist/{useRequest-C9uwM79q.js → useRequest-CDkrXNU7.js} +2 -2
- package/dist/{useRequest-C9uwM79q.js.map → useRequest-CDkrXNU7.js.map} +1 -1
- package/package.json +1 -1
- package/src/__tests__/components/AppTopBar.test.ts +33 -2
- package/src/__tests__/components/GeneratedPluginView.test.ts +1 -1
- package/src/__tests__/components/JobsStatusTray.test.ts +373 -71
- package/src/__tests__/components/PluginWorkspaceView.test.ts +56 -1
- package/src/__tests__/composables/useJobCenter.test.ts +262 -3
- package/src/__tests__/docs/frontendDocsCatalog.test.ts +4 -3
- package/src/components/AppTopBar.vue +14 -0
- package/src/components/GeneratedPluginView.vue +4 -9
- package/src/components/JobsStatusTray.story.vue +97 -43
- package/src/components/JobsStatusTray.vue +287 -290
- package/src/components/PluginWorkspaceView.props.ts +3 -0
- package/src/components/PluginWorkspaceView.vue +17 -0
- package/src/components/internal/WorkspaceShellInternal.vue +12 -0
- package/src/composables/useJobCenter.ts +188 -6
- package/src/runtime.ts +2 -1
- package/src/styles/components/app-top-bar.css +7 -0
- package/src/styles/components/jobs-status-tray.css +134 -296
- package/src/types/components.ts +2 -0
- package/dist/AppSidebar-CB0-RQ4m.js.map +0 -1
- package/dist/runtime-Cz1GJa_O.js.map +0 -1
- package/dist/useListReorder-C_8RYeVP.js.map +0 -1
- package/dist/useRealtime-CUMbW_ln.js +0 -699
- package/dist/useRealtime-CUMbW_ln.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { i as useEventListener, o as __exportAll, t as useDropdownState } from "./useDropdownState-Bb2N4m40.js";
|
|
2
2
|
import { i as AuthenticationRequiredError, o as useApi } from "./experiment-DyO54FQB.js";
|
|
3
|
-
import { L as EmptyState_default,
|
|
4
|
-
import { A as
|
|
5
|
-
import { r as LoadingSpinner_default, t as AlertBox_default } from "./AlertBox-
|
|
6
|
-
import { D as DataFrame_default, T as WellPlate_default, a as GeneratedPlotlyResult_default, b as PlateEditor_default, c as downloadEndpoint, d as useEventStream, f as useSettingsEndpoint, i as GeneratedResultRenderer_default, l as pluginFormDataFromPayload, m as resolvePluginBaseUrl, n as ScheduleCalendar_default, o as createClient, p as buildEndpointUrl, t as useRackEditor, u as uploadEndpoint, v as DoseCalculator_default } from "./useRackEditor-
|
|
7
|
-
import { A as controlValuesToComponentBindingsById, C as usePluginWorkspace, D as useControlSchema, E as getControlDefaults, F as getDefaultControlView, M as controlsTo, O as controlBindings, S as AppLayout_default, T as defineControls, d as useForm, f as AppTopBar_default, j as controlValuesToComponentProps, k as controlValuesToComponentBindings, l as useFormBuilder, p as providePluginIdentity, t as AppSidebar_default, u as evaluateCondition, w as defineControlComponentBindings } from "./AppSidebar-
|
|
8
|
-
import { n as isControlModelBinding } from "./controlSchemaModel-
|
|
9
|
-
import {
|
|
10
|
-
import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentScope, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, normalizeStyle, onMounted, onScopeDispose, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toHandlers, toValue, unref, useId, useSlots, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
3
|
+
import { L as EmptyState_default, d as isActiveJobStatus, f as isTerminalJobStatus, g as resolveJobCapabilities, h as normalizeJobState, m as normalizeJobPercent, o as resolveCurrentPluginId, p as jobStatusLabel, t as isRecord, v as useAppExperiment } from "./records-CR_pYzIP.js";
|
|
4
|
+
import { A as useJobsEndpoint, D as _plugin_vue_export_helper_default, E as GeneratedPathInput_default, M as usePlatform, O as GENERATED_JOBS_API_KEY, R as definePluginWorkspaceView, _ as getTypeDefault, g as getFieldRegistryEntry, h as replaceRecord, k as createGeneratedAnalysisTransport } from "./useListReorder-CQ9OCScc.js";
|
|
5
|
+
import { r as LoadingSpinner_default, t as AlertBox_default } from "./AlertBox-CzLg0UaL.js";
|
|
6
|
+
import { D as DataFrame_default, T as WellPlate_default, a as GeneratedPlotlyResult_default, b as PlateEditor_default, c as downloadEndpoint, d as useEventStream, f as useSettingsEndpoint, i as GeneratedResultRenderer_default, l as pluginFormDataFromPayload, m as resolvePluginBaseUrl, n as ScheduleCalendar_default, o as createClient, p as buildEndpointUrl, t as useRackEditor, u as uploadEndpoint, v as DoseCalculator_default } from "./useRackEditor-wL3kPrRT.js";
|
|
7
|
+
import { A as controlValuesToComponentBindingsById, C as usePluginWorkspace, D as useControlSchema, E as getControlDefaults, F as getDefaultControlView, M as controlsTo, O as controlBindings, S as AppLayout_default, T as defineControls, d as useForm, f as AppTopBar_default, j as controlValuesToComponentProps, k as controlValuesToComponentBindings, l as useFormBuilder, p as providePluginIdentity, t as AppSidebar_default, u as evaluateCondition, w as defineControlComponentBindings } from "./AppSidebar-6oTT-gPO.js";
|
|
8
|
+
import { n as isControlModelBinding } from "./controlSchemaModel-DCUOx8ll.js";
|
|
9
|
+
import { i as JobsStatusTray_default, n as subscribeRealtime, r as useRealtime, t as currentPresence } from "./useRealtime-C3whhVvb.js";
|
|
10
|
+
import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentScope, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, normalizeStyle, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toValue, unref, useId, useSlots, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
11
11
|
import { ChartColumn, Eye, FlaskConical, Pencil, RefreshCw } from "lucide-vue-next";
|
|
12
12
|
//#region src/composables/useToast.ts
|
|
13
13
|
var toasts = ref([]);
|
|
@@ -232,6 +232,333 @@ var AppToastContainer_default = /* @__PURE__ */ defineComponent({
|
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
234
|
//#endregion
|
|
235
|
+
//#region src/composables/useJobCenter.ts
|
|
236
|
+
/** How long a job that just completed stays in the top-bar run slot. */
|
|
237
|
+
var FINISHED_HOLD_MS = 6e3;
|
|
238
|
+
/**
|
|
239
|
+
* Combines independent job runtimes without copying their reactive state.
|
|
240
|
+
*
|
|
241
|
+
* Job ids must be globally unique across the sources. A duplicate id throws
|
|
242
|
+
* when jobs are read or an id-routed action is requested, rather than silently
|
|
243
|
+
* dispatching a mutation to the wrong owner.
|
|
244
|
+
*/
|
|
245
|
+
function combinePluginJobSources(sources) {
|
|
246
|
+
const jobs = computed(() => {
|
|
247
|
+
const combined = [];
|
|
248
|
+
const owners = /* @__PURE__ */ new Set();
|
|
249
|
+
for (const source of sources) for (const job of toValue(source.jobs)) {
|
|
250
|
+
if (owners.has(job.job_id)) throw duplicatePluginJobId(job.job_id);
|
|
251
|
+
owners.add(job.job_id);
|
|
252
|
+
combined.push(job);
|
|
253
|
+
}
|
|
254
|
+
return combined;
|
|
255
|
+
});
|
|
256
|
+
function ownerFor(jobId) {
|
|
257
|
+
let owner;
|
|
258
|
+
for (const source of sources) {
|
|
259
|
+
if (!toValue(source.jobs).some((job) => job.job_id === jobId)) continue;
|
|
260
|
+
if (owner) throw duplicatePluginJobId(jobId);
|
|
261
|
+
owner = source;
|
|
262
|
+
}
|
|
263
|
+
if (!owner) throw new Error(`Unknown plugin job id: ${jobId}`);
|
|
264
|
+
return owner;
|
|
265
|
+
}
|
|
266
|
+
const combined = { jobs };
|
|
267
|
+
if (sources.some((source) => source.refresh)) combined.refresh = async () => {
|
|
268
|
+
await Promise.all(sources.map((source) => source.refresh?.()));
|
|
269
|
+
return jobs.value;
|
|
270
|
+
};
|
|
271
|
+
if (sources.some((source) => source.cancel)) combined.cancel = async (jobId) => {
|
|
272
|
+
const owner = ownerFor(jobId);
|
|
273
|
+
if (!owner.cancel) throw new Error(`Job ${jobId} cannot be cancelled by its source`);
|
|
274
|
+
return owner.cancel(jobId);
|
|
275
|
+
};
|
|
276
|
+
if (sources.length > 0 && sources.every((source) => source.delete)) combined.delete = async (jobId) => {
|
|
277
|
+
const owner = ownerFor(jobId);
|
|
278
|
+
if (!owner.delete) throw new Error(`Job ${jobId} cannot be deleted by its source`);
|
|
279
|
+
return owner.delete(jobId);
|
|
280
|
+
};
|
|
281
|
+
if (sources.length > 0 && sources.every((source) => source.clear)) combined.clear = async () => {
|
|
282
|
+
const results = await Promise.all(sources.map((source) => source.clear()));
|
|
283
|
+
return results.every((result) => typeof result === "number") ? results.reduce((total, result) => total + result, 0) : void 0;
|
|
284
|
+
};
|
|
285
|
+
if (sources.some((source) => source.dispose)) combined.dispose = () => {
|
|
286
|
+
const errors = [];
|
|
287
|
+
for (const source of sources) try {
|
|
288
|
+
source.dispose?.();
|
|
289
|
+
} catch (cause) {
|
|
290
|
+
errors.push(cause);
|
|
291
|
+
}
|
|
292
|
+
if (errors.length === 1) throw errors[0];
|
|
293
|
+
if (errors.length > 1) throw new PluginJobSourceDisposeError(errors);
|
|
294
|
+
};
|
|
295
|
+
return combined;
|
|
296
|
+
}
|
|
297
|
+
var PluginJobSourceDisposeError = class extends Error {
|
|
298
|
+
cause;
|
|
299
|
+
errors;
|
|
300
|
+
constructor(errors) {
|
|
301
|
+
super("Failed to dispose plugin job sources");
|
|
302
|
+
this.name = "PluginJobSourceDisposeError";
|
|
303
|
+
this.cause = errors[0];
|
|
304
|
+
this.errors = Object.freeze([...errors]);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
function duplicatePluginJobId(jobId) {
|
|
308
|
+
return /* @__PURE__ */ new Error(`Duplicate plugin job id across combined sources: ${jobId}`);
|
|
309
|
+
}
|
|
310
|
+
/** The stored seen failures, or null when nothing is stored or storage is blocked. */
|
|
311
|
+
function readSeenFailed(key) {
|
|
312
|
+
try {
|
|
313
|
+
const parsed = JSON.parse(globalThis.localStorage?.getItem(key) ?? "null");
|
|
314
|
+
return Array.isArray(parsed) ? new Set(parsed.filter((id) => typeof id === "string")) : null;
|
|
315
|
+
} catch {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function writeSeenFailed(key, seen) {
|
|
320
|
+
try {
|
|
321
|
+
globalThis.localStorage?.setItem(key, JSON.stringify([...seen]));
|
|
322
|
+
} catch {}
|
|
323
|
+
}
|
|
324
|
+
function jobMessage(job) {
|
|
325
|
+
if (job.error) return job.error;
|
|
326
|
+
if (job.status === "awaiting_input") return job.progress.message || "Waiting for external input";
|
|
327
|
+
if (job.status === "queued" && job.queue_position > 0) return `Queue position ${job.queue_position}`;
|
|
328
|
+
return job.progress.message || job.progress.stage || jobStatusLabel(job.status);
|
|
329
|
+
}
|
|
330
|
+
function errorMessage(error, fallback) {
|
|
331
|
+
return error instanceof Error ? error.message : fallback;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Headless controller for plugin job presentation and actions.
|
|
335
|
+
*
|
|
336
|
+
* Every job list is derived directly from the source. The controller never
|
|
337
|
+
* mirrors source jobs into another ref.
|
|
338
|
+
*/
|
|
339
|
+
function useJobCenter(options = {}) {
|
|
340
|
+
const isOpen = ref(false);
|
|
341
|
+
const isLoading = ref(false);
|
|
342
|
+
const error = shallowRef(null);
|
|
343
|
+
const pendingJobIds = ref(/* @__PURE__ */ new Set());
|
|
344
|
+
let requestGeneration = 0;
|
|
345
|
+
let active = true;
|
|
346
|
+
const source = computed(() => toValue(options.source));
|
|
347
|
+
const jobs = computed(() => {
|
|
348
|
+
const currentSource = source.value;
|
|
349
|
+
return currentSource ? [...toValue(currentSource.jobs)].map(normalizeJobState) : [];
|
|
350
|
+
});
|
|
351
|
+
const activeJobs = computed(() => jobs.value.filter((job) => isActiveJobStatus(job.status)));
|
|
352
|
+
const historyJobs = computed(() => jobs.value.filter((job) => !isActiveJobStatus(job.status)));
|
|
353
|
+
const deletableJobs = computed(() => historyJobs.value.filter((job) => job.can_delete));
|
|
354
|
+
const featuredJob = computed(() => activeJobs.value[0] ?? historyJobs.value[0] ?? null);
|
|
355
|
+
const completedCount = computed(() => jobs.value.filter((job) => job.status === "completed").length);
|
|
356
|
+
const { integrated, user, plugin, isAdmin } = usePlatform();
|
|
357
|
+
const isOwnJob = (job) => {
|
|
358
|
+
if (!integrated.value) return true;
|
|
359
|
+
if (user.value == null) return isAdmin.value;
|
|
360
|
+
return (job.owner_user_id ?? job.user_id) === String(user.value.id);
|
|
361
|
+
};
|
|
362
|
+
const ownActiveJobs = computed(() => activeJobs.value.filter(isOwnJob));
|
|
363
|
+
const justFinished = shallowRef(null);
|
|
364
|
+
const heldJob = computed(() => {
|
|
365
|
+
const held = justFinished.value;
|
|
366
|
+
return held ? jobs.value.find((job) => job.job_id === held.job_id) ?? null : null;
|
|
367
|
+
});
|
|
368
|
+
let finishedTimer;
|
|
369
|
+
watch([source, ownActiveJobs], ([currentSource, now], [previousSource, before]) => {
|
|
370
|
+
if (currentSource !== previousSource) {
|
|
371
|
+
justFinished.value = null;
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const nowIds = new Set(now.map((job) => job.job_id));
|
|
375
|
+
const left = new Set(before.filter((job) => !nowIds.has(job.job_id)).map((job) => job.job_id));
|
|
376
|
+
const finished = jobs.value.find((job) => left.has(job.job_id) && job.status === "completed");
|
|
377
|
+
if (!finished) return;
|
|
378
|
+
justFinished.value = finished;
|
|
379
|
+
clearTimeout(finishedTimer);
|
|
380
|
+
finishedTimer = setTimeout(() => {
|
|
381
|
+
justFinished.value = null;
|
|
382
|
+
}, FINISHED_HOLD_MS);
|
|
383
|
+
});
|
|
384
|
+
const seenFailedKey = `mint.jobs.${plugin.value?.id ?? "standalone"}.seen-failed`;
|
|
385
|
+
const storedSeenFailed = readSeenFailed(seenFailedKey);
|
|
386
|
+
const seenFailed = shallowRef(storedSeenFailed ?? /* @__PURE__ */ new Set());
|
|
387
|
+
const unseenFailedJobs = computed(() => historyJobs.value.filter((job) => job.status === "failed" && isOwnJob(job) && !seenFailed.value.has(job.job_id)));
|
|
388
|
+
function markFailedSeen() {
|
|
389
|
+
seenFailed.value = /* @__PURE__ */ new Set([...seenFailed.value, ...unseenFailedJobs.value.map((job) => job.job_id)]);
|
|
390
|
+
writeSeenFailed(seenFailedKey, seenFailed.value);
|
|
391
|
+
}
|
|
392
|
+
let hasBaseline = storedSeenFailed !== null;
|
|
393
|
+
let awaitingLoad = options.loadOnMount !== false && Boolean(source.value?.refresh);
|
|
394
|
+
function takeBaseline() {
|
|
395
|
+
if (hasBaseline || !active) return;
|
|
396
|
+
hasBaseline = true;
|
|
397
|
+
markFailedSeen();
|
|
398
|
+
}
|
|
399
|
+
watch(jobs, (list) => {
|
|
400
|
+
if (!awaitingLoad && list.length > 0) takeBaseline();
|
|
401
|
+
}, { immediate: true });
|
|
402
|
+
watch([isOpen, unseenFailedJobs], ([open, unseen]) => {
|
|
403
|
+
if (open && unseen.length > 0) markFailedSeen();
|
|
404
|
+
});
|
|
405
|
+
const topBarJob = computed(() => {
|
|
406
|
+
const own = ownActiveJobs.value;
|
|
407
|
+
const shown = own.find((job) => job.status === "awaiting_input") ?? own[0];
|
|
408
|
+
if (shown) return options.topBarJob?.(shown) ?? {
|
|
409
|
+
status: shown.status,
|
|
410
|
+
label: shown.progress.message || `${shown.name} ${jobStatusLabel(shown.status).toLowerCase()}`,
|
|
411
|
+
percent: shown.status === "running" ? normalizeJobPercent(shown.progress.percent) : null
|
|
412
|
+
};
|
|
413
|
+
const held = heldJob.value;
|
|
414
|
+
if (held) return options.topBarJob?.(held) ?? {
|
|
415
|
+
status: "completed",
|
|
416
|
+
label: `${held.name} completed`
|
|
417
|
+
};
|
|
418
|
+
const failed = unseenFailedJobs.value.length;
|
|
419
|
+
return failed > 0 ? {
|
|
420
|
+
status: "failed",
|
|
421
|
+
label: `${failed} failed`
|
|
422
|
+
} : null;
|
|
423
|
+
});
|
|
424
|
+
function rowView(job) {
|
|
425
|
+
const override = options.rowJob?.(job) ?? {};
|
|
426
|
+
const status = override.status ?? job.status;
|
|
427
|
+
const percent = override.percent !== void 0 ? override.percent : job.status === "running" ? job.progress.percent : null;
|
|
428
|
+
return {
|
|
429
|
+
status,
|
|
430
|
+
percent: percent == null ? null : Math.round(normalizeJobPercent(percent)),
|
|
431
|
+
message: override.message ?? jobMessage(job)
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function handleTopBarClick(onSelect) {
|
|
435
|
+
const finished = heldJob.value;
|
|
436
|
+
if (!isOpen.value && ownActiveJobs.value.length === 0 && finished) onSelect(finished);
|
|
437
|
+
else isOpen.value = !isOpen.value;
|
|
438
|
+
}
|
|
439
|
+
const canRefresh = computed(() => Boolean(source.value?.refresh));
|
|
440
|
+
const canCancel = computed(() => Boolean(source.value?.cancel));
|
|
441
|
+
const canDelete = computed(() => Boolean(source.value?.delete));
|
|
442
|
+
const canClearFinished = computed(() => Boolean(source.value?.clear || source.value?.delete));
|
|
443
|
+
function setPending(jobId, pending) {
|
|
444
|
+
const next = new Set(pendingJobIds.value);
|
|
445
|
+
if (pending) next.add(jobId);
|
|
446
|
+
else next.delete(jobId);
|
|
447
|
+
pendingJobIds.value = next;
|
|
448
|
+
}
|
|
449
|
+
async function refresh() {
|
|
450
|
+
const listJobs = source.value?.refresh;
|
|
451
|
+
if (!listJobs) return false;
|
|
452
|
+
const generation = ++requestGeneration;
|
|
453
|
+
isLoading.value = true;
|
|
454
|
+
error.value = null;
|
|
455
|
+
try {
|
|
456
|
+
await listJobs();
|
|
457
|
+
return active && generation === requestGeneration;
|
|
458
|
+
} catch (cause) {
|
|
459
|
+
if (active && generation === requestGeneration) error.value = errorMessage(cause, "Failed to load jobs");
|
|
460
|
+
return false;
|
|
461
|
+
} finally {
|
|
462
|
+
if (active && generation === requestGeneration) isLoading.value = false;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
async function cancelJob(job) {
|
|
466
|
+
const sourceCancel = source.value?.cancel;
|
|
467
|
+
if (!job.can_cancel || !sourceCancel || pendingJobIds.value.has(job.job_id)) return false;
|
|
468
|
+
setPending(job.job_id, true);
|
|
469
|
+
error.value = null;
|
|
470
|
+
try {
|
|
471
|
+
await sourceCancel(job.job_id);
|
|
472
|
+
return active;
|
|
473
|
+
} catch (cause) {
|
|
474
|
+
if (active) error.value = errorMessage(cause, "Failed to cancel job");
|
|
475
|
+
return false;
|
|
476
|
+
} finally {
|
|
477
|
+
if (active) setPending(job.job_id, false);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
async function deleteJob(job) {
|
|
481
|
+
const sourceDelete = source.value?.delete;
|
|
482
|
+
if (!job.can_delete || !sourceDelete || pendingJobIds.value.has(job.job_id)) return false;
|
|
483
|
+
setPending(job.job_id, true);
|
|
484
|
+
error.value = null;
|
|
485
|
+
try {
|
|
486
|
+
const deleted = await sourceDelete(job.job_id);
|
|
487
|
+
return active && deleted !== false;
|
|
488
|
+
} catch (cause) {
|
|
489
|
+
if (active) error.value = errorMessage(cause, "Failed to delete job");
|
|
490
|
+
return false;
|
|
491
|
+
} finally {
|
|
492
|
+
if (active) setPending(job.job_id, false);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
async function clearFinished() {
|
|
496
|
+
const targets = deletableJobs.value;
|
|
497
|
+
if (targets.length === 0) return false;
|
|
498
|
+
error.value = null;
|
|
499
|
+
try {
|
|
500
|
+
const currentSource = source.value;
|
|
501
|
+
if (currentSource?.clear) {
|
|
502
|
+
const deleted = await currentSource.clear();
|
|
503
|
+
if (!active) return false;
|
|
504
|
+
return typeof deleted !== "number" || deleted === targets.length;
|
|
505
|
+
}
|
|
506
|
+
if (!currentSource?.delete) return false;
|
|
507
|
+
return (await Promise.all(targets.map((job) => deleteJob(job)))).every(Boolean);
|
|
508
|
+
} catch (cause) {
|
|
509
|
+
if (active) error.value = errorMessage(cause, "Failed to clear jobs");
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
onMounted(() => {
|
|
514
|
+
if (options.loadOnMount === false) return;
|
|
515
|
+
refresh().then((loaded) => {
|
|
516
|
+
awaitingLoad = false;
|
|
517
|
+
if (loaded || jobs.value.length > 0) takeBaseline();
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
onUnmounted(() => {
|
|
521
|
+
active = false;
|
|
522
|
+
requestGeneration += 1;
|
|
523
|
+
clearTimeout(finishedTimer);
|
|
524
|
+
});
|
|
525
|
+
return {
|
|
526
|
+
source,
|
|
527
|
+
jobs,
|
|
528
|
+
activeJobs,
|
|
529
|
+
historyJobs,
|
|
530
|
+
deletableJobs,
|
|
531
|
+
featuredJob,
|
|
532
|
+
canRefresh,
|
|
533
|
+
canCancel,
|
|
534
|
+
canDelete,
|
|
535
|
+
canClearFinished,
|
|
536
|
+
panelId: `mint-jobs-tray-${useId()}`,
|
|
537
|
+
rowView,
|
|
538
|
+
topBarJob,
|
|
539
|
+
completedCount,
|
|
540
|
+
isOpen,
|
|
541
|
+
isLoading,
|
|
542
|
+
error,
|
|
543
|
+
pendingJobIds,
|
|
544
|
+
open: () => {
|
|
545
|
+
isOpen.value = true;
|
|
546
|
+
},
|
|
547
|
+
close: () => {
|
|
548
|
+
isOpen.value = false;
|
|
549
|
+
},
|
|
550
|
+
toggle: () => {
|
|
551
|
+
isOpen.value = !isOpen.value;
|
|
552
|
+
},
|
|
553
|
+
handleTopBarClick,
|
|
554
|
+
refresh,
|
|
555
|
+
cancelJob,
|
|
556
|
+
deleteJob,
|
|
557
|
+
clearFinished,
|
|
558
|
+
isPending: (job) => pendingJobIds.value.has(job.job_id)
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
//#endregion
|
|
235
562
|
//#region src/composables/controlWorkspaceOptions.ts
|
|
236
563
|
function mergeControlWorkspaceOptions(base, override) {
|
|
237
564
|
return {
|
|
@@ -396,11 +723,18 @@ var WorkspaceControlsInternal_default = /* @__PURE__ */ defineComponent({
|
|
|
396
723
|
//#region src/components/internal/WorkspaceShellInternal.vue
|
|
397
724
|
var WorkspaceShellInternal_default = /* @__PURE__ */ defineComponent({
|
|
398
725
|
__name: "WorkspaceShellInternal",
|
|
399
|
-
props: {
|
|
726
|
+
props: {
|
|
727
|
+
shell: {},
|
|
728
|
+
job: {},
|
|
729
|
+
jobsDone: {},
|
|
730
|
+
jobsOpen: { type: Boolean },
|
|
731
|
+
jobsPanelId: {}
|
|
732
|
+
},
|
|
400
733
|
emits: [
|
|
401
734
|
"pill-select",
|
|
402
735
|
"pill-option-select",
|
|
403
|
-
"settings-values-change"
|
|
736
|
+
"settings-values-change",
|
|
737
|
+
"job-click"
|
|
404
738
|
],
|
|
405
739
|
setup(__props, { emit: __emit }) {
|
|
406
740
|
/**
|
|
@@ -429,9 +763,14 @@ var WorkspaceShellInternal_default = /* @__PURE__ */ defineComponent({
|
|
|
429
763
|
subtitle: __props.shell.subtitle,
|
|
430
764
|
spec: __props.shell.topBar,
|
|
431
765
|
pill: __props.shell.pill,
|
|
432
|
-
|
|
766
|
+
job: __props.job,
|
|
767
|
+
"jobs-done": __props.jobsDone,
|
|
768
|
+
"jobs-open": __props.jobsOpen,
|
|
769
|
+
"jobs-panel-id": __props.jobsPanelId,
|
|
770
|
+
onJobClick: _cache[0] || (_cache[0] = ($event) => emit("job-click")),
|
|
771
|
+
onPillSelect: _cache[1] || (_cache[1] = ($event) => emit("pill-select", $event)),
|
|
433
772
|
onPillOptionSelect: handlePillOptionSelect,
|
|
434
|
-
onSettingsValuesChange: _cache[
|
|
773
|
+
onSettingsValuesChange: _cache[2] || (_cache[2] = ($event) => emit("settings-values-change", $event))
|
|
435
774
|
}, createSlots({ _: 2 }, [renderList(__props.shell.topBarSlotNames, (slotName) => {
|
|
436
775
|
return {
|
|
437
776
|
name: slotName,
|
|
@@ -441,7 +780,11 @@ var WorkspaceShellInternal_default = /* @__PURE__ */ defineComponent({
|
|
|
441
780
|
"title",
|
|
442
781
|
"subtitle",
|
|
443
782
|
"spec",
|
|
444
|
-
"pill"
|
|
783
|
+
"pill",
|
|
784
|
+
"job",
|
|
785
|
+
"jobs-done",
|
|
786
|
+
"jobs-open",
|
|
787
|
+
"jobs-panel-id"
|
|
445
788
|
])) : createCommentVNode("", true)])]),
|
|
446
789
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(__props.shell.controls)))]),
|
|
447
790
|
_: 2
|
|
@@ -551,7 +894,8 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
|
|
|
551
894
|
"update:toggle",
|
|
552
895
|
"section-action",
|
|
553
896
|
"form-submit",
|
|
554
|
-
"form-cancel"
|
|
897
|
+
"form-cancel",
|
|
898
|
+
"job-select"
|
|
555
899
|
],
|
|
556
900
|
setup(__props, { emit: __emit }) {
|
|
557
901
|
/**
|
|
@@ -583,6 +927,11 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
|
|
|
583
927
|
saveDisabledMessage: computed(() => toValue(save?.reason))
|
|
584
928
|
});
|
|
585
929
|
}
|
|
930
|
+
const jobs = props.spec.jobs;
|
|
931
|
+
const jobCenter = jobs ? useJobCenter({ source: jobs }) : null;
|
|
932
|
+
function handleJobSelect(job) {
|
|
933
|
+
emit("job-select", job);
|
|
934
|
+
}
|
|
586
935
|
const { shell, sidebar, controls, handleControlValuesUpdate, handlePillSelect } = usePluginWorkspace({
|
|
587
936
|
props,
|
|
588
937
|
slots,
|
|
@@ -600,14 +949,27 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
|
|
|
600
949
|
return (_ctx, _cache) => {
|
|
601
950
|
return openBlock(), createBlock(WorkspaceShellInternal_default, {
|
|
602
951
|
shell: unref(shell),
|
|
952
|
+
job: unref(jobCenter) ? unref(jobCenter).topBarJob.value : void 0,
|
|
953
|
+
"jobs-done": unref(jobCenter)?.completedCount.value,
|
|
954
|
+
"jobs-open": unref(jobCenter)?.isOpen.value,
|
|
955
|
+
"jobs-panel-id": unref(jobCenter)?.panelId,
|
|
956
|
+
onJobClick: _cache[2] || (_cache[2] = ($event) => unref(jobCenter)?.handleTopBarClick(handleJobSelect)),
|
|
603
957
|
onPillSelect: unref(handlePillSelect),
|
|
604
|
-
onPillOptionSelect: _cache[
|
|
605
|
-
onSettingsValuesChange: _cache[
|
|
958
|
+
onPillOptionSelect: _cache[3] || (_cache[3] = (option, item) => emit("pill-option-select", option, item)),
|
|
959
|
+
onSettingsValuesChange: _cache[4] || (_cache[4] = ($event) => emit("settings-values-change", $event))
|
|
606
960
|
}, createSlots({
|
|
607
|
-
default: withCtx(() => [
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
961
|
+
default: withCtx(() => [
|
|
962
|
+
createVNode(WorkspaceControlsInternal_default, { controls: unref(controls) }, {
|
|
963
|
+
default: withCtx((controlsScope) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(controlsScope)))]),
|
|
964
|
+
_: 3
|
|
965
|
+
}, 8, ["controls"]),
|
|
966
|
+
__props.spec.toasts !== false ? (openBlock(), createBlock(AppToastContainer_default, { key: 0 })) : createCommentVNode("", true),
|
|
967
|
+
unref(jobCenter) ? (openBlock(), createBlock(JobsStatusTray_default, {
|
|
968
|
+
key: 1,
|
|
969
|
+
center: unref(jobCenter),
|
|
970
|
+
onSelect: handleJobSelect
|
|
971
|
+
}, null, 8, ["center"])) : createCommentVNode("", true)
|
|
972
|
+
]),
|
|
611
973
|
_: 2
|
|
612
974
|
}, [
|
|
613
975
|
unref(slots).topbar ? {
|
|
@@ -639,7 +1001,14 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
|
|
|
639
1001
|
})]), 1032, ["sidebar", "onUpdate:values"])])]),
|
|
640
1002
|
key: "1"
|
|
641
1003
|
} : void 0
|
|
642
|
-
]), 1032, [
|
|
1004
|
+
]), 1032, [
|
|
1005
|
+
"shell",
|
|
1006
|
+
"job",
|
|
1007
|
+
"jobs-done",
|
|
1008
|
+
"jobs-open",
|
|
1009
|
+
"jobs-panel-id",
|
|
1010
|
+
"onPillSelect"
|
|
1011
|
+
]);
|
|
643
1012
|
};
|
|
644
1013
|
}
|
|
645
1014
|
});
|
|
@@ -901,7 +1270,8 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
901
1270
|
title: "Parameters",
|
|
902
1271
|
panels: panels.value,
|
|
903
1272
|
forms: forms.value
|
|
904
|
-
}
|
|
1273
|
+
},
|
|
1274
|
+
jobs: generated
|
|
905
1275
|
}));
|
|
906
1276
|
watch(() => generated.manifest.value?.ui, (ui) => {
|
|
907
1277
|
if (ui) providePluginIdentity({ plugin: {
|
|
@@ -956,7 +1326,8 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
956
1326
|
"form-loading": unref(generated).isSubmitting.value,
|
|
957
1327
|
"form-disabled": unref(generated).isSubmitting.value,
|
|
958
1328
|
"onUpdate:values": updateValues,
|
|
959
|
-
onFormSubmit: submitJob
|
|
1329
|
+
onFormSubmit: submitJob,
|
|
1330
|
+
onJobSelect: selectJob
|
|
960
1331
|
}, {
|
|
961
1332
|
default: withCtx(() => [createElementVNode("main", _hoisted_1$3, [unref(generated).isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [createVNode(LoadingSpinner_default, { size: "lg" }), _cache[1] || (_cache[1] = createElementVNode("span", null, "Loading analysis workspace", -1))])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
962
1333
|
unref(generated).error.value ? (openBlock(), createBlock(AlertBox_default, {
|
|
@@ -980,11 +1351,7 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
980
1351
|
description: "Set the parameters and run the analysis. Jobs continue independently if you switch tabs.",
|
|
981
1352
|
size: "md"
|
|
982
1353
|
}))])
|
|
983
|
-
], 64)),
|
|
984
|
-
source: unref(generated),
|
|
985
|
-
"teleport-to": false,
|
|
986
|
-
onSelect: selectJob
|
|
987
|
-
}, null, 8, ["source"])])]),
|
|
1354
|
+
], 64))])]),
|
|
988
1355
|
_: 1
|
|
989
1356
|
}, 8, [
|
|
990
1357
|
"view",
|
|
@@ -995,7 +1362,7 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
995
1362
|
]);
|
|
996
1363
|
};
|
|
997
1364
|
}
|
|
998
|
-
}), [["__scopeId", "data-v-
|
|
1365
|
+
}), [["__scopeId", "data-v-c8ff991b"]]);
|
|
999
1366
|
//#endregion
|
|
1000
1367
|
//#region src/components/internal/PlateEditorBindingInternal.vue
|
|
1001
1368
|
var PlateEditorBindingInternal_default = /* @__PURE__ */ defineComponent({
|
|
@@ -1486,6 +1853,6 @@ var runtime_exports = /* @__PURE__ */ __exportAll({
|
|
|
1486
1853
|
useSettingsEndpoint: () => useSettingsEndpoint
|
|
1487
1854
|
});
|
|
1488
1855
|
//#endregion
|
|
1489
|
-
export { ComponentBindingRenderer_default as a, generatedJobFormSchema as c, PluginWorkspaceView_default as d, useControlWorkspace as f, RuntimeUpdateNotice_default as i, normalizeGeneratedJobInput as l,
|
|
1856
|
+
export { ComponentBindingRenderer_default as a, generatedJobFormSchema as c, PluginWorkspaceView_default as d, useControlWorkspace as f, useToast as g, AppToastContainer_default as h, RuntimeUpdateNotice_default as i, normalizeGeneratedJobInput as l, useJobCenter as m, PresenceAvatars_default as n, GeneratedPluginView_default as o, combinePluginJobSources as p, usePresence as r, generatedJobDefaults as s, runtime_exports as t, Avatar_default as u };
|
|
1490
1857
|
|
|
1491
|
-
//# sourceMappingURL=runtime-
|
|
1858
|
+
//# sourceMappingURL=runtime-CoHhBP10.js.map
|