You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2021/08/05 12:37:30 UTC

[cloudstack] branch 4.15 updated: ui: Add 'on / off' to status icon and make it case insensitive (#5278)

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

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


The following commit(s) were added to refs/heads/4.15 by this push:
     new d8c407d  ui: Add 'on / off' to status icon and make it case insensitive (#5278)
d8c407d is described below

commit d8c407d94a51a487fe9c73f398501449566444f7
Author: davidjumani <dj...@gmail.com>
AuthorDate: Thu Aug 5 18:07:11 2021 +0530

    ui: Add 'on / off' to status icon and make it case insensitive (#5278)
    
    * ui: Add 'on' to success status icon
    
    * Add off state as well
    
    * make it case insensitive
---
 ui/src/components/widgets/Status.vue | 98 ++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/ui/src/components/widgets/Status.vue b/ui/src/components/widgets/Status.vue
index b73bec7..97028c8 100644
--- a/ui/src/components/widgets/Status.vue
+++ b/ui/src/components/widgets/Status.vue
@@ -44,32 +44,32 @@ export default {
     getText () {
       if (this.displayText && this.text) {
         var state = this.text
-        switch (state) {
-          case 'Running':
+        switch (state.toLowerCase()) {
+          case 'running':
             state = this.$t('state.running')
             break
-          case 'Stopped':
+          case 'stopped':
             state = this.$t('state.stopped')
             break
-          case 'Starting':
+          case 'starting':
             state = this.$t('state.starting')
             break
-          case 'Stopping':
+          case 'stopping':
             state = this.$t('state.stopping')
             break
-          case 'Suspended':
+          case 'suspended':
             state = this.$t('state.suspended')
             break
-          case 'Pending':
+          case 'pending':
             state = this.$t('state.pending')
             break
-          case 'Migrating':
+          case 'migrating':
             state = this.$t('state.migrating')
             break
-          case 'Expunging':
+          case 'expunging':
             state = this.$t('state.expunging')
             break
-          case 'Error':
+          case 'error':
             state = this.$t('state.error')
             break
         }
@@ -79,66 +79,66 @@ export default {
     },
     getBadgeStatus (state) {
       var status = 'default'
-      switch (state) {
-        case 'Active':
-        case 'BackedUp':
-        case 'Completed':
-        case 'Connected':
-        case 'Download Complete':
-        case 'Enabled':
-        case 'Implemented':
-        case 'Ready':
-        case 'Running':
-        case 'Setup':
-        case 'Started':
-        case 'Successfully Installed':
-        case 'ReadWrite':
-        case 'True':
-        case 'true':
-        case 'Up':
+      switch (state.toLowerCase()) {
+        case 'active':
+        case 'backedup':
+        case 'completed':
+        case 'connected':
+        case 'download complete':
         case 'enabled':
+        case 'implemented':
+        case 'on':
+        case 'readwrite':
+        case 'ready':
+        case 'running':
+        case 'setup':
+        case 'started':
+        case 'successfully installed':
+        case 'true':
+        case 'up':
           status = 'success'
           break
-        case 'Alert':
-        case 'Declined':
-        case 'Disabled':
-        case 'Disconnected':
-        case 'Down':
-        case 'Error':
-        case 'False':
+        case 'alert':
+        case 'declined':
+        case 'disabled':
+        case 'disconnected':
+        case 'down':
+        case 'error':
         case 'false':
-        case 'Stopped':
-        case 'ReadOnly':
+        case 'off':
+        case 'readonly':
+        case 'stopped':
           status = 'error'
           break
-        case 'Migrating':
-        case 'Scaling':
-        case 'Starting':
-        case 'Stopping':
-        case 'Upgrading':
+        case 'migrating':
+        case 'scaling':
+        case 'starting':
+        case 'stopping':
+        case 'upgrading':
           status = 'processing'
           break
-        case 'Allocated':
+        case 'allocated':
           if (this.$route.path.startsWith('/publicip')) {
             status = 'success'
           } else {
             status = 'warning'
           }
           break
-        case 'Created':
-        case 'Maintenance':
-        case 'Pending':
+        case 'created':
+        case 'maintenance':
+        case 'pending':
           status = 'warning'
           break
       }
       return status
     },
     getStatusColor (state) {
-      if (state === 'Scheduled') {
-        return 'blue'
+      switch (state.toLowerCase()) {
+        case 'scheduled':
+          return 'blue'
+        default:
+          return null
       }
-
-      return null
     },
     getTooltip (state) {
       if (!(state && this.displayText)) {