From ed7aa81aea1591126d80be7699e29f390d8b5253 Mon Sep 17 00:00:00 2001 From: Norman Niati Date: Wed, 20 May 2026 18:00:08 +0200 Subject: [PATCH] feat(plugin-id/ui): convert user edit to a dialog (chantier I.2) Per Fabrice's review (chantier I.2): the user create/edit screen is no longer a routed page but a popup, mirroring the Roles screen. - Extract the former UserEditView form into UserEditDialog.vue, a v-dialog component (props modelValue + userId, emits saved). It is hosted by UserListView and opened from the "New user" button and the row gear menu's Edit action; clicking a row also opens it. - Remove the per-entity routes /id/user/new and /id/user/:id (Option A, mirroring the Roles screen which has no per-entity route). - Adapt the unsaved-changes guard: useFormGuard's onBeforeRouteLeave is inert without a route change, so the dialog binds model-value one-way and intercepts every close (Cancel / Esc / scrim) through requestClose, which raises the existing guard dialog when the form is dirty. - Rearrange the lock/isolate/reset actions inside the dialog as a compact bordered list, consistent with the row gear menu. - Preload the Groups dropdown's first page of options when it opens, in edit mode as well as create, so the user always sees a list to pick from without typing; already-assigned groups are merged in so their chips keep rendering. --- ui/src/index.js | 5 +- .../{UserEditView.vue => UserEditDialog.vue} | 437 +++++++++++------- ui/src/views/UserListView.vue | 36 +- 3 files changed, 300 insertions(+), 178 deletions(-) rename ui/src/views/{UserEditView.vue => UserEditDialog.vue} (52%) diff --git a/ui/src/index.js b/ui/src/index.js index a10e316..74abdec 100644 --- a/ui/src/index.js +++ b/ui/src/index.js @@ -36,7 +36,6 @@ if (typeof document !== 'undefined') { import { useI18nStore } from '@ligoj/host' import IdPlugin from './IdPlugin.vue' import UserListView from './views/UserListView.vue' -import UserEditView from './views/UserEditView.vue' import GroupListView from './views/GroupListView.vue' import GroupEditView from './views/GroupEditView.vue' import CompanyListView from './views/CompanyListView.vue' @@ -55,9 +54,9 @@ const features = { } const routes = [ + // User create/edit is a dialog hosted by UserListView (chantier I.2), + // so there is no per-entity user route — mirrors the Roles screen. { path: '/id/user', name: 'id-user', component: UserListView }, - { path: '/id/user/new', name: 'id-user-new', component: UserEditView }, - { path: '/id/user/:id', name: 'id-user-edit', component: UserEditView }, { path: '/id/group', name: 'id-group', component: GroupListView }, { path: '/id/group/new', name: 'id-group-new', component: GroupEditView }, { path: '/id/group/:id', name: 'id-group-edit', component: GroupEditView }, diff --git a/ui/src/views/UserEditView.vue b/ui/src/views/UserEditDialog.vue similarity index 52% rename from ui/src/views/UserEditView.vue rename to ui/src/views/UserEditDialog.vue index 6e8a518..d952c97 100644 --- a/ui/src/views/UserEditView.vue +++ b/ui/src/views/UserEditDialog.vue @@ -1,119 +1,134 @@