@morscherlab/mint-sdk 1.4.0-beta.2 → 1.4.0-beta.21
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/{ActionMenu-CScINahU.js → AlertBox-DwgNTEqf.js} +40 -209
- package/dist/AlertBox-DwgNTEqf.js.map +1 -0
- package/dist/{AppSidebar-BmiiPfz9.js → AppSidebar-CZZaxni0.js} +1249 -239
- package/dist/AppSidebar-CZZaxni0.js.map +1 -0
- package/dist/{ConfirmDialog-CJ7hqYUP.js → ConfirmDialog-CjWoxAD1.js} +2 -2
- package/dist/{ConfirmDialog-CJ7hqYUP.js.map → ConfirmDialog-CjWoxAD1.js.map} +1 -1
- package/dist/ExperimentPopover-DujiuQIO.js +337 -0
- package/dist/ExperimentPopover-DujiuQIO.js.map +1 -0
- package/dist/{ExperimentSelectorModal-D-9z7cNx.js → ExperimentSelectorModal-B4j4eUOJ.js} +244 -211
- package/dist/ExperimentSelectorModal-B4j4eUOJ.js.map +1 -0
- package/dist/{SegmentedControl-DERBN-Xd.js → SegmentedControl-DyUPH3I5.js} +2 -2
- package/dist/{SegmentedControl-DERBN-Xd.js.map → SegmentedControl-DyUPH3I5.js.map} +1 -1
- package/dist/{SettingsModal-CSLE31yg.js → SettingsModal-D2MOOtuO.js} +28 -27
- package/dist/SettingsModal-D2MOOtuO.js.map +1 -0
- package/dist/__stories__/experiment-helpers.d.ts +10 -0
- package/dist/__tests__/components/AppTopBarOnboarding.test.d.ts +1 -0
- package/dist/__tests__/components/FloatingPanelsInModal.test.d.ts +1 -0
- package/dist/__tests__/composables/useFloatingPanel.test.d.ts +1 -0
- package/dist/__tests__/composables/useOnboarding.test.d.ts +1 -0
- package/dist/__tests__/styles/paletteTokens.test.d.ts +1 -0
- package/dist/__tests__/styles/v2AuditRules.test.d.ts +1 -0
- package/dist/components/AppSidebar.vue.d.ts +1 -1
- package/dist/components/AppTopBar.vue.d.ts +20 -5
- package/dist/components/ArtifactSaveDialog.vue.d.ts +9 -1
- package/dist/components/AuditTrail.vue.d.ts +1 -1
- package/dist/components/BaseButton.vue.d.ts +4 -2
- package/dist/components/BaseSelect.vue.d.ts +2 -2
- package/dist/components/ChartContainer.vue.d.ts +2 -0
- package/dist/components/DatePicker.vue.d.ts +1 -1
- package/dist/components/ExperimentPopover.vue.d.ts +18 -0
- package/dist/components/ExperimentSelectorModal.vue.d.ts +15 -5
- package/dist/components/FilePicker.vue.d.ts +1 -1
- package/dist/components/FileUploader.vue.d.ts +2 -2
- package/dist/components/JobsStatusTray.vue.d.ts +15 -4
- package/dist/components/PluginIcon.vue.d.ts +2 -2
- package/dist/components/PluginWorkspaceView.props.d.ts +3 -0
- package/dist/components/PluginWorkspaceView.vue.d.ts +3 -0
- package/dist/components/SampleSelector.vue.d.ts +6 -6
- package/dist/components/SequenceProgressBar.vue.d.ts +3 -0
- package/dist/components/SmartGroupFieldRecipe.vue.d.ts +3 -3
- package/dist/components/StepWizard.vue.d.ts +3 -0
- package/dist/components/internal/AppTopBarOnboardingInternal.vue.d.ts +7 -0
- package/dist/components/internal/AppTopBarPageSelectorInternal.vue.d.ts +2 -1
- package/dist/components/internal/AutoGroupModalInternal.vue.d.ts +3 -3
- package/dist/components/internal/DatePickerTimeInternal.vue.d.ts +1 -1
- package/dist/components/internal/OnboardingLayerInternal.vue.d.ts +7 -0
- package/dist/components/internal/ResourcePickerListInternal.vue.d.ts +2 -7
- package/dist/components/internal/SelectMultipleInternal.vue.d.ts +4 -0
- package/dist/components/internal/WorkspaceShellInternal.vue.d.ts +8 -0
- package/dist/composables/createClient.d.ts +2 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/pluginIdentity.d.ts +24 -0
- package/dist/composables/pluginWorkspaceModel.d.ts +2 -2
- package/dist/composables/useAppExperiment.d.ts +8 -0
- package/dist/composables/useCalendarGrid.d.ts +1 -1
- package/dist/composables/useExperimentSelector.d.ts +6 -2
- package/dist/composables/useFileImport.d.ts +7 -0
- package/dist/composables/useFloatingPanel.d.ts +29 -0
- package/dist/composables/useJobCenter.d.ts +41 -3
- package/dist/composables/useOnboarding.d.ts +119 -0
- package/dist/composables/usePlatform.d.ts +1 -0
- package/dist/{controlSchemaModel-CP5-_nAj.js → controlSchemaModel-Bsg0t5Ab.js} +2 -2
- package/dist/{controlSchemaModel-CP5-_nAj.js.map → controlSchemaModel-Bsg0t5Ab.js.map} +1 -1
- package/dist/{data-C2PwI_dn.js → data-Boeh4uPI.js} +180 -125
- package/dist/data-Boeh4uPI.js.map +1 -0
- package/dist/data.d.ts +1 -1
- package/dist/data.js +9 -9
- package/dist/{experiment-43OJtH7R.js → experiment-DyO54FQB.js} +25 -61
- package/dist/experiment-DyO54FQB.js.map +1 -0
- package/dist/{experimentStatus-BZmU4czV.js → experimentStatus-DCn2QKG7.js} +3 -3
- package/dist/{experimentStatus-BZmU4czV.js.map → experimentStatus-DCn2QKG7.js.map} +1 -1
- package/dist/index.js +20 -20
- package/dist/{install-DAID6c2-.js → install-BEHp7Mo-.js} +15 -14
- package/dist/{install-DAID6c2-.js.map → install-BEHp7Mo-.js.map} +1 -1
- package/dist/install.js +1 -1
- package/dist/{lab-DLwRl_Ql.js → lab-D61eaX6f.js} +136 -148
- package/dist/lab-D61eaX6f.js.map +1 -0
- package/dist/lab.js +4 -3
- package/dist/{records-BzTcxekG.js → records-D4aQXyZu.js} +647 -389
- package/dist/records-D4aQXyZu.js.map +1 -0
- package/dist/{runtime-D6gVat6r.js → runtime-q-R0CNLh.js} +417 -54
- package/dist/runtime-q-R0CNLh.js.map +1 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +7 -7
- package/dist/{shell-5ju97nOS.js → shell-6CGFvUUw.js} +10 -5
- package/dist/{shell-5ju97nOS.js.map → shell-6CGFvUUw.js.map} +1 -1
- package/dist/shell.d.ts +1 -0
- package/dist/shell.js +6 -6
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/stores/settings.d.ts +4 -12
- package/dist/styles.css +2753 -2101
- package/dist/types/componentWorkflowTypes.d.ts +2 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/generated/platformContext.d.ts +1 -0
- package/dist/types/generated-ui.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jobs.d.ts +9 -0
- package/dist/types/platform.d.ts +1 -1
- package/dist/{BaseModal-DfRIuVoj.js → useDropdownState-uFIz6Yv8.js} +75 -5
- package/dist/useDropdownState-uFIz6Yv8.js.map +1 -0
- package/dist/{useExperimentSamples-CxcnxZ8h.js → useExperimentSamples-QEFoq4tf.js} +48 -6
- package/dist/useExperimentSamples-QEFoq4tf.js.map +1 -0
- package/dist/{useListReorder-CcbEYxX-.js → useListReorder-DsuzwWGS.js} +219 -437
- package/dist/useListReorder-DsuzwWGS.js.map +1 -0
- package/dist/{useRackEditor-BD5NIo5s.js → useRackEditor-KpZ4iJ6o.js} +85 -81
- package/dist/useRackEditor-KpZ4iJ6o.js.map +1 -0
- package/dist/useRealtime-B58Lo-Tm.js +508 -0
- package/dist/useRealtime-B58Lo-Tm.js.map +1 -0
- package/dist/useRequest-BuDmW8Jc.js +215 -0
- package/dist/useRequest-BuDmW8Jc.js.map +1 -0
- package/dist/utils/time.d.ts +7 -0
- package/package.json +3 -2
- package/src/__stories__/experiment-helpers.ts +3 -3
- package/src/__tests__/components/ActionMenu.test.ts +2 -2
- package/src/__tests__/components/AppTopBar.test.ts +257 -3
- package/src/__tests__/components/AppTopBarOnboarding.test.ts +160 -0
- package/src/__tests__/components/AppTopBarPageSelector.test.ts +125 -9
- package/src/__tests__/components/AppTopBarPillNav.test.ts +35 -0
- package/src/__tests__/components/ArtifactSaveDialog.test.ts +78 -0
- package/src/__tests__/components/BaseButton.test.ts +19 -0
- package/src/__tests__/components/BaseModal.test.ts +13 -0
- package/src/__tests__/components/BaseSelect.multiple.test.ts +87 -32
- package/src/__tests__/components/BaseSelect.test.ts +2 -1
- package/src/__tests__/components/BatchProgressList.test.ts +16 -0
- package/src/__tests__/components/CalendarGridPanel.test.ts +2 -2
- package/src/__tests__/components/ChartContainer.test.ts +11 -0
- package/src/__tests__/components/ChemicalFormula.test.ts +6 -3
- package/src/__tests__/components/DatePicker.datetime.test.ts +6 -0
- package/src/__tests__/components/DatePicker.test.ts +21 -0
- package/src/__tests__/components/DatePicker.time.test.ts +2 -2
- package/src/__tests__/components/EmptyState.test.ts +1 -1
- package/src/__tests__/components/ExperimentPopover.test.ts +125 -16
- package/src/__tests__/components/ExperimentSelectorModal.test.ts +153 -14
- package/src/__tests__/components/FloatingPanelsInModal.test.ts +94 -0
- package/src/__tests__/components/GeneratedPluginView.test.ts +23 -2
- package/src/__tests__/components/InstrumentStateBadge.test.ts +4 -4
- package/src/__tests__/components/JobsStatusTray.test.ts +373 -71
- package/src/__tests__/components/PluginWorkspaceView.test.ts +63 -1
- package/src/__tests__/components/ResourcePickerListInternal.test.ts +0 -20
- package/src/__tests__/components/SampleSelector.test.ts +33 -8
- package/src/__tests__/components/SequenceProgressBar.test.ts +12 -0
- package/src/__tests__/components/SettingsModal.test.ts +9 -2
- package/src/__tests__/components/StepWizard.test.ts +11 -0
- package/src/__tests__/components/WellPlate.decoration.test.ts +11 -4
- package/src/__tests__/components/deprecationTags.test.ts +1 -1
- package/src/__tests__/composables/useAppExperiment.test.ts +27 -1
- package/src/__tests__/composables/useCalendarGrid.test.ts +4 -2
- package/src/__tests__/composables/useExperimentSelector.test.ts +111 -0
- package/src/__tests__/composables/useFileImport.test.ts +36 -0
- package/src/__tests__/composables/useFloatingPanel.test.ts +68 -0
- package/src/__tests__/composables/useJobCenter.test.ts +262 -3
- package/src/__tests__/composables/useOnboarding.test.ts +317 -0
- package/src/__tests__/docs/frontendDocsCatalog.test.ts +4 -3
- package/src/__tests__/fixtures/table-import/cells.xlsx +0 -0
- package/src/__tests__/fixtures/table-import/samples.xlsx +0 -0
- package/src/__tests__/stores/settings.test.ts +21 -21
- package/src/__tests__/styles/baseControlsRules.test.ts +6 -2
- package/src/__tests__/styles/controlRefreshRules.test.ts +0 -6
- package/src/__tests__/styles/cssTokens.test.ts +6 -3
- package/src/__tests__/styles/menusShellRefresh.test.ts +22 -12
- package/src/__tests__/styles/paletteTokens.test.ts +44 -0
- package/src/__tests__/styles/v2AuditRules.test.ts +104 -0
- package/src/__tests__/utils/plotlyTemplate.test.ts +4 -4
- package/src/__tests__/utils/time.test.ts +18 -1
- package/src/components/ActionMenu.vue +6 -37
- package/src/components/AdductText.story.vue +7 -0
- package/src/components/AdductText.vue +1 -1
- package/src/components/AlertBox.story.vue +2 -2
- package/src/components/AlertBox.vue +18 -16
- package/src/components/AppSidebar.story.vue +0 -28
- package/src/components/AppTopBar.onboarding.story.vue +69 -0
- package/src/components/AppTopBar.story.vue +105 -15
- package/src/components/AppTopBar.vue +248 -122
- package/src/components/ArtifactSaveDialog.story.vue +23 -0
- package/src/components/ArtifactSaveDialog.vue +102 -12
- package/src/components/AuditTrail.story.vue +2 -1
- package/src/components/AuditTrail.vue +2 -21
- package/src/components/Avatar.vue +10 -14
- package/src/components/BaseButton.vue +16 -2
- package/src/components/BaseModal.vue +2 -1
- package/src/components/BaseSelect.multiple.story.vue +13 -2
- package/src/components/BaseSelect.vue +4 -3
- package/src/components/BatchProgressList.vue +35 -25
- package/src/components/ChartContainer.story.vue +2 -1
- package/src/components/ChartContainer.vue +8 -6
- package/src/components/ConfirmDialog.story.vue +1 -1
- package/src/components/EmptyState.vue +1 -1
- package/src/components/ExperimentPopover.story.vue +165 -53
- package/src/components/ExperimentPopover.vue +169 -187
- package/src/components/ExperimentSelectorModal.story.vue +73 -31
- package/src/components/ExperimentSelectorModal.vue +144 -111
- package/src/components/FormField.story.vue +8 -48
- package/src/components/GeneratedPluginView.vue +11 -10
- package/src/components/GeneratedResultRenderer.vue +3 -4
- package/src/components/InstrumentStateBadge.vue +1 -1
- package/src/components/JobsStatusTray.story.vue +97 -43
- package/src/components/JobsStatusTray.vue +287 -290
- package/src/components/LayoutResizeHandle.story.vue +65 -4
- package/src/components/LoadingSpinner.vue +1 -1
- package/src/components/NumberInput.vue +3 -6
- package/src/components/PluginIcon.story.vue +2 -10
- package/src/components/PluginIcon.vue +2 -2
- package/src/components/PluginWorkspaceView.props.ts +3 -0
- package/src/components/PluginWorkspaceView.story.vue +1 -1
- package/src/components/PluginWorkspaceView.vue +17 -0
- package/src/components/RuntimeUpdateNotice.vue +1 -1
- package/src/components/SampleSelector.story.vue +22 -7
- package/src/components/SampleSelector.vue +34 -37
- package/src/components/SampleSelectorGroupNode.vue +1 -1
- package/src/components/SectionCard.story.vue +35 -2
- package/src/components/SequenceProgressBar.story.vue +9 -0
- package/src/components/SequenceProgressBar.vue +6 -1
- package/src/components/SettingsModal.schema.ts +1 -1
- package/src/components/SettingsModal.vue +9 -14
- package/src/components/SmartGroupFieldRecipe.story.vue +1 -1
- package/src/components/SmartGroupManual.story.vue +1 -1
- package/src/components/StepWizard.story.vue +33 -0
- package/src/components/StepWizard.vue +8 -1
- package/src/components/Tooltip.vue +9 -32
- package/src/components/WellPlate.story.vue +3 -1
- package/src/components/WellPlate.vue +7 -0
- package/src/components/internal/AppTopBarOnboardingInternal.vue +172 -0
- package/src/components/internal/AppTopBarPageSelectorInternal.vue +140 -72
- package/src/components/internal/AppTopBarPillNavInternal.vue +33 -2
- package/src/components/internal/DatePickerDateInternal.vue +23 -85
- package/src/components/internal/DatePickerDateTimeInternal.vue +10 -14
- package/src/components/internal/DatePickerTimeInternal.vue +13 -9
- package/src/components/internal/NumberUnitInputInternal.vue +4 -18
- package/src/components/internal/OnboardingLayerInternal.vue +173 -0
- package/src/components/internal/ResourcePickerListInternal.vue +45 -85
- package/src/components/internal/SelectMultipleInternal.vue +187 -65
- package/src/components/internal/SelectSearchableInternal.vue +8 -4
- package/src/components/internal/WellEditPopupInternal.vue +11 -22
- package/src/components/internal/WorkspaceShellInternal.vue +12 -0
- package/src/composables/createClient.ts +2 -0
- package/src/composables/index.ts +1 -0
- package/src/composables/pluginIdentity.ts +31 -0
- package/src/composables/pluginWorkspaceModel.ts +2 -2
- package/src/composables/useAppExperiment.ts +20 -0
- package/src/composables/useCalendarGrid.ts +4 -3
- package/src/composables/useExperimentSelector.ts +77 -31
- package/src/composables/useFileImport.ts +51 -1
- package/src/composables/useFloatingPanel.ts +107 -0
- package/src/composables/useJobCenter.ts +188 -6
- package/src/composables/useOnboarding.ts +465 -0
- package/src/composables/usePluginWorkspace.ts +1 -1
- package/src/data.ts +1 -0
- package/src/runtime.ts +2 -1
- package/src/shell.ts +17 -0
- package/src/stores/index.ts +0 -2
- package/src/stores/settings.ts +20 -50
- package/src/styles/components/action-menu.css +1 -1
- package/src/styles/components/adduct-text.css +13 -5
- package/src/styles/components/alert-box.css +39 -58
- package/src/styles/components/app-layout.css +10 -6
- package/src/styles/components/app-page-selector.css +121 -44
- package/src/styles/components/app-pill-nav.css +11 -12
- package/src/styles/components/app-sidebar.css +9 -18
- package/src/styles/components/app-top-bar.css +219 -55
- package/src/styles/components/artifact-save-dialog.css +153 -2
- package/src/styles/components/audit-trail.css +16 -19
- package/src/styles/components/avatar.css +6 -4
- package/src/styles/components/batch-progress-list.css +38 -36
- package/src/styles/components/button.css +36 -59
- package/src/styles/components/calendar.css +12 -12
- package/src/styles/components/chart-container.css +34 -23
- package/src/styles/components/checkbox.css +2 -12
- package/src/styles/components/collapsible-card.css +27 -29
- package/src/styles/components/confirm-dialog.css +13 -14
- package/src/styles/components/dataframe.css +13 -5
- package/src/styles/components/date-picker.css +84 -94
- package/src/styles/components/datetime-picker.css +35 -47
- package/src/styles/components/divider.css +20 -20
- package/src/styles/components/dose-calculator.css +3 -3
- package/src/styles/components/empty-state.css +20 -17
- package/src/styles/components/experiment-code-badge.css +2 -0
- package/src/styles/components/experiment-popover.css +174 -329
- package/src/styles/components/experiment-selector-modal.css +88 -56
- package/src/styles/components/file-picker.css +3 -3
- package/src/styles/components/file-uploader.css +38 -49
- package/src/styles/components/form-builder.css +3 -3
- package/src/styles/components/formula-input.css +1 -1
- package/src/styles/components/icon-button.css +18 -24
- package/src/styles/components/input.css +5 -4
- package/src/styles/components/instrument-monitor.css +13 -15
- package/src/styles/components/jobs-status-tray.css +140 -296
- package/src/styles/components/layout-resize-handle.css +59 -16
- package/src/styles/components/modal.css +5 -7
- package/src/styles/components/molecule-input.css +2 -2
- package/src/styles/components/multi-select.css +65 -117
- package/src/styles/components/number-input.css +26 -19
- package/src/styles/components/onboarding.css +368 -0
- package/src/styles/components/pill.css +3 -2
- package/src/styles/components/plate-editor.css +0 -1
- package/src/styles/components/plugin-icon.css +26 -23
- package/src/styles/components/popover.css +2 -2
- package/src/styles/components/presence-avatars.css +1 -1
- package/src/styles/components/progress-bar.css +3 -3
- package/src/styles/components/protocol-step-editor.css +1 -3
- package/src/styles/components/resource-card.css +2 -2
- package/src/styles/components/resource-picker-list.css +6 -57
- package/src/styles/components/sample-hierarchy-tree.css +4 -4
- package/src/styles/components/sample-selector.css +138 -79
- package/src/styles/components/schedule-calendar.css +8 -8
- package/src/styles/components/searchable-select.css +15 -19
- package/src/styles/components/section-card.css +54 -49
- package/src/styles/components/segmented-control.css +18 -15
- package/src/styles/components/select.css +3 -3
- package/src/styles/components/sequence-input.css +2 -2
- package/src/styles/components/sequence-progress-bar.css +17 -8
- package/src/styles/components/settings-modal.css +7 -2
- package/src/styles/components/smart-group.css +18 -18
- package/src/styles/components/step-wizard.css +52 -16
- package/src/styles/components/tabs.css +2 -2
- package/src/styles/components/textarea.css +3 -3
- package/src/styles/components/time-picker.css +37 -25
- package/src/styles/components/toast.css +13 -11
- package/src/styles/components/toggle.css +1 -11
- package/src/styles/components/tooltip.css +12 -11
- package/src/styles/components/unit-input.css +9 -8
- package/src/styles/components/well-edit-popup.css +2 -2
- package/src/styles/components/well-plate.css +9 -2
- package/src/styles/index.css +1 -0
- package/src/styles/variables.css +247 -78
- package/src/types/componentWorkflowTypes.ts +2 -0
- package/src/types/components.ts +2 -0
- package/src/types/generated/platformContext.ts +1 -0
- package/src/types/generated-ui.ts +4 -0
- package/src/types/index.ts +1 -0
- package/src/types/jobs.ts +10 -0
- package/src/types/platform.ts +1 -1
- package/src/utils/time.ts +21 -0
- package/dist/ActionMenu-CScINahU.js.map +0 -1
- package/dist/AppSidebar-BmiiPfz9.js.map +0 -1
- package/dist/BaseModal-DfRIuVoj.js.map +0 -1
- package/dist/ExperimentPopover-C4sGw-is.js +0 -359
- package/dist/ExperimentPopover-C4sGw-is.js.map +0 -1
- package/dist/ExperimentSelectorModal-D-9z7cNx.js.map +0 -1
- package/dist/SettingsModal-CSLE31yg.js.map +0 -1
- package/dist/data-C2PwI_dn.js.map +0 -1
- package/dist/experiment-43OJtH7R.js.map +0 -1
- package/dist/lab-DLwRl_Ql.js.map +0 -1
- package/dist/records-BzTcxekG.js.map +0 -1
- package/dist/runtime-D6gVat6r.js.map +0 -1
- package/dist/useExperimentSamples-CxcnxZ8h.js.map +0 -1
- package/dist/useListReorder-CcbEYxX-.js.map +0 -1
- package/dist/useRackEditor-BD5NIo5s.js.map +0 -1
- package/dist/useRealtime-PalKue84.js +0 -696
- package/dist/useRealtime-PalKue84.js.map +0 -1
- package/dist/useRequest-D5JDfsgZ.js +0 -76
- package/dist/useRequest-D5JDfsgZ.js.map +0 -1
|
@@ -5,20 +5,26 @@ import {
|
|
|
5
5
|
ref,
|
|
6
6
|
shallowRef,
|
|
7
7
|
toValue,
|
|
8
|
+
useId,
|
|
9
|
+
watch,
|
|
8
10
|
type ComputedRef,
|
|
9
11
|
type MaybeRefOrGetter,
|
|
10
12
|
type Ref,
|
|
11
13
|
type ShallowRef,
|
|
12
14
|
} from 'vue'
|
|
13
15
|
|
|
14
|
-
import { isActiveJobStatus, normalizeJobState } from '../jobs'
|
|
16
|
+
import { isActiveJobStatus, jobStatusLabel, normalizeJobPercent, normalizeJobState } from '../jobs'
|
|
15
17
|
import type {
|
|
16
18
|
JobListPayload,
|
|
17
19
|
JobState,
|
|
18
20
|
JobStateInput,
|
|
21
|
+
JobStatus,
|
|
22
|
+
TopBarJob,
|
|
19
23
|
} from '../types/jobs'
|
|
24
|
+
import { usePlatform } from './usePlatform'
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
/** How long a job that just completed stays in the top-bar run slot. */
|
|
27
|
+
const FINISHED_HOLD_MS = 6000
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* The canonical owner of a collection of plugin jobs.
|
|
@@ -143,9 +149,41 @@ function duplicatePluginJobId(jobId: string): Error {
|
|
|
143
149
|
export interface UseJobCenterOptions {
|
|
144
150
|
source?: MaybeRefOrGetter<PluginJobCenterSource | undefined>
|
|
145
151
|
loadOnMount?: boolean
|
|
152
|
+
/**
|
|
153
|
+
* Maps the job that the top-bar chip shows. It is called for the chosen own
|
|
154
|
+
* active job AND for the held just-completed job, so check `job.status`.
|
|
155
|
+
* `null` keeps the default mapping.
|
|
156
|
+
*/
|
|
157
|
+
topBarJob?: (job: JobState) => TopBarJob | null
|
|
158
|
+
/**
|
|
159
|
+
* Overrides how a tray row looks: `status` (icon, awaiting-input tint and
|
|
160
|
+
* pinning), `percent` (progress bar and value) and `message` (detail line).
|
|
161
|
+
* A missing or `undefined` field, or a `null` status or message, keeps the
|
|
162
|
+
* job's own; `percent: null` hides the bar and shows the time, and a status
|
|
163
|
+
* alone keeps the job's own percent. The job's section, actions and counts
|
|
164
|
+
* do not change.
|
|
165
|
+
*/
|
|
166
|
+
rowJob?: (job: JobState) => JobRowOverride | null
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** A `rowJob` result; see `UseJobCenterOptions.rowJob`. */
|
|
170
|
+
export interface JobRowOverride {
|
|
171
|
+
status?: JobStatus | null
|
|
172
|
+
percent?: number | null
|
|
173
|
+
message?: string | null
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** How a tray row shows a job; see `UseJobCenterReturn.rowView`. */
|
|
177
|
+
export interface JobRowView {
|
|
178
|
+
status: JobStatus
|
|
179
|
+
/** 0-100, rounded; `null` hides the progress bar and shows the time instead. */
|
|
180
|
+
percent: number | null
|
|
181
|
+
message: string
|
|
146
182
|
}
|
|
147
183
|
|
|
148
184
|
export interface UseJobCenterReturn {
|
|
185
|
+
/** The current source; a new identity is a new job list. */
|
|
186
|
+
source: ComputedRef<PluginJobCenterSource | undefined>
|
|
149
187
|
jobs: ComputedRef<JobState[]>
|
|
150
188
|
activeJobs: ComputedRef<JobState[]>
|
|
151
189
|
historyJobs: ComputedRef<JobState[]>
|
|
@@ -155,14 +193,23 @@ export interface UseJobCenterReturn {
|
|
|
155
193
|
canCancel: ComputedRef<boolean>
|
|
156
194
|
canDelete: ComputedRef<boolean>
|
|
157
195
|
canClearFinished: ComputedRef<boolean>
|
|
196
|
+
/** DOM id of the JobsStatusTray panel, for `AppTopBar`'s `jobsPanelId` prop. */
|
|
197
|
+
panelId: string
|
|
198
|
+
/** The row view of a job, with the `rowJob` option applied. */
|
|
199
|
+
rowView: (job: JobState) => JobRowView
|
|
200
|
+
/** The viewer's own job for `AppTopBar`'s `job` prop. */
|
|
201
|
+
topBarJob: ComputedRef<TopBarJob | null>
|
|
202
|
+
/** Jobs in the list with status `completed`, for `AppTopBar`'s `jobsDone` prop. */
|
|
203
|
+
completedCount: ComputedRef<number>
|
|
158
204
|
isOpen: Ref<boolean>
|
|
159
|
-
activeTab: Ref<JobsStatusTrayTab>
|
|
160
205
|
isLoading: Ref<boolean>
|
|
161
206
|
error: ShallowRef<string | null>
|
|
162
207
|
pendingJobIds: Ref<Set<string>>
|
|
163
208
|
open: () => void
|
|
164
209
|
close: () => void
|
|
165
210
|
toggle: () => void
|
|
211
|
+
/** The top-bar chip: with the tray closed and none of the viewer's jobs active, selects the held just-completed job; else toggles. */
|
|
212
|
+
handleTopBarClick: (onSelect: (job: JobState) => void) => void
|
|
166
213
|
refresh: () => Promise<boolean>
|
|
167
214
|
cancelJob: (job: JobState) => Promise<boolean>
|
|
168
215
|
deleteJob: (job: JobState) => Promise<boolean>
|
|
@@ -170,6 +217,35 @@ export interface UseJobCenterReturn {
|
|
|
170
217
|
isPending: (job: JobState) => boolean
|
|
171
218
|
}
|
|
172
219
|
|
|
220
|
+
/** The stored seen failures, or null when nothing is stored or storage is blocked. */
|
|
221
|
+
function readSeenFailed(key: string): Set<string> | null {
|
|
222
|
+
try {
|
|
223
|
+
const parsed: unknown = JSON.parse(globalThis.localStorage?.getItem(key) ?? 'null')
|
|
224
|
+
return Array.isArray(parsed) ? new Set(parsed.filter((id): id is string => typeof id === 'string')) : null
|
|
225
|
+
} catch {
|
|
226
|
+
return null
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function writeSeenFailed(key: string, seen: Set<string>): void {
|
|
231
|
+
try {
|
|
232
|
+
globalThis.localStorage?.setItem(key, JSON.stringify([...seen]))
|
|
233
|
+
} catch {
|
|
234
|
+
// Private windows and full storage: the state lasts until reload.
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function jobMessage(job: JobState): string {
|
|
239
|
+
if (job.error) return job.error
|
|
240
|
+
if (job.status === 'awaiting_input') {
|
|
241
|
+
return job.progress.message || 'Waiting for external input'
|
|
242
|
+
}
|
|
243
|
+
if (job.status === 'queued' && job.queue_position > 0) {
|
|
244
|
+
return `Queue position ${job.queue_position}`
|
|
245
|
+
}
|
|
246
|
+
return job.progress.message || job.progress.stage || jobStatusLabel(job.status)
|
|
247
|
+
}
|
|
248
|
+
|
|
173
249
|
function errorMessage(error: unknown, fallback: string): string {
|
|
174
250
|
return error instanceof Error ? error.message : fallback
|
|
175
251
|
}
|
|
@@ -184,7 +260,6 @@ export function useJobCenter(
|
|
|
184
260
|
options: UseJobCenterOptions = {},
|
|
185
261
|
): UseJobCenterReturn {
|
|
186
262
|
const isOpen = ref(false)
|
|
187
|
-
const activeTab = ref<JobsStatusTrayTab>('active')
|
|
188
263
|
const isLoading = ref(false)
|
|
189
264
|
const error = shallowRef<string | null>(null)
|
|
190
265
|
const pendingJobIds = ref(new Set<string>())
|
|
@@ -200,6 +275,103 @@ export function useJobCenter(
|
|
|
200
275
|
const historyJobs = computed(() => jobs.value.filter(job => !isActiveJobStatus(job.status)))
|
|
201
276
|
const deletableJobs = computed(() => historyJobs.value.filter(job => job.can_delete))
|
|
202
277
|
const featuredJob = computed(() => activeJobs.value[0] ?? historyJobs.value[0] ?? null)
|
|
278
|
+
const completedCount = computed(() => jobs.value.filter(job => job.status === 'completed').length)
|
|
279
|
+
|
|
280
|
+
// Top-bar run slot: the viewer's own jobs only. Standalone or with auth off
|
|
281
|
+
// (no signed-in user), every job is the viewer's.
|
|
282
|
+
const { integrated, user, plugin, isAdmin } = usePlatform()
|
|
283
|
+
const isOwnJob = (job: JobState) => {
|
|
284
|
+
if (!integrated.value) return true
|
|
285
|
+
// With no user, isAdmin is true only with auth off.
|
|
286
|
+
if (user.value == null) return isAdmin.value
|
|
287
|
+
return (job.owner_user_id ?? job.user_id) === String(user.value.id)
|
|
288
|
+
}
|
|
289
|
+
const ownActiveJobs = computed(() => activeJobs.value.filter(isOwnJob))
|
|
290
|
+
const justFinished = shallowRef<JobState | null>(null)
|
|
291
|
+
// The live held job; it drops out once the job leaves the list.
|
|
292
|
+
const heldJob = computed(() => {
|
|
293
|
+
const held = justFinished.value
|
|
294
|
+
return held ? jobs.value.find(job => job.job_id === held.job_id) ?? null : null
|
|
295
|
+
})
|
|
296
|
+
let finishedTimer: ReturnType<typeof setTimeout> | undefined
|
|
297
|
+
// Compare active jobs within one source only: a replaced source starts over.
|
|
298
|
+
watch([source, ownActiveJobs], ([currentSource, now], [previousSource, before]) => {
|
|
299
|
+
if (currentSource !== previousSource) {
|
|
300
|
+
justFinished.value = null
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
const nowIds = new Set(now.map(job => job.job_id))
|
|
304
|
+
const left = new Set(before.filter(job => !nowIds.has(job.job_id)).map(job => job.job_id))
|
|
305
|
+
const finished = jobs.value.find(job => left.has(job.job_id) && job.status === 'completed')
|
|
306
|
+
if (!finished) return
|
|
307
|
+
justFinished.value = finished
|
|
308
|
+
clearTimeout(finishedTimer)
|
|
309
|
+
finishedTimer = setTimeout(() => { justFinished.value = null }, FINISHED_HOLD_MS)
|
|
310
|
+
})
|
|
311
|
+
// ponytail: the seen set only grows; prune to listed jobs if the stored array ever matters.
|
|
312
|
+
const seenFailedKey = `mint.jobs.${plugin.value?.id ?? 'standalone'}.seen-failed`
|
|
313
|
+
const storedSeenFailed = readSeenFailed(seenFailedKey)
|
|
314
|
+
const seenFailed = shallowRef(storedSeenFailed ?? new Set<string>())
|
|
315
|
+
const unseenFailedJobs = computed(() => historyJobs.value.filter(job => (
|
|
316
|
+
job.status === 'failed' && isOwnJob(job) && !seenFailed.value.has(job.job_id)
|
|
317
|
+
)))
|
|
318
|
+
function markFailedSeen(): void {
|
|
319
|
+
seenFailed.value = new Set([...seenFailed.value, ...unseenFailedJobs.value.map(job => job.job_id)])
|
|
320
|
+
writeSeenFailed(seenFailedKey, seenFailed.value)
|
|
321
|
+
}
|
|
322
|
+
// Nothing stored (new browser, cleared or blocked storage): the failures at the
|
|
323
|
+
// initial load are the baseline, so only later failures alert. Without a load
|
|
324
|
+
// step, the first non-empty list stands in for it.
|
|
325
|
+
let hasBaseline = storedSeenFailed !== null
|
|
326
|
+
let awaitingLoad = options.loadOnMount !== false && Boolean(source.value?.refresh)
|
|
327
|
+
function takeBaseline(): void {
|
|
328
|
+
if (hasBaseline || !active) return
|
|
329
|
+
hasBaseline = true
|
|
330
|
+
markFailedSeen()
|
|
331
|
+
}
|
|
332
|
+
watch(jobs, (list) => {
|
|
333
|
+
if (!awaitingLoad && list.length > 0) takeBaseline()
|
|
334
|
+
}, { immediate: true })
|
|
335
|
+
// The open tray shows every failure, including one that happens while it is open.
|
|
336
|
+
watch([isOpen, unseenFailedJobs], ([open, unseen]) => {
|
|
337
|
+
if (open && unseen.length > 0) markFailedSeen()
|
|
338
|
+
})
|
|
339
|
+
const topBarJob = computed<TopBarJob | null>(() => {
|
|
340
|
+
const own = ownActiveJobs.value
|
|
341
|
+
const shown = own.find(job => job.status === 'awaiting_input') ?? own[0]
|
|
342
|
+
if (shown) {
|
|
343
|
+
return options.topBarJob?.(shown) ?? {
|
|
344
|
+
status: shown.status,
|
|
345
|
+
label: shown.progress.message || `${shown.name} ${jobStatusLabel(shown.status).toLowerCase()}`,
|
|
346
|
+
percent: shown.status === 'running' ? normalizeJobPercent(shown.progress.percent) : null,
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const held = heldJob.value
|
|
350
|
+
if (held) return options.topBarJob?.(held) ?? { status: 'completed', label: `${held.name} completed` }
|
|
351
|
+
const failed = unseenFailedJobs.value.length
|
|
352
|
+
return failed > 0 ? { status: 'failed', label: `${failed} failed` } : null
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
function rowView(job: JobState): JobRowView {
|
|
356
|
+
const override = options.rowJob?.(job) ?? {}
|
|
357
|
+
const status = override.status ?? job.status
|
|
358
|
+
// Only an explicit percent changes the bar; a status override keeps the job's own.
|
|
359
|
+
const percent = override.percent !== undefined
|
|
360
|
+
? override.percent
|
|
361
|
+
: job.status === 'running' ? job.progress.percent : null
|
|
362
|
+
return {
|
|
363
|
+
status,
|
|
364
|
+
percent: percent == null ? null : Math.round(normalizeJobPercent(percent)),
|
|
365
|
+
message: override.message ?? jobMessage(job),
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function handleTopBarClick(onSelect: (job: JobState) => void): void {
|
|
370
|
+
const finished = heldJob.value
|
|
371
|
+
if (!isOpen.value && ownActiveJobs.value.length === 0 && finished) onSelect(finished)
|
|
372
|
+
else isOpen.value = !isOpen.value
|
|
373
|
+
}
|
|
374
|
+
|
|
203
375
|
const canRefresh = computed(() => Boolean(source.value?.refresh))
|
|
204
376
|
const canCancel = computed(() => Boolean(source.value?.cancel))
|
|
205
377
|
const canDelete = computed(() => Boolean(source.value?.delete))
|
|
@@ -290,14 +462,20 @@ export function useJobCenter(
|
|
|
290
462
|
}
|
|
291
463
|
|
|
292
464
|
onMounted(() => {
|
|
293
|
-
if (options.loadOnMount
|
|
465
|
+
if (options.loadOnMount === false) return
|
|
466
|
+
void refresh().then((loaded) => {
|
|
467
|
+
awaitingLoad = false
|
|
468
|
+
if (loaded || jobs.value.length > 0) takeBaseline()
|
|
469
|
+
})
|
|
294
470
|
})
|
|
295
471
|
onUnmounted(() => {
|
|
296
472
|
active = false
|
|
297
473
|
requestGeneration += 1
|
|
474
|
+
clearTimeout(finishedTimer)
|
|
298
475
|
})
|
|
299
476
|
|
|
300
477
|
return {
|
|
478
|
+
source,
|
|
301
479
|
jobs,
|
|
302
480
|
activeJobs,
|
|
303
481
|
historyJobs,
|
|
@@ -307,14 +485,18 @@ export function useJobCenter(
|
|
|
307
485
|
canCancel,
|
|
308
486
|
canDelete,
|
|
309
487
|
canClearFinished,
|
|
488
|
+
panelId: `mint-jobs-tray-${useId()}`,
|
|
489
|
+
rowView,
|
|
490
|
+
topBarJob,
|
|
491
|
+
completedCount,
|
|
310
492
|
isOpen,
|
|
311
|
-
activeTab,
|
|
312
493
|
isLoading,
|
|
313
494
|
error,
|
|
314
495
|
pendingJobIds,
|
|
315
496
|
open: () => { isOpen.value = true },
|
|
316
497
|
close: () => { isOpen.value = false },
|
|
317
498
|
toggle: () => { isOpen.value = !isOpen.value },
|
|
499
|
+
handleTopBarClick,
|
|
318
500
|
refresh,
|
|
319
501
|
cancelJob,
|
|
320
502
|
deleteJob,
|