summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-05-29 22:40:31 +0200
committerJulius Härtl <jus@bitgrid.net>2018-06-06 11:40:09 +0200
commit127b21b493323034eff6944c0ec7a808529e7529 (patch)
treebec7b22ec6ea828b1716b39833ca447571bff67c /settings
parent5f8b935c8e44304db3d0d0caefbc78e503041bcf (diff)
downloadnextcloud-server-127b21b493323034eff6944c0ec7a808529e7529.tar.gz
nextcloud-server-127b21b493323034eff6944c0ec7a808529e7529.zip
Implement app bundle management
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings')
-rw-r--r--settings/src/components/appList.vue32
-rw-r--r--settings/src/store/apps.js28
2 files changed, 52 insertions, 8 deletions
diff --git a/settings/src/components/appList.vue b/settings/src/components/appList.vue
index 78e6cdb5adf..36980f57085 100644
--- a/settings/src/components/appList.vue
+++ b/settings/src/components/appList.vue
@@ -113,10 +113,40 @@ export default {
},
useBundleView() {
return (this.category === 'app-bundles');
+ },
+ allBundlesEnabled() {
+ return function(id) {
+ console.log(this.bundleApps(id).filter(app => !app.active));
+ return this.bundleApps(id).filter(app => !app.active).length === 0;
+ }
+ },
+ bundleToggleText() {
+ return function(id) {
+ if (this.allBundlesEnabled(id)) {
+ return t('settings', 'Disable all');
+ }
+ return t('settings', 'Enable all');
+ }
}
},
methods: {
-
+ toggleBundle(id) {
+ if (this.allBundlesEnabled) {
+ return this.disableBundle(id);
+ }
+ return this.enableBundle(id);
+ },
+ enableBundle(id) {
+ let apps = this.bundleApps(id).map(app => app.id);
+ console.log(apps);
+ this.$store.dispatch('enableApp', { appId: apps, groups: [] })
+ .catch((error) => { console.log(error); OC.Notification.show(error)});
+ },
+ disableBundle(id) {
+ let apps = this.bundleApps(id).map(app => app.id);
+ this.$store.dispatch('disableApp', { appId: apps, groups: [] })
+ .catch((error) => { OC.Notification.show(error)});
+ }
},
}
</script>
diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js
index 5d935f59292..09bc00a3966 100644
--- a/settings/src/store/apps.js
+++ b/settings/src/store/apps.js
@@ -138,28 +138,42 @@ const getters = {
const actions = {
enableApp(context, { appId, groups }) {
+ let apps;
+ if (Array.isArray(appId)) {
+ apps = appId;
+ } else {
+ apps = [appId];
+ }
return api.requireAdmin().then((response) => {
- return api.post(OC.generateUrl(`settings/apps/enable/${appId}`), {
- groups: groups
- })
+ return api.post(OC.generateUrl(`settings/apps/enable`), {appIds: apps, groups: groups})
.then((response) => {
- context.commit('enableApp', {appId: appId, groups: groups});
+ apps.forEach(_appId => {
+ context.commit('enableApp', {appId: _appId, groups: groups});
+ });
return true;
})
.catch((error) => context.commit('APPS_API_FAILURE', { appId, error }))
}).catch((error) => context.commit('API_FAILURE', { appId, error }));
-
},
disableApp(context, { appId }) {
+ let apps;
+ if (Array.isArray(appId)) {
+ apps = appId;
+ } else {
+ apps = [appId];
+ }
return api.requireAdmin().then((response) => {
- return api.get(OC.generateUrl(`settings/apps/disable/${appId}`))
+ return api.post(OC.generateUrl(`settings/apps/disable`), {appIds: apps})
.then((response) => {
- context.commit('disableApp', appId);
+ apps.forEach(_appId => {
+ context.commit('disableApp', _appId);
+ });
return true;
})
.catch((error) => context.commit('APPS_API_FAILURE', { appId, error }))
}).catch((error) => context.commit('API_FAILURE', { appId, error }));
},
+ // TODO: use enable app
installApp(context, { appId }) {
return api.requireAdmin().then((response) => {
return api.get(OC.generateUrl(`settings/apps/enable/${appId}`))