Commit ec6004f4 authored by Sven Franck's avatar Sven Franck

fixed network API to generate query objects correctly

parent cd773165
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"form": true, "form": true,
"id": "network_overview", "id": "network_overview",
"property_dict": { "property_dict": {
"initial_query_url_identifier": "reference",
"dynamic_children": [2], "dynamic_children": [2],
"requires_authentication": true, "requires_authentication": true,
"depends_on": "login_state", "depends_on": "login_state",
...@@ -26,7 +25,7 @@ ...@@ -26,7 +25,7 @@
}, },
"feature_dict": { "feature_dict": {
"linkable": true, "linkable": true,
"link_identifier": "reference" "link_identifier": "_id"
} }
}, },
"children": [{ "children": [{
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"form": true, "form": true,
"id": "network_view", "id": "network_view",
"property_dict": { "property_dict": {
"initial_query_url_identifier": "_id",
"dynamic_children": [0], "dynamic_children": [0],
"requires_authentication": true, "requires_authentication": true,
"depends_on": "login_state", "depends_on": "login_state",
......
...@@ -3980,7 +3980,7 @@ ...@@ -3980,7 +3980,7 @@
* @return {object} "allDocs" response object * @return {object} "allDocs" response object
**/ **/
storage.mapResponse = function (response, convert) { storage.mapResponse = function (response, convert) {
var answer, i, record, key, data, pushit; var answer, i, record, key, data, pushit, value_dict;
answer = {"data": {"total_rows": null, "rows": []}}; answer = {"data": {"total_rows": null, "rows": []}};
pushit = function (obj, record_id) { pushit = function (obj, record_id) {
...@@ -3999,13 +3999,16 @@ ...@@ -3999,13 +3999,16 @@
answer.data.total_rows = response.data.total_rows; answer.data.total_rows = response.data.total_rows;
for (i = 0; i < response.data.total_rows; i += 1) { for (i = 0; i < response.data.total_rows; i += 1) {
data = {}; data = {};
record = response.data.rows[i].value; record = response.data.rows[i];
for (key in record) { value_dict = record.value;
if (record.hasOwnProperty(key)) { for (key in value_dict) {
data[key] = record[key]; if (value_dict.hasOwnProperty(key)) {
data[key] = value_dict[key];
} }
} }
answer.data.rows.push(pushit(data)); // TODO: verfiy this is valid!
data["_id"] = record.id;
answer.data.rows.push(pushit(data, record.id));
} }
} }
return answer; return answer;
...@@ -5965,7 +5968,6 @@ ...@@ -5965,7 +5968,6 @@
return storage[parcel.storage][method || "allDocs"](parcel.query) return storage[parcel.storage][method || "allDocs"](parcel.query)
.then(function (response) { .then(function (response) {
// TODO: best way? // TODO: best way?
if (convert !== undefined && response.status === 200) { if (convert !== undefined && response.status === 200) {
return { return {
......
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