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 @@
};
group_list.push(["right",[["my_reference"]]])
if (metadata != null) {
for (var i = 0, entry; entry = metadata[i]; i++) {
var key = "my_" + entry[0].replace(" ","_"),
side = (i % 2 == 0) ? "left" : "right" ;
view_dict[key] = {
"title": entry[0],
"default": entry[1],
"key": "field_" + key
};
group_list.push([side,[[key]]])
var i = 0
for (var key in metadata) {
if (metadata.hasOwnProperty(key)) {
var side = (i % 2 == 0) ? "left" : "right" ;
view_dict[key] = {
"title": key,
"default": metadata[key],
"key": "field_" + key
};
group_list.push([side,[[key]]])
}
i++;
}
}
else {
view_dict["my_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"
};
group_list.push(["left",[["my_metadata"]]])
......@@ -90,9 +93,15 @@
.declareMethod("getDescriptorContent", function (descriptorReference) {
var url = "/erp5/getDescriptorHTMLContent?reference=" + descriptorReference,
xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
return xmlHttp.responseText;
try {
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
return xmlHttp.responseText;
}
catch(err) {
console.log("URL error: " + err)
return "";
}
})
.declareMethod("render", function (options) {
var gadget = this;
......@@ -108,19 +117,14 @@
});
})
.declareService(function () {
var content = this.state.textcontent.replace('<table class="table table-hover">', '<table id="table_custom_id" class="table table-hover">'),
metadata = [];
document.getElementById("html_report").innerHTML = content;
if (document.getElementById("table_custom_id") === null) {
document.getElementById("html_report").innerHTML = "";
return;
try {
var json_dict = JSON.parse(this.state.textcontent)
}
var table = document.getElementById("table_custom_id");
document.getElementById("html_report").innerHTML = "";
for (var i = 0, row; row = table.rows[i]; i++) {
metadata.push([row.cells[0].innerHTML, row.cells[1].innerHTML]);
catch(err) {
console.log("Error reading Data Descriptor JSON: " + err)
return
}
return this.changeState({"metadata" : metadata });
return this.changeState({"metadata" : json_dict });
});
}(window, rJS, RSVP, calculatePageTitle, jIO));
......
......@@ -138,6 +138,12 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -197,4 +203,63 @@
</tuple>
</pickle>
</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>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.467.36915.6741</string> </value>
<value> <string>968.25389.60346.26402</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1508934953.62</float>
<float>1529660655.72</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -65,7 +65,7 @@
"key": "field_listbox",
"lines": 15,
"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": [],
"search_column_list": column_list,
"sort_column_list": column_list,
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>969.6188.36317.22374</string> </value>
<value> <string>969.10372.38821.30208</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1532525619.7</float>
<float>1532802432.68</float>
<string>UTC</string>
</tuple>
</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