<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<div class="moz-cite-prefix">On 5/10/2016 11:06 AM, Archana Singh
wrote:<br>
</div>
<blockquote cite="mid:57317365.3070908@linux.vnet.ibm.com"
type="cite">
<br>
<br>
On 5/9/2016 6:55 PM, Aline Manera wrote:
<br>
<blockquote type="cite">
<br>
<br>
On 05/05/2016 04:02 AM, <a class="moz-txt-link-abbreviated" href="mailto:pkulkark@linux.vnet.ibm.com">pkulkark@linux.vnet.ibm.com</a> wrote:
<br>
<blockquote type="cite">From: Pooja Kulkarni
<a class="moz-txt-link-rfc2396E" href="mailto:pkulkark@linux.vnet.ibm.com"><pkulkark@linux.vnet.ibm.com></a>
<br>
<br>
co-authored by: Archana Singh
<a class="moz-txt-link-rfc2396E" href="mailto:archus@linux.vnet.ibm.com"><archus@linux.vnet.ibm.com></a>
<br>
<br>
v2:
<br>
Modified call to fetch locale
<br>
<br>
v1:
<br>
This patch formats the datetime fields
<br>
in user activity log as per locale by
<br>
using suitable formatters.
<br>
<br>
Signed-off-by: Pooja Kulkarni
<a class="moz-txt-link-rfc2396E" href="mailto:pkulkark@linux.vnet.ibm.com"><pkulkark@linux.vnet.ibm.com></a>
<br>
---
<br>
ui/js/wok.bootgrid.js | 10 +++++++++-
<br>
ui/js/wok.user-log.js | 3 ++-
<br>
2 files changed, 11 insertions(+), 2 deletions(-)
<br>
<br>
diff --git a/ui/js/wok.bootgrid.js b/ui/js/wok.bootgrid.js
<br>
index 1312fe5..e3b0b16 100644
<br>
--- a/ui/js/wok.bootgrid.js
<br>
+++ b/ui/js/wok.bootgrid.js
<br>
@@ -72,6 +72,14 @@ wok.createBootgrid = function(opts) {
<br>
},
<br>
"settings-user-log-message": function(column, row) {
<br>
return '<span class="trim" data-toggle="tooltip"
data-placement="auto bottom" title="'+row.message+'">'
+row.message+ '</span> ';
<br>
+ },
<br>
+ "settings-user-log-date": function(column, row) {
<br>
+ var dte = new Date(row.date);
<br>
+ return dte.toLocaleDateString(wok.lang.get_locale());
<br>
+ },
<br>
+ "settings-user-log-time": function(column, row) {
<br>
+ var dte = new Date(row.date);
<br>
+ return dte.toLocaleTimeString(wok.lang.get_locale());
<br>
}
<br>
</blockquote>
<br>
The same I commented about wok.list.js.
<br>
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.
<br>
</blockquote>
<br>
The data from backend if return and should be shown in UI
depending upon the locale selected in UI by user while login.
<br>
I agree that this is common widget and hence the format has to be
done at common place to ensure that data & time are formatted
as per locale selected by user in common way(thinking of plugin
using this widget).
<br>
So I think having common formatter will help us keeping the format
consistent across plugins also.
<br>
</blockquote>
<br>
So I mean here that having formatter define at one place and using
same across (where ever required), which makes it consistent.<br>
Also there is no way to define formatter after bootgrid creation, it
has to be define at time of bootgrid creation.<br>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<br>
<blockquote cite="mid:57317365.3070908@linux.vnet.ibm.com"
type="cite">
<br>
<br>
<blockquote type="cite">
<br>
<blockquote type="cite"> },
<br>
css: {
<br>
@@ -138,4 +146,4 @@ wok.showBootgridData = function(opts) {
<br>
<br>
wok.hideBootgridData = function(opts) {
<br>
$("#" + opts['gridId'] + " tbody").hide();
<br>
-};
<br>
\ No newline at end of file
<br>
+};
<br>
diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
<br>
index 8c2b4a7..1bdbd31 100644
<br>
--- a/ui/js/wok.user-log.js
<br>
+++ b/ui/js/wok.user-log.js
<br>
@@ -94,6 +94,7 @@ wok.listUserLogConfig = function() {
<br>
"title": i18n['WOKSETT0004M']
<br>
}, {
<br>
"column-id": 'time',
<br>
</blockquote>
<br>
<blockquote type="cite">+ "formatter":
"settings-user-log-time",
<br>
"converter": 'string',
<br>
</blockquote>
<br>
The data conversion should be done here and only pass the right
data to the displayed on UI to wok.bootgrid.js
<br>
</blockquote>
Same as above, I think using common formatter define above keep
formatting consistent across.
<br>
<blockquote type="cite">
<br>
<blockquote type="cite"> "order": 'desc',
<br>
"title": i18n['WOKSETT0005M']
<br>
@@ -243,4 +244,4 @@ wok.initUserLogWindow = function() {
<br>
});
<br>
$('#form-advanced-search').submit();
<br>
});
<br>
-};
<br>
\ No newline at end of file
<br>
+};
<br>
</blockquote>
<br>
_______________________________________________
<br>
Kimchi-devel mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
<br>
<br>
</blockquote>
<br>
_______________________________________________
<br>
Kimchi-devel mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
<br>
<br>
</blockquote>
<br>
</body>
</html>