summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/view/graph_view.js22
-rw-r--r--src/client/view/node_info.js1
-rw-r--r--src/client/view/tab.js11
3 files changed, 26 insertions, 8 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 2315eb10..fe18ed5c 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -147,12 +147,11 @@ function GraphView(spec) {
});
function showNodeInfo(node) {
- var closed = false;
+ var diffBusUnsubscribe;
util.assert(!temporary, "cannot showNodeInfo on a temporary graph");
view.node_info.on_save(function(e, form_data) {
- closed = true;
graph.update_node(node, form_data, function() {
var old_type = node.type,
new_type = form_data.type;
@@ -162,12 +161,25 @@ function GraphView(spec) {
return false;
});
- graph.diffBus.onValue(function (diff) {
- if (closed || !model_diff.is_attr_diff(diff)) {
- return Bacon.noMore;
+ diffBusUnsubscribe = graph.diffBus.onValue(function (diff) {
+ if (!model_diff.is_attr_diff(diff)) {
+ console.log('node_edit listener for ' + node.id + ': ignoring diff');
+ return;
}
view.node_info.show(node);
});
+ view.node_info.isOpenProperty.skip(1).onValue(function (open) {
+ var ISaidNoMore = false;
+ if (ISaidNoMore) {
+ console.log('MAYDAY MAYDAY why am I here??');
+ }
+ if (!open) {
+ console.log('node_edit listener for ' + node.id + ': shutting down');
+ diffBusUnsubscribe();
+ ISaidNoMore = true;
+ return Bacon.noMore;
+ }
+ })
view.node_info.on_delete(function() {
var topo_diff = model_diff.new_topo_diff({
diff --git a/src/client/view/node_info.js b/src/client/view/node_info.js
index 215d1f3a..500c2aa2 100644
--- a/src/client/view/node_info.js
+++ b/src/client/view/node_info.js
@@ -98,6 +98,7 @@ function on_keyup(f) {
return {
show: show,
hide: hide,
+ isOpenProperty: internal.edit_tab.isOpenProperty,
on_save: on_save,
on_delete: on_delete,
on_keyup: on_keyup,
diff --git a/src/client/view/tab.js b/src/client/view/tab.js
index 97ba1351..9fca9a29 100644
--- a/src/client/view/tab.js
+++ b/src/client/view/tab.js
@@ -1,12 +1,13 @@
"use strict"
-define(['jquery'],
-function($) {
+define(['jquery', 'Bacon'],
+function($, Bacon) {
function Tab(dict) {
var k,
selector = {},
- name = [];
+ name = [],
+ openessBus = new Bacon.Bus();
for (k in dict) {
if (dict.hasOwnProperty(k) == false) {
@@ -17,6 +18,8 @@ function Tab(dict) {
}
this._selector = selector;
this._name = name;
+ this._openessBus = openessBus;
+ this.isOpenProperty = openessBus.toProperty(false)
}
Tab.prototype.show = function(shown_name) {
@@ -33,6 +36,7 @@ Tab.prototype.show = function(shown_name) {
element.hide();
}
}
+ this._openessBus.push(true);
}
Tab.prototype.hide = function() {
@@ -41,6 +45,7 @@ Tab.prototype.hide = function() {
for (i = 0 ; i < this._name.length ; ++i) {
$(this._selector[this._name[i]]).fadeOut(300);
}
+ this._openessBus.push(false);
}
Tab.prototype.get = function(name, sel) {