Copilot commented on code in PR #13981:
URL: https://github.com/apache/cloudstack/pull/13981#discussion_r4093298380


##########
ui/public/locales/en.json:
##########
@@ -3262,7 +3263,7 @@
 "message.action.vmsnapshot.delete": "Please confirm that you want to delete 
this Instance Snapshot. <br>Please notice that the Instance will be paused 
before the Snapshot deletion, and resumed after deletion, if it runs on KVM.",
 "message.action.vmsnapshot.disk-only.delete": "Please confirm that you want to 
delete this Instance Snapshot.",
 "message.activate.project": "Are you sure you want to activate this project?",
-"message.api.not.available": "API is not available.",
+"message.add.account.warning": "Creating a new account creates a separate 
tenant with its own resource limits and isolated resources. Users in different 
accounts cannot share Instances or Volumes. Networks can be shared between 
accounts when the appropriate permissions are granted. To add a new user to an 
existing account instead, use the <b>Add User</b> action from the account's 
list or details view.",

Review Comment:
   This replaces the existing `message.api.not.available` translation instead 
of adding a new key. `ImportUnmanagedInstance.vue` still translates that key 
when the API is unavailable, so the English notification now displays the raw 
key; restore the existing entry and keep this warning as a separate entry.



##########
ui/src/config/section/account.js:
##########
@@ -104,11 +104,23 @@ export default {
     {
       api: 'createAccount',
       icon: 'plus-outlined',
-      label: 'label.add.account',
+      label: 'label.add.new.tenant.account',
       listView: true,
       popup: true,
       component: shallowRef(defineAsyncComponent(() => 
import('@/views/iam/AddAccount.vue')))
     },
+    {
+      api: 'createUser',
+      icon: 'usergroup-add-outlined',
+      label: 'label.add.user',
+      listView: true,
+      dataView: true,

Review Comment:
   Because this action is marked `listView: true`, it is also rendered in the 
list-level action bar. In list mode `AutogenView` supplies that bar with 
`resource = items[0]`, so clicking this button creates the user in the first 
listed account rather than an account the operator selected. The per-row 
QuickView already uses `dataView: true`; remove `listView` so the action is 
only offered for the account row/detail resource.



##########
ui/src/views/iam/AddUser.vue:
##########
@@ -247,8 +253,8 @@ export default {
       })
     },
     fetchData () {
-      this.account = this.$route.query && this.$route.query.account ? 
this.$route.query.account : null
-      this.domainid = this.$route.query && this.$route.query.domainid ? 
this.$route.query.domainid : null
+      this.account = (this.$route.query && this.$route.query.account) || 
this.resource?.name || null
+      this.domainid = (this.$route.query && this.$route.query.domainid) || 
this.resource?.domainid || null

Review Comment:
   `AutogenView` keeps action components alive and clears only `currentAction` 
on close, so `created()` is not rerun when this form is opened for another 
account. Since `fetchData()` copies `resource.name` and `resource.domainid` 
only once, reopening this action for account B can leave the previous account A 
in `this.account`/`this.domainid` and create the new user under A. Watch the 
resource (and reset/reinitialize the form state) or otherwise force a fresh 
component for each action.



##########
ui/src/config/section/account.js:
##########
@@ -104,11 +104,23 @@ export default {
     {
       api: 'createAccount',
       icon: 'plus-outlined',
-      label: 'label.add.account',
+      label: 'label.add.new.tenant.account',
       listView: true,
       popup: true,
       component: shallowRef(defineAsyncComponent(() => 
import('@/views/iam/AddAccount.vue')))
     },
+    {
+      api: 'createUser',
+      icon: 'usergroup-add-outlined',

Review Comment:
   `usergroup-add-outlined` is not registered in `core/lazy_lib/icons_use.js` 
(the registered user action icon is `UserAddOutlined`), so this action can 
render without an icon. It is also not one of the icon names that 
`ActionButton` treats as a labeled list action, so the new list button will not 
display the “Add User” text. Use a registered/recognized icon or register and 
wire this one in both places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to