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 @@
})
.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;
return new RSVP.Queue()
.push(function () {
......@@ -98,13 +98,14 @@
}), gadget.getDeclaredGadget("productionline_graph") ]);
})
.push(function (result_list) {
return result_list[1].render(result_list[0]);
data = result_list[0];
return result_list[1].render(data);
})
.push(function () {
return gadget.getDeclaredGadget("productionline_toolbox");
})
.push(function (toolbox_gadget) {
toolbox_gadget.render();
toolbox_gadget.render(data);
});
})
......
......@@ -729,7 +729,7 @@
g.props.main = g.props.element.querySelector('#main');
initJsPlumb(g);
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) {
value.coordinate = {
'top': 0.0,
......@@ -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);
});
})
......
......@@ -36,15 +36,18 @@
.declareAcquiredMethod("getConfigurationDict", "getConfigurationDict")
.declareMethod("render", function () {
var g = this;
.declareMethod("render", function (options) {
var g = this, options = JSON.parse(options);
return g.getConfigurationDict()
.push(function (config_dict) {
var tools_container = document.createElement('div');
tools_container.className = 'tools-container';
Object.keys(config_dict).forEach(function (key) {
var name = config_dict[key].name || key.split('-')[1];
if (key !== 'Dream-Configuration') {
window.console.log("X", options);
Object.keys(options.class_definition).forEach(function (key) {
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({
key: key,
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