Commit d55ca7b7 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(argonaut): Add retry action for failed jobs

This adds a retry action for failed jobs, not implemented yet
The icon needs to be chosen
The action is shown raw
The validation does not work

issue #5700
parent adb29e40
No related merge requests found
Showing with 28 additions and 1 deletion
+28 -1
......@@ -96,7 +96,8 @@ class argonautAction extends simplePlugin
'main' => array(
'name' => _('Schedule'),
'attrs' => array(
new HiddenAttribute(
new DisplayAttribute(
_('Action'), _('The action you are about to schedule'),
'action'
),
new HiddenAttribute(
......
......@@ -71,6 +71,8 @@ class argonautQueue extends simpleManagement
$this->registerAction('abort', 'abortEvent');
$this->registerAction('import', 'importEvents');
$this->registerAction('showError', 'showErrorEntry');
$this->registerAction('retry', 'retryAction');
$this->registerAction('saveEvent', 'saveEventDialog');
$this->headpage->registerElementFilter('hostName', 'argonautQueue::filterHostName');
$this->headpage->registerElementFilter('filterTask', 'argonautQueue::filterTask');
......@@ -196,6 +198,12 @@ class argonautQueue extends simpleManagement
$this->execute_queue_entries($target);
}
function retryAction($action, array $target)
{
$entry = $this->getHeadpage()->getEntry($target[0]);
$this->dialogObject = new argonautAction($entry['HEADERTAG'][0], array($entry['MACADDRESS'][0]));
}
function viewLogs($action, array $target)
{
if (count($target) == 1) {
......@@ -220,6 +228,10 @@ class argonautQueue extends simpleManagement
$action = parent::detectPostActions();
if (isset($_POST['import_abort'])) {
$action['action'] = 'cancel';
} elseif (isset($_POST['save_event_dialog'])) {
$action['action'] = 'saveEvent';
} elseif (isset($_POST['abort_event_dialog'])) {
$action['action'] = 'cancel';
}
return $action;
}
......
......@@ -95,6 +95,12 @@ class filterArgonautEvents extends filterLDAP
$entry['objectClass'][] = "FAKE_OC__abort";
}
/* If ERROR add retry action
*/
if (in_array($entry['STATUS'], array("error")) && $acl_is_writeable) {
$entry['objectClass'][] = "FAKE_OC__retry";
}
/* If WAITING or ERROR add remove action
*/
if ( $acl_is_removeable && in_array($entry['STATUS'], array("waiting","error","processed"))) {
......
......@@ -120,6 +120,14 @@
<label>Process now</label>
</action>
<action>
<name>retry</name>
<type>entry</type>
<objectclass>FAKE_OC__retry</objectclass>
<image>geticon.php?context=actions&amp;icon=retry&amp;size=16</image>
<label>Retry</label>
</action>
<action>
<name>viewLogs</name>
<type>entry</type>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment