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

GUI: attempt at handling errors properly

Errors in occuring in jIO are silently ignored because there many error
paths are missing in promise chain
parent 35e5195b
...@@ -62,13 +62,18 @@ ...@@ -62,13 +62,18 @@
// We are notified by an included gadget that the data has changed. // We are notified by an included gadget that the data has changed.
// Here we save automatically. We could mark a dirty flag to warn the // Here we save automatically. We could mark a dirty flag to warn the
// user if she leaves the page without saving. // user if she leaves the page without saving.
return new RSVP.Queue()
.push(function() {
return RSVP.delay(100);
}).push(saveGraph.bind(this));
/*
// Since we are notified quite often and saving is resource expensive, we // Since we are notified quite often and saving is resource expensive, we
// use this trick to prevent saving too many times // use this trick to prevent saving too many times
if (this.timeout) { if (this.timeout) {
window.clearTimeout(this.timeout); window.clearTimeout(this.timeout);
} }
this.timeout = window.setTimeout(saveGraph.bind(this), 100); this.timeout = window.setTimeout(saveGraph.bind(this), 100);
*/
}) })
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
...@@ -91,7 +96,7 @@ ...@@ -91,7 +96,7 @@
return gadget.getDeclaredGadget("productionline_toolbox"); return gadget.getDeclaredGadget("productionline_toolbox");
}) })
.push(function (toolbox_gadget) { .push(function (toolbox_gadget) {
toolbox_gadget.render(data); return toolbox_gadget.render(data);
}); });
}) })
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
edge_data.destination = getNodeId(gadget, connection.targetId); edge_data.destination = getNodeId(gadget, connection.targetId);
gadget.props.data.graph.edge[connection.id] = edge_data; gadget.props.data.graph.edge[connection.id] = edge_data;
} }
gadget.notifyDataChanged(); return gadget.notifyDataChanged();
} }
function convertToAbsolutePosition(gadget, x, y) { function convertToAbsolutePosition(gadget, x, y) {
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
} }
}); });
gadget.notifyDataChanged(); return gadget.notifyDataChanged();
} }
function updateElementData(gadget, node_id, data) { function updateElementData(gadget, node_id, data) {
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
} }
}); });
} }
gadget.notifyDataChanged(); return gadget.notifyDataChanged();
} }
function addEdge(gadget, edge_id, edge_data) { function addEdge(gadget, edge_id, edge_data) {
...@@ -689,14 +689,14 @@ ...@@ -689,14 +689,14 @@
function waitForConnection(gadget) { function waitForConnection(gadget) {
return loopJsplumbBind(gadget, 'connection', return loopJsplumbBind(gadget, 'connection',
function (info, originalEvent) { function (info, originalEvent) {
updateConnectionData(gadget, info.connection, false); return updateConnectionData(gadget, info.connection, false);
}); });
} }
function waitForConnectionDetached(gadget) { function waitForConnectionDetached(gadget) {
return loopJsplumbBind(gadget, 'connectionDetached', return loopJsplumbBind(gadget, 'connectionDetached',
function (info, originalEvent) { function (info, originalEvent) {
updateConnectionData(gadget, info.connection, true); return updateConnectionData(gadget, info.connection, true);
}); });
} }
...@@ -774,8 +774,7 @@ ...@@ -774,8 +774,7 @@
{ isTarget:true, maxConnections: -1 }, { isTarget:true, maxConnections: -1 },
{ anchor: "LeftMiddle", uuid: node_id + ".flowChartLeftMiddle" }); { anchor: "LeftMiddle", uuid: node_id + ".flowChartLeftMiddle" });
return gadget.notifyDataChanged();
gadget.notifyDataChanged();
} }
function waitForDrop(gadget) { function waitForDrop(gadget) {
......
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