Merge pull request #14322 from nextcloud/users-management-enhancements

Users management enhancements and fixes
This commit is contained in:
Roeland Jago Douma 2019-02-26 08:57:40 +01:00 committed by GitHub
commit fc105d3bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 4077 additions and 24 deletions

26
package-lock.json generated
View file

@ -1413,7 +1413,7 @@
},
"util": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"dev": true,
"requires": {
@ -1436,7 +1436,7 @@
},
"async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
},
"async-each": {
@ -2307,13 +2307,13 @@
"dependencies": {
"jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
},
"regexpu-core": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz",
"resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz",
"integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=",
"dev": true,
"requires": {
@ -2324,13 +2324,13 @@
},
"regjsgen": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
"resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
"integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=",
"dev": true
},
"regjsparser": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
"resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
"integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=",
"dev": true,
"requires": {
@ -2779,7 +2779,7 @@
"dependencies": {
"source-map": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.0.tgz",
"resolved": "http://registry.npmjs.org/source-map/-/source-map-0.5.0.tgz",
"integrity": "sha1-D+llA6yGpa213mP05BKuSHLNvoY=",
"dev": true
}
@ -3841,7 +3841,7 @@
},
"handlebars": {
"version": "4.1.0",
"resolved": "http://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz",
"integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==",
"requires": {
"async": "^2.5.0",
@ -3852,7 +3852,7 @@
"dependencies": {
"async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz",
"resolved": "http://registry.npmjs.org/async/-/async-2.6.1.tgz",
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
"requires": {
"lodash": "^4.17.10"
@ -4510,7 +4510,7 @@
},
"json5": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
"dev": true
},
@ -4872,7 +4872,7 @@
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"mississippi": {
@ -6197,7 +6197,7 @@
"dependencies": {
"jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
}
@ -7830,7 +7830,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {

605
settings/js/vue-1.js Normal file

File diff suppressed because one or more lines are too long

1
settings/js/vue-1.js.map Normal file

File diff suppressed because one or more lines are too long

3418
settings/js/vue-2.js Normal file

File diff suppressed because one or more lines are too long

1
settings/js/vue-2.js.map Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -189,7 +189,7 @@ export default {
* In case the user directly loaded the user list within a group
* the watch won't be triggered. We need to initialize it.
*/
this.setNewUserDefaultGroup(this.$route.params.selectedGroup);
this.setNewUserDefaultGroup(this.selectedGroup);
/**
* Register search
@ -206,7 +206,7 @@ export default {
if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) {
// disabled group is empty, redirection to all users
this.$router.push({name: 'users'});
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
this.$refs.infiniteLoading.stateChanger.reset()
}
return disabledUsers;
}
@ -253,6 +253,9 @@ export default {
usersLimit() {
return this.$store.getters.getUsersLimit;
},
usersCount() {
return this.users.length
},
/* LANGUAGES */
languages() {
@ -272,8 +275,22 @@ export default {
// watch url change and group select
selectedGroup: function (val, old) {
this.$store.commit('resetUsers');
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
this.$refs.infiniteLoading.stateChanger.reset()
this.setNewUserDefaultGroup(val);
},
// make sure the infiniteLoading state is changed if we manually
// add/remove data from the store
usersCount: function(val, old) {
// deleting the last user, reset the list
if (val === 0 && old === 1) {
this.$refs.infiniteLoading.stateChanger.reset()
// adding the first user, warn the infiniteLoader that
// the list is not empty anymore (we don't fetch the newly
// added user as we already have all the info we need)
} else if (val === 1 && old === 0) {
this.$refs.infiniteLoading.stateChanger.loaded()
}
}
},
methods: {
@ -313,7 +330,7 @@ export default {
search(query) {
this.searchQuery = query;
this.$store.commit('resetUsers');
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
this.$refs.infiniteLoading.stateChanger.reset()
},
resetSearch() {
this.search('');
@ -322,6 +339,8 @@ export default {
resetForm() {
// revert form to original state
Object.assign(this.newUser, this.$options.data.call(this).newUser);
// reset group
this.setNewUserDefaultGroup(this.selectedGroup);
this.loading.all = false;
},
createUser() {
@ -336,7 +355,9 @@ export default {
quota: this.newUser.quota.id,
language: this.newUser.language.code,
})
.then(() => this.resetForm())
.then(() => {
this.resetForm()
})
.catch((error) => {
this.loading.all = false;
if (error.response && error.response.data && error.response.data.ocs && error.response.data.ocs.meta) {

View file

@ -21,7 +21,7 @@
-->
<template>
<AppContent app-name="settings" :navigation-class="{ 'icon-loading': loading }">
<AppContent app-name="settings" :navigation-class="{ 'icon-loading': loadingAddGroup }">
<template #navigation>
<AppNavigationNew button-id="new-user-button" :text="t('settings','New user')" button-class="icon-add" @click="toggleNewUserMenu" />
<ul id="usergrouplist">
@ -227,6 +227,12 @@ export default {
.then(() => {
this.showAddGroupEntry = false;
this.loadingAddGroup = false;
this.$router.push({
name: 'group',
params: {
selectedGroup: gid
}
})
})
.catch(() => {
this.loadingAddGroup = false;
@ -237,9 +243,6 @@ export default {
users() {
return this.$store.getters.getUsers;
},
loading() {
return Object.keys(this.users).length === 0;
},
usersOffset() {
return this.$store.getters.getUsersOffset;
},
@ -422,6 +425,10 @@ export default {
} else {
Vue.set(addGroup, 'action', function() {
self.showAddGroupEntry = true
// focus input
Vue.nextTick(() => {
window.addgroup.querySelector('form > input[type="text"]').focus()
})
})
}
groups.unshift(addGroup);