Commit f6f445d1 authored by Roque Porchetto's avatar Roque Porchetto

erp5_wendelin_telecom_UI: list data streams instead of arrays

parent a3eedef3
...@@ -54,21 +54,24 @@ ...@@ -54,21 +54,24 @@
}; };
group_list.push(["right",[["my_reference"]]]) group_list.push(["right",[["my_reference"]]])
if (metadata != null) { if (metadata != null) {
for (var i = 0, entry; entry = metadata[i]; i++) { var i = 0
var key = "my_" + entry[0].replace(" ","_"), for (var key in metadata) {
side = (i % 2 == 0) ? "left" : "right" ; if (metadata.hasOwnProperty(key)) {
view_dict[key] = { var side = (i % 2 == 0) ? "left" : "right" ;
"title": entry[0], view_dict[key] = {
"default": entry[1], "title": key,
"key": "field_" + key "default": metadata[key],
}; "key": "field_" + key
group_list.push([side,[[key]]]) };
group_list.push([side,[[key]]])
}
i++;
} }
} }
else { else {
view_dict["my_metadata"] = { view_dict["my_metadata"] = {
"title": "Metadata", "title": "Metadata",
"default": "No metadata available for this type of file yet", "default": "Could not find metadata for this file",
"key": "field_my_metadata" "key": "field_my_metadata"
}; };
group_list.push(["left",[["my_metadata"]]]) group_list.push(["left",[["my_metadata"]]])
...@@ -90,9 +93,15 @@ ...@@ -90,9 +93,15 @@
.declareMethod("getDescriptorContent", function (descriptorReference) { .declareMethod("getDescriptorContent", function (descriptorReference) {
var url = "/erp5/getDescriptorHTMLContent?reference=" + descriptorReference, var url = "/erp5/getDescriptorHTMLContent?reference=" + descriptorReference,
xmlHttp = new XMLHttpRequest(); xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", url, false); try {
xmlHttp.send(null); xmlHttp.open("GET", url, false);
return xmlHttp.responseText; xmlHttp.send(null);
return xmlHttp.responseText;
}
catch(err) {
console.log("URL error: " + err)
return "";
}
}) })
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
...@@ -108,19 +117,14 @@ ...@@ -108,19 +117,14 @@
}); });
}) })
.declareService(function () { .declareService(function () {
var content = this.state.textcontent.replace('<table class="table table-hover">', '<table id="table_custom_id" class="table table-hover">'), try {
metadata = []; var json_dict = JSON.parse(this.state.textcontent)
document.getElementById("html_report").innerHTML = content;
if (document.getElementById("table_custom_id") === null) {
document.getElementById("html_report").innerHTML = "";
return;
} }
var table = document.getElementById("table_custom_id"); catch(err) {
document.getElementById("html_report").innerHTML = ""; console.log("Error reading Data Descriptor JSON: " + err)
for (var i = 0, row; row = table.rows[i]; i++) { return
metadata.push([row.cells[0].innerHTML, row.cells[1].innerHTML]);
} }
return this.changeState({"metadata" : metadata }); return this.changeState({"metadata" : json_dict });
}); });
}(window, rJS, RSVP, calculatePageTitle, jIO)); }(window, rJS, RSVP, calculatePageTitle, jIO));
......
...@@ -138,6 +138,12 @@ ...@@ -138,6 +138,12 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -197,4 +203,63 @@ ...@@ -197,4 +203,63 @@
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>969.15125.3949.58658</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1532889234.5</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.467.36915.6741</string> </value> <value> <string>968.25389.60346.26402</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1508934953.62</float> <float>1529660655.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
"key": "field_listbox", "key": "field_listbox",
"lines": 15, "lines": 15,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22Data+Array%22+AND+validation_state%3A%22validated%22+AND+reference%3A%22" + dataset + "%2F%25%22", "query": "urn:jio:allDocs?query=portal_type%3A%22Data+Stream%22+AND+validation_state%3A%22validated%22+AND+reference%3A%22" + dataset + "%2F%25%22",
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": column_list,
"sort_column_list": column_list, "sort_column_list": column_list,
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>969.6188.36317.22374</string> </value> <value> <string>969.10372.38821.30208</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1532525619.7</float> <float>1532802432.68</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