<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 7:13 PM, Aline Manera
wrote:<br>
</div>
<blockquote
cite="mid:9857189e-1eef-9132-a311-62849755dd87@linux.vnet.ibm.com"
type="cite">
<br>
<br>
On 05/10/2016 03:43 AM, Archana Singh wrote:
<br>
<blockquote type="cite">
<br>
<br>
On 5/9/2016 6:51 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 as per locale
<br>
in wok-list widget.
<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/src/wok.list.js | 6 +++++-
<br>
1 file changed, 5 insertions(+), 1 deletion(-)
<br>
<br>
diff --git a/ui/js/src/wok.list.js b/ui/js/src/wok.list.js
<br>
index f40b2e2..8f02fde 100644
<br>
--- a/ui/js/src/wok.list.js
<br>
+++ b/ui/js/src/wok.list.js
<br>
@@ -123,6 +123,10 @@ wok.widget.List.prototype = (function()
{
<br>
var checkboxName = $('ul',
container).parent().parent().parent().attr('id') + '-check'
|| $(container).parent().parent().parent().attr('id') +
'-check';
<br>
$.each(fields, function(fi, field) {
<br>
var value = getValue(field.name, row);
<br>
</blockquote>
<br>
<blockquote type="cite">+ if (field.name
=== 'time') {
<br>
+ var dte = new
Date(value.substr(0,10)+'T'+value.substr(11))
<br>
+ value =
dte.toLocaleString(wok.lang.get_locale())
<br>
+
<br>
</blockquote>
<br>
wok.list.js is a generic widget, ie, it will only display the
data in a given visual format. Any data logic should be done
prior to it.
<br>
wok.list.js will not be aware about which data to do the
conversion. Assuming the field will have a 'name' as 'time' is
dangerous IMO. We can have different fields for datetime which
does not have a name=time on it.
<br>
</blockquote>
<br>
I will propose to have check for type(type=='datetime') instead
of name(name=='time'). what do you think?
<br>
And in debug report have the field type as datetime which has
datetime in it?
<br>
<br>
</blockquote>
<br>
The conversion must be done outside the widget. The widget should
only receive a bunch of data to display in a visual way.
<br>
</blockquote>
<br>
I have tried adding converters define for list widget as below:<br>
<br>
<br>
<img src="cid:part1.02070206.08020508@linux.vnet.ibm.com" alt=""><br>
<br>
And then use it as below in ui/js/src/gingerbase.host-dashboard.js<br>
<br>
<img src="cid:part2.01080803.00090103@linux.vnet.ibm.com" alt=""><br>
<br>
ya the function used here for format can be moved to util.js.<br>
<br>
So you think this is better approach?<br>
<br>
<blockquote
cite="mid:9857189e-1eef-9132-a311-62849755dd87@linux.vnet.ibm.com"
type="cite">
<br>
<blockquote type="cite">
<blockquote type="cite">
<br>
<blockquote type="cite"> }
<br>
if (field.type === 'status' &&
field.name === 'enabled') {
<br>
styleClass = (value === true ? ''
: ' disabled');
<br>
state = [
<br>
@@ -299,4 +303,4 @@ wok.widget.List.prototype = (function()
{
<br>
reload: reload,
<br>
showMessage: showMessage
<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>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>