[Rt-commit] rt branch, 4.6/lifecycle-ui-dev, repushed
Craig Kaiser
craig at bestpractical.com
Tue Dec 31 14:48:35 EST 2019
The branch 4.6/lifecycle-ui-dev was deleted and repushed:
was 30bf4681d0470dfd958bbac4dda35f5b0b6f4b9a
now 8eda2669254b07b11ecc8e93184b5cdd755bf00c
1: 30bf4681d0 ! 1: 8eda266925 Lifecycle-UI
@@ -1382,10 +1382,10 @@
+ self.mouseup_node = null;
+
+ self.NodesFromConfig(config);
-+ self.nodes.forEach(source => {
-+ self.LinksForNodeFromConfig(source.name).forEach(targetName => {
++ self.nodes.forEach(function(source) {
++ self.LinksForNodeFromConfig(source.name).forEach(function(targetName) {
+ // Get our target node
-+ var target = self.nodes.filter(source => { return source.name === targetName; })[0];
++ var target = self.nodes.filter(function(source) { return source.name === targetName; })[0];
+
+ if ( source.id < target.id ) {
+ self.links.push({id: ++self.links_seq, source: source, target: target, start: false, end: true});
@@ -1426,8 +1426,8 @@
+
+ self.simulation
+ .nodes(self.nodes)
-+ .on("tick", ( t => {
-+ this.node.attr("transform", (d => {
++ .on("tick", function (t) {
++ self.node.attr("transform", function (d) {
+
+ var x = d.x, y = d.y;
+ if ( d.x + self.node_radius / 2 > self.width ) x = self.width - self.node_radius;
@@ -1445,9 +1445,9 @@
+ }
+
+ return "translate(" + x + "," + y + ")";
-+ }));
-+
-+ this.link.attr('d', (d => {
++ });
++
++ self.link.attr('d', (function(d) {
+ var sx = d.source.x,
+ sy = d.source.y,
+ tx = d.target.x,
@@ -1476,7 +1476,7 @@
+ return 'M' + sourceX + ',' + sourceY + 'L' + targetX + ',' + targetY;
+ })
+ );
-+ }));
++ });
+
+ // Add our current config to the DOM
+ var form = jQuery('form[name="ModifyLifecycle"]');
@@ -1485,7 +1485,7 @@
+ form.append(field);
+
+ var pos = {};
-+ self.nodes.forEach( d => {
++ self.nodes.forEach( function(d) {
+ pos[d.name] = [d.x, d.y];
+ });
+
@@ -1602,7 +1602,7 @@
+ var self = this;
+
+ self.node = self.svg.selectAll(".node")
-+ .data(self.nodes.filter(d => d.id >= 0));
++ .data(self.nodes.filter(function(d) { return d.id >= 0 }));
+
+ self.node.exit()
+ .remove();
@@ -1616,22 +1616,22 @@
+ nodeEnter.append("title");
+
+ self.node = nodeEnter.merge(self.node)
-+ .attr("id", d => { d.id });
++ .attr("id", function(d) { return d.id });
+
+ self.node.call(d3.drag()
-+ .on("start", (d => {
-+ if (!d3.event.active) this.simulation.alphaTarget(0.3).restart();
++ .on("start", function(d) {
++ if (!d3.event.active) self.simulation.alphaTarget(0.3).restart();
+ d.fx = d.x, d.fy = d.y;
-+ }))
-+ .on("drag", (d => {
++ })
++ .on("drag", function(d) {
+ d.fx = d3.event.x, d.fy = d3.event.y;
-+ }))
-+ .on("end", (d => {
-+ if (!d3.event.active) this.simulation.alphaTarget(0);
++ })
++ .on("end", function(d) {
++ if (!d3.event.active) self.simulation.alphaTarget(0);
+ if ( !self.enableSimulation ) {
+ d.fx = null, d.fy = null;
+ }
-+ })));
++ }));
+
+ // Add our circle to our new node
+ self.node.select("circle")
@@ -1698,14 +1698,15 @@
+ var self = this;
+ const nodeInput = jQuery("#lifeycycle-ui-edit-node");
+
-+ var posX = event.pageX;
-+ var posY = event.pageY;
-+
-+ if ( posX + nodeInput.width() > self.width ) posX = self.width - nodeInput.width();
-+ if ( posY + nodeInput.height() > self.height ) posY = self.height - nodeInput.height();
-+
-+ nodeInput.css( {position:"absolute", top:posY - self.node_radius, left: posX - self.node_radius});
-+
++ if ( event.pageX ) {
++ var posX = event.pageX;
++ var posY = event.pageY;
++
++ if ( posX + nodeInput.width() > self.width ) posX = self.width - nodeInput.width();
++ if ( posY + nodeInput.height() > self.height ) posY = self.height - nodeInput.height();
++
++ nodeInput.css( {position:"absolute", top:posY - self.node_radius, left: posX - self.node_radius});
++ }
+ var list = document.getElementById('lifeycycle-ui-edit-node').querySelectorAll('input, select');
+
+ if ( element ) {
@@ -1713,10 +1714,12 @@
+ jQuery(item).val(element[item.name]);
+ }
+ self.editing_node = element;
++ jQuery('.selectpicker').selectpicker('refresh')
+ }
+ else {
+ var name = document.getElementsByName('name')[0].value;
-+ if ( self.nodes.reduce((n, x) => n + (x.name === name), 0) > 1 || name === '' ) {
++
++ if ( self.nodes.reduce(function(n, x) { return n + (x.name === name) }, 0) >= 1 || name === '' ) {
+ var form = jQuery('#lifeycycle-ui-edit-node');
+ var field = jQuery('<div class="alert alert-warning removing">Name invalid</div>');
+ form.prepend(field);
@@ -1726,7 +1729,7 @@
+ var values = {};
+ for (let item of list) {
+ if ( item.name === 'id' ) {
-+ values.index = self.nodes.findIndex(x => x.id == item.value);
++ values.index = self.nodes.findIndex(function(x) { return x.id == item.value });
+ }
+ values[item.name] = item.value;
+ }
@@ -1760,10 +1763,10 @@
+ var linkEnter = self.link.enter().append("g")
+ .append("path")
+ .attr("class", 'link')
-+ .style("marker-start", (d => d.start ? 'url(#start-arrow)' : '' ))
-+ .style("marker-end", (d => d.end ? 'url(#end-arrow)' : '' ))
++ .style("marker-start", function(d) { return d.start ? 'url(#start-arrow)' : '' })
++ .style("marker-end", function(d) { return d.end ? 'url(#end-arrow)' : '' })
+ .attr("transform", "translate(0,0)")
-+ .on("click", d => {
++ .on("click", function(d) {
+ d3.event.stopPropagation();
+ self.simulation.stop();
+ self.ToggleLink(d);
@@ -1774,8 +1777,8 @@
+ });
+ self.link = linkEnter.merge(self.link);
+ self.link
-+ .style("marker-start", (d => d.start ? 'url(#start-arrow)' : '' ))
-+ .style("marker-end", (d => d.end ? 'url(#end-arrow)' : '' ));
++ .style("marker-start", function(d) { return d.start ? 'url(#start-arrow)' : '' })
++ .style("marker-end", function(d) { d.end ? 'url(#end-arrow)' : '' });
+ }
+
+ Refresh() {
@@ -1789,7 +1792,7 @@
+ .nodes(self.nodes)
+ .force("link")
+ .links(self.links)
-+ .id(d => d.id);
++ .id(function(d) { return d.id });
+
+ self.RenderLink();
+ self.RenderNode();
@@ -1911,7 +1914,7 @@
+ }))
+ self.simulation.force("link")
+ .links(self.links)
-+ .id(d => d.id);
++ .id(function(d) { return d.id });
+ }
+ self.ExportAsConfiguration();
+ }
@@ -1937,7 +1940,7 @@
+
+ jQuery.each(['initial', 'active', 'inactive'], function (i, type) {
+ if ( config[type] ) {
-+ config[type].forEach(element => {
++ config[type].forEach(function(element) {
+ self.nodes = self.nodes.concat({id: ++self.nodes_seq, name: element, type: type});
+ });
+ }
@@ -1962,7 +1965,7 @@
+ name;
+ while (1) {
+ name = 'status #' + ++i;
-+ var index = this.nodes.findIndex(x => x.name == name);
++ var index = this.nodes.findIndex(function(x) { return x.name == name });
+ if ( index < 0 ) {
+ break;
+ }
@@ -1983,7 +1986,7 @@
+
+ ToggleLink(d) {
+ var self = this;
-+ var index = self.links.findIndex(x => x.id == d.id);
++ var index = self.links.findIndex(function(x) { return x.id == d.id });
+
+ var link = self.links[index];
+ // delete link if we have both transitions already
@@ -2013,7 +2016,7 @@
+ DeleteNode(d) {
+ var self = this;
+
-+ var index = this.nodes.findIndex(x => x.id == d.id);
++ var index = this.nodes.findIndex(function(x) { x.id == d.id });
+ this.DeleteLinksForNode(this.nodes[index]);
+
+ self.CheckRights(d);
@@ -2024,7 +2027,7 @@
+ }
+
+ LinksForNode (node) {
-+ return this.links.filter(link => {
++ return this.links.filter(function(link) {
+ if ( link.source.id === node.id ) {
+ return true;
+ }
@@ -2095,36 +2098,39 @@
+ }
+
+ UpdateNodeModel(node, args) {
-+ this.CheckActions(node);
-+ this.CheckDefaults(node);
-+ this.CheckRights(node);
-+
-+ var nodeIndex = this.nodes.findIndex(x => x.id == node.id);
-+
-+ this.nodes[nodeIndex] = {...this.nodes[nodeIndex], ...args};
-+ var nodeUpdated = this.nodes[nodeIndex];
++ var self = this;
++
++ self.CheckActions(node);
++ self.CheckDefaults(node);
++ self.CheckRights(node);
++
++ var nodeIndex = self.nodes.findIndex(function(x) { return x.id == node.id });
++
++ self.nodes[nodeIndex] = {...self.nodes[nodeIndex], ...args};
++ var nodeUpdated = self.nodes[nodeIndex];
+
+ // Update any links with node being changed as source
-+ var links = this.links.filter(function(l) { return (
++ var links = self.links.filter(function(l) { return (
+ ( l.source.id === node.id ) )
+ });
-+ links.forEach(link => {
-+ var index = this.links.findIndex(x => x.id == link.id);
-+ this.links[index] = {...link, source: nodeUpdated}
++ links.forEach(function(link) {
++ var index = self.links.findIndex(function(x) { return x.id == link.id });
++ self.links[index] = {...link, source: nodeUpdated}
+ });
+
+ // Update any links with node being changed as target
-+ var links = this.links.filter(function(l) { return (
++ var links = self.links.filter(function(l) { return (
+ ( l.target.id === node.id ) )
+ });
-+ links.forEach(link => {
-+ var index = this.links.findIndex(x => x.id == link.id);
-+ this.links[index] = {...link, target: nodeUpdated}
++ links.forEach(function(link) {
++ var index = self.links.findIndex(function(x) { return x.id == link.id });
++ self.links[index] = {...link, target: nodeUpdated}
+ });
+ }
+
+ ExportAsConfiguration () {
+ var self = this;
++
+ var config = {
+ type: self.type,
+ initial: [],
@@ -2134,15 +2140,15 @@
+ };
+
+ // Grab our status nodes
-+ ['initial', 'active', 'inactive'].forEach(type => {
-+ config[type] = self.nodes.filter(n => n.type == type).map(n => n.name);
++ ['initial', 'active', 'inactive'].forEach(function(type) {
++ config[type] = self.nodes.filter(function(n) { return n.type == type }).map(function(n) { return n.name });
+ });
+
+ // Grab our links
+ config.transitions[""] = self.config.transitions ? self.config.transitions[""]: [];
+
+ var seen = {};
-+ self.nodes.forEach(source => {
++ self.nodes.forEach(function(source) {
+ var links = self.LinksForNode(source);
+ var targets = links.map(link => {
+ if ( link.source.id === source.id ) {
@@ -2172,7 +2178,7 @@
+ pos["checked"] = 1;
+ }
+ else {
-+ self.nodes.forEach( d => {
++ self.nodes.forEach( function(d) {
+ pos[d.name] = [d.fx, d.fy];
+ });
+
More information about the rt-commit
mailing list