Commit d6ab5a12 authored by Klaus Wölfel's avatar Klaus Wölfel Committed by Jérome Perrin

Show icon to warn when no input for node defined

parent c1c384a3
......@@ -145,6 +145,7 @@
edge_data.destination = getNodeId(gadget, connection.targetId);
gadget.props.data.graph.edge[connection.id] = edge_data;
}
checkNodeConstraint(gadget,getNodeId(gadget, connection.targetId));
gadget.notifyDataChanged();
}
......@@ -293,6 +294,23 @@
gadget.notifyDataChanged();
}
function checkNodeConstraint(gadget, node_id) {
var element_id = gadget.props.node_id_to_dom_element_id[node_id],
element = $(gadget.props.element).find("#" + element_id),
jsplumb_instance = gadget.props.jsplumb_instance,
node_class = gadget.props.data.graph.node[node_id]._class;
if (jsplumb_instance.getConnections({target:element_id}).length === 0 &&
node_class.toLowerCase().search('source') === -1) {
var warning = $("<div></div>").attr({
"class": "alert_no_input ui-btn-icon-notext ui-icon-alert",
"title": "No input defined!"
});
element.append(warning);
} else {
element.find(".alert_no_input").remove();
}
}
function updateElementData(gadget, node_id, data) {
var element_id = gadget.props.node_id_to_dom_element_id[node_id],
......@@ -900,6 +918,9 @@
$.each(this.props.data.graph.edge, function (key, value) {
addEdge(gadget, key, value);
});
$.each(this.props.data.graph.node, function (key, value) {
checkNodeConstraint(gadget, key);
});
return RSVP.all([
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