Browse Source

Redirect if disabled list is empty

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tags/v14.0.0beta1
John Molakvoæ (skjnldsv) 6 years ago
parent
commit
85f5ae9264
No account linked to committer's email address
4 changed files with 579 additions and 38 deletions
  1. 568
    23
      settings/js/main.js
  2. 9
    6
      settings/src/components/userList.vue
  3. 1
    8
      settings/src/store/index.js
  4. 1
    1
      settings/src/views/Users.vue

+ 568
- 23
settings/js/main.js
File diff suppressed because it is too large
View File


+ 9
- 6
settings/src/components/userList.vue View File

@@ -139,8 +139,14 @@ export default {
return this.$store.getters.getServerData;
},
filteredUsers() {
if (this.route.hash === '#group_disabled') {
return this.users.filter(user => user.enabled !== true);
if (this.$route.hash === '#group_disabled') {
let disabledUsers = this.users.filter(user => user.enabled !== true);
if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) {
// disabled group is empty, redirection to all users
window.location.hash = '#group_everyone';
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
}
return disabledUsers;
}
return this.users.filter(user => user.enabled === true);
},
@@ -169,12 +175,9 @@ export default {
usersLimit() {
return this.$store.getters.getUsersLimit;
},
route() {
return this.$store.getters.getRoute;
},
// get selected hash
selectedGroup() {
let hash = this.route.hash;
let hash = this.$route.hash;
if (typeof hash === 'string' && hash.length > 0) {
// we have a valid hash: groupXXXX
// group_XXXX are reserved groups

+ 1
- 8
settings/src/store/index.js View File

@@ -13,12 +13,6 @@ const mutations = {
}
};

const getters = {
getRoute(state) {
return state.route;
}
};

export default new Vuex.Store({
modules: {
users,
@@ -26,6 +20,5 @@ export default new Vuex.Store({
},
strict: debug,

mutations,
getters
mutations
});

+ 1
- 1
settings/src/views/Users.vue View File

@@ -142,7 +142,7 @@ export default {
});

// Set current group as active
let activeGroup = groups.findIndex(group => group.href === this.route.hash);
let activeGroup = groups.findIndex(group => group.href === this.$route.hash);
if (activeGroup >= 0) {
groups[activeGroup].classes.push('active');
} else {

Loading…
Cancel
Save