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

rohit 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 584c1cf  ui: secondary storage - Display text and change the badge 
color of the Read-only column (#5176)
584c1cf is described below

commit 584c1cfbe0211347d94972ffdc142fca5007b42b
Author: Hoang Nguyen <[email protected]>
AuthorDate: Mon Jul 5 13:23:38 2021 +0700

    ui: secondary storage - Display text and change the badge color of the 
Read-only column (#5176)
    
    * change badge color and display text of read-only secondary storage
    
    * change readonly label to access
    
    Fixes #5169
---
 ui/public/locales/en.json                        |  2 ++
 ui/src/components/view/ListView.vue              |  2 +-
 ui/src/components/widgets/Status.vue             |  8 +++++++-
 ui/src/config/section/infra/secondaryStorages.js |  5 ++++-
 ui/src/views/AutogenView.vue                     | 16 ++++++++++++----
 5 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 2f51944..870686b 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -3324,6 +3324,8 @@
 "state.expunging": "Expunging",
 "state.migrating": "Migrating",
 "state.pending": "Pending",
+"state.readonly": "Read-Only",
+"state.readwrite": "Read-Write",
 "state.running": "Running",
 "state.starting": "Starting",
 "state.stopped": "Stopped",
diff --git a/ui/src/components/view/ListView.vue 
b/ui/src/components/view/ListView.vue
index 85f49b3..06b9fe3 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -231,7 +231,7 @@
       <span v-else>{{ text }}</span>
     </span>
     <a slot="readonly" slot-scope="text, record">
-      <status :text="record.readonly ? 'ReadOnly' : 'ReadWrite'" />
+      <status :text="record.readonly ? 'ReadOnly' : 'ReadWrite'" displayText />
     </a>
     <span slot="created" slot-scope="text">
       {{ $toLocaleDate(text) }}
diff --git a/ui/src/components/widgets/Status.vue 
b/ui/src/components/widgets/Status.vue
index fa8fe1a..d380271 100644
--- a/ui/src/components/widgets/Status.vue
+++ b/ui/src/components/widgets/Status.vue
@@ -72,6 +72,12 @@ export default {
           case 'Error':
             state = this.$t('state.error')
             break
+          case 'ReadOnly':
+            state = this.$t('state.readonly')
+            break
+          case 'ReadWrite':
+            state = this.$t('state.readwrite')
+            break
         }
         return state.charAt(0).toUpperCase() + state.slice(1)
       }
@@ -106,7 +112,6 @@ export default {
         case 'Error':
         case 'False':
         case 'Stopped':
-        case 'ReadOnly':
           status = 'error'
           break
         case 'Migrating':
@@ -126,6 +131,7 @@ export default {
         case 'Created':
         case 'Maintenance':
         case 'Pending':
+        case 'ReadOnly':
           status = 'warning'
           break
       }
diff --git a/ui/src/config/section/infra/secondaryStorages.js 
b/ui/src/config/section/infra/secondaryStorages.js
index 17600aa..d22564d 100644
--- a/ui/src/config/section/infra/secondaryStorages.js
+++ b/ui/src/config/section/infra/secondaryStorages.js
@@ -25,7 +25,10 @@ export default {
   columns: () => {
     var fields = ['name', 'url', 'protocol', 'scope', 'zonename']
     if (store.getters.apis.listImageStores.params.filter(x => x.name === 
'readonly').length > 0) {
-      fields.push('readonly')
+      fields.push({
+        field: 'readonly',
+        customTitle: 'access'
+      })
     }
     return fields
   },
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index ebeca6e..ecd8547 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -583,13 +583,21 @@ export default {
 
       const customRender = {}
       for (var columnKey of this.columnKeys) {
-        var key = columnKey
+        let key = columnKey
+        let title = columnKey
         if (typeof columnKey === 'object') {
-          key = Object.keys(columnKey)[0]
-          customRender[key] = columnKey[key]
+          if ('customTitle' in columnKey && 'field' in columnKey) {
+            key = columnKey.field
+            title = columnKey.customTitle
+            customRender[key] = columnKey[key]
+          } else {
+            key = Object.keys(columnKey)[0]
+            title = Object.keys(columnKey)[0]
+            customRender[key] = columnKey[key]
+          }
         }
         this.columns.push({
-          title: this.$t('label.' + String(key).toLowerCase()),
+          title: this.$t('label.' + String(title).toLowerCase()),
           dataIndex: key,
           scopedSlots: { customRender: key },
           sorter: function (a, b) { return genericCompare(a[this.dataIndex] || 
'', b[this.dataIndex] || '') }

Reply via email to