Add default confirm dialog (#2114)

This commit is contained in:
Chenlei Hu
2024-12-31 18:18:48 -05:00
committed by GitHub
parent 174a9a114a
commit 3189e310a8
5 changed files with 66 additions and 9 deletions

View File

@@ -13,7 +13,14 @@
autofocus
/>
<Button
v-if="type === 'delete'"
v-if="type === 'default'"
:label="$t('g.confirm')"
severity="primary"
@click="onConfirm"
icon="pi pi-check"
/>
<Button
v-else-if="type === 'delete'"
:label="$t('g.delete')"
severity="danger"
@click="onConfirm"

View File

@@ -12,6 +12,7 @@ import type { ExecutionErrorWsMessage } from '@/types/apiTypes'
import type { MissingNodeType } from '@/types/comfy'
export type ConfirmationDialogType =
| 'default'
| 'overwrite'
| 'delete'
| 'dirtyClose'
@@ -121,16 +122,16 @@ export const useDialogService = () => {
*/
async function confirm({
title,
type,
message,
type = 'default',
itemList = []
}: {
/** Dialog heading */
title: string
/** Pre-configured dialog type */
type: ConfirmationDialogType
/** The main message body */
message: string
/** Pre-configured dialog type */
type?: ConfirmationDialogType
/** Displayed as an unorderd list immediately below the message body */
itemList?: string[]
}): Promise<boolean | null> {