Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
- Displays restore, rerun and cancel buttons with icon and text
- Makes restore module available via topnavbar
  • Loading branch information
fbergkemper committed Sep 8, 2015
1 parent 1b71dee commit 65ae746
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 39 deletions.
2 changes: 0 additions & 2 deletions module/Application/config/module.config.php
Expand Up @@ -161,12 +161,10 @@
'label' => 'Jobs',
'route' => 'job',
),
/*
array(
'label' => 'Restore',
'route' => 'restore',
),
*/
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion module/Client/view/client/client/details.phtml
Expand Up @@ -45,7 +45,7 @@ $this->headTitle($title);
'client' => $this->client['name'],
'restoreclient' => $this->client['name']
)
)); ?>" role="button" data-toggle="tooltip" data-placement="top" title="restore"><span class="glyphicon glyphicon-import"></span></a>
)); ?>" role="button" data-toggle="tooltip" data-placement="left" title="Restore"><span class="glyphicon glyphicon-import"></span> Restore</a>
</td>
</tr>

Expand Down
2 changes: 1 addition & 1 deletion module/Client/view/client/client/index.phtml
Expand Up @@ -76,7 +76,7 @@ Clients per page:
'client' => $client['name'],
'restoreclient' => $client['name']
)
)); ?>" class="btn btn-default btn-xs" role="button" data-toggle="tooltip" data-placement="top" title="Restore"><span class="glyphicon glyphicon-import"></span></a>
)); ?>" class="btn btn-default btn-xs" role="button" data-toggle="tooltip" data-placement="left" title="Restore"><span class="glyphicon glyphicon-import"></span> Restore</a>
</td>

</tr>
Expand Down
4 changes: 2 additions & 2 deletions module/Job/view/job/job/details.phtml
Expand Up @@ -42,7 +42,7 @@ $this->headTitle($title);

<div class="panel-body">

<table class="table table-bordered table-condensed">
<table class="table table-condensed">

<tr>
<td><b>Job</b></td><td><?php echo $this->escapeHtml($job['jobid']); ?></td>
Expand Down Expand Up @@ -94,7 +94,7 @@ $this->headTitle($title);

<div class="panel-body">

<table class="table table-bordered table-condensed">
<table class="table table-condensed">

<tr>
<th class="bg-primary">Timestamp</th>
Expand Down
4 changes: 2 additions & 2 deletions module/Job/view/job/job/index.phtml
Expand Up @@ -98,8 +98,8 @@ Jobs per page:
<?php if($job['jobstatus'] == "T" || $job['jobstatus'] == "E" || $job['jobstatus'] == "e" || $job['jobstatus'] == "f" || $job['jobstatus'] == "A") : ?>
<a class="btn btn-default btn-xs"
href="<?php echo $this->url('job', array('action' => 'rerun', 'id' => $job['jobid'])); ?>"
title="<?php echo $this->translate("Rerun"); ?>" data-toggle="tooltip" data-placement="top">
<span class="glyphicon glyphicon-repeat"></span></a>
title="<?php echo $this->translate("Rerun"); ?>" data-toggle="tooltip" data-placement="left">
<span class="glyphicon glyphicon-repeat"></span> Rerun</a>
<?php endif; ?>
<?php endif; ?>
</td>
Expand Down
7 changes: 3 additions & 4 deletions module/Job/view/job/job/run.phtml
Expand Up @@ -43,7 +43,7 @@ $this->headTitle($title);

<div class="row">

<div class="col-md-8">
<div class="col-md-6">

<div class="panel panel-default">

Expand Down Expand Up @@ -76,9 +76,8 @@ Jobs per page:
'job',
array('action'=>'queue'),
array('query' => array('job' => $job['name']))
); ?>" class="btn btn-default btn-xs" title="run now" role="button" data-toggle="tooltip" data-placement="top">
<span class="glyphicon glyphicon-play-circle" aria-hidden="true"></span>
</a>
); ?>" class="btn btn-default btn-xs" title="Run" role="button" data-toggle="tooltip" data-placement="left">
<span class="glyphicon glyphicon-play-circle" aria-hidden="true"> Run</span></a>
</td>
</tr>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion module/Job/view/job/job/running.phtml
Expand Up @@ -107,7 +107,7 @@ Jobs per page:
<td><?php echo $this->printDate($job['starttime']); ?></td>
<td><?php echo $this->printJobStatus($job['jobstatus']); ?></td>
<td>
<a class="btn btn-default btn-xs" href="<?php echo $this->url('job', array('action' => 'cancel', 'id' => $job['jobid'])); ?>" title="<?php echo $this->translate("Cancel"); ?>" data-toggle="tooltip" data-placement="top"><span class="glyphicon glyphicon-trash"></span></a>
<a class="btn btn-default btn-xs" href="<?php echo $this->url('job', array('action' => 'cancel', 'id' => $job['jobid'])); ?>" title="<?php echo $this->translate("Cancel"); ?>" data-toggle="tooltip" data-placement="left"><span class="glyphicon glyphicon-trash"></span> Cancel</a>
</td>

</tr>
Expand Down
4 changes: 2 additions & 2 deletions module/Job/view/job/job/successful.phtml
Expand Up @@ -115,8 +115,8 @@ Jobs per page:
<?php if($job['jobstatus'] == "T" || $job['jobstatus'] == "E" || $job['jobstatus'] == "e" || $job['jobstatus'] == "f" || $job['jobstatus'] == "A") : ?>
<a class="btn btn-default btn-xs"
href="<?php echo $this->url('job', array('action' => 'rerun', 'id' => $job['jobid'])); ?>"
title="<?php echo $this->translate("Rerun"); ?>" data-toggle="tooltip" data-placement="top">
<span class="glyphicon glyphicon-repeat"></span></a>
title="<?php echo $this->translate("Rerun"); ?>" data-toggle="tooltip" data-placement="left">
<span class="glyphicon glyphicon-repeat"></span> Rerun</a>
<?php endif; ?>
<?php endif; ?>
</td>
Expand Down
4 changes: 2 additions & 2 deletions module/Job/view/job/job/unsuccessful.phtml
Expand Up @@ -112,8 +112,8 @@ Jobs per page:
<?php if($job['jobstatus'] == "T" || $job['jobstatus'] == "E" || $job['jobstatus'] == "e" || $job['jobstatus'] == "f" || $job['jobstatus'] == "A") : ?>
<a class="btn btn-default btn-xs"
href="<?php echo $this->url('job', array('action' => 'rerun', 'id' => $job['jobid'])); ?>"
title="<?php echo $this->translate("Rerun"); ?>" data-toggle="tooltip" data-placement="top">
<span class="glyphicon glyphicon-repeat"></span></a>
title="<?php echo $this->translate("Rerun"); ?>" data-toggle="tooltip" data-placement="left">
<span class="glyphicon glyphicon-repeat"></span> Rerun</a>
<?php endif; ?>
<?php endif; ?>
</td>
Expand Down
2 changes: 1 addition & 1 deletion module/Job/view/job/job/waiting.phtml
Expand Up @@ -104,7 +104,7 @@ Jobs per page:
<td><?php echo $this->printJobLevel($job['level']); ?></td>
<td><?php echo $this->printJobStatus($job['jobstatus']); ?></td>
<td>
<a class="btn btn-default btn-xs" href="<?php echo $this->url('job', array('action' => 'cancel', 'id' => $job['jobid'])); ?>" title="<?php echo $this->translate("Cancel"); ?>" data-toggle="tooltip" data-placement="top"><span class="glyphicon glyphicon-trash"></span></a>
<a class="btn btn-default btn-xs" href="<?php echo $this->url('job', array('action' => 'cancel', 'id' => $job['jobid'])); ?>" title="<?php echo $this->translate("Cancel"); ?>" data-toggle="tooltip" data-placement="left"><span class="glyphicon glyphicon-trash"></span> Cancel</a>
</div>
</td>
</tr>
Expand Down
16 changes: 8 additions & 8 deletions module/Pool/view/pool/pool/index.phtml
Expand Up @@ -51,14 +51,14 @@ Pools per page:
<table class="table table-condensed">

<tr>
<th class="bg-primary"><div align="right">Pool</div></th>
<th class="bg-primary"><div align="right">Name</div></th>
<th class="bg-primary"><div align="right">Type</div></th>
<th class="bg-primary"><div align="right">Volumes</div></th>
<th class="bg-primary"><div align="right">Maximum volumes</div></th>
<th class="bg-primary"><div align="right">Volume retention</div></th>
<th class="bg-primary"><div align="right">Maximum volume jobs</div></th>
<th class="bg-primary"><div align="right">Maximum volume bytes</div></th>
<th class="bg-primary">Pool</th>
<th class="bg-primary">Name</th>
<th class="bg-primary">Type</th>
<th class="bg-primary">Volumes</th>
<th class="bg-primary">Maximum volumes</th>
<th class="bg-primary">Volume retention</th>
<th class="bg-primary">Maximum volume jobs</th>
<th class="bg-primary">Maximum volume bytes</th>

</tr>

Expand Down
34 changes: 23 additions & 11 deletions module/Restore/src/Restore/Controller/RestoreController.php
Expand Up @@ -45,6 +45,10 @@ public function indexAction()

$this->getRestoreParams();

if($this->restore_params['client'] == null) {
$this->restore_params['client'] = @array_pop($this->getClients(2))['name'];
}

if($this->restore_params['type'] == "client" && $this->restore_params['jobid'] == null) {
$latestbackup = $this->getClientBackups($this->restore_params['client'], "any", "desc", 1);
$this->restore_params['jobid'] = $latestbackup[0]['jobid'];
Expand All @@ -62,7 +66,7 @@ public function indexAction()
}

$jobs = $this->getJobs(2);
$clients = $this->getClients(0);
$clients = $this->getClients(2);
$filesets = $this->getFilesets(0);
$restorejobs = $this->getRestoreJobs(0);

Expand Down Expand Up @@ -263,7 +267,7 @@ private function getRestoreParams()
$this->restore_params['type'] = $this->params()->fromQuery('type');
}
else {
$this->restore_params['type'] = null;
$this->restore_params['type'] = 'client';
}

if($this->params()->fromQuery('jobid')) {
Expand Down Expand Up @@ -477,15 +481,17 @@ private function getJobIds($jobid=null, $mergefilesets=0, $mergejobs=0)
$jobids = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
$result = "";

$jnum = count($jobids['result']['jobids']);
if(!empty($jobids['result'])) {
$jnum = count($jobids['result']['jobids']);

foreach($jobids['result']['jobids'] as $jobid) {
$result .= $jobid['id'];
--$jnum;
if($jnum > 0) {
$result .= ",";
}
}
foreach($jobids['result']['jobids'] as $jobid) {
$result .= $jobid['id'];
--$jnum;
if($jnum > 0) {
$result .= ",";
}
}
}

$this->restore_params['jobids'] = $result;

Expand Down Expand Up @@ -530,6 +536,7 @@ private function getClients($format=2)
}
elseif($format == 0) {
$result = $director->send_command(".clients", 2);
return $result;
}
$clients = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
return $clients['result']['clients'];
Expand Down Expand Up @@ -583,7 +590,12 @@ private function getClientBackups($client=null, $fileset=null, $order=null, $lim
$result = $director->send_command("list backups client=$client fileset=$fileset order=$order", 2);
}
$backups = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
return $backups['result']['backups'];
if(empty($backups['result'])) {
return null;
}
else {
return $backups['result']['backups'];
}
}

}
3 changes: 2 additions & 1 deletion module/Restore/src/Restore/Form/RestoreForm.php
Expand Up @@ -157,7 +157,8 @@ public function __construct($restore_params=null, $jobs=null, $clients=null, $fi
'value_options' => $this->getClientList()
),
'attributes' => array(
'id' => 'client'
'id' => 'client',
'value' => @array_pop($this->getClientList())
)
));
}
Expand Down
1 change: 0 additions & 1 deletion module/Restore/view/restore/restore/index.phtml
Expand Up @@ -72,7 +72,6 @@ $this->headTitle($title);
echo $this->formRow($form->get('restorejob')->setAttribute('class','form-control'));
echo $this->formRow($form->get('where')->setAttribute('class','form-control'));
}

?>

</div>
Expand Down

0 comments on commit 65ae746

Please sign in to comment.