From 8f42b751aebda2e7dce2c363bed6f1e15b411b1d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2002 01:03:10 +0000 Subject: use Net::SSH::ssh_cmd for all job queueing rather than local duplicated ssh subs queue daemon updates: retry & remove links work, bubble up error message to webinterface, link to svcnum & have job listings on view/svc_* pages, closes: Bug#280 s/option/optionname/ schema change, dumb mysql, closes: Bug#334 --- httemplate/misc/queue.cgi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 httemplate/misc/queue.cgi (limited to 'httemplate/misc/queue.cgi') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi new file mode 100644 index 000000000..7e962d498 --- /dev/null +++ b/httemplate/misc/queue.cgi @@ -0,0 +1,25 @@ +<% + +$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; +my $jobnum = $1; +my $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; + +$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +my $action = $1; + +if ( $action eq 'new' ) { + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; +} elsif ( $action eq 'del' ) { + my $error = $job->delete; + die $error if $error; +} + +print $cgi->redirect(popurl(2). "browse/queue.cgi"); + +%> -- cgit v1.2.1 From f70985da9714a8a2c5dd87f56d891ed0197ef590 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 13 Apr 2002 08:51:54 +0000 Subject: bulk queue operations (closes: Bug#389) --- httemplate/misc/queue.cgi | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'httemplate/misc/queue.cgi') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index 7e962d498..8c1e5362d 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -1,13 +1,17 @@ <% -$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; -my $jobnum = $1; -my $job = qsearchs('queue', { 'jobnum' => $1 }) - or die "unknown jobnum $jobnum"; - -$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +$cgi->param('action') =~ /^(new|del|(retry|remove) selected)$/ + or die "Illegal action"; my $action = $1; +my $job; +if ( $action eq 'new' || $action eq 'del' ) { + $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; + my $jobnum = $1; + $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; +} + if ( $action eq 'new' ) { my %hash = $job->hash; $hash{'status'} = 'new'; @@ -18,6 +22,23 @@ if ( $action eq 'new' ) { } elsif ( $action eq 'del' ) { my $error = $job->delete; die $error if $error; +} elsif ( $action =~ /^(retry|remove) selected$/ ) { + foreach my $jobnum ( + map { /^jobnum(\d+)$/; $1; } grep /^jobnum\d+$/, $cgi->param + ) { + my $job = qsearchs('queue', { 'jobnum' => $jobnum }); + if ( $action eq 'retry selected' && $job ) { #new + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; + } elsif ( $action eq 'remove selected' && $job ) { #del + my $error = $job->delete; + die $error if $error; + } + } } print $cgi->redirect(popurl(2). "browse/queue.cgi"); -- cgit v1.2.1 From 967ff9a298e535bf3ad4611737a99932ed2f6e1a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Jun 2002 23:52:39 +0000 Subject: better error message --- httemplate/misc/queue.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc/queue.cgi') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index 8c1e5362d..ce9c8fbd3 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -9,7 +9,8 @@ if ( $action eq 'new' || $action eq 'del' ) { $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; my $jobnum = $1; $job = qsearchs('queue', { 'jobnum' => $1 }) - or die "unknown jobnum $jobnum"; + or die "unknown jobnum $jobnum - ". + "it probably completed normally or was removed by another user"; } if ( $action eq 'new' ) { -- cgit v1.2.1