Commit b4db07e0 authored by Jérome Perrin's avatar Jérome Perrin

graph editor: (partially) update to new json format

parent 87834a56
......@@ -15,28 +15,14 @@
return gadget.getDeclaredGadget("productionline_graph");
})
.push(function (graph_gadget) {
return graph_gadget.getData();
})
.push(function (data) {
graph_data = data;
// Always get a fresh version, to prevent deleting spreadsheet & co
return gadget.aq_getAttachment({
"_id": gadget.props.jio_key,
"_attachment": "body.json"
});
return graph_gadget.getContent();
})
.push(function (body) {
var data = JSON.parse(body),
json_graph_data = JSON.parse(graph_data);
data.nodes = json_graph_data.nodes;
data.edges = json_graph_data.edges;
data.preference = json_graph_data.preference;
console.log("saving", JSON.parse(body));
return gadget.aq_putAttachment({
"_id": gadget.props.jio_key,
"_attachment": "body.json",
"_data": JSON.stringify(data, null, 2),
"_data": body, //JSON.stringify(data, null, 2),
"_mimetype": "application/json"
});
})
......
This diff is collapsed.
......@@ -42,13 +42,14 @@
tools_container.className = 'tools-container';
Object.keys(data.class_definition).forEach(function (key) {
var _class = data.class_definition[key], tool;
// XXX "expand" the json schema "allOF" etc
if (_class._class === 'node') {
tool = document.createElement('div');
// XXX maybe allow to configure the class name ?
tool.className = "tool " + key;
tool.textContent = _class.name || key;
tool.draggable = true;
tool.dataset.class_definition = JSON.stringify(_class);
tool.dataset.class_definition = JSON.stringify([key, _class]);
Object.keys(_class.css || {}).forEach(function (k) {
tool.style[k] = _class.css[k];
});
......
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