mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 09:45:13 +00:00
fix: address CodeRabbit review - add toast notifications and remove todo.md
- Add toast notifications for asset validation errors (surfacing to user) - Add i18n translations for invalidAsset and invalidFilename errors - Remove todo.md that was accidentally committed Amp-Thread-ID: https://ampcode.com/threads/T-019c0c78-3249-72eb-9c45-0db1bf7067d6 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -2499,6 +2499,10 @@
|
||||
"errorUnsafePickleScan": "CivitAI detected potentially unsafe code in this file",
|
||||
"errorUnsafeVirusScan": "CivitAI detected malware or suspicious content in this file",
|
||||
"errorUploadFailed": "Failed to import asset. Please try again.",
|
||||
"invalidAsset": "Invalid Asset",
|
||||
"invalidAssetDetail": "The selected asset could not be validated. Please try again.",
|
||||
"invalidFilename": "Invalid Filename",
|
||||
"invalidFilenameDetail": "The asset filename could not be determined. Please try again.",
|
||||
"failedToCreateNode": "Failed to create node. Please try again or check console for details.",
|
||||
"fileFormats": "File formats",
|
||||
"fileName": "File Name",
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
assetFilenameSchema,
|
||||
assetItemSchema
|
||||
} from '@/platform/assets/schemas/assetSchema'
|
||||
import { useToastStore } from '@/platform/updates/common/toastStore'
|
||||
import { getAssetFilename } from '@/platform/assets/utils/assetMetadataUtils'
|
||||
|
||||
interface CreateAssetWidgetParams {
|
||||
@@ -45,6 +46,8 @@ export function createAssetWidget(
|
||||
const assetBrowserDialog = useAssetBrowserDialog()
|
||||
|
||||
async function openModal(widget: IBaseWidget) {
|
||||
const toastStore = useToastStore()
|
||||
|
||||
await assetBrowserDialog.show({
|
||||
nodeType: nodeTypeForBrowser,
|
||||
inputName: widgetName,
|
||||
@@ -59,6 +62,12 @@ export function createAssetWidget(
|
||||
'Received:',
|
||||
asset
|
||||
)
|
||||
toastStore.add({
|
||||
severity: 'error',
|
||||
summary: t('assetBrowser.invalidAsset'),
|
||||
detail: t('assetBrowser.invalidAssetDetail'),
|
||||
life: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -72,6 +81,12 @@ export function createAssetWidget(
|
||||
'for asset:',
|
||||
validatedAsset.data.id
|
||||
)
|
||||
toastStore.add({
|
||||
severity: 'error',
|
||||
summary: t('assetBrowser.invalidFilename'),
|
||||
detail: t('assetBrowser.invalidFilenameDetail'),
|
||||
life: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user