From 7d3ae09cec7b90343788458ab4e2067500daa495 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Thu, 13 Jan 2022 15:38:28 +0100 Subject: [PATCH] icon picker error for missing sets --- zero.Backoffice.UI/app/components/ui-iconpicker.vue | 11 ++++++++++- .../Resources/Localization/zero.en-us.json | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/zero.Backoffice.UI/app/components/ui-iconpicker.vue b/zero.Backoffice.UI/app/components/ui-iconpicker.vue index 56d8e06b..b82e7f36 100644 --- a/zero.Backoffice.UI/app/components/ui-iconpicker.vue +++ b/zero.Backoffice.UI/app/components/ui-iconpicker.vue @@ -10,6 +10,8 @@ import { open as openOverlay } from '../services/overlay'; import { extendObject } from '../utils'; import { useUiStore } from '../ui/store'; + import * as notifications from '../services/notification'; + import { localize } from '../services/localization'; export default { name: 'uiIconpicker', @@ -87,7 +89,8 @@ loadSet() { - this.iconSet = this.store.iconSets.find(x => x.alias === this.set); + const alias = this.set || 'feather'; + this.iconSet = this.store.iconSets.find(x => x.alias === alias); }, async pick() @@ -97,6 +100,12 @@ return; } + if (!this.iconSet) + { + notifications.error("@iconpicker.notfound.title", localize("@iconpicker.notfound.text", { tokens: { name: this.set || '' } })); + return; + } + const result = await openOverlay(extendObject({ model: { set: this.iconSet, diff --git a/zero.Backoffice/Resources/Localization/zero.en-us.json b/zero.Backoffice/Resources/Localization/zero.en-us.json index fbeaedc4..63dda7d4 100644 --- a/zero.Backoffice/Resources/Localization/zero.en-us.json +++ b/zero.Backoffice/Resources/Localization/zero.en-us.json @@ -620,7 +620,11 @@ }, "iconpicker": { - "title": "Pick an icon" + "title": "Pick an icon", + "notfound": { + "title": "Icon set not found", + "text": "Could not locate a registered icon set (\"{name}\")" + } }, "colorpicker": {