From a522d1b5eae986cad7912c3dce40c68ac11a7535 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 22 Feb 2024 17:16:08 +0100 Subject: [PATCH] fix(settings): Adjust frontend of appstore and user management to use initial state Signed-off-by: Ferdinand Thiessen --- apps/settings/src/App.vue | 7 ------- apps/settings/src/components/AppList.vue | 2 +- apps/settings/src/store/apps.js | 7 ++++++- apps/settings/src/store/index.js | 2 +- .../src/store/{settings.js => users-settings.js} | 4 +++- apps/settings/src/store/users.js | 2 +- apps/settings/src/views/Apps.vue | 15 +++++++++------ 7 files changed, 21 insertions(+), 18 deletions(-) rename apps/settings/src/store/{settings.js => users-settings.js} (90%) diff --git a/apps/settings/src/App.vue b/apps/settings/src/App.vue index f7f81da5063..21565aea9ad 100644 --- a/apps/settings/src/App.vue +++ b/apps/settings/src/App.vue @@ -27,12 +27,5 @@ diff --git a/apps/settings/src/components/AppList.vue b/apps/settings/src/components/AppList.vue index 18c4331e0f9..ca32b9f0495 100644 --- a/apps/settings/src/components/AppList.vue +++ b/apps/settings/src/components/AppList.vue @@ -204,7 +204,7 @@ export default { }) }, bundles() { - return this.$store.getters.getServerData.bundles.filter(bundle => this.bundleApps(bundle.id).length > 0) + return this.$store.getters.getAppBundles.filter(bundle => this.bundleApps(bundle.id).length > 0) }, bundleApps() { return function(bundle) { diff --git a/apps/settings/src/store/apps.js b/apps/settings/src/store/apps.js index d1c5be8034f..0b71367c3b2 100644 --- a/apps/settings/src/store/apps.js +++ b/apps/settings/src/store/apps.js @@ -26,11 +26,13 @@ import api from './api.js' import Vue from 'vue' import { generateUrl } from '@nextcloud/router' import { showError, showInfo } from '@nextcloud/dialogs' +import { loadState } from '@nextcloud/initial-state' const state = { apps: [], + bundles: loadState('settings', 'appstoreBundles', []), categories: [], - updateCount: 0, + updateCount: loadState('settings', 'appstoreUpdateCount', 0), loading: {}, loadingList: false, gettingCategoriesPromise: null, @@ -164,6 +166,9 @@ const getters = { getAllApps(state) { return state.apps }, + getAppBundles(state) { + return state.bundles + }, getUpdateCount(state) { return state.updateCount }, diff --git a/apps/settings/src/store/index.js b/apps/settings/src/store/index.js index abb1f374691..7f477d3882d 100644 --- a/apps/settings/src/store/index.js +++ b/apps/settings/src/store/index.js @@ -25,7 +25,7 @@ import Vue from 'vue' import Vuex, { Store } from 'vuex' import users from './users.js' import apps from './apps.js' -import settings from './settings.js' +import settings from './users-settings.js' import oc from './oc.js' import { showError } from '@nextcloud/dialogs' diff --git a/apps/settings/src/store/settings.js b/apps/settings/src/store/users-settings.js similarity index 90% rename from apps/settings/src/store/settings.js rename to apps/settings/src/store/users-settings.js index 28d40a08028..275c7f40bf0 100644 --- a/apps/settings/src/store/settings.js +++ b/apps/settings/src/store/users-settings.js @@ -20,8 +20,10 @@ * */ +import { loadState } from '@nextcloud/initial-state' + const state = { - serverData: {}, + serverData: loadState('settings', 'usersSettings', {}), } const mutations = { setServerData(state, data) { diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js index 499aa73170d..e0ed4e2b3bf 100644 --- a/apps/settings/src/store/users.js +++ b/apps/settings/src/store/users.js @@ -32,7 +32,7 @@ import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' import { getCapabilities } from '@nextcloud/capabilities' import logger from '../logger.js' -import { parseFileSize } from "@nextcloud/files" +import { parseFileSize } from '@nextcloud/files' const orderGroups = function(groups, orderBy) { /* const SORT_USERCOUNT = 1; diff --git a/apps/settings/src/views/Apps.vue b/apps/settings/src/views/Apps.vue index 192dcb5cd89..b88afdde4e8 100644 --- a/apps/settings/src/views/Apps.vue +++ b/apps/settings/src/views/Apps.vue @@ -65,7 +65,7 @@ -