mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 23:40:57 +01:00
567dea5449
Summary: Ref T5474. This provides a Herald-like UI for editing workboard trigger rules. This probably has some missing pieces and doesn't actually save anything to the database yet, but the basics at least roughly work. Test Plan: {F6299886} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T5474 Differential Revision: https://secure.phabricator.com/D20301
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/**
|
|
* @requires javelin-behavior
|
|
* trigger-rule-editor
|
|
* trigger-rule
|
|
* trigger-rule-type
|
|
* @provides javelin-behavior-trigger-rule-editor
|
|
* @javelin
|
|
*/
|
|
|
|
JX.behavior('trigger-rule-editor', function(config) {
|
|
var form_node = JX.$(config.formNodeID);
|
|
var table_node = JX.$(config.tableNodeID);
|
|
var create_node = JX.$(config.createNodeID);
|
|
var input_node = JX.$(config.inputNodeID);
|
|
|
|
var editor = new JX.TriggerRuleEditor(form_node)
|
|
.setTableNode(table_node)
|
|
.setCreateButtonNode(create_node)
|
|
.setInputNode(input_node);
|
|
|
|
editor.start();
|
|
|
|
var ii;
|
|
|
|
for (ii = 0; ii < config.types.length; ii++) {
|
|
var type = JX.TriggerRuleType.newFromDictionary(config.types[ii]);
|
|
editor.addType(type);
|
|
}
|
|
|
|
if (config.rules.length) {
|
|
for (ii = 0; ii < config.rules.length; ii++) {
|
|
var rule = JX.TriggerRule.newFromDictionary(config.rules[ii]);
|
|
editor.addRule(rule);
|
|
}
|
|
} else {
|
|
// If the trigger doesn't have any rules yet, add an empty rule to start
|
|
// with, so the user doesn't have to click "New Rule".
|
|
editor.addRule(editor.newRule());
|
|
}
|
|
|
|
});
|