Line data Source code
1 : import { defineAsyncComponent } from 'vue'
2 :
3 : import { useDialogService } from '@/services/dialogService'
4 : import { useDialogStore } from '@/stores/dialogStore'
5 :
6 2356 : const DIALOG_KEY = 'global-comfyhub-publish'
7 :
8 2356 : const ComfyHubPublishDialog = defineAsyncComponent(
9 : () =>
10 : import('@/platform/workflow/sharing/components/publish/ComfyHubPublishDialog.vue')
11 : )
12 :
13 2355 : export function useComfyHubPublishDialog() {
14 2355 : const dialogService = useDialogService()
15 2355 : const dialogStore = useDialogStore()
16 :
17 2 : function hide() {
18 2 : dialogStore.closeDialog({ key: DIALOG_KEY })
19 : }
20 :
21 0 : function show() {
22 0 : dialogService.showLayoutDialog({
23 : key: DIALOG_KEY,
24 : component: ComfyHubPublishDialog,
25 : props: {
26 : onClose: hide
27 : }
28 : })
29 : }
30 :
31 : /** Extension-facing entry point; also used by the e2e publish fixture. */
32 30 : async function showPublishDialog(): Promise<void> {
33 30 : dialogService.showLayoutDialog({
34 : key: DIALOG_KEY,
35 : component: ComfyHubPublishDialog,
36 : props: {
37 : onClose: hide,
38 : // Falls through to the BaseModalLayout root for the e2e
39 : // publish-dialog selector.
40 : 'data-testid': 'publish-dialog'
41 : }
42 : })
43 : }
44 :
45 2355 : return {
46 : show,
47 : hide,
48 : showPublishDialog
49 : }
50 : }
|