diff options
author | Greta Doci <gretadoci@gmail.com> | 2019-10-11 15:29:41 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-11-26 17:32:40 +0100 |
commit | 277880318ba70575ce39b4410d10a526ca622424 (patch) | |
tree | 69152d996ef87d260678637e84633d307bd86134 /apps/settings/src | |
parent | b1dffc5c2dd17216c87788bf36b8e15b45be2241 (diff) | |
download | nextcloud-server-277880318ba70575ce39b4410d10a526ca622424.tar.gz nextcloud-server-277880318ba70575ce39b4410d10a526ca622424.zip |
Add update all button
Signed-off-by: Greta Doci <gretadoci@gmail.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/AppList.vue | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/apps/settings/src/components/AppList.vue b/apps/settings/src/components/AppList.vue index 3e40eeb5fbb..a406f6b8ff6 100644 --- a/apps/settings/src/components/AppList.vue +++ b/apps/settings/src/components/AppList.vue @@ -24,6 +24,13 @@ <div id="app-content-inner"> <div id="apps-list" class="apps-list" :class="{installed: (useBundleView || useListView), store: useAppStoreView}"> <template v-if="useListView"> + <div v-if="showUpdateAll" class="counter"> + {{ t('settings', '{counter} apps have an update available', {counter}) }} + <button v-if="showUpdateAll" + id="app-list-update-all" + class="primary" + @click="updateAll">{{t('settings', 'Update all')}}</button> + </div> <transition-group name="app-list" tag="div" class="apps-list-container"> <AppItem v-for="app in apps" :key="app.id" @@ -91,6 +98,7 @@ <script> import AppItem from './AppList/AppItem' import PrefixMixin from './PrefixMixin' +import pLimit from 'p-limit' export default { name: 'AppList', @@ -100,9 +108,18 @@ export default { mixins: [PrefixMixin], props: ['category', 'app', 'search'], computed: { + counter() { + return this.apps.filter(app => app.update).length + }, loading() { return this.$store.getters.loading('list') }, + hasPendingUpdate() { + return this.apps.filter(app => app.update).length > 1 + }, + showUpdateAll() { + return this.hasPendingUpdate && ['installed', 'updates'].includes(this.category) + }, apps() { let apps = this.$store.getters.getAllApps .filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1) @@ -189,12 +206,24 @@ export default { enableBundle(id) { let apps = this.bundleApps(id).map(app => app.id) this.$store.dispatch('enableApp', { appId: apps, groups: [] }) - .catch((error) => { console.error(error); OC.Notification.show(error) }) + .catch((error) => { + console.error(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) }) + .catch((error) => { + OC.Notification.show(error) + }) + }, + updateAll() { + const limit = pLimit(1) + this.apps + .filter(app => app.update) + .map(app => limit(() => this.$store.dispatch('updateApp', { appId: app.id })) + ) } } } |