summaryrefslogtreecommitdiffstats
path: root/settings/src
diff options
context:
space:
mode:
Diffstat (limited to 'settings/src')
-rw-r--r--settings/src/components/appList.vue34
-rw-r--r--settings/src/store/apps.js35
-rw-r--r--settings/src/views/Apps.vue6
3 files changed, 37 insertions, 38 deletions
diff --git a/settings/src/components/appList.vue b/settings/src/components/appList.vue
index ab8d30b1227..734bc9d55fa 100644
--- a/settings/src/components/appList.vue
+++ b/settings/src/components/appList.vue
@@ -80,15 +80,45 @@ export default {
return this.$store.getters.loading('list');
},
apps() {
- return this.$store.getters.getApps
+ let apps = this.$store.getters.getAllApps
.filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1)
+ .sort(function (a, b) {
+ if (a.active !== b.active) {
+ return (a.active ? -1 : 1)
+ }
+ if (a.update !== b.update) {
+ return (a.update ? -1 : 1)
+ }
+ return OC.Util.naturalSortCompare(a.name, b.name);
+ });
+
+ if (this.category === 'installed') {
+ return apps.filter(app => app.installed);
+ }
+ if (this.category === 'enabled') {
+ return apps.filter(app => app.active);
+ }
+ if (this.category === 'disabled') {
+ return apps.filter(app => !app.active);
+ }
+ if (this.category === 'app-bundles') {
+ return apps.filter(app => app.bundles);
+ }
+ if (this.category === 'updates') {
+ return apps.filter(app => app.update);
+ }
+ // filter app store categories
+ return apps.filter(app => {
+ return app.appstore && app.category !== undefined &&
+ (app.category === this.category || app.category.indexOf(this.category) > -1);
+ });
},
bundles() {
return this.$store.getters.getServerData.bundles;
},
bundleApps() {
return function(bundle) {
- return this.$store.getters.getApps
+ return this.$store.getters.getAllApps
.filter(app => app.bundleId === bundle);
}
},
diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js
index 97d7aaa6cb0..2247e68996c 100644
--- a/settings/src/store/apps.js
+++ b/settings/src/store/apps.js
@@ -26,7 +26,6 @@ import Vue from 'vue';
const state = {
apps: [],
- allApps: [],
categories: [],
updateCount: 0,
loading: {},
@@ -58,12 +57,8 @@ const mutations = {
state.categories = categoriesArray;
},
- setApps(state, apps) {
- state.apps = apps;
- },
-
setAllApps(state, apps) {
- state.allApps = apps;
+ state.apps = apps;
},
setError(state, {appId, error}) {
@@ -145,19 +140,8 @@ const getters = {
getCategories(state) {
return state.categories;
},
- getApps(state) {
- return state.apps.concat([]).sort(function (a, b) {
- if (a.active !== b.active) {
- return (a.active ? -1 : 1)
- }
- if (a.update !== b.update) {
- return (a.update ? -1 : 1)
- }
- return OC.Util.naturalSortCompare(a.name, b.name);
- });
- },
getAllApps(state) {
- return state.allApps;
+ return state.apps;
},
getUpdateCount(state) {
return state.updateCount;
@@ -279,23 +263,12 @@ const actions = {
}).catch((error) => context.commit('API_FAILURE', { appId, error }));
},
- getApps(context, { category }) {
- context.commit('startLoading', 'list');
- return api.get(OC.generateUrl(`settings/apps/list?category=${category}`))
- .then((response) => {
- context.commit('setApps', response.data.apps);
- context.commit('stopLoading', 'list');
- return true;
- })
- .catch((error) => context.commit('API_FAILURE', error))
- },
-
getAllApps(context) {
- context.commit('startLoading', 'all');
+ context.commit('startLoading', 'list');
return api.get(OC.generateUrl(`settings/apps/list`))
.then((response) => {
context.commit('setAllApps', response.data.apps);
- context.commit('stopLoading', 'all');
+ context.commit('stopLoading', 'list');
return true;
})
.catch((error) => context.commit('API_FAILURE', error))
diff --git a/settings/src/views/Apps.vue b/settings/src/views/Apps.vue
index 994677700e1..1bd76b8718e 100644
--- a/settings/src/views/Apps.vue
+++ b/settings/src/views/Apps.vue
@@ -69,7 +69,6 @@ export default {
},
beforeMount() {
this.$store.dispatch('getCategories');
- this.$store.dispatch('getApps', {category: this.category});
this.$store.dispatch('getAllApps');
this.$store.dispatch('getGroups');
this.$store.commit('setUpdateCount', this.$store.getters.getServerData.updateCount)
@@ -89,11 +88,8 @@ export default {
}
},
watch: {
- // watch url change and group select
category: function (val, old) {
- this.$store.commit('resetApps');
this.setSearch('');
- this.$store.dispatch('getApps', { category: this.category });
}
},
computed: {
@@ -110,7 +106,7 @@ export default {
return this.$store.getters.getCategories;
},
apps() {
- return this.$store.getters.getApps;
+ return this.$store.getters.getAllApps;
},
updateCount() {
return this.$store.getters.getUpdateCount;