mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
## Summary Additional fixes and updates based on testing ## Changes - **What**: - add warning to welcome screen & when sharing an app that has had all outputs removed - fix target workflow when changing mode via tab right click menu - change build app text to be conditional "edit" vs "build" depending on if an app is already defined - update empty apps sidebar tab button text to make it clearer - remove templates button from app mode (we will reintroduce this once we have app templates) - add "exit to graph" after applying default mode of node graph - update cancel button to remove item from queue if it hasn't started yet - improve scoping of jobs/outputs to the current workflow [not perfect but should be much improved] - close sidebar tabs on entering app mode - change tooltip to be under the workflow menu rather than covering the button ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9511-feat-fix-App-mode-QA-feedback-2-31b6d73d365081d59bbbc13111100d46) by [Unito](https://www.unito.io)
78 lines
2.3 KiB
TypeScript
78 lines
2.3 KiB
TypeScript
import { computed } from 'vue'
|
|
|
|
import { useAppMode } from '@/composables/useAppMode'
|
|
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
|
|
import { app } from '@/scripts/app'
|
|
import { useDialogService } from '@/services/dialogService'
|
|
import { useDialogStore } from '@/stores/dialogStore'
|
|
|
|
import BuilderDefaultModeAppliedDialogContent from './BuilderDefaultModeAppliedDialogContent.vue'
|
|
import DefaultViewDialogContent from './DefaultViewDialogContent.vue'
|
|
import { useAppModeStore } from '@/stores/appModeStore'
|
|
|
|
const DIALOG_KEY = 'builder-default-view'
|
|
const APPLIED_DIALOG_KEY = 'builder-default-view-applied'
|
|
|
|
export function useAppSetDefaultView() {
|
|
const workflowStore = useWorkflowStore()
|
|
const dialogService = useDialogService()
|
|
const dialogStore = useDialogStore()
|
|
const appModeStore = useAppModeStore()
|
|
const { setMode } = useAppMode()
|
|
|
|
const settingView = computed(() => dialogStore.isDialogOpen(DIALOG_KEY))
|
|
|
|
function showDialog() {
|
|
dialogService.showLayoutDialog({
|
|
key: DIALOG_KEY,
|
|
component: DefaultViewDialogContent,
|
|
props: {
|
|
initialOpenAsApp: workflowStore.activeWorkflow?.initialMode !== 'graph',
|
|
onApply: handleApply,
|
|
onClose: closeDialog
|
|
}
|
|
})
|
|
}
|
|
|
|
function handleApply(openAsApp: boolean) {
|
|
const workflow = workflowStore.activeWorkflow
|
|
if (!workflow) return
|
|
|
|
workflow.initialMode = openAsApp ? 'app' : 'graph'
|
|
const extra = (app.rootGraph.extra ??= {})
|
|
extra.linearMode = openAsApp
|
|
workflow.changeTracker?.checkState()
|
|
closeDialog()
|
|
showAppliedDialog(openAsApp)
|
|
}
|
|
|
|
function showAppliedDialog(appliedAsApp: boolean) {
|
|
dialogService.showLayoutDialog({
|
|
key: APPLIED_DIALOG_KEY,
|
|
component: BuilderDefaultModeAppliedDialogContent,
|
|
props: {
|
|
appliedAsApp,
|
|
onViewApp: () => {
|
|
closeAppliedDialog()
|
|
setMode('app')
|
|
},
|
|
onExitToWorkflow: () => {
|
|
closeAppliedDialog()
|
|
appModeStore.exitBuilder()
|
|
},
|
|
onClose: closeAppliedDialog
|
|
}
|
|
})
|
|
}
|
|
|
|
function closeDialog() {
|
|
dialogStore.closeDialog({ key: DIALOG_KEY })
|
|
}
|
|
|
|
function closeAppliedDialog() {
|
|
dialogStore.closeDialog({ key: APPLIED_DIALOG_KEY })
|
|
}
|
|
|
|
return { settingView, showDialog }
|
|
}
|