From b6114f93d45183f85e044b1ac1e7d25d75000125 Mon Sep 17 00:00:00 2001 From: FREDERICK Date: Sat, 18 Jan 2025 01:08:55 +0100 Subject: [PATCH] Add `Official` badge to official plugins --- src/components/ASF/Plugins.vue | 49 +++++++++++++++++++++++++++++++--- src/i18n/locale/default.json | 1 + 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/components/ASF/Plugins.vue b/src/components/ASF/Plugins.vue index 7a1ddcd5a..38f5339db 100644 --- a/src/components/ASF/Plugins.vue +++ b/src/components/ASF/Plugins.vue @@ -12,6 +12,7 @@
{{ plugin.Name }} {{ plugin.Version }} + {{ $t('official') }}
@@ -35,14 +36,26 @@ }, async created() { try { - this.plugins = await this.$http.get('Plugins'); + const officialPlugins = await this.$http.get('Plugins', { official: true, custom: false }); + officialPlugins.forEach(plugin => { + plugin.IsOfficialPlugin = true; + }); + + const customPlugins = await this.$http.get('Plugins', { official: false, custom: true }); + customPlugins.forEach(plugin => { + plugin.IsOfficialPlugin = false; + }); + + this.plugins = [...officialPlugins, ...customPlugins]; + this.plugins.forEach((plugin, i) => { if (!Object.prototype.hasOwnProperty.call(plugin, 'Name')) plugin.Name = this.$t('plugin-unknown-name', { number: i }); if (!Object.prototype.hasOwnProperty.call(plugin, 'Version')) plugin.Version = this.$t('plugin-unknown-version'); }); - this.loading = false; } catch (err) { this.error = err.message; + } finally { + this.loading = false; } }, }; @@ -66,12 +79,42 @@ } } + .plugin__title { + display: flex; + align-items: baseline; + + @media screen and (max-width: 400px) { + align-items: flex-start; + flex-direction: column; + gap: 4px; + } + } + .plugin__name { font-size: 1.3em; font-weight: bold; } .plugin__version { - padding-left: 10px; + padding-left: 0.8em; + + @media screen and (max-width: 400px) { + padding-left: 0; + } + } + + .plugin__label { + color: #00a65a; + background-color: var(--color-background-light); + border: 2px solid currentColor; + border-radius: 4px; + display: inline-block; + line-height: 1; + margin-left: 0.8em; + padding: 0.25em 0.5em; + + @media screen and (max-width: 400px) { + margin-left: 0; + } } diff --git a/src/i18n/locale/default.json b/src/i18n/locale/default.json index 57261c402..722f74326 100644 --- a/src/i18n/locale/default.json +++ b/src/i18n/locale/default.json @@ -194,6 +194,7 @@ "notification-position-right-top": "Right top", "notify-release": "New release notification", "notify-release-description": "Notify me when a new release is available (depending on config property UpdateChannel in ASF Config).", + "official": "Official", "other": "Other", "password": "Password", "password-invalid": "Invalid password!",