[Kimchi-devel] [PATCH] [Wok] Bug fix #144: The filter of of the user activity log shows loading forever
Lucio Correia
luciojhc at linux.vnet.ibm.com
Wed Dec 14 11:27:16 UTC 2016
On 13/12/2016 17:59, bianca at linux.vnet.ibm.com wrote:
> From: Bianca Carvalho <bianca at linux.vnet.ibm.com>
>
> User log data was storing null value to user field, changed the reqlogger.py
> and wok.user-log.js to make sure both get 'N/A' instead of null.
>
> Signed-off-by: Bianca Carvalho <bianca at linux.vnet.ibm.com>
> ---
> src/wok/reqlogger.py | 3 ++-
> ui/js/wok.user-log.js | 4 ++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
> index b51abf1..edddb6e 100644
> --- a/src/wok/reqlogger.py
> +++ b/src/wok/reqlogger.py
> @@ -99,7 +99,8 @@ def log_request(code, params, exception, method, status, app=None, user=None,
> app = cherrypy.request.app.script_name
>
> if user is None:
> - user = cherrypy.session.get(USER_NAME, 'N/A')
> + cherrypy_user = cherrypy.session.get(USER_NAME, 'N/A')
> + user = cherrypy_user if cherrypy_user is not None else "N/A"
Here you can simplify by doing:
user = cherrypy.session.get(USER_NAME, 'N/A') or 'N/A'
>
> if ip is None:
> ip = cherrypy.request.remote.ip
> diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
> index e49e428..fa4945f 100644
> --- a/ui/js/wok.user-log.js
> +++ b/ui/js/wok.user-log.js
> @@ -155,11 +155,15 @@ wok.initUserLogConfigGridData = function() {
> wok.getUserLogs(function(result) {
> $.each(result, function(index, log){
> var statusLabel = labelStyle(log.status);
> + var userLabel = labelStyle(log.user);
> if (statusLabel != null) {
> log.status = "<span class='" + statusLabel.labelColor + "'><i class='" + statusLabel.labelIcon + "' aria-hidden='true'></i> " + log.status + "</span> ";
> } else {
> log.status = "";
> }
> + if (userLabel == null) {
> + log.user = "N/A";
> + }
> })
> wok.loadBootgridData(wok.opts_user_log['gridId'], result);
> wok.showBootgridData(wok.opts_user_log);
>
--
Lucio Correia
Software Engineer
IBM LTC Brazil
More information about the Kimchi-devel
mailing list