From f09f1f4f1ee9d4ddab80b0ddcc1a474e974673ab Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 22 Dec 2019 16:08:18 -0500 Subject: [PATCH] feat: delete a user --- .../components/admin/admin-users-create.vue | 3 +- client/components/admin/admin-users-edit.vue | 87 +++++++++++++++---- .../admin/users/users-mutation-delete.gql | 12 +++ server/graph/resolvers/user.js | 24 +++-- server/helpers/error.js | 8 ++ .../rendering/openapi-core/definition.yml | 8 ++ .../rendering/openapi-core/renderer.js | 14 +++ 7 files changed, 135 insertions(+), 21 deletions(-) create mode 100644 client/graph/admin/users/users-mutation-delete.gql create mode 100644 server/modules/rendering/openapi-core/definition.yml create mode 100644 server/modules/rendering/openapi-core/renderer.js diff --git a/client/components/admin/admin-users-create.vue b/client/components/admin/admin-users-create.vue index 17bb03ec..5ea9ddef 100644 --- a/client/components/admin/admin-users-create.vue +++ b/client/components/admin/admin-users-create.vue @@ -57,7 +57,8 @@ prepend-icon='mdi-account-group' v-model='group' label='Assign to Group(s)...' - dense + hint='Note that you cannot assign users to the Administrators or Guests groups from this dialog.' + persistent-hint clearable multiple ) diff --git a/client/components/admin/admin-users-edit.vue b/client/components/admin/admin-users-edit.vue index a16e87cd..034370bd 100644 --- a/client/components/admin/admin-users-edit.vue +++ b/client/components/admin/admin-users-edit.vue @@ -23,23 +23,30 @@ v-spacer i18next.caption.grey--text.animated.fadeInRight.wait-p5s(path='admin:users.id', tag='div') strong(place='id') {{user.id}} - v-divider.animated.fadeInRight.wait-p3s.ml-3(vertical) - v-btn.ml-3.animated.fadeInDown.wait-p2s(color='grey', large, outlined, to='/users') + v-divider.animated.fadeInRight.wait-p4s.ml-3(vertical) + v-btn.ml-3.animated.fadeInDown.wait-p3s(color='grey', large, outlined, to='/users') v-icon mdi-arrow-left - v-dialog(v-model='deleteUserDialog', max-width='500', v-if='user.id !== currentUserId && !user.isSystem') + v-menu(offset-y, origin='top right') template(v-slot:activator='{ on }') - v-btn.ml-3.animated.fadeInDown.wait-p1s(color='red', large, outlined, v-on='on', disabled) - v-icon(color='red') mdi-trash-can-outline - v-card - .dialog-header.is-red Delete User? - v-card-text Are you sure you want to delete user #[strong {{ user.name }}]? - v-card-actions - v-spacer - v-btn(text, @click='deleteUserDialog = false') Cancel - v-btn(color='red', dark, @click='deleteUser') Delete + v-btn.ml-3.animated.fadeInDown.wait-p2s(color='indigo', v-on='on', large, depressed, dark) + span Actions + v-icon(right) mdi-chevron-down + v-list(dense, nav) + v-list-item(v-if='!user.isActive', @click='activateUser') + v-list-item-icon + v-icon(color='purple') mdi-steering + v-list-item-title Activate + v-list-item(v-else, @click='deactivateUser', :disabled='user.id == currentUserId || user.isSystem') + v-list-item-icon + v-icon(color='purple') mdi-cancel + v-list-item-title Deactivate + v-list-item(@click='deleteUserDialog = true', :disabled='user.id == currentUserId || user.isSystem') + v-list-item-icon + v-icon(color='red') mdi-trash-can-outline + v-list-item-title Delete v-btn.ml-3.animated.fadeInDown(color='primary', large, depressed, @click='updateUser') v-icon(left) mdi-check - span Update User + span {{$t('admin:users.updateUser')}} v-flex(xs6) v-card.animated.fadeInUp v-toolbar(color='primary', dense, dark, flat) @@ -208,7 +215,6 @@ item-disabled='isSystem' solo flat - dense hide-details @keydown.esc='editPop.assignGroup = false' style='max-width: 300px;' @@ -216,6 +222,10 @@ v-btn.ml-2.px-4(depressed, color='primary', height='48', @click='assignGroup', :disabled='newGroup === 0') v-icon(left) mdi-clipboard-account-outline span {{$t('admin:users.groupAssign')}} + v-system-bar(window, :color='$vuetify.theme.dark ? `grey darken-4-l3` : `grey lighten-3`') + v-spacer + .caption {{$t('admin:users.groupAssignNotice')}} + v-flex(xs6) v-card.animated.fadeInUp.wait-p2s v-toolbar(color='primary', dense, dark, flat) @@ -317,6 +327,18 @@ v-card-text em.caption.grey--text Coming soon + v-dialog(v-model='deleteUserDialog', max-width='500') + v-card + .dialog-header.is-red {{$t('admin:users.deleteConfirmTitle')}} + v-card-text.pt-5 + i18next(path='admin:users.deleteConfirmText', tag='span') + strong(place='username') {{ user.email }} + .caption.mt-3 {{$t('admin:users.deleteConfirmForeignNotice')}} + v-card-actions + v-spacer + v-btn(text, @click='deleteUserDialog = false') {{$t('common:actions.cancel')}} + v-btn(color='red', dark, @click='deleteUser') {{$t('common:actions.delete')}} +