Commit 8019f798 authored by Roque's avatar Roque

erp5_officejs: truncate long string fields

parent d1ce9351
...@@ -178,9 +178,17 @@ ...@@ -178,9 +178,17 @@
} }
return gadget.jio_allDocs(param_list[0]) return gadget.jio_allDocs(param_list[0])
.push(function (result) { .push(function (result) {
// render dates with proper format function truncate(str, n) {
return (str.length > n) ? str.slice(0, n - 1) + '...' : str;
}
var i, date, len = result.data.total_rows, date_key_array; var i, date, len = result.data.total_rows, date_key_array;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
// truncate long strings
for (var key in result.data.rows[i].value) {
result.data.rows[i].value[key] =
truncate(result.data.rows[i].value[key], 40);
}
// render dates with proper format
date_key_array = Object.keys( date_key_array = Object.keys(
result.data.rows[i].value).filter((k) => k.includes("date") || result.data.rows[i].value).filter((k) => k.includes("date") ||
k.includes("Date")); k.includes("Date"));
......
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1015.64633.24396.51677</string> </value> <value> <string>1016.10474.46597.2816</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1713455747.66</float> <float>1714138267.55</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment