[Rt-commit] rt branch, 5.0/lifecycle-ui-handle-create-transitions, created. rt-5.0.0alpha1-225-gc234d3e20c
Craig Kaiser
craig at bestpractical.com
Tue May 5 18:25:21 EDT 2020
The branch, 5.0/lifecycle-ui-handle-create-transitions has been created
at c234d3e20c3dca5c5c569ef5f6122db96e1a5737 (commit)
- Log -----------------------------------------------------------------
commit c234d3e20c3dca5c5c569ef5f6122db96e1a5737
Author: Craig <craig at bestpractical.com>
Date: Tue May 5 18:23:17 2020 -0400
Handle updating statuses in the ticket create '' transition
diff --git a/share/static/js/lifecycleui-model.js b/share/static/js/lifecycleui-model.js
index 30508b06aa..bfeaf958e0 100644
--- a/share/static/js/lifecycleui-model.js
+++ b/share/static/js/lifecycleui-model.js
@@ -3,6 +3,8 @@ class LifecycleModel {
constructor() {
this.links_seq = 0;
this.nodes_seq = 0;
+ // Here we store the '' => transitions
+ this.create_nodes = [];
}
// Generate nodes from config
@@ -24,7 +26,10 @@ class LifecycleModel {
var config = config || this.config;
for (let [fromNode, toList] of Object.entries(config.transitions)) {
- if ( fromNode.toLowerCase() == node.toLowerCase() ) {
+ if ( fromNode == '' ) {
+ this.create_nodes = toList;
+ }
+ else if ( fromNode.toLowerCase() == node.toLowerCase() ) {
return toList;
}
}
@@ -199,6 +204,8 @@ class LifecycleModel {
var nodeIndex = self.nodes.findIndex(function(x) { return x.id == node.id });
+ var oldValue = self.nodes[nodeIndex];
+
self.nodes[nodeIndex] = {...self.nodes[nodeIndex], ...args};
var nodeUpdated = self.nodes[nodeIndex];
@@ -219,6 +226,17 @@ class LifecycleModel {
var index = self.links.findIndex(function(x) { return x.id == link.id });
self.links[index] = {...link, target: nodeUpdated}
});
+ // Only need to check for target
+ var tempArr = [];
+ self.create_nodes.forEach(function(target) {
+ if ( target != oldValue.name ) {
+ tempArr.push(target);
+ }
+ else {
+ tempArr.push(nodeUpdated.name);
+ }
+ });
+ self.create_nodes = tempArr;
}
ExportAsConfiguration () {
@@ -238,7 +256,7 @@ class LifecycleModel {
});
// Grab our links
- config.transitions[""] = self.config.transitions ? self.config.transitions[""]: [];
+ config.transitions[""] = self.create_nodes;
var seen = {};
self.nodes.forEach(function(source) {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list