summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-05-29 16:58:22 +0200
committerJulius Härtl <jus@bitgrid.net>2018-06-06 11:40:09 +0200
commit7c639a5399599cb731ce55d60487211568fcd6ee (patch)
tree64ad4c21d8b2db681fcfce5fcaf65e0f032b15b8 /settings
parent8b919ecdc4624d13423f6fd6bb00a48bf3f48c62 (diff)
downloadnextcloud-server-7c639a5399599cb731ce55d60487211568fcd6ee.tar.gz
nextcloud-server-7c639a5399599cb731ce55d60487211568fcd6ee.zip
Implement loading indicators
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings')
-rw-r--r--settings/src/components/appList.vue31
-rw-r--r--settings/src/store/apps.js26
-rw-r--r--settings/src/views/Apps.vue12
3 files changed, 38 insertions, 31 deletions
diff --git a/settings/src/components/appList.vue b/settings/src/components/appList.vue
index 56e169c7dde..07a8a2d3267 100644
--- a/settings/src/components/appList.vue
+++ b/settings/src/components/appList.vue
@@ -21,7 +21,7 @@
-->
<template>
- <div id="app-content" class="app-settings-content" :class="{ 'with-app-sidebar': app }">
+ <div id="app-content" class="app-settings-content" :class="{ 'with-app-sidebar': app, 'icon-loading': loading }">
<div id="apps-list" class="installed" v-if="useListView">
<app-item v-for="app in apps" :key="app.id" :app="app" :category="category" />
</div>
@@ -44,7 +44,7 @@
<app-item v-for="app in apps" :key="app.id" :app="app" :category="category" :list-view="false" />
</div>
- <div id="apps-list" class="installed" v-if="search !== ''">
+ <div id="apps-list" class="installed" v-if="search !== '' && searchApps.length > 0">
<div class="section">
<div></div>
<h2>{{ t('settings', 'Results from other categories') }}</h2>
@@ -52,7 +52,7 @@
<app-item v-for="app in searchApps" :key="app.id" :app="app" :category="category" :list-view="true" />
</div>
- <div id="apps-list-empty" class="emptycontent emptycontent-search" v-if="apps.length == 0 && loading">
+ <div id="apps-list-empty" class="emptycontent emptycontent-search" v-if="!loading && searchApps.length === 0 && apps.length === 0">
<div id="app-list-empty-icon" class="icon-search"></div>
<h2>{{ t('settings', 'No apps found for your versoin')}}</h2>
</div>
@@ -74,21 +74,10 @@ export default {
Multiselect,
appItem
},
- data() {
- return {
- loading: false,
- scrolled: false,
- };
- },
- watch: {
-
- },
- mounted() {
- //this.$store.dispatch('getApps', { category: this.category });
- this.$store.dispatch('getGroups');
-
- },
computed: {
+ loading() {
+ return this.$store.getters.loading('list');
+ },
apps() {
return this.$store.getters.getApps
.filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1)
@@ -100,14 +89,8 @@ export default {
return (!this.apps.find(_app => _app.id === app.id));
}
return false;
-
});
},
- groups() {
- return this.$store.getters.getGroups
- .filter(group => group.id !== 'disabled')
- .sort((a, b) => a.name.localeCompare(b.name));
- },
useAppStoreView() {
return !this.useListView && !this.useBundleView;
},
@@ -120,6 +103,6 @@ export default {
},
methods: {
- }
+ },
}
</script>
diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js
index cc859c96845..5d935f59292 100644
--- a/settings/src/store/apps.js
+++ b/settings/src/store/apps.js
@@ -22,12 +22,15 @@
import api from './api';
import axios from 'axios/index';
+import Vue from 'vue';
const state = {
apps: [],
allApps: [],
categories: [],
- updateCount: 0
+ updateCount: 0,
+ loading: {},
+ loadingList: false,
};
const mutations = {
@@ -93,10 +96,23 @@ const mutations = {
state.apps = [];
state.categories = [];
state.updateCount = 0;
- }
+ },
+ startLoading(state, id) {
+ Vue.set(state.loading, id, true);
+ console.log(state.loading);
+ },
+ stopLoading(state, id) {
+ Vue.set(state.loading, id, false);
+ console.log(state.loading);
+ },
};
const getters = {
+ loading(state) {
+ return function(id) {
+ return state.loading[id];
+ }
+ },
getCategories(state) {
return state.categories;
},
@@ -166,28 +182,34 @@ const actions = {
},
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');
return api.get(OC.generateUrl(`settings/apps/list`))
.then((response) => {
context.commit('setAllApps', response.data.apps);
+ context.commit('stopLoading', 'all');
return true;
})
.catch((error) => context.commit('API_FAILURE', error))
},
getCategories(context) {
+ context.commit('startLoading', 'categories');
return api.get(OC.generateUrl('settings/apps/categories'))
.then((response) => {
if (response.data.length > 0) {
context.commit('appendCategories', response.data);
+ context.commit('stopLoading', 'categories');
return true;
}
return false;
diff --git a/settings/src/views/Apps.vue b/settings/src/views/Apps.vue
index d59a62ee22c..54a83444a2e 100644
--- a/settings/src/views/Apps.vue
+++ b/settings/src/views/Apps.vue
@@ -69,6 +69,7 @@ export default {
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)
console.log(this.$store.getters.getServerData.updateCount);
},
@@ -93,6 +94,9 @@ export default {
}
},
computed: {
+ loading() {
+ return this.$store.getters.loading('categories');
+ },
currentApp() {
return this.apps.find(app => app.id === this.id );
},
@@ -102,9 +106,6 @@ export default {
apps() {
return this.$store.getters.getApps;
},
- loading() {
- return Object.keys(this.apps).length === 0;
- },
updateCount() {
return this.$store.getters.getUpdateCount;
},
@@ -161,7 +162,7 @@ export default {
if (!this.settings.appstoreEnabled) {
return {
id: 'appscategories',
- items: defaultCategories
+ items: defaultCategories,
}
}
@@ -204,7 +205,8 @@ export default {
// Return
return {
id: 'appscategories',
- items: categories
+ items: categories,
+ loading: this.loading
}
},
}