[Rt-commit] rt branch 5.0/lifecycle-ui-respect-current-defaults created. rt-5.0.4-64-g2652f1d204
BPS Git Server
git at git.bestpractical.com
Fri Jul 14 18:10:21 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/lifecycle-ui-respect-current-defaults has been created
at 2652f1d204c9eb3f12c0059755b9d6e45119204b (commit)
- Log -----------------------------------------------------------------
commit 2652f1d204c9eb3f12c0059755b9d6e45119204b
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 14 13:51:19 2023 -0400
Set on_create status only if it's absent
The initial goal of 64666b75e0 was to set a fallback value when the
on_create status node is removed, but it wrongly set the fallback value
unconditionally without respecting the existing value.
This commit moved the fallback code a bit later to respect existing
values accordingly.
diff --git a/share/static/js/lifecycleui-model.js b/share/static/js/lifecycleui-model.js
index 63862bf389..93847fee88 100644
--- a/share/static/js/lifecycleui-model.js
+++ b/share/static/js/lifecycleui-model.js
@@ -298,7 +298,6 @@ class LifecycleModel {
initial: [],
active: [],
inactive: [],
- defaults: {},
transitions: {},
};
@@ -307,9 +306,6 @@ class LifecycleModel {
config[type] = self.nodes.filter(function(n) { return n.type == type }).map(function(n) { return n.name });
});
- // Set defaults on_create
- config.defaults.on_create = config.initial[0] || config.active[0] || null;
-
// Clean removed states from create_nodes
self.create_nodes = self.create_nodes.filter(target => self.nodes.find(n => n.name == target));
@@ -339,6 +335,10 @@ class LifecycleModel {
self.config = {...self.config, ...config};
+ // Set defaults on_create if it's absent
+ self.config.defaults ||= {};
+ self.config.defaults.on_create ||= self.config.initial[0] || self.config.active[0] || null;
+
var field = jQuery('form[name=ModifyLifecycle] input[name=Config]');
field.val(JSON.stringify(self.config));
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list