2 title
: L
.tr('Startup'),
5 var redraw = function() { return self
.execute(); };
6 var allow_write
= self
.options
.acls
.startup
;
9 L
.system
.initList().then(function(list
) {
10 /* filter init scripts with no start prio */
11 for (var i
= 0; i
< list
.length
; i
++)
13 if (typeof(list
[i
].start
) != 'undefined')
19 var initTable
= new L
.ui
.table({
21 caption
: L
.tr('Start priority'),
24 caption
: L
.tr('Initscript'),
28 format: function(v
, n
) {
31 .addClass('btn-group pull-right')
32 .append($('<button />')
33 .attr('disabled', !allow_write
)
34 .attr('name', list
[n
].name
)
35 .addClass('btn btn-sm')
36 .addClass(v
? 'btn-success' : 'btn-danger')
37 .text(v
? L
.trc('Init script state', 'Enabled') : L
.trc('Init script state', 'Disabled'))
41 L
.system
.initDisable(this.getAttribute('name')).then(redraw
);
43 L
.system
.initEnable(this.getAttribute('name')).then(redraw
);
45 .append($('<button />')
46 .addClass('btn btn-primary btn-sm dropdown-toggle')
47 .attr('data-toggle', 'dropdown')
48 .attr('disabled', !allow_write
)
49 .text(L
.tr('Action…')))
51 .addClass('dropdown-menu pull-right')
56 .click(function(ev
) { L
.system
.initReload(v
).then(redraw
); ev
.preventDefault(); })))
60 .text(L
.tr('Restart'))
61 .click(function(ev
) { L
.system
.initRestart(v
).then(redraw
); ev
.preventDefault(); })))
66 .click(function(ev
) { L
.system
.initStop(v
).then(redraw
); ev
.preventDefault(); }))))
73 initTable
.insertInto('#init_table');
77 L
.system
.getRcLocal().then(function(data
) {
78 $('textarea').val(data
).attr('disabled', !allow_write
);
79 $('input.cbi-button-save').attr('disabled', !allow_write
).click(function() {
80 var data
= ($('textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
82 L
.system
.setRcLocal(data
).then(function() {
83 $('textarea').val(data
);