[backport core/1.33] Restore Cancel Button (#7266)
Backport of 259e9563c8 to core/1.33.
Resolved conflicts in TopMenuSection.vue and reverted binary snapshots.
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7266-Backport-Restore-Cancel-Button-to-core-1-33-2c46d73d3650812f996cd959e5e29cfa)
by [Unito](https://www.unito.io)
---------
Co-authored-by: github-actions <github-actions@github.com>
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
@@ -20,6 +20,17 @@
|
|||||||
class="[&:not(:has(*>*:not(:empty)))]:hidden"
|
class="[&:not(:has(*>*:not(:empty)))]:hidden"
|
||||||
></div>
|
></div>
|
||||||
<ComfyActionbar />
|
<ComfyActionbar />
|
||||||
|
<IconButton
|
||||||
|
v-tooltip.bottom="cancelJobTooltipConfig"
|
||||||
|
type="transparent"
|
||||||
|
size="sm"
|
||||||
|
class="mr-2 bg-destructive-background text-base-foreground transition-colors duration-200 ease-in-out hover:bg-destructive-background-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-destructive-background"
|
||||||
|
:disabled="isExecutionIdle"
|
||||||
|
:aria-label="t('menu.interrupt')"
|
||||||
|
@click="cancelCurrentJob"
|
||||||
|
>
|
||||||
|
<i class="icon-[lucide--x] size-4" />
|
||||||
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
v-tooltip.bottom="queueHistoryTooltipConfig"
|
v-tooltip.bottom="queueHistoryTooltipConfig"
|
||||||
type="transparent"
|
type="transparent"
|
||||||
@@ -54,6 +65,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
@@ -67,11 +79,15 @@ import LoginButton from '@/components/topbar/LoginButton.vue'
|
|||||||
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
|
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
|
||||||
import { buildTooltipConfig } from '@/composables/useTooltipConfig'
|
import { buildTooltipConfig } from '@/composables/useTooltipConfig'
|
||||||
import { app } from '@/scripts/app'
|
import { app } from '@/scripts/app'
|
||||||
|
import { useCommandStore } from '@/stores/commandStore'
|
||||||
|
import { useExecutionStore } from '@/stores/executionStore'
|
||||||
import { useQueueStore } from '@/stores/queueStore'
|
import { useQueueStore } from '@/stores/queueStore'
|
||||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||||
import { isElectron } from '@/utils/envUtil'
|
import { isElectron } from '@/utils/envUtil'
|
||||||
|
|
||||||
const workspaceStore = useWorkspaceStore()
|
const workspaceStore = useWorkspaceStore()
|
||||||
|
const executionStore = useExecutionStore()
|
||||||
|
const commandStore = useCommandStore()
|
||||||
const { isLoggedIn } = useCurrentUser()
|
const { isLoggedIn } = useCurrentUser()
|
||||||
const isDesktop = isElectron()
|
const isDesktop = isElectron()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -88,6 +104,12 @@ const queueHistoryButtonBackgroundClass = computed(() =>
|
|||||||
: 'bg-secondary-background'
|
: 'bg-secondary-background'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const cancelJobTooltipConfig = computed(() =>
|
||||||
|
buildTooltipConfig(t('menu.interrupt'))
|
||||||
|
)
|
||||||
|
|
||||||
|
const { isIdle: isExecutionIdle } = storeToRefs(executionStore)
|
||||||
|
|
||||||
// Maintain support for legacy topbar elements attached by custom scripts
|
// Maintain support for legacy topbar elements attached by custom scripts
|
||||||
const legacyCommandsContainerRef = ref<HTMLElement>()
|
const legacyCommandsContainerRef = ref<HTMLElement>()
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -100,6 +122,11 @@ onMounted(() => {
|
|||||||
const toggleQueueOverlay = () => {
|
const toggleQueueOverlay = () => {
|
||||||
isQueueOverlayExpanded.value = !isQueueOverlayExpanded.value
|
isQueueOverlayExpanded.value = !isQueueOverlayExpanded.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cancelCurrentJob = async () => {
|
||||||
|
if (isExecutionIdle.value) return
|
||||||
|
await commandStore.execute('Comfy.Interrupt')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||