Line data Source code
1 : import { useDialogService } from '@/services/dialogService'
2 : import type { DialogComponentProps } from '@/stores/dialogStore'
3 : import { useDialogStore } from '@/stores/dialogStore'
4 : import NodeConflictDialogContent from '@/platform/customNodes/manager/components/manager/NodeConflictDialogContent.vue'
5 : import NodeConflictFooter from '@/platform/customNodes/manager/components/manager/NodeConflictFooter.vue'
6 : import NodeConflictHeader from '@/platform/customNodes/manager/components/manager/NodeConflictHeader.vue'
7 : import type { ConflictDetectionResult } from '@/platform/customNodes/manager/types/conflictDetectionTypes'
8 :
9 2355 : const DIALOG_KEY = 'global-node-conflict'
10 :
11 4481 : export function useNodeConflictDialog() {
12 4481 : const { showSmallLayoutDialog } = useDialogService()
13 4481 : const dialogStore = useDialogStore()
14 :
15 0 : function hide() {
16 0 : dialogStore.closeDialog({ key: DIALOG_KEY })
17 : }
18 :
19 0 : function show(
20 : options: {
21 : buttonText?: string
22 : conflictedPackages?: ConflictDetectionResult[]
23 : dialogComponentProps?: DialogComponentProps
24 : onButtonClick?: () => void
25 : showAfterWhatsNew?: boolean
26 : } = {}
27 : ) {
28 0 : const {
29 : dialogComponentProps,
30 : buttonText,
31 : onButtonClick,
32 : showAfterWhatsNew,
33 : conflictedPackages
34 : } = options
35 :
36 0 : showSmallLayoutDialog({
37 : key: DIALOG_KEY,
38 : headerComponent: NodeConflictHeader,
39 : footerComponent: NodeConflictFooter,
40 : component: NodeConflictDialogContent,
41 : dialogComponentProps,
42 : props: {
43 : showAfterWhatsNew,
44 : conflictedPackages
45 : },
46 : footerProps: {
47 : buttonText,
48 : onButtonClick
49 : }
50 : })
51 : }
52 :
53 4481 : return { show, hide }
54 : }
|