[Rt-commit] rt branch, 4.6/lifecycle-ui-dev, repushed
Craig Kaiser
craig at bestpractical.com
Thu Jan 2 15:42:08 EST 2020
The branch 4.6/lifecycle-ui-dev was deleted and repushed:
was b1e69137a4b51c26c76cb36c5aa1535dd61c84a3
now 57c331ec200fc7a782f3e81c11fbb645f1c97d41
1: b1e69137a4 ! 1: 57c331ec20 Lifecycle-UI
@@ -1546,6 +1546,7 @@
+ else {
+ self.simulation.stop();
+ self.Deselect();
++
+ self.AddNode(d3.mouse(this));
+
+ self.ExportAsConfiguration();
@@ -1778,7 +1779,7 @@
+ self.link = linkEnter.merge(self.link);
+ self.link
+ .style("marker-start", function(d) { return d.start ? 'url(#start-arrow)' : '' })
-+ .style("marker-end", function(d) { d.end ? 'url(#end-arrow)' : '' });
++ .style("marker-end", function(d) { return d.end ? 'url(#end-arrow)' : '' });
+ }
+
+ Refresh() {
@@ -1804,27 +1805,31 @@
+ }
+
+ SelectNode(node) {
-+ this.Deselect();
-+ this.selected_node = node;
++ var self = this;
++
++ self.Deselect();
++ self.selected_node = node;
+
+ d3.select(node)
+ .classed('node-selected', true);
+ }
+
+ Deselect() {
++ var self = this;
++
+ if ( jQuery("#lifeycycle-ui-edit-node").is(':visible') ) {
+ jQuery("#lifeycycle-ui-edit-node").toggle();
+ jQuery('.removing').remove();
+ }
+
-+ this.editing_node = null;
-+
-+ if (!this.selected_node) return;
-+ this.selected_node = null;
-+
-+ this.svg.selectAll("foreignObject").remove();
-+
-+ this.svg.selectAll('.node-selected')
++ self.editing_node = null;
++
++ if (!self.selected_node) return;
++ self.selected_node = null;
++
++ self.svg.selectAll("foreignObject").remove();
++
++ self.svg.selectAll('.node-selected')
+ .classed('node-selected', false);
+ }
+
@@ -1843,9 +1848,9 @@
+ var self = this;
+ if (!self.mousedown_node) return;
+
-+ this.drag_line.attr('d', 'M' + self.mousedown_node.x + ',' + self.mousedown_node.y + 'L' + d3.mouse(d)[0] + ',' + d3.mouse(d)[1]);
-+
-+ this.Refresh();
++ self.drag_line.attr('d', 'M' + self.mousedown_node.x + ',' + self.mousedown_node.y + 'L' + d3.mouse(d)[0] + ',' + d3.mouse(d)[1]);
++
++ self.Refresh();
+ }
+
+ Mouseup(d) {
@@ -1961,16 +1966,18 @@
+
+ // Create a new node for our JS model
+ AddNode(point) {
++ var self = this;
++
+ var i = 0,
+ name;
+ while (1) {
+ name = 'status #' + ++i;
-+ var index = this.nodes.findIndex(function(x) { return x.name == name });
++ var index = self.nodes.findIndex(function(x) { return x.name == name });
+ if ( index < 0 ) {
+ break;
+ }
+ }
-+ this.nodes.push({id: ++this.nodes_seq, name: name, type: 'active', x: point[0], y: point[1]});
++ self.nodes.push({id: ++self.nodes_seq, name: name, type: 'active', x: point[0], y: point[1]});
+ }
+
+ AddLink(source, target) {
@@ -1978,7 +1985,9 @@
+ if (!source || !target) return;
+
+ var link = self.links.filter(function(l) { return (l.source === target && l.target === source); })[0];
-+ if(link) link.start = true;
++ if ( link ) {
++ link.start = true;
++ }
+ else {
+ self.links.push({id: ++self.links_seq, source: source, target: target, start: false, end: true});
+ }
@@ -1993,7 +2002,7 @@
+ if ( link.start && link.end ) {
+ self.links.splice(index, 1);
+
-+ self.CheckActions(d);
++ self.UpdateChecks(d);
+ }
+ else if( link.start ) {
+ link.end = true;
@@ -2004,40 +2013,52 @@
+ }
+
+ NodeById(id) {
-+ var nodeMap = d3.map(this.nodes, function(d) { return d.id; });
++ var self = this;
++
++ var nodeMap = d3.map(self.nodes, function(d) { return d.id; });
+ return nodeMap.get( id );
+ }
+
+ NodeByStatus(status) {
-+ var nodeMap = d3.map(this.nodes, function(d) { return d.name; });
++ var self = this;
++
++ var nodeMap = d3.map(self.nodes, function(d) { return d.name; });
+ return nodeMap.get( status );
+ }
+
+ DeleteNode(d) {
+ var self = this;
+
-+ var index = this.nodes.findIndex(function(x) { x.id == d.id });
-+ this.DeleteLinksForNode(this.nodes[index]);
++ var index = self.nodes.findIndex(function(x) { return x.id == d.id });
++ self.DeleteLinksForNode(self.nodes[index]);
++
++ self.UpdateChecks(d);
++
++ self.nodes.splice(index, 1);
++ }
++
++ LinksForNode (node) {
++ var self = this;
++
++ return self.links.filter(function(link) {
++ if ( link.source.id === node.id ) {
++ return true;
++ }
++ else if ( link.target.id === node.id && link.start ) {
++ return true;
++ }
++ else {
++ return false;
++ }
++ });
++ }
++
++ UpdateChecks(d) {
++ var self = this;
+
+ self.CheckRights(d);
+ self.CheckDefaults(d);
+ self.CheckActions(d);
-+
-+ this.nodes.splice(index, 1);
-+ }
-+
-+ LinksForNode (node) {
-+ return this.links.filter(function(link) {
-+ if ( link.source.id === node.id ) {
-+ return true;
-+ }
-+ else if ( link.target.id === node.id && link.start ) {
-+ return true;
-+ }
-+ else {
-+ return false;
-+ }
-+ });
+ }
+
+ CheckDefaults(d) {
@@ -2086,23 +2107,23 @@
+ DeleteLinksForNode(node) {
+ var self = this;
+
-+ this.links = jQuery.grep(this.links, function (transition) {
++ if ( !node ) {
++ return;
++ }
++
++ self.links = jQuery.grep(self.links, function (transition) {
+ if (transition.source.id == node.id || transition.target.id == node.id) {
+ return false;
+ }
+ return true;
+ });
-+ self.CheckRights(node);
-+ self.CheckDefaults(node);
-+ self.CheckActions(node);
++ self.UpdateChecks(node);
+ }
+
+ UpdateNodeModel(node, args) {
+ var self = this;
+
-+ self.CheckActions(node);
-+ self.CheckDefaults(node);
-+ self.CheckRights(node);
++ self.UpdateChecks(node);
+
+ var nodeIndex = self.nodes.findIndex(function(x) { return x.id == node.id });
+
More information about the rt-commit
mailing list