mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Various fixes and group deletion
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
8bca1558c3
commit
e1297f1fde
5 changed files with 31 additions and 18 deletions
File diff suppressed because one or more lines are too long
|
|
@ -17,14 +17,14 @@
|
|||
<!-- first action if only one action and counter -->
|
||||
<li v-if="item.utils.actions && item.utils.actions.length === 1 && Number.isInteger(item.utils.counter)"
|
||||
class="app-navigation-entry-utils-menu-button">
|
||||
<button :class="item.utils.actions[0].icon"></button>
|
||||
<button @click="item.utils.actions[0].action" :class="item.utils.actions[0].icon" :title="item.utils.actions[0].text"></button>
|
||||
</li>
|
||||
|
||||
<!-- second action only two actions and no counter -->
|
||||
<li v-else-if="item.utils.actions && item.utils.actions.length === 2 && !Number.isInteger(item.utils.counter)"
|
||||
v-for="action in item.utils.actions" :key="action.action"
|
||||
class="app-navigation-entry-utils-menu-button">
|
||||
<button :class="action.icon"></button>
|
||||
<button @click="action.action" :class="action.icon" :title="action.text"></button>
|
||||
</li>
|
||||
|
||||
<!-- menu if only at least one action and counter OR two actions and no counter-->
|
||||
|
|
@ -77,7 +77,7 @@ export default {
|
|||
directives: {
|
||||
ClickOutside
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
openedMenu: false
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ export default {
|
|||
this.item.classes = this.item.classes.filter(item => item !== 'editing');
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
// prevent click outside event with popupItem.
|
||||
this.popupItem = this.$el;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -192,10 +192,10 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
/* MENU HANDLING */
|
||||
showMenu () {
|
||||
showMenu() {
|
||||
this.openedMenu = true;
|
||||
},
|
||||
hideMenu () {
|
||||
hideMenu() {
|
||||
this.openedMenu = false;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const orderGroups = function(groups, orderBy) {
|
|||
} else {
|
||||
return groups.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const state = {
|
||||
users: [],
|
||||
|
|
|
|||
|
|
@ -115,12 +115,11 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
userCount() {
|
||||
return this.$store.getters.getUserCount;
|
||||
},
|
||||
|
||||
menu() {
|
||||
let self = this;
|
||||
// Data provided php side
|
||||
let groups = this.$store.getters.getGroups;
|
||||
groups = Array.isArray(groups) ? groups : [];
|
||||
|
|
@ -133,6 +132,15 @@ export default {
|
|||
item.href = '#group'+group.id.replace(' ', '_');
|
||||
item.text = group.name;
|
||||
item.utils = {counter: group.usercount};
|
||||
if (item.id !== 'admin' && item.id !== '_disabled') {
|
||||
// add delete button
|
||||
let self = this;
|
||||
item.utils.actions = [{
|
||||
icon: 'icon-delete',
|
||||
text: t('settings', 'Remove group'),
|
||||
action: function(){}
|
||||
}];
|
||||
};
|
||||
return item;
|
||||
});
|
||||
|
||||
|
|
@ -140,11 +148,12 @@ export default {
|
|||
let adminGroup = groups.find(group => group.id == 'admin');
|
||||
let disabledGroup = groups.find(group => group.id == '_disabled');
|
||||
if (adminGroup.text) {
|
||||
adminGroup.text = t('settings', 'Admins');} // rename admin group
|
||||
adminGroup.text = t('settings', 'Admins'); // rename admin group
|
||||
}
|
||||
if (disabledGroup.text) {
|
||||
disabledGroup.text = t('settings', 'Disabled users'); // rename disabled group
|
||||
disabledGroup.text = t('settings', 'Disabled users'); // rename disabled group
|
||||
if (disabledGroup.utils.counter === 0) {
|
||||
groups.splice(groups.findIndex(group => group.id == '_disabled'), 1); // remove disabled if empty
|
||||
groups.splice(groups.findIndex(group => group.id == '_disabled'), 1); // remove disabled if empty
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -172,10 +181,14 @@ export default {
|
|||
id:'new-user-button',
|
||||
text: t('settings','New user'),
|
||||
icon: 'icon-add',
|
||||
action: function(){self.showConfig.showNewUserForm=!self.showConfig.showNewUserForm}
|
||||
action: () => this.showConfig.showNewUserForm=!this.showConfig.showNewUserForm
|
||||
},
|
||||
items: groups
|
||||
}
|
||||
},
|
||||
removeGroup(groupid) {
|
||||
console.trace(this);
|
||||
return this.$store.dispatch('removeGroup', groupid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue