luci2: major changes to RPC implementation
[project/luci2/ui.git] / luci2 / htdocs / luci2 / view / system.cron.js
1 L.ui.view.extend({
2 title: L.tr('Scheduled Tasks'),
3 description: L.tr('This is the system crontab in which scheduled tasks can be defined.'),
4 execute: function() {
5 var allow_write = this.options.acls.cron;
6
7 return L.system.getCrontab().then(function(data) {
8 $('textarea').val(data).attr('disabled', !allow_write);
9 $('input.cbi-button-save').attr('disabled', !allow_write).click(function() {
10 var data = ($('textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
11 L.ui.loading(true);
12 L.system.setCrontab(data).then(function() {
13 $('textarea').val(data);
14 L.ui.loading(false);
15 });
16 });
17 });
18 }
19 });