Przeglądaj źródła

Redirect if disabled list is empty

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tags/v14.0.0beta1
John Molakvoæ (skjnldsv) 6 lat temu
rodzic
commit
85f5ae9264
No account linked to committer's email address

+ 568
- 23
settings/js/main.js
Plik diff jest za duży
Wyświetl plik


+ 9
- 6
settings/src/components/userList.vue Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 {

Ładowanie…
Anuluj
Zapisz