aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src
diff options
context:
space:
mode:
authorArcticFall <23174635+ArcticFall@users.noreply.github.com>2021-11-18 00:39:19 +0100
committerLouis Chemineau <louis@chmn.me>2022-02-01 12:54:55 +0100
commit1f80d767b4668de42bc6f53efa20dbb6e28fd1b5 (patch)
treec6fa7911dd78ddbb3116f270e648f0a88cf8873c /apps/settings/src
parentd635d58d19d5ab65c0be754fc32fce99672c249f (diff)
downloadnextcloud-server-1f80d767b4668de42bc6f53efa20dbb6e28fd1b5.tar.gz
nextcloud-server-1f80d767b4668de42bc6f53efa20dbb6e28fd1b5.zip
Add ActionInput for renaming a group and corresponding method.
Signed-off-by: Martin Jänel <spammemore@posteo.de> Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/settings/src')
-rw-r--r--apps/settings/src/views/Users.vue30
1 files changed, 29 insertions, 1 deletions
diff --git a/apps/settings/src/views/Users.vue b/apps/settings/src/views/Users.vue
index 02f55a0d3cb..a606600b6ca 100644
--- a/apps/settings/src/views/Users.vue
+++ b/apps/settings/src/views/Users.vue
@@ -81,7 +81,15 @@
<AppNavigationCounter v-if="group.count" slot="counter">
{{ group.count }}
</AppNavigationCounter>
- <template slot="actions">
+ <template #actions>
+ <ActionInput v-if="group.id !== 'admin' && group.id !== 'disabled' && settings.isAdmin"
+ ref="displayNameInput"
+ icon="icon-edit"
+ type="text"
+ :value="group.title"
+ @submit="renameGroup(group.id)">
+ {{ t('settings', 'Rename group') }}
+ </ActionInput>
<ActionButton v-if="group.id !== 'admin' && group.id !== 'disabled' && settings.isAdmin"
icon="icon-delete"
@click="removeGroup(group.id)">
@@ -154,6 +162,7 @@
</template>
<script>
+import ActionInput from '@nextcloud/vue/dist/Components/ActionInput'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import AppContent from '@nextcloud/vue/dist/Components/AppContent'
import AppNavigation from '@nextcloud/vue/dist/Components/AppNavigation'
@@ -176,6 +185,7 @@ Vue.use(VueLocalStorage)
export default {
name: 'Users',
components: {
+ ActionInput,
ActionButton,
AppContent,
AppNavigation,
@@ -366,6 +376,24 @@ export default {
this.$localStorage.set(key, status)
return status
},
+ async renameGroup(gid) {
+ // check if group id is valid
+ if (gid.trim() === '') {
+ return
+ }
+
+ const displayName = this.$refs.displayNameInput[0].$el.querySelector('input[type="text"]').value
+
+ // check if group name is valid
+ if (displayName.trim() === '') {
+ return
+ }
+
+ try {
+ await this.$store.dispatch('renameGroup', { groupid: gid.trim(), displayName: displayName.trim() })
+ } catch {
+ }
+ },
removeGroup(groupid) {
const self = this
// TODO migrate to a vue js confirm dialog component