This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 9c4d18f9b13 role ispublic param on UI (#7973)
9c4d18f9b13 is described below

commit 9c4d18f9b13776c2bc8f6fe5b2ae9a34299ca768
Author: sato03 <[email protected]>
AuthorDate: Thu Nov 2 05:22:18 2023 -0300

    role ispublic param on UI (#7973)
    
    Co-authored-by: Henrique Sato <[email protected]>
---
 .../apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java |  3 +--
 ui/src/config/section/role.js                                  |  4 ++--
 ui/src/views/iam/CreateRole.vue                                | 10 +++++++++-
 ui/src/views/iam/ImportRole.vue                                |  9 ++++++++-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git 
a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
 
b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
index 8a469df1f1f..e67a3e2c0a0 100644
--- 
a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
+++ 
b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
@@ -48,8 +48,7 @@ public class CreateRoleCmd extends RoleCmd {
             description = "ID of the role to be cloned from. Either roleid or 
type must be passed in")
     private Long roleId;
 
-    @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, 
description = "Indicates whether the role will be visible to all users (public) 
or only to root admins (private)." +
-            " If this parameter is not specified during the creation of the 
role its value will be defaulted to true (public).")
+    @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, 
description = "Indicates whether the role will be visible to all users (public) 
or only to root admins (private). Default is true.")
     private boolean publicRole = true;
 
     /////////////////////////////////////////////////////
diff --git a/ui/src/config/section/role.js b/ui/src/config/section/role.js
index a040615b9e1..5196d2ad98d 100644
--- a/ui/src/config/section/role.js
+++ b/ui/src/config/section/role.js
@@ -23,7 +23,7 @@ export default {
   docHelp: 'adminguide/accounts.html#roles',
   permission: ['listRoles', 'listRolePermissions'],
   columns: ['name', 'type', 'description'],
-  details: ['name', 'id', 'type', 'description'],
+  details: ['name', 'id', 'type', 'description', 'ispublic'],
   tabs: [{
     name: 'details',
     component: shallowRef(defineAsyncComponent(() => 
import('@/components/view/DetailsTab.vue')))
@@ -53,7 +53,7 @@ export default {
       icon: 'edit-outlined',
       label: 'label.edit.role',
       dataView: true,
-      args: ['name', 'description', 'type'],
+      args: ['name', 'description', 'type', 'ispublic'],
       mapping: {
         type: {
           options: ['Admin', 'DomainAdmin', 'User']
diff --git a/ui/src/views/iam/CreateRole.vue b/ui/src/views/iam/CreateRole.vue
index d0ec8bea754..e3513b62a3f 100644
--- a/ui/src/views/iam/CreateRole.vue
+++ b/ui/src/views/iam/CreateRole.vue
@@ -99,6 +99,13 @@
           </a-select>
         </a-form-item>
 
+        <a-form-item name="ispublic" ref="ispublic">
+          <template #label>
+            <tooltip-label :title="$t('label.ispublic')" 
:tooltip="apiParams.ispublic.description"/>
+          </template>
+          <a-switch v-model:checked="form.ispublic"/>
+        </a-form-item>
+
         <div :span="24" class="action-button">
           <a-button @click="closeAction">{{ $t('label.cancel') }}</a-button>
           <a-button :loading="loading" ref="submit" type="primary" 
@click="handleSubmit">{{ $t('label.ok') }}</a-button>
@@ -150,7 +157,8 @@ export default {
     initForm () {
       this.formRef = ref()
       this.form = reactive({
-        using: 'type'
+        using: 'type',
+        ispublic: true
       })
       this.rules = reactive({
         name: [{ required: true, message: 
this.$t('message.error.required.input') }],
diff --git a/ui/src/views/iam/ImportRole.vue b/ui/src/views/iam/ImportRole.vue
index 991912796f2..85778724474 100644
--- a/ui/src/views/iam/ImportRole.vue
+++ b/ui/src/views/iam/ImportRole.vue
@@ -80,6 +80,13 @@
           </a-select>
         </a-form-item>
 
+        <a-form-item name="ispublic" ref="ispublic">
+          <template #label>
+            <tooltip-label :title="$t('label.ispublic')" 
:tooltip="apiParams.ispublic.description"/>
+          </template>
+          <a-switch v-model:checked="form.ispublic"/>
+        </a-form-item>
+
         <a-form-item name="forced" ref="forced">
           <template #label>
             <tooltip-label :title="$t('label.forced')" 
:tooltip="apiParams.forced.description"/>
@@ -124,7 +131,7 @@ export default {
   methods: {
     initForm () {
       this.formRef = ref()
-      this.form = reactive({})
+      this.form = reactive({ ispublic: true })
       this.rules = reactive({
         file: [
           { required: true, message: this.$t('message.error.required.input') },

Reply via email to