mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
[Beta Menu] Shows unsaved state on browser tab title (#860)
* [Beta Menu] Shows unsaved state on browser tab title * Proper state management * Add playwright test * Fix browser tests
This commit is contained in:
@@ -11,6 +11,7 @@ import { useWorkflowStore } from '@/stores/workflowStore'
|
||||
import { useTitle } from '@vueuse/core'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const DEFAULT_TITLE = 'ComfyUI'
|
||||
const executionStore = useExecutionStore()
|
||||
const executionText = computed(() =>
|
||||
executionStore.isIdle ? '' : `[${executionStore.executionProgress}%]`
|
||||
@@ -22,12 +23,18 @@ const betaMenuEnabled = computed(
|
||||
)
|
||||
|
||||
const workflowStore = useWorkflowStore()
|
||||
const workflowNameText = computed(
|
||||
() =>
|
||||
(betaMenuEnabled.value ? workflowStore.activeWorkflow?.name : undefined) ??
|
||||
'ComfyUI'
|
||||
const isUnsavedText = computed(() =>
|
||||
workflowStore.previousWorkflowUnsaved ? ' *' : ''
|
||||
)
|
||||
const workflowNameText = computed(() => {
|
||||
const workflowName = workflowStore.activeWorkflow?.name
|
||||
return workflowName ? isUnsavedText.value + workflowName : DEFAULT_TITLE
|
||||
})
|
||||
|
||||
const title = computed(() => executionText.value + workflowNameText.value)
|
||||
const title = computed(
|
||||
() =>
|
||||
executionText.value +
|
||||
(betaMenuEnabled.value ? workflowNameText.value : DEFAULT_TITLE)
|
||||
)
|
||||
useTitle(title)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user