
On 05/05/2016 04:02 AM, pkulkark@linux.vnet.ibm.com wrote:
From: Pooja Kulkarni <pkulkark@linux.vnet.ibm.com>
co-authored by: Archana Singh <archus@linux.vnet.ibm.com>
v2: Modified call to fetch locale
v1: This patch formats the datetime fields in user activity log as per locale by using suitable formatters.
Signed-off-by: Pooja Kulkarni <pkulkark@linux.vnet.ibm.com> --- ui/js/wok.bootgrid.js | 10 +++++++++- ui/js/wok.user-log.js | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ui/js/wok.bootgrid.js b/ui/js/wok.bootgrid.js index 1312fe5..e3b0b16 100644 --- a/ui/js/wok.bootgrid.js +++ b/ui/js/wok.bootgrid.js @@ -72,6 +72,14 @@ wok.createBootgrid = function(opts) { }, "settings-user-log-message": function(column, row) { return '<span class="trim" data-toggle="tooltip" data-placement="auto bottom" title="'+row.message+'">' +row.message+ '</span> '; + }, + "settings-user-log-date": function(column, row) { + var dte = new Date(row.date); + return dte.toLocaleDateString(wok.lang.get_locale()); + }, + "settings-user-log-time": function(column, row) { + var dte = new Date(row.date); + return dte.toLocaleTimeString(wok.lang.get_locale()); }
The same I commented about wok.list.js. wok.bootgrid.js is a generic widget which only display data in a visual format. It should not deal with data formatting, instead of that it should only receive the data to be displayed.
}, css: { @@ -138,4 +146,4 @@ wok.showBootgridData = function(opts) {
wok.hideBootgridData = function(opts) { $("#" + opts['gridId'] + " tbody").hide(); -}; \ No newline at end of file +}; diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js index 8c2b4a7..1bdbd31 100644 --- a/ui/js/wok.user-log.js +++ b/ui/js/wok.user-log.js @@ -94,6 +94,7 @@ wok.listUserLogConfig = function() { "title": i18n['WOKSETT0004M'] }, { "column-id": 'time',
+ "formatter": "settings-user-log-time", "converter": 'string',
The data conversion should be done here and only pass the right data to the displayed on UI to wok.bootgrid.js
"order": 'desc', "title": i18n['WOKSETT0005M'] @@ -243,4 +244,4 @@ wok.initUserLogWindow = function() { }); $('#form-advanced-search').submit(); }); -}; \ No newline at end of file +};