summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-01-05 17:20:20 +0200
committerAlon Levy <alon@pobox.com>2015-01-05 17:20:20 +0200
commitcb0c218b3609947c32574c47bf85a0153f41ac57 (patch)
treeda2541a563952154281c9ff6bfbb31374ae59329 /src
parent2f8f2a0e4d6d8fa32fb2c32623c3fa6fc1967ca9 (diff)
client: link removal to server works, missing update of client
Diffstat (limited to 'src')
-rw-r--r--src/client/model/graph.js20
-rw-r--r--src/client/view/graph_view.js2
2 files changed, 10 insertions, 12 deletions
diff --git a/src/client/model/graph.js b/src/client/model/graph.js
index 9a96343a..222c809b 100644
--- a/src/client/model/graph.js
+++ b/src/client/model/graph.js
@@ -552,11 +552,14 @@ function Graph(spec) {
}
}
- this.removeLink = function(link) {
-
- util.assert(link.id !== undefined, 'bug: link without an id');
+ this.links_rm = function(links) {
+ var ids = links.map(function (link) {
+ util.assert(link.id !== undefined, 'bug: link without an id');
+ return link.id;
+ });
- this._remove_link_set([link]);
+ var topo_diff = model_diff.new_topo_diff({link_set_rm: ids});
+ this.commit_and_tx_diff__topo(topo_diff);
}
var _remove_link_set = function(link_id_set) {
@@ -572,19 +575,14 @@ function Graph(spec) {
}
this._remove_link_set = _remove_link_set;
- this.removeNodes = function(state) {
+ this.nodes_rm = function(state) {
var node_ids = get_nodes().filter(function (n) { return n.state == state; })
.map(function (n) { return n.id; }),
topo_diff = model_diff.new_topo_diff({
node_set_rm : node_ids,
});
- this.commit_diff__topo(topo_diff);
- }
-
- this.removeLinks = function(state) {
- var ls = find_links__by_state(state);
- ls.map(_link_remove_helper);
+ this.commit_and_tx_diff__topo(topo_diff);
}
var findLink = function(src_id, dst_id, name) {
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 43a7e849..178a5209 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -224,7 +224,7 @@ function GraphView(spec) {
view.edge_info.on_delete(function () {
view.edge_info.hide();
- graph.removeLink(that.link);
+ graph.links_rm([that.link]);
});
view.edge_info.show(d);
selection.update([src, dst]);