Skip to content

Commit 71d49dc

Browse files
committed
Add toast on failed rename.
1 parent c9b5bb5 commit 71d49dc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/locales/en/main.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,9 @@
21582158
"inProgress": "Deleting {assetName}...",
21592159
"complete": "{assetName} has been deleted.",
21602160
"failed": "{assetName} could not be deleted."
2161+
},
2162+
"rename": {
2163+
"failed": "Could not rename asset."
21612164
}
21622165
},
21632166
"mediaAsset": {

src/platform/assets/components/AssetCard.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ import AssetBadgeGroup from '@/platform/assets/components/AssetBadgeGroup.vue'
134134
import type { AssetDisplayItem } from '@/platform/assets/composables/useAssetBrowser'
135135
import { assetService } from '@/platform/assets/services/assetService'
136136
import { useSettingStore } from '@/platform/settings/settingStore'
137+
import { useToastStore } from '@/platform/updates/common/toastStore'
137138
import { useDialogStore } from '@/stores/dialogStore'
138139
import { cn } from '@/utils/tailwindUtil'
139140
@@ -150,6 +151,7 @@ const { t } = useI18n()
150151
const settingStore = useSettingStore()
151152
const { closeDialog } = useDialogStore()
152153
const { flags } = useFeatureFlags()
154+
const toastStore = useToastStore()
153155
154156
const dropdownMenuButton = useTemplateRef<InstanceType<typeof MoreButton>>(
155157
'dropdown-menu-button'
@@ -241,6 +243,11 @@ async function assetRename(newName?: string) {
241243
newNameRef.value = result.name
242244
} catch (err: unknown) {
243245
console.error(err)
246+
toastStore.add({
247+
severity: 'error',
248+
summary: t('assetBrowser.rename.failed'),
249+
life: 10_000
250+
})
244251
newNameRef.value = undefined
245252
}
246253
}

0 commit comments

Comments
 (0)