[Kimchi-devel] [PATCH] [Wok 6/7] Update UI to show TASK statuses and search for TASK entries

Lucio Correia luciojhc at linux.vnet.ibm.com
Fri Aug 19 19:37:41 UTC 2016


Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 ui/js/wok.user-log.js                   | 28 +++++++++++++++++++---------
 ui/pages/tabs/settings-search.html.tmpl |  1 +
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
index bac5439..c54b037 100644
--- a/ui/js/wok.user-log.js
+++ b/ui/js/wok.user-log.js
@@ -135,17 +135,27 @@ wok.initUserLogConfigGridData = function() {
   var labelStyle = function(status) {
     var result = null;
     if (status != undefined) {
-      var firstNumberOfStatus = status.toString().charAt(0);
       result = {
         labelColor: "",
-        labelIcon: ""
+        labelIcon: "",
+        labelValue: status
       };
-      switch(firstNumberOfStatus) {
-        case "1":
-        case "2": result.labelColor = 'label label-info'; result.labelIcon = 'fa fa-check fa-2'; break;
-        case "3": result.labelColor = 'label label-warning'; result.labelIcon = 'fa fa-times fa-2'; break;
-        case "4":
-        case "5": result.labelColor = 'label label-danger'; result.labelIcon = 'fa fa-times fa-2'; break;
+      if (status == 1000 || status == 1001) {
+        result.labelColor = 'label label-default'; result.labelIcon = 'fa fa-check fa-2';
+        result.labelValue = ''
+      }
+      else if (status == 1002) {
+        result.labelColor = 'label label-danger'; result.labelIcon = 'fa fa-times fa-2';
+        result.labelValue = ''
+      }
+      else if (status >= 400) {
+        result.labelColor = 'label label-danger'; result.labelIcon = 'fa fa-times fa-2';
+      }
+      else if (status >= 300) {
+        result.labelColor = 'label label-warning'; result.labelIcon = 'fa fa-times fa-2';
+      }
+      else {
+        result.labelColor = 'label label-info'; result.labelIcon = 'fa fa-check fa-2';
       }
     }
     return result;
@@ -155,7 +165,7 @@ wok.initUserLogConfigGridData = function() {
     $.each(result, function(index, log){
       var statusLabel = labelStyle(log.status);
       if (statusLabel != null) {
-        log.status = "<span class='" + statusLabel.labelColor + "'><i class='" + statusLabel.labelIcon + "' aria-hidden='true'></i> " + log.status + "</span> ";
+        log.status = "<span class='" + statusLabel.labelColor + "'><i class='" + statusLabel.labelIcon + "' aria-hidden='true'></i> " + statusLabel.labelValue + "</span> ";
       } else {
         log.status = "";
       }
diff --git a/ui/pages/tabs/settings-search.html.tmpl b/ui/pages/tabs/settings-search.html.tmpl
index 0bf664f..43eafd4 100644
--- a/ui/pages/tabs/settings-search.html.tmpl
+++ b/ui/pages/tabs/settings-search.html.tmpl
@@ -47,6 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
               <option value="GET">$_("GET")</option>
               <option value="PUT">$_("PUT")</option>
               <option value="DELETE">$_("DELETE")</option>
+              <option value="TASK">$_("TASK")</option>
             </select>
         </div>
         <div class="row clearfix">
-- 
1.9.1




More information about the Kimchi-devel mailing list