From ac75d051b720da2c47393de6b35663afe50d37cc Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 29 Mar 2023 23:26:57 +0300 Subject: [PATCH] better frontends tab, now you can set default frontend --- src/App.scss | 1 + .../admin_tabs/frontends_tab.js | 6 + .../admin_tabs/frontends_tab.scss | 2 +- .../admin_tabs/frontends_tab.vue | 208 +++++++++++++----- .../settings_modal/helpers/group_setting.js | 1 - .../settings_modal/helpers/setting.js | 4 +- .../helpers/shared_computed_object.js | 3 + .../settings_modal/settings_modal.scss | 3 + .../settings_modal_admin_content.js | 3 + .../settings_modal_admin_content.vue | 1 + src/i18n/en.json | 11 +- 11 files changed, 179 insertions(+), 64 deletions(-) diff --git a/src/App.scss b/src/App.scss index 149d640f..ef68ac50 100644 --- a/src/App.scss +++ b/src/App.scss @@ -646,6 +646,7 @@ option { } .cards-list { + list-style: none; display: grid; grid-auto-flow: row dense; grid-template-columns: 1fr 1fr; diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.js b/src/components/settings_modal/admin_tabs/frontends_tab.js index a5d33cbe..a2c27c2a 100644 --- a/src/components/settings_modal/admin_tabs/frontends_tab.js +++ b/src/components/settings_modal/admin_tabs/frontends_tab.js @@ -51,6 +51,12 @@ const FrontendsTab = { .then((externalUser) => { this.$store.dispatch('loadFrontendsStuff') }) + }, + setDefault (frontend, suggestRef) { + const ref = suggestRef || frontend.refs[0] + 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 1e1881ff..e3e04bc6 100644 --- a/src/components/settings_modal/admin_tabs/frontends_tab.scss +++ b/src/components/settings_modal/admin_tabs/frontends_tab.scss @@ -8,6 +8,6 @@ word-wrap: nowrap; white-space: nowrap; overflow-x: hidden; - max-width: 80%; + max-width: 10em; } } diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue index 48649dfb..71bbfa69 100644 --- a/src/components/settings_modal/admin_tabs/frontends_tab.vue +++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue @@ -2,67 +2,157 @@

{{ $t('admin_dash.tabs.frontends') }}

-
    -
  • - {{ frontend.name }} -
    -
    {{ $t('admin_dash.frontend.repository') }}
    -
    {{ frontend.git }}
    -
    {{ $t('admin_dash.frontend.versions') }}
    -
    {{ frontend.refs }}
    -
    {{ $t('admin_dash.frontend.build_url') }}
    -
    {{ frontend.build_url }}
    -
    -
    - - - - - - - -
    +

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

    +
      +
    • +

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

      +

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

      +

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

      +
    • +
    • + + NAME + +
    • +
    • + + REF + +
    • +
    • +
    +
    +

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

    +
      +
    • + {{ frontend.name }} + {{ ' ' }} + + + + + + +
      +
      {{ $t('admin_dash.frontend.repository') }}
      +
      {{ frontend.git }}
      + +
      {{ $t('admin_dash.frontend.build_url') }}
      +
      {{ frontend.build_url }}
      +
      +
      + + + + + + + + + + {{ ' ' }} + + + + + +
      +
    • +
    +
diff --git a/src/components/settings_modal/helpers/group_setting.js b/src/components/settings_modal/helpers/group_setting.js index 12a49000..23a2a202 100644 --- a/src/components/settings_modal/helpers/group_setting.js +++ b/src/components/settings_modal/helpers/group_setting.js @@ -7,7 +7,6 @@ export default { computed: { ...Setting.computed, isDirty () { - console.log(this.state, this.draft) return !isEqual(this.state, this.draft) } } diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index d2e1a6f4..4f0be448 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -61,7 +61,7 @@ export default { // TODO allow passing shared draft object? get () { if (this.realSource === 'admin') { - return get(this.$store.state.adminSettings.draft, this.path) + return get(this.$store.state.adminSettings.draft, this.canonPath) } else { return this.localDraft } @@ -75,7 +75,7 @@ export default { } }, state () { - const value = get(this.configSource, this.path) + const value = get(this.configSource, this.canonPath) if (value === undefined) { return this.defaultState } else { diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js index d02db542..bb3d36ac 100644 --- a/src/components/settings_modal/helpers/shared_computed_object.js +++ b/src/components/settings_modal/helpers/shared_computed_object.js @@ -10,6 +10,9 @@ const SharedComputedObject = () => ({ }, adminConfig () { return this.$store.state.adminSettings.config + }, + adminDraft () { + return this.$store.state.adminSettings.draft } }) diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss index 98de736b..49ef83e0 100644 --- a/src/components/settings_modal/settings_modal.scss +++ b/src/components/settings_modal/settings_modal.scss @@ -43,6 +43,9 @@ .btn { min-height: 2em; + } + + .btn:not(.dropdown-button) { padding: 0 2em; } } diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js index b7c0de57..f94721ec 100644 --- a/src/components/settings_modal/settings_modal_admin_content.js +++ b/src/components/settings_modal/settings_modal_admin_content.js @@ -51,6 +51,9 @@ const SettingsModalAdminContent = { adminDbLoaded () { return this.$store.state.adminSettings.loaded }, + adminDescriptionsLoaded () { + return this.$store.state.adminSettings.descriptions !== null + }, noDb () { return this.$store.state.adminSettings.dbConfigEnabled === false } diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue index ae670a90..a7a2ac9a 100644 --- a/src/components/settings_modal/settings_modal_admin_content.vue +++ b/src/components/settings_modal/settings_modal_admin_content.vue @@ -1,5 +1,6 @@