From b9a24bfef8aad3e8ccdb8a72d654e14a03d2bf30 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Wed, 8 Aug 2018 19:17:55 +0200 Subject: Allow external actions to users list + Created fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- settings/src/components/userList.vue | 5 +++-- settings/src/components/userList/userRow.vue | 9 +++++---- settings/src/views/Users.vue | 30 +++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 7 deletions(-) (limited to 'settings/src') diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue index 0649575bf88..69f459b3a6c 100644 --- a/settings/src/components/userList.vue +++ b/settings/src/components/userList.vue @@ -119,7 +119,8 @@ + :groups="groups" :subAdminsGroups="subAdminsGroups" :quotaOptions="quotaOptions" :languages="languages" + :externalActions="externalActions" />
@@ -141,7 +142,7 @@ import Vue from 'vue'; export default { name: 'userList', - props: ['users', 'showConfig', 'selectedGroup'], + props: ['users', 'showConfig', 'selectedGroup', 'externalActions'], components: { userRow, Multiselect, diff --git a/settings/src/components/userList/userRow.vue b/settings/src/components/userList/userRow.vue index b0b638ee687..1b1bb1b5fc4 100644 --- a/settings/src/components/userList/userRow.vue +++ b/settings/src/components/userList/userRow.vue @@ -22,7 +22,7 @@ - + @@ -83,12 +83,24 @@ export default { }); this.$store.dispatch('getPasswordPolicyMinLength'); }, + created() { + // init the OCA.Settings.UserList object + // and add the registerAction method + Object.assign(OCA, { + Settings: { + UserList: { + registerAction: this.registerAction + } + } + }); + }, data() { return { // default quota is set to unlimited unlimitedQuota: {id: 'none', label: t('settings', 'Unlimited')}, // temporary value used for multiselect change selectedQuota: false, + externalActions: [], showConfig: { showStoragePath: false, showUserBackend: false, @@ -171,6 +183,22 @@ export default { // if no valid do not change return false; }, + + /** + * Register a new action for the user menu + * + * @param {string} icon the icon class + * @param {string} text the text to display + * @param {function} action the function to run + */ + registerAction(icon, text, action) { + this.externalActions.push({ + icon: icon, + text: text, + action: action + }); + return this.externalActions; + } }, computed: { users() { -- cgit v1.2.3