@@ -2,9 +2,6 @@ import { merge } from 'es-toolkit/compat'
22import type { Component } from 'vue'
33
44import ApiNodesSignInContent from '@/components/dialog/content/ApiNodesSignInContent.vue'
5- import MissingNodesContent from '@/components/dialog/content/MissingNodesContent.vue'
6- import MissingNodesFooter from '@/components/dialog/content/MissingNodesFooter.vue'
7- import MissingNodesHeader from '@/components/dialog/content/MissingNodesHeader.vue'
85import ConfirmationDialogContent from '@/components/dialog/content/ConfirmationDialogContent.vue'
96import ErrorDialogContent from '@/components/dialog/content/ErrorDialogContent.vue'
107import MissingModelsWarning from '@/components/dialog/content/MissingModelsWarning.vue'
@@ -30,10 +27,6 @@ import ManagerProgressFooter from '@/workbench/extensions/manager/components/Man
3027import ManagerProgressHeader from '@/workbench/extensions/manager/components/ManagerProgressHeader.vue'
3128import ManagerDialogContent from '@/workbench/extensions/manager/components/manager/ManagerDialogContent.vue'
3229import ManagerHeader from '@/workbench/extensions/manager/components/manager/ManagerHeader.vue'
33- import NodeConflictDialogContent from '@/workbench/extensions/manager/components/manager/NodeConflictDialogContent.vue'
34- import NodeConflictFooter from '@/workbench/extensions/manager/components/manager/NodeConflictFooter.vue'
35- import NodeConflictHeader from '@/workbench/extensions/manager/components/manager/NodeConflictHeader.vue'
36- import type { ConflictDetectionResult } from '@/workbench/extensions/manager/types/conflictDetectionTypes'
3730import type { ComponentProps } from 'vue-component-type-helpers'
3831
3932export type ConfirmationDialogType =
@@ -47,32 +40,6 @@ export type ConfirmationDialogType =
4740export const useDialogService = ( ) => {
4841 const dialogStore = useDialogStore ( )
4942
50- function showLoadWorkflowWarning (
51- props : ComponentProps < typeof MissingNodesContent >
52- ) {
53- dialogStore . showDialog ( {
54- key : 'global-missing-nodes' ,
55- headerComponent : MissingNodesHeader ,
56- footerComponent : MissingNodesFooter ,
57- component : MissingNodesContent ,
58- dialogComponentProps : {
59- closable : true ,
60- pt : {
61- root : { class : 'bg-base-background border-border-default' } ,
62- header : { class : '!p-0 !m-0' } ,
63- content : { class : '!p-0 overflow-y-hidden' } ,
64- footer : { class : '!p-0' } ,
65- pcCloseButton : {
66- root : {
67- class : '!w-7 !h-7 !border-none !outline-none !p-2 !m-1.5'
68- }
69- }
70- }
71- } ,
72- props
73- } )
74- }
75-
7643 function showMissingModelsWarning (
7744 props : InstanceType < typeof MissingModelsWarning > [ '$props' ]
7845 ) {
@@ -449,6 +416,44 @@ export const useDialogService = () => {
449416 }
450417 }
451418
419+ function showSmallDialog < T extends Component > ( options : {
420+ key : string
421+ component : T
422+ headerComponent ?: Component
423+ footerComponent ?: Component
424+ props ?: ComponentProps < T >
425+ footerProps ?: Record < string , unknown >
426+ dialogComponentProps ?: DialogComponentProps
427+ } ) {
428+ const smallDialogDefaultProps : DialogComponentProps = {
429+ closable : true ,
430+ pt : {
431+ root : { class : 'bg-base-background border-border-default' } ,
432+ header : { class : '!p-0 !m-0' } ,
433+ content : { class : '!p-0 overflow-y-hidden' } ,
434+ footer : { class : '!p-0' } ,
435+ pcCloseButton : {
436+ root : {
437+ class : '!w-7 !h-7 !border-none !outline-none !p-2 !m-1.5'
438+ }
439+ }
440+ }
441+ }
442+
443+ return dialogStore . showDialog ( {
444+ key : options . key ,
445+ component : options . component ,
446+ headerComponent : options . headerComponent ,
447+ footerComponent : options . footerComponent ,
448+ props : options . props ,
449+ footerProps : options . footerProps ,
450+ dialogComponentProps : merge (
451+ smallDialogDefaultProps ,
452+ options . dialogComponentProps || { }
453+ )
454+ } )
455+ }
456+
452457 function showLayoutDialog ( options : {
453458 key : string
454459 component : Component
@@ -481,54 +486,6 @@ export const useDialogService = () => {
481486 } )
482487 }
483488
484- function showNodeConflictDialog (
485- options : {
486- showAfterWhatsNew ?: boolean
487- conflictedPackages ?: ConflictDetectionResult [ ]
488- dialogComponentProps ?: DialogComponentProps
489- buttonText ?: string
490- onButtonClick ?: ( ) => void
491- } = { }
492- ) {
493- const {
494- dialogComponentProps,
495- buttonText,
496- onButtonClick,
497- showAfterWhatsNew,
498- conflictedPackages
499- } = options
500-
501- return dialogStore . showDialog ( {
502- key : 'global-node-conflict' ,
503- headerComponent : NodeConflictHeader ,
504- footerComponent : NodeConflictFooter ,
505- component : NodeConflictDialogContent ,
506- dialogComponentProps : {
507- closable : true ,
508- pt : {
509- header : { class : '!p-0 !m-0' } ,
510- content : { class : '!p-0 overflow-y-hidden' } ,
511- footer : { class : '!p-0' } ,
512- pcCloseButton : {
513- root : {
514- class :
515- '!w-7 !h-7 !border-none !outline-none !p-2 !m-1.5 bg-dialog-surface text-white'
516- }
517- }
518- } ,
519- ...dialogComponentProps
520- } ,
521- props : {
522- showAfterWhatsNew,
523- conflictedPackages
524- } ,
525- footerProps : {
526- buttonText,
527- onButtonClick
528- }
529- } )
530- }
531-
532489 async function showSubscriptionRequiredDialog ( ) {
533490 if ( ! isCloud || ! window . __CONFIG__ ?. subscription_required ) {
534491 return
@@ -542,7 +499,6 @@ export const useDialogService = () => {
542499 }
543500
544501 return {
545- showLoadWorkflowWarning,
546502 showMissingModelsWarning,
547503 showSettingsDialog,
548504 showAboutDialog,
@@ -560,7 +516,7 @@ export const useDialogService = () => {
560516 confirm,
561517 toggleManagerDialog,
562518 toggleManagerProgressDialog,
563- showLayoutDialog ,
564- showNodeConflictDialog
519+ showSmallDialog ,
520+ showLayoutDialog
565521 }
566522}
0 commit comments