Commit 0ca1f8b
committed
Resolves #7253(FR-2819)
## Summary
Sweep all permanent-delete flows that still used `modal.confirm` / `Popconfirm` / ad-hoc dialogs and move them onto the project's typed-confirmation pattern (`.claude/rules/destructive-confirmation.md`). In the process, **consolidate two overlapping components** — `BAIConfirmModalWithInput` and `BAIDeleteConfirmModal` — into a single API so every irreversible delete in the app looks and behaves the same.
## What changed
### Component consolidation
- **Remove `BAIConfirmModalWithInput`** (component, stories, exports). All 16 call sites are migrated to `BAIDeleteConfirmModal`.
- **Extend `BAIDeleteConfirmModal`**:
- Add `requireConfirmInput` to force typed confirmation for single-item deletes.
- Add `target` prop — when set (and no `description` is provided) the modal renders the localized "Are you sure you want to permanently delete {target}?" copy. Centralizes the most common irreversible-delete sentence so call sites don't redeclare it.
- Reinstall-confirm flows (`ManageImageResourceLimitModal`, `ManageAppsModal`) — which are confirmations but **not deletes** — are moved to plain `BAIModal` instead of a delete-shaped modal. They were only on `BAIConfirmModalWithInput` for the typed-input UX, which they don't actually need.
### Bug fixes (the issue's scope)
- `UserCredentialList.tsx` — permanent keypair deletion was a single-click `modal.confirm`. Now opens `BAIDeleteConfirmModal` with `requireConfirmInput` and the keypair's `access_key` as the confirm string.
- `AutoScalingRuleListLegacy.tsx` — permanent rule deletion was a `Popconfirm`. Now opens `BAIDeleteConfirmModal` requiring the rule's identifier to be typed. Card is migrated to `BAICard` in the same change per project convention.
### Sweep — other irreversible flows migrated
Single-click confirms / ad-hoc patterns replaced with `BAIDeleteConfirmModal` (+ `requireConfirmInput` where the item is sensitive):
- `AutoScalingRuleList.tsx` (V2)
- `ContainerRegistryList.tsx`
- `CustomizedImageList.tsx`
- `DeleteForeverVFolderModalV2.tsx`
- `DeploymentAccessTokensTab.tsx`, `DeploymentConfigurationSection.tsx`, `DeploymentList.tsx`, `EndpointList.tsx`
- `KeypairResourcePolicyList.tsx`, `ProjectResourcePolicyList.tsx`, `UserResourcePolicyList.tsx`
- `MyKeypairManagementModal.tsx`
- `PrometheusPresetTab.tsx`
- `PurgeUsersModal.tsx`
- `ResourceGroupList.tsx`, `ResourcePresetList.tsx`
- `RoleAssignmentTab.tsx`, `RolePermissionTab.tsx`, `RBACManagementPage.tsx`
- `ShellScriptEditModal.tsx`
- `UserCredentialList.tsx`
- `VFolderNodes.tsx`
- `AIAgentPage.tsx`
- `FileExplorer/DeleteSelectedItemsModal.tsx`
- `fragments/BAIProjectTable.tsx`
### `confirmText` policy
Standardized so each call site picks the **safer** of two options:
- **User-readable IDs** (project name, vfolder name, keypair `access_key`, role name, …) → use the resource's name as the confirm string. The user has it on screen and can copy-type it unambiguously.
- **Cryptic / long IDs** (image full path, autoscaling metric name, bulk purge across N users) → use the literal `"Permanently Delete"` string. Asking the user to type a 90-char Docker reference is worse UX, not better.
Activate / deactivate (reversible) flows are intentionally **left as-is** — those belong to FR-2825.
### i18n
- New keys across all 22 locales:
- `general.*` resource-type labels (9 new entries) for the `target` prop.
- `dialog.title.DeleteSomething`
- `comp:BAIDeleteConfirmModal.AreYouSureToPermanentlyDeleteTarget`
- Filled in previously missing keys across non-English locales (translations were already drifting; this PR brings them back in sync).
- Fix one Korean typo: `environment.ModifyImageResourceLimitReinstallRequired`.
### Storybook
- Remove `BAIConfirmModalWithInput.stories.tsx`.
- Add a Storybook case for the new `target` prop on `BAIDeleteConfirmModal`.
## Why one API, not two
Before: `BAIConfirmModalWithInput` (typed-input shape) and `BAIDeleteConfirmModal` (item-list shape) covered overlapping use cases — the typed-input modal was being used for deletes, and call sites were duplicating copy and layout that already existed in `BAIDeleteConfirmModal`. After: a single component covers both the single-item and N-item delete cases, with `requireConfirmInput` and `target` handling the variants. Less surface area, less drift, fewer translation keys to keep aligned.
## Checklist
- [x] Documentation — N/A (no user-facing manual change; convention rule unchanged)
- [x] Minimum required manager version — N/A
- [x] Specific setting for review — none
- [x] Minimum requirements to check during review — `bash scripts/verify.sh` passes; manually exercise a few migrated flows (keypair delete, autoscaling rule delete, vfolder permanent delete, bulk user purge) to confirm the OK button stays disabled until the right string is typed
- [x] Test case(s) — see Storybook stories and the migrated call sites; behavior across all 16 sites is now driven by one component
1 parent 674da9d commit 0ca1f8b
77 files changed
Lines changed: 1036 additions & 1296 deletions
File tree
- packages/backend.ai-ui/src
- components
- baiClient/FileExplorer
- fragments
- locale
- react/src
- components
- pages
- resources/i18n
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 0 additions & 169 deletions
This file was deleted.
Lines changed: 0 additions & 109 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
96 | 130 | | |
97 | 131 | | |
98 | 132 | | |
| |||
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
| |||
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
95 | 106 | | |
96 | 107 | | |
97 | 108 | | |
| |||
159 | 170 | | |
160 | 171 | | |
161 | 172 | | |
162 | | - | |
| 173 | + | |
163 | 174 | | |
164 | 175 | | |
165 | 176 | | |
| |||
199 | 210 | | |
200 | 211 | | |
201 | 212 | | |
202 | | - | |
| 213 | + | |
203 | 214 | | |
204 | 215 | | |
205 | 216 | | |
| |||
0 commit comments