forked from hummypkg/sweeper
add run now button
This commit is contained in:
parent
57b685846c
commit
3b78c420d8
@ -1,7 +1,7 @@
|
||||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.0.7-5
|
||||
Version: 2.0.7-6
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.0.16)
|
||||
|
@ -43,6 +43,7 @@ puts {
|
||||
<button id=b_revert>Discard changes</button>
|
||||
<button id=b_show>View config</button>
|
||||
<button id=b_test>Test config</button>
|
||||
<button id=b_run>Run now</button>
|
||||
<button id=b_edit>Text editor</button>
|
||||
<button id=b_raw>Toggle raw display</button>
|
||||
</div>
|
||||
@ -198,7 +199,7 @@ Enter new filename base (no extension) e.g. %title_%yyyymmdd_%hhmm
|
||||
</div>
|
||||
|
||||
<div class=hidden id=testresults title="Test current ruleset">
|
||||
<span class=blood>
|
||||
<span id=dryrun_info class=blood>
|
||||
The following output shows what would happen if these rules were applied.
|
||||
No changes have been made.
|
||||
</span>
|
||||
|
@ -642,11 +642,29 @@ $('#b_show').button({icons: {primary: "ui-icon-clipboard"}})
|
||||
});
|
||||
});
|
||||
|
||||
$('#b_test').button({icons: {primary: "ui-icon-check"}})
|
||||
$('#b_test').button({icons: {primary: "ui-icon-check"}});
|
||||
$('#b_run').button({icons: {primary: "ui-icon-play"}});
|
||||
|
||||
$('#b_test,#b_run')
|
||||
.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('id');
|
||||
$('#testresults_inner').empty()
|
||||
.html('<img src=/img/loading.gif> Running rules... Please wait...');
|
||||
|
||||
if (id == 'b_test')
|
||||
{
|
||||
$('#dryrun_info').show();
|
||||
dryrun = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!confirm('Run ruleset now?'))
|
||||
return;
|
||||
$('#dryrun_info').hide();
|
||||
dryrun = 0;
|
||||
}
|
||||
|
||||
$('#testresults').dialog({
|
||||
height: '600', width: '800',
|
||||
draggable: true, resizable: true,
|
||||
@ -659,6 +677,7 @@ $('#b_test').button({icons: {primary: "ui-icon-check"}})
|
||||
});
|
||||
$.post('test.jim', {
|
||||
dir: $('span.dir').text(),
|
||||
dryrun: dryrun,
|
||||
data: conffile()
|
||||
}, function(data) {
|
||||
$('#testresults_inner').text(data);
|
||||
|
@ -6,6 +6,7 @@ source /mod/webif/plugin/sweeper/harness.jim
|
||||
httpheader
|
||||
|
||||
set dir [cgi_get dir ""]
|
||||
set dryrun [cgi_get dryrun 1]
|
||||
|
||||
set cf "/tmp/sweepertest.cf"
|
||||
|
||||
@ -28,7 +29,7 @@ if {[catch {set fp [open $cf w]} msg]} {
|
||||
$fp puts -nonewline $data
|
||||
close $fp
|
||||
|
||||
set ::sweeper::dryrun 1
|
||||
set ::sweeper::dryrun $dryrun
|
||||
::sweeper::apply $dir $cf
|
||||
|
||||
file delete $cf
|
||||
|
Loading…
Reference in New Issue
Block a user