Files
beef/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js

69 lines
2.1 KiB
JavaScript

const areNotificationUpdateTest = {
"name": "Display an alert-----",
"author": "mgeeky",
"modules": [
{
"name": "alert_dialog",
"condition": null,
"options": {
"text":"You've been BeEFed ;>"
}
}
],
"execution_order": [0],
"execution_delay": [0],
"chain_mode": "nested-forward"
};
/**
* Form for the user to read, update and delete a specific Auto Run rule.
*
* rule: The object definition of this rule from the Auto Run Engine.
* deleteFn: callback function to delete this rule.
* updateFn: callback function to update this rule.
*/
AutoRunRuleForm = function(rule, deleteFn, updateFn, addFn) {
function handleUpdateRule() {
// TODO: Get data from form inputs.
updateFn(areNotificationUpdateTest);
}
AutoRunRuleForm.superclass.constructor.call(this, {
padding:'10 10 10 10',
items: [{
xtype: 'textfield',
value: rule.name ? rule.name : '',
fieldLabel: 'Name',
},
{
xtype: 'displayfield',
fieldLabel: 'Author',
value: rule.author ? rule.author : 'anonymous',
},{
xtype: 'combo',
fieldLabel: 'Chain Mode',
store: ['sequential', 'nested-forward'],
queryMode: 'local', // Use local data.
triggerAction: 'all', // Show both options instead of just the default.
editable: false, // Disable manual text input.
forceSelection: true,
value: rule.chain_mode ? rule.chain_mode : 'sequential'
}
],
buttons: [{
text: 'Delete',
handler: deleteFn
}, {
text: 'Save',
handler: handleUpdateRule
},
{
text: 'Add New',
handler: addFn
}],
border: false,
closable: false
});
};
Ext.extend(AutoRunRuleForm, Ext.FormPanel, {});