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

Commit

Permalink
Merge pull request #34 from fbergkemper/master
Browse files Browse the repository at this point in the history
bugfixes
  • Loading branch information
frabdev committed Aug 27, 2014
2 parents 2f23f1e + 62d07a8 commit 1f2b714
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 136 deletions.
56 changes: 43 additions & 13 deletions module/Application/src/Application/View/Helper/JobType.php
Expand Up @@ -29,19 +29,49 @@

class JobType extends AbstractHelper
{
public function __invoke($jobType)
{
switch($jobType)
{
case 'B':
$output = "Backup";
break;
case 'R':
$output = "Restore";
break;
default:
$output = $jobType;
break;
public function __invoke($jobType)
{
switch($jobType)
{
case 'B':
$output = "Backup Job";
break;
case 'M':
$output = "Migrated Job";
break;
case 'V':
$output = "Verify Job";
break;
case 'R':
$output = "Restore Job";
break;
case 'U':
$output = "Console program";
break;
case 'I':
$output = "Internal system job";
break;
case 'D':
$output = "Admin Job";
break;
case 'A':
$output = "Archive Job";
break;
case 'C':
$output = "Copy of a Job";
break;
case 'c':
$output = "Copy Job";
break;
case 'g':
$output = "Migration Job";
break;
case 'S':
$output = "Scan Job";
break;
default:
$output = $jobType;
break;
}

return $output;
Expand Down
46 changes: 11 additions & 35 deletions module/Application/view/layout/layout.phtml
Expand Up @@ -65,22 +65,18 @@ echo $this->doctype();

<body>

<!-- Navigation start -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<!-- <div class="container"> -->
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="<?php echo $this->basePath('img/bareos-logo-small.png') ?>" alt="Bareos" />&nbsp;
<a href="http://www.bareos.org/" target="_blank"><img src="<?php echo $this->basePath('img/bareos-logo-small.png') ?>" alt="Bareos" /></a>&nbsp;
</div>

<!-- TODO -->

<!--<div class="container">-->
<div class="collapse navbar-collapse">

<?php
Expand All @@ -91,41 +87,21 @@ echo $this->doctype();
->setUlClass('nav navbar-nav');
?>

<!--
<ul class="nav navbar-nav">
<li class="active"><a href="<?php echo $this->url('home') ?>"><?php echo $this->translate('Home') ?></a></li>
<li class="active"><a href="<?php echo $this->url('job') ?>"><?php echo $this->translate('Jobs') ?></a></li>
</ul>
-->
</div>
<!--</div>-->
<!--</div>-->
</div>
</nav>
<!-- Navigation end -->


<div class="container">

<!-- TODO CLEANUP BREADCRUMBS -->
<!-- Breadcrumbs start
<p>
<?php echo $this->navigation('navigation')
->breadcrumbs()
->setMinDepth(0)
->setPartial(array('partial/breadcrumb.phtml', 'Home'));
?>
</p>
Breadcrumbs end -->

<div class="container-fluid">

<?php echo $this->content; ?>
<?php echo $this->content; ?>

<hr />
<hr />

<footer>
<p class="text-muted">&copy; 2013 - <?php echo date('Y') ?> Bareos GmbH &amp; Co. KG, GNU Affero General Public License Version 3</p>
</footer>
<footer>
<p class="text-muted">&copy; 2013 - <?php echo date('Y') ?> <a href="http://www.bareos.com/" target="_blank">Bareos GmbH &amp; Co. KG</a>, GNU Affero General Public License Version 3</p>
</footer>

</div> <!-- /container -->
</div>

<?php echo $this->inlineScript() ?>

Expand Down
2 changes: 1 addition & 1 deletion module/Client/src/Client/Controller/ClientController.php
Expand Up @@ -16,7 +16,7 @@ public function indexAction()
{
$paginator = $this->getClientTable()->fetchAll(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(array('paginator' => $paginator));
}
Expand Down
Expand Up @@ -38,7 +38,7 @@ public function indexAction()
{
$paginator = $this->getFilesetTable()->fetchAll(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(array('paginator' => $paginator));
}
Expand Down
4 changes: 2 additions & 2 deletions module/Fileset/view/fileset/fileset/index.phtml
Expand Up @@ -41,8 +41,8 @@ $this->headTitle($title);
<table class="table table-striped table-hover" style="font-size: 9pt;">

<tr>
<th>Fileset ID</th>
<th>Fileset Name</th>
<th>Fileset</th>
<th>Name</th>
<th>MD5</th>
<th>Modified</th>
</tr>
Expand Down
63 changes: 20 additions & 43 deletions module/Job/src/Job/Controller/JobController.php
Expand Up @@ -28,6 +28,7 @@

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Bareos\BConsole\BConsoleConnector;

class JobController extends AbstractActionController
{
Expand All @@ -41,9 +42,14 @@ public function indexAction()

$paginator = $this->getJobTable()->fetchAll(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(array('paginator' => $paginator));
return new ViewModel(
array(
'paginator' => $paginator,
'allJobs' => $this->getJobTable()->fetchAll()
)
);

}

Expand All @@ -64,7 +70,7 @@ public function runningAction()
{
$paginator = $this->getJobTable()->getRunningJobs(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(
array(
Expand All @@ -78,7 +84,7 @@ public function waitingAction()
{
$paginator = $this->getJobTable()->getWaitingJobs(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(
array(
Expand All @@ -92,7 +98,7 @@ public function unsuccessfulAction()
{
$paginator = $this->getJobTable()->getLast24HoursUnsuccessfulJobs(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(
array(
Expand All @@ -106,7 +112,7 @@ public function successfulAction()
{
$paginator = $this->getJobTable()->getLast24HoursSuccessfulJobs(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(
array(
Expand All @@ -126,9 +132,11 @@ public function rerunAction()
{
$jobid = (int) $this->params()->fromRoute('id', 0);
$cmd = "rerun jobid=" . $jobid . " yes";
$config = $this->getServiceLocator()->get('Config');
$bcon = new BConsoleConnector($config['bconsole']);
return new ViewModel(
array(
'bconsoleOutput' => $this->getBConsoleOutput($cmd),
'bconsoleOutput' => $bcon->getBConsoleOutput($cmd),
'jobid' => $jobid,
)
);
Expand All @@ -137,11 +145,13 @@ public function rerunAction()
public function cancelAction()
{
$jobid = (int) $this->params()->fromRoute('id', 0);

$cmd = "cancel jobid=" . $jobid . " yes";

$config = $this->getServiceLocator()->get('Config');
$bcon = new BConsoleConnector($config['bconsole']);
return new ViewModel(
array('bconsoleOutput' => $this->getBConsoleOutput($cmd))
array(
'bconsoleOutput' => $bcon->getBConsoleOutput($cmd)
)
);
}

Expand All @@ -164,39 +174,6 @@ public function getLogTable()
}
return $this->logTable;
}

public function getBConsoleOutput($cmd)
{
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "r")
);

$cwd = '/usr/sbin';
$env = array('/usr/sbin');

$process = proc_open('sudo /usr/sbin/bconsole', $descriptorspec, $pipes, $cwd, $env);

if(!is_resource($process))
throw new \Exception("proc_open error");

if(is_resource($process))
{
fwrite($pipes[0], $cmd);
fclose($pipes[0]);
while(!feof($pipes[1])) {
array_push($this->bconsoleOutput, fread($pipes[1],8192));
}
fclose($pipes[1]);

}

$return_value = proc_close($process);

return $this->bconsoleOutput;

}

}

15 changes: 14 additions & 1 deletion module/Job/view/job/job/index.phtml
Expand Up @@ -43,6 +43,8 @@ $this->headTitle($title);

<br />

<?php if(count($this->allJobs) > 0) : ?>

<div class="row">

<div class="col-md-12">
Expand All @@ -68,7 +70,7 @@ $this->headTitle($title);

<?php foreach ($this->paginator as $job) : ?>

<tr>
<tr>

<td><a href="<?php echo $this->url('job', array('action' => 'details', 'id' => $job->jobid)); ?>"><?php echo $this->escapeHtml($job->jobid); ?></a></td>
<td><?php echo $this->escapeHtml($job->jobname); ?></td>
Expand Down Expand Up @@ -131,3 +133,14 @@ echo $this->paginationControl(
</div>

</div>

<?php print_r($this->job); ?>

<?php elseif(count($this->allJobs) == 0) : ?>
<div class="alert alert-dismissable alert-info">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<ul>
<li><?php echo $this->translate("No jobs found."); ?></li>
</ul>
</div>
<?php endif; ?>
1 change: 1 addition & 0 deletions module/Job/view/job/job/running.phtml
Expand Up @@ -145,3 +145,4 @@ echo $this->paginationControl(
</ul>
</div>
<?php endif; ?>

1 change: 1 addition & 0 deletions module/Job/view/job/job/successful.phtml
Expand Up @@ -151,3 +151,4 @@ echo $this->paginationControl(
</div>

<?php endif; ?>

1 change: 1 addition & 0 deletions module/Job/view/job/job/unsuccessful.phtml
Expand Up @@ -151,3 +151,4 @@ echo $this->paginationControl(
</div>

<?php endif; ?>

2 changes: 1 addition & 1 deletion module/Job/view/job/job/waiting.phtml
Expand Up @@ -135,7 +135,7 @@ echo $this->paginationControl(

</div>

<?php elseif(count($this->runningJobs) == 0) : ?>
<?php elseif(count($this->waitingJobs) == 0) : ?>
<div class="alert alert-dismissable alert-info">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion module/Media/src/Media/Controller/MediaController.php
Expand Up @@ -37,7 +37,7 @@ public function indexAction()
{
$paginator = $this->getMediaTable()->fetchAll(true);
$paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) );
$paginator->setItemCountPerPage(10);
$paginator->setItemCountPerPage(25);

return new ViewModel(array('paginator' => $paginator));
}
Expand Down
4 changes: 2 additions & 2 deletions module/Pool/view/pool/pool/index.phtml
Expand Up @@ -42,8 +42,8 @@ $this->headTitle($title);
<table class="table table-striped table-hover" style="font-size: 9pt;">

<tr>
<th>Pool ID</th>
<th>Pool name</th>
<th>Pool</th>
<th>Name</th>
<th>Pool type</th>
<th><div align="right">Volumes</div></th>
<th><div align="right">Maximum volumes</div></th>
Expand Down

0 comments on commit 1f2b714

Please sign in to comment.