From 55ecb5239ac32e027d14aca0ce9212e990b10627 Mon Sep 17 00:00:00 2001 From: HJ <30-hj@users.noreply.git.pleroma.social> Date: Mon, 27 Nov 2023 13:26:01 +0000 Subject: [PATCH] Merge branch 'admin-dashboard-fixes' into 'develop' Fixes and minor improvements for admin dashboard See merge request pleroma/pleroma-fe!1863 (cherry picked from commit d21e3d5de28afc1725e256370326f5c119d7a736) f354cef0 fix no feedback and no dropdown close for actions in frontends tab, c99390e8 make notices appear above admin dash modal b6a4b620 add better indication that stuff is happening ce109c38 add favicon setting and add compact layout for AttachmentSetting bf49aeb7 changelog d9ea160a account for if there's no primary frontend setup 75eea5f2 Merge remote-tracking branch 'origin/develop' into admin-dashboard-fixes a190ef2c fix crash added in this MR 1037a3bb remove the WIP tip since pleroma!3862 is in stable b707a14b make sure generated meta goes below FE-provided favicon so that BE's one --- changelog.d/admin-dash-fixes.fix | 1 + index.html | 2 +- .../global_notice_list/global_notice_list.vue | 2 +- .../admin_tabs/frontends_tab.js | 51 +++++++++++++++++-- .../admin_tabs/frontends_tab.scss | 16 ++++++ .../admin_tabs/frontends_tab.vue | 30 +++++++---- .../admin_tabs/instance_tab.vue | 6 ++- .../helpers/attachment_setting.js | 1 + .../helpers/attachment_setting.vue | 38 ++++++++++++-- src/i18n/en.json | 5 +- src/i18n/zh.json | 1 - src/modules/adminSettings.js | 1 + 12 files changed, 132 insertions(+), 22 deletions(-) create mode 100644 changelog.d/admin-dash-fixes.fix diff --git a/changelog.d/admin-dash-fixes.fix b/changelog.d/admin-dash-fixes.fix new file mode 100644 index 00000000..ff8eb0a2 --- /dev/null +++ b/changelog.d/admin-dash-fixes.fix @@ -0,0 +1 @@ +fix admin dashboard not having any feedback on frontend installation diff --git a/index.html b/index.html index a02939f7..e790fb57 100644 --- a/index.html +++ b/index.html @@ -3,8 +3,8 @@ - + diff --git a/src/components/global_notice_list/global_notice_list.vue b/src/components/global_notice_list/global_notice_list.vue index 0e58476f..9e9ec7aa 100644 --- a/src/components/global_notice_list/global_notice_list.vue +++ b/src/components/global_notice_list/global_notice_list.vue @@ -32,7 +32,7 @@ top: calc(var(--navbar-height) + 0.5em); width: 100%; pointer-events: none; - z-index: var(--ZI_navbar_popovers); + z-index: var(--ZI_modals_popovers); display: flex; flex-direction: column; align-items: center; diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.js b/src/components/settings_modal/admin_tabs/frontends_tab.js index a2c27c2a..8163af59 100644 --- a/src/components/settings_modal/admin_tabs/frontends_tab.js +++ b/src/components/settings_modal/admin_tabs/frontends_tab.js @@ -4,6 +4,7 @@ import IntegerSetting from '../helpers/integer_setting.vue' import StringSetting from '../helpers/string_setting.vue' import GroupSetting from '../helpers/group_setting.vue' import Popover from 'src/components/popover/popover.vue' +import PanelLoading from 'src/components/panel_loading/panel_loading.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' import { library } from '@fortawesome/fontawesome-svg-core' @@ -22,12 +23,18 @@ const FrontendsTab = { defaultSource: 'admin' } }, + data () { + return { + working: false + } + }, components: { BooleanSetting, ChoiceSetting, IntegerSetting, StringSetting, GroupSetting, + PanelLoading, Popover }, created () { @@ -42,18 +49,56 @@ const FrontendsTab = { ...SharedComputedObject() }, methods: { + canInstall (frontend) { + const fe = this.frontends.find(f => f.name === frontend.name) + if (!fe) return false + return fe.refs.includes(frontend.ref) + }, + getSuggestedRef (frontend) { + const defaultFe = this.adminDraft[':pleroma'][':frontends'][':primary'] + if (defaultFe?.name === frontend.name && this.canInstall(defaultFe)) { + return defaultFe.ref + } else { + return frontend.refs[0] + } + }, update (frontend, suggestRef) { - const ref = suggestRef || frontend.refs[0] + const ref = suggestRef || this.getSuggestedRef(frontend) const { name } = frontend const payload = { name, ref } + this.working = true this.$store.state.api.backendInteractor.installFrontend({ payload }) - .then((externalUser) => { + .finally(() => { + this.working = false + }) + .then(async (response) => { this.$store.dispatch('loadFrontendsStuff') + if (response.error) { + const reason = await response.error.json() + this.$store.dispatch('pushGlobalNotice', { + level: 'error', + messageKey: 'admin_dash.frontend.failure_installing_frontend', + messageArgs: { + version: name + '/' + ref, + reason: reason.error + }, + timeout: 5000 + }) + } else { + this.$store.dispatch('pushGlobalNotice', { + level: 'success', + messageKey: 'admin_dash.frontend.success_installing_frontend', + messageArgs: { + version: name + '/' + ref + }, + timeout: 2000 + }) + } }) }, setDefault (frontend, suggestRef) { - const ref = suggestRef || frontend.refs[0] + const ref = suggestRef || this.getSuggestedRef(frontend) const { name } = frontend this.$store.commit('updateAdminDraft', { path: [':pleroma', ':frontends', ':primary'], value: { name, ref } }) diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.scss b/src/components/settings_modal/admin_tabs/frontends_tab.scss index e3e04bc6..420d20b3 100644 --- a/src/components/settings_modal/admin_tabs/frontends_tab.scss +++ b/src/components/settings_modal/admin_tabs/frontends_tab.scss @@ -3,6 +3,22 @@ padding: 0; } + .relative { + position: relative; + } + + .overlay { + position: absolute; + background: var(--bg); + // fix buttons showing through + z-index: 2; + opacity: 0.9; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + dd { text-overflow: ellipsis; word-wrap: nowrap; diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue index 25b08eb7..dd4c9790 100644 --- a/src/components/settings_modal/admin_tabs/frontends_tab.vue +++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue @@ -10,7 +10,6 @@
  • {{ $t('admin_dash.frontend.default_frontend') }}

    {{ $t('admin_dash.frontend.default_frontend_tip') }}

    -

    {{ $t('admin_dash.frontend.default_frontend_tip2') }}

  • -
    +
    +

    {{ $t('admin_dash.frontend.available_frontends') }}

    • + {{ + getSuggestedRef(frontend) + }} + -