Commit 1a3cd5b1 authored by Jérome Perrin's avatar Jérome Perrin

Use new json format to display possible nodes in the palette

parent a8f92a93
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
}) })
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this, data;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
...@@ -98,13 +98,14 @@ ...@@ -98,13 +98,14 @@
}), gadget.getDeclaredGadget("productionline_graph") ]); }), gadget.getDeclaredGadget("productionline_graph") ]);
}) })
.push(function (result_list) { .push(function (result_list) {
return result_list[1].render(result_list[0]); data = result_list[0];
return result_list[1].render(data);
}) })
.push(function () { .push(function () {
return gadget.getDeclaredGadget("productionline_toolbox"); return gadget.getDeclaredGadget("productionline_toolbox");
}) })
.push(function (toolbox_gadget) { .push(function (toolbox_gadget) {
toolbox_gadget.render(); toolbox_gadget.render(data);
}); });
}) })
......
...@@ -729,7 +729,7 @@ ...@@ -729,7 +729,7 @@
g.props.main = g.props.element.querySelector('#main'); g.props.main = g.props.element.querySelector('#main');
initJsPlumb(g); initJsPlumb(g);
g.props.nodes_click_monitor = RSVP.Monitor(); g.props.nodes_click_monitor = RSVP.Monitor();
$.each(g.props.data.nodes, function (key, value) { $.each(g.props.data.graph.main_graph.node, function (key, value) {
if (coordinates === undefined || coordinates[key] === undefined) { if (coordinates === undefined || coordinates[key] === undefined) {
value.coordinate = { value.coordinate = {
'top': 0.0, 'top': 0.0,
...@@ -746,7 +746,7 @@ ...@@ -746,7 +746,7 @@
}); });
} }
}); });
$.each(g.props.data.edges, function (key, value) { $.each(g.props.data.graph.main_graph.edge, function (key, value) {
addEdge(g, key, value); addEdge(g, key, value);
}); });
}) })
......
...@@ -36,15 +36,18 @@ ...@@ -36,15 +36,18 @@
.declareAcquiredMethod("getConfigurationDict", "getConfigurationDict") .declareAcquiredMethod("getConfigurationDict", "getConfigurationDict")
.declareMethod("render", function () { .declareMethod("render", function (options) {
var g = this; var g = this, options = JSON.parse(options);
return g.getConfigurationDict() return g.getConfigurationDict()
.push(function (config_dict) { .push(function (config_dict) {
var tools_container = document.createElement('div'); var tools_container = document.createElement('div');
tools_container.className = 'tools-container'; tools_container.className = 'tools-container';
Object.keys(config_dict).forEach(function (key) { window.console.log("X", options);
var name = config_dict[key].name || key.split('-')[1]; Object.keys(options.class_definition).forEach(function (key) {
if (key !== 'Dream-Configuration') { window.console.log("K", key,options.class_definition[key]);
var name = options.class_definition[key].name || key.split('-')[1];
if (options.class_definition[key]._class === 'node') {
tools_container.innerHTML += tool_template({ tools_container.innerHTML += tool_template({
key: key, key: key,
name: name name: name
......
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