[Kimchi-devel] [PATCH] [Wok 5/5] Status label on user log #145

Lucio Correia luciojhc at linux.vnet.ibm.com
Thu Aug 18 12:58:45 UTC 2016


Reviewed-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>
Tested-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>

On 16-08-2016 14:27, peterpnns at gmail.com wrote:
> From: peterpennings <peterpnns at gmail.com>
>
> Signed-off-by: peterpennings <peterpnns at gmail.com>
> ---
>  ui/js/wok.user-log.js   | 37 ++++++++++++++++++++++++++++++++++---
>  ui/pages/i18n.json.tmpl |  1 +
>  2 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
> index 1606f47..bac5439 100644
> --- a/ui/js/wok.user-log.js
> +++ b/ui/js/wok.user-log.js
> @@ -104,13 +104,17 @@ wok.listUserLogConfig = function() {
>        "column-id": 'zone',
>        "converter": 'string',
>        "title": i18n['WOKSETT0013M']
> -    },
> -    {
> +    }, {
> +      "column-id": 'status',
> +      "converter": 'string',
> +      "width": "7%",
> +      "title": i18n['WOKSETT0015M']
> +    }, {
>        "column-id": 'message',
>        "converter": 'string',
>        "formatter": "settings-user-log-message",
>        "sortable": false,
> -      "width": "25%",
> +      "width": "30%",
>        "title": i18n['WOKSETT0006M']
>      }
>    ];
> @@ -128,7 +132,34 @@ wok.initUserLogConfigGridData = function() {
>    wok.hideBootgridData(wok.opts_user_log);
>    wok.showBootgridLoading(wok.opts_user_log);
>
> +  var labelStyle = function(status) {
> +    var result = null;
> +    if (status != undefined) {
> +      var firstNumberOfStatus = status.toString().charAt(0);
> +      result = {
> +        labelColor: "",
> +        labelIcon: ""
> +      };
> +      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;
> +      }
> +    }
> +    return result;
> +  }
> +
>    wok.getUserLogs(function(result) {
> +    $.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> ";
> +      } else {
> +        log.status = "";
> +      }
> +    })
>      wok.loadBootgridData(wok.opts_user_log['gridId'], result);
>      wok.showBootgridData(wok.opts_user_log);
>      wok.hideBootgridLoading(wok.opts_user_log);
> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
> index aca2449..17ee40c 100644
> --- a/ui/pages/i18n.json.tmpl
> +++ b/ui/pages/i18n.json.tmpl
> @@ -55,6 +55,7 @@
>      "WOKSETT0012M": "$_("Actions")",
>      "WOKSETT0013M": "$_("Timezone")",
>      "WOKSETT0014M": "$_("IP Address")",
> +    "WOKSETT0015M": "$_("Status")",
>
>      "WOKSESS0001M": "$_("Your session will be expired on: %1 s. Do you want to renew it?")",
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list