diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 49c3666a2..10cb1aa2d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -17,6 +17,7 @@ - More complete error messages from spectre - fix: Wiki uploads didn't obey image and thumbnail size - fix: Doesn't copy LDAP link to user on create, also wrong search base + - fix: Unable to view running workflows if spectre not running 7.4.8 - fix: Syndicated Content doesn't display all items with multiple feeds in interleaved mode diff --git a/lib/WebGUI/Operation/Workflow.pm b/lib/WebGUI/Operation/Workflow.pm index 4d24c867a..cdd7bee42 100644 --- a/lib/WebGUI/Operation/Workflow.pm +++ b/lib/WebGUI/Operation/Workflow.pm @@ -578,66 +578,87 @@ ENDCODE name=>rand(100000), timeout=>10 ); - if (! $remote) { - my $output = $i18n->get('spectre not running error'); - return $ac->render($output, $i18n->get('show running workflows')); - } - my $sitename = $session->config()->get('sitename')->[0]; - my $workflowResult = $remote->post_respond('workflow/getJsonStatus',$sitename); - if (! defined $workflowResult) { - $remote->disconnect(); - my $output = $i18n->get('spectre no info error'); - return $ac->render($output, $i18n->get('show running workflows')); + my $workflowResult; + if ($remote) { + $workflowResult = $remote->post_respond('workflow/getJsonStatus',$sitename); + if (!defined $workflowResult) { + $remote->disconnect(); + $output = $i18n->get('spectre no info error'); + } + } + else { + $output = $i18n->get('spectre not running error') } - my $workflowsHref = jsonToObj($workflowResult); + if (defined $workflowResult) { + my $workflowsHref = jsonToObj($workflowResult); - my $workflowTitleFor = $session->db->buildHashRef(<<""); - SELECT wi.instanceId, w.title - FROM WorkflowInstance wi - JOIN Workflow w USING (workflowId) + my $workflowTitleFor = $session->db->buildHashRef(<<""); + SELECT wi.instanceId, w.title + FROM WorkflowInstance wi + JOIN Workflow w USING (workflowId) - my $lastActivityFor = $session->db->buildHashRef(<<""); - SELECT wi.instanceId, wa.title - FROM WorkflowInstance wi - JOIN WorkflowActivity wa ON wi.currentActivityId = wa.activityId + my $lastActivityFor = $session->db->buildHashRef(<<""); + SELECT wi.instanceId, wa.title + FROM WorkflowInstance wi + JOIN WorkflowActivity wa ON wi.currentActivityId = wa.activityId - for my $workflowType (qw( Suspended Waiting Running )) { - my $workflowsAref = $workflowsHref->{$workflowType}; - my $workflowCount = @$workflowsAref; + for my $workflowType (qw( Suspended Waiting Running )) { + my $workflowsAref = $workflowsHref->{$workflowType}; + my $workflowCount = @$workflowsAref; - my $titleHeader = $i18n->get('title header'); - my $priorityHeader = $i18n->get('priority header'); - my $activityHeader = $i18n->get('activity header'); - my $lastStateHeader = $i18n->get('last state header'); - my $lastRunTimeHeader = $i18n->get('last run time header'); - $output .= sprintf $i18n->get('workflow type count'), $workflowCount, $workflowType; - $output .= ''; - $output .= ""; - $output .= ""; + my $titleHeader = $i18n->get('title header'); + my $priorityHeader = $i18n->get('priority header'); + my $activityHeader = $i18n->get('activity header'); + my $lastStateHeader = $i18n->get('last state header'); + my $lastRunTimeHeader = $i18n->get('last run time header'); + $output .= sprintf $i18n->get('workflow type count'), $workflowCount, $workflowType; + $output .= '
$titleHeader$priorityHeader$activityHeader$lastStateHeader$lastRunTimeHeader
'; + $output .= ""; + $output .= ""; - for my $workflow (@$workflowsAref) { - my($priority, $id, $instance) = @$workflow; + for my $workflow (@$workflowsAref) { + my($priority, $id, $instance) = @$workflow; - my $originalPriority = ($instance->{priority} - 1) * 10; - my $instanceId = $instance->{instanceId}; - my $title = $workflowTitleFor->{$instanceId} || '(no title)'; - my $lastActivity = $lastActivityFor->{$instanceId} || '(none)'; - my $lastRunTime = $instance->{lastRunTime} || '(never)'; + my $originalPriority = ($instance->{priority} - 1) * 10; + my $instanceId = $instance->{instanceId}; + my $title = $workflowTitleFor->{$instanceId} || '(no title)'; + my $lastActivity = $lastActivityFor->{$instanceId} || '(none)'; + my $lastRunTime = $instance->{lastRunTime} || '(never)'; - $output .= ''; - $output .= ""; - $output .= qq[]; - $output .= ""; - $output .= ""; - $output .= ""; + $output .= ''; + $output .= ""; + $output .= qq[]; + $output .= ""; + $output .= ""; + $output .= ""; - if ($isAdmin) { - my $run = $i18n->get('run'); - my $href = $session->url->page(qq[op=runWorkflow;instanceId=$instanceId]); - $output .= qq[]; + if ($isAdmin) { + my $run = $i18n->get('run'); + my $href = $session->url->page(qq[op=runWorkflow;instanceId=$instanceId]); + $output .= qq[]; + } + $output .= "\n"; } + $output .= '
$titleHeader$priorityHeader$activityHeader$lastStateHeader$lastRunTimeHeader
$title$priority/$originalPriority$lastActivity$instance->{lastState}$lastRunTime
$title$priority/$originalPriority$lastActivity$instance->{lastState}$lastRunTime$run$run
'; + } + } + else { + $output .= ''; + my $rs = $session->db->read("select Workflow.title, WorkflowInstance.lastStatus, WorkflowInstance.runningSince, WorkflowInstance.lastUpdate, WorkflowInstance.instanceId from WorkflowInstance left join Workflow on WorkflowInstance.workflowId=Workflow.workflowId order by WorkflowInstance.runningSince desc"); + while (my ($title, $status, $runningSince, $lastUpdate, $id) = $rs->array) { + my $class = $status || "complete"; + $output .= '' + .'' + .''; + if ($status) { + $output .= ''; + } + $output .= '' + if ($isAdmin); $output .= "\n"; } $output .= '
'.$title.''.$session->datetime->epochToHuman($runningSince).'' + .$status.' / '.$session->datetime->epochToHuman($lastUpdate) + .''.$i18n->get("run").'
'; diff --git a/lib/WebGUI/i18n/English/Workflow.pm b/lib/WebGUI/i18n/English/Workflow.pm index 3293a8af7..81af2a8db 100644 --- a/lib/WebGUI/i18n/English/Workflow.pm +++ b/lib/WebGUI/i18n/English/Workflow.pm @@ -179,13 +179,13 @@ our $I18N = { }, 'spectre not running error' => { - message => q|Spectre is not running.
Unable to get workflow information.|, + message => q|Spectre is not running.
Unable to get detailed workflow information.
|, context => q||, - lastUpdated => 0, + lastUpdated => 1192031332, }, 'spectre no info error' => { - message => q|Spectre is running, but I was not able to get workflow information.|, + message => q|Spectre is running, but I was not able to get detailed workflow information.
|, context => q||, lastUpdated => 0, },