summaryrefslogtreecommitdiff
path: root/luci2/htdocs/luci2/view/system.cron.js
diff options
context:
space:
mode:
Diffstat (limited to 'luci2/htdocs/luci2/view/system.cron.js')
-rw-r--r--luci2/htdocs/luci2/view/system.cron.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/luci2/htdocs/luci2/view/system.cron.js b/luci2/htdocs/luci2/view/system.cron.js
index aae4ce4..c663e01 100644
--- a/luci2/htdocs/luci2/view/system.cron.js
+++ b/luci2/htdocs/luci2/view/system.cron.js
@@ -1,19 +1,33 @@
L.ui.view.extend({
title: L.tr('Scheduled Tasks'),
description: L.tr('This is the system crontab in which scheduled tasks can be defined.'),
- execute: function() {
- var allow_write = this.options.acls.cron;
- return L.system.getCrontab().then(function(data) {
+ getCrontab: L.rpc.declare({
+ object: 'luci2.system',
+ method: 'crontab_get',
+ expect: { data: '' }
+ }),
+
+ setCrontab: L.rpc.declare({
+ object: 'luci2.system',
+ method: 'crontab_set',
+ params: [ 'data' ]
+ }),
+
+ execute: function() {
+ var self = this;
+ var allow_write = this.options.acls.cron;
+
+ return self.getCrontab().then(function(data) {
$('textarea').val(data).attr('disabled', !allow_write);
$('input.cbi-button-save').attr('disabled', !allow_write).click(function() {
var data = ($('textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
L.ui.loading(true);
- L.system.setCrontab(data).then(function() {
+ self.setCrontab(data).then(function() {
$('textarea').val(data);
L.ui.loading(false);
});
});
});
- }
+ }
});