fix(settings): Adjust frontend of appstore and user management to use initial state

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/43769/head
Ferdinand Thiessen 9 months ago committed by skjnldsv
parent 00386a5407
commit a522d1b5ea
  1. 7
      apps/settings/src/App.vue
  2. 2
      apps/settings/src/components/AppList.vue
  3. 7
      apps/settings/src/store/apps.js
  4. 2
      apps/settings/src/store/index.js
  5. 4
      apps/settings/src/store/users-settings.js
  6. 2
      apps/settings/src/store/users.js
  7. 15
      apps/settings/src/views/Apps.vue

@ -27,12 +27,5 @@
<script>
export default {
name: 'App',
beforeMount() {
// importing server data into the store
const serverDataElmt = document.getElementById('serverData')
if (serverDataElmt !== null) {
this.$store.commit('setServerData', JSON.parse(document.getElementById('serverData').dataset.server))
}
},
}
</script>

@ -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) {

@ -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
},

@ -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'

@ -20,8 +20,10 @@
*
*/
import { loadState } from '@nextcloud/initial-state'
const state = {
serverData: {},
serverData: loadState('settings', 'usersSettings', {}),
}
const mutations = {
setServerData(state, data) {

@ -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;

@ -65,7 +65,7 @@
<NcAppNavigationSpacer />
<!-- App store categories -->
<template v-if="settings.appstoreEnabled">
<template v-if="appstoreEnabled">
<NcAppNavigationItem id="app-category-featured"
:to="{ name: 'apps-category', params: { category: 'featured' } }"
icon="icon-favorite"
@ -165,9 +165,13 @@ import AppScore from '../components/AppList/AppScore.vue'
import Markdown from '../components/Markdown.vue'
import { APPS_SECTION_ENUM } from './../constants/AppsConstants.js'
import { loadState } from '@nextcloud/initial-state'
Vue.use(VueLocalStorage)
const appstoreEnabled = loadState('settings', 'appstoreEnabled')
const developerDocumentation = loadState('settings', 'appstoreDeveloperDocs')
export default {
name: 'Apps',
APPS_SECTION_ENUM,
@ -208,6 +212,9 @@ export default {
},
computed: {
appstoreEnabled() {
return appstoreEnabled
},
pageHeading() {
if (this.$options.APPS_SECTION_ENUM[this.category]) {
return this.$options.APPS_SECTION_ENUM[this.category]
@ -233,9 +240,6 @@ export default {
updateCount() {
return this.$store.getters.getUpdateCount
},
settings() {
return this.$store.getters.getServerData
},
hasRating() {
return this.app.appstoreData && this.app.appstoreData.ratingNumOverall > 5
@ -302,7 +306,6 @@ export default {
this.$store.dispatch('getCategories', { shouldRefetchCategories: true })
this.$store.dispatch('getAllApps')
this.$store.dispatch('getGroups', { offset: 0, limit: 5 })
this.$store.commit('setUpdateCount', this.$store.getters.getServerData.updateCount)
},
mounted() {
@ -329,7 +332,7 @@ export default {
})
},
openDeveloperDocumentation() {
window.open(this.settings.developerDocumentation)
window.open(developerDocumentation)
},
},
}

Loading…
Cancel
Save