From: Bianca Carvalho <bianca(a)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(a)linux.vnet.ibm.com>
---
src/wok/reqlogger.py | 4 +++-
ui/js/wok.user-log.js | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index b51abf1..0184a48 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -99,7 +99,9 @@ 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"
+ 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);
--
2.9.3