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

Commit

Permalink
Merge branch 'barbossa-0.0.1'
Browse files Browse the repository at this point in the history
Conflicts:
	.travis.yml
  • Loading branch information
fbergkemper committed Nov 21, 2013
2 parents a63ee44 + bf21051 commit 326664f
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 11 deletions.
21 changes: 14 additions & 7 deletions .travis.yml
@@ -1,22 +1,29 @@
language: php

php:
- 5.5
- 5.4
- 5.3
- 5.5
- 5.4
- 5.3

env:
- DB=mysql
- DB=pgsql
# - DB=mysql
- DB=pgsql

before_install:
- composer self-update
- composer update --prefer-source --dev
- composer self-update
- composer update --prefer-source --dev

before_script:
- if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS bareos;" -U postgres; fi
- if [[ "$DB" == "pgsql" ]]; then psql -c "create database bareos;" -U postgres; fi
#- if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS bareos;" -uroot; fi

script:
<<<<<<< HEAD
- ./vendor/bin/phpunit
=======
phpunit --configuration ./tests/phpunit.xml --coverage-text
>>>>>>> barbossa-0.0.1

after_script:

Expand Down
Expand Up @@ -23,6 +23,8 @@ public function indexAction()

'lastSuccessfulJobs' => $this->getJobTable()->getLast24HoursSuccessfulJobs(),
'lastUnsuccessfulJobs' => $this->getJobTable()->getLast24HoursUnsuccessfulJobs(),
'waitingJobs' => $this->getJobTable()->getWaitingJobs(),
'runningJobs' => $this->getJobTable()->getRunningJobs(),

'jobsCreatedNotRunning' => $this->getJobTable()->getJobCountLast24HoursByStatus("C"),
'jobsBlocked' => $this->getJobTable()->getJobCountLast24HoursByStatus("B"),
Expand Down
136 changes: 133 additions & 3 deletions module/Dashboard/view/dashboard/dashboard/index.phtml
Expand Up @@ -5,7 +5,7 @@ $this->headTitle($title);

?>

<h2><?php echo $title; ?></h2>
<h2><?php echo $this->translate($title); ?></h2>
<hr />

<script type="text/javascript">
Expand Down Expand Up @@ -82,6 +82,136 @@ $flash->setMessageOpenFormat('

?>

<!-- RUNNING JOBS -->
<?php if(count($this->runningJobs) > 0) : ?>

<div class="row">

<div class="col-md-12">

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Running jobs') ?></h3>
</div>

<div class="panel-body">

<table class="table table-striped table-hover" style="font-size: 9pt;">

<tr>
<th>Job</th>
<th>Name</th>
<th>Client</th>
<th>Type</th>
<th>Level</th>
<th>Start</th>
<th>Duration</th>
<th>Status</th>
<th>Log</th>
</tr>

<?php foreach ($this->runningJobs as $item) : ?>

<tr>

<td><a href="<?php echo $this->url('job', array('action' => 'details', 'id' => $item->jobid)); ?>"><?php echo $this->escapeHtml($item->jobid); ?></a></td>
<td><?php echo $this->escapeHtml($item->jobname); ?></td>
<td><a href="<?php echo $this->url('client', array('action' => 'details', 'id' => $item->clientid)); ?>"><?php echo $this->escapeHtml($item->clientname); ?></a></td>
<td><?php echo $this->printJobType($item->type); ?></td>
<td><?php echo $this->printJobLevel($item->level); ?></td>
<td><?php echo $this->escapeHtml($item->starttime); ?></td>
<td><?php echo $this->printJobDuration($item->starttime, $item->endtime); ?></td>
<td><?php echo $this->printJobStatus($item->jobstatus); ?></td>
<td><a href="<?php echo $this->url('log', array('action' => 'job', 'id' => $item->jobid)); ?>"><span class="glyphicon glyphicon-file"></a></td>

</tr>

<?php endforeach; ?>
</table>

</div>

</div>

</div>

</div>

<?php elseif(count($this->runningJobs) == 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("Currently, there are no jobs running."); ?></li>
</ul>
</div>
<?php endif; ?>

<!-- WAITING JOBS -->
<?php if(count($this->waitingJobs) > 0) : ?>

<div class="row">

<div class="col-md-12">

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Waiting jobs') ?></h3>
</div>

<div class="panel-body">

<table class="table table-striped table-hover" style="font-size: 9pt;">

<tr>
<th>Job</th>
<th>Name</th>
<th>Client</th>
<th>Type</th>
<th>Level</th>
<th>Start</th>
<th>Duration</th>
<th>Status</th>
<th>Log</th>
</tr>

<?php foreach ($this->waitingJobs as $item) : ?>

<tr>

<td><a href="<?php echo $this->url('job', array('action' => 'details', 'id' => $item->jobid)); ?>"><?php echo $this->escapeHtml($item->jobid); ?></a></td>
<td><?php echo $this->escapeHtml($item->jobname); ?></td>
<td><a href="<?php echo $this->url('client', array('action' => 'details', 'id' => $item->clientid)); ?>"><?php echo $this->escapeHtml($item->clientname); ?></a></td>
<td><?php echo $this->printJobType($item->type); ?></td>
<td><?php echo $this->printJobLevel($item->level); ?></td>
<td><?php echo $this->escapeHtml($item->starttime); ?></td>
<td><?php echo $this->printJobDuration($item->starttime, $item->endtime); ?></td>
<td><?php echo $this->printJobStatus($item->jobstatus); ?></td>
<td><a href="<?php echo $this->url('log', array('action' => 'job', 'id' => $item->jobid)); ?>"><span class="glyphicon glyphicon-file"></a></td>

</tr>

<?php endforeach; ?>
</table>

</div>

</div>

</div>

</div>

<?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>
<li><?php echo $this->translate("Currently, there are no jobs waiting."); ?></li>
</ul>
</div>
<?php endif; ?>

<!-- UNSUCCESSFUL JOBS -->
<?php if(count($this->lastUnsuccessfulJobs) > 0) : ?>

Expand Down Expand Up @@ -143,7 +273,7 @@ $flash->setMessageOpenFormat('
<div class="alert alert-dismissable alert-info">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<ul>
<li>No unsuccessful jobs during the last 24 hours!</li>
<li><?php echo $this->translate("No unsuccessful jobs during the last 24 hours!"); ?></li>
</ul>
</div>

Expand Down Expand Up @@ -211,7 +341,7 @@ $flash->setMessageOpenFormat('
<div class="alert alert-dismissable alert-info">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<ul>
<li>No successful jobs during the last 24 hours!</li>
<li><?php echo $this->translate("No successful jobs during the last 24 hours!"); ?></li>
</ul>
</div>

Expand Down
35 changes: 35 additions & 0 deletions module/Job/src/Job/Model/JobTable.php
Expand Up @@ -56,6 +56,41 @@ public function getJob($jobid)
return $row;
}

public function getRunningJobs()
{
$select = new Select();
$select->from('job');
$select->join('client', 'job.clientid = client.clientid', array('clientname' => 'name'));
$select->order('job.jobid DESC');
$select->where("jobstatus = 'R'");

$resultSet = $this->tableGateway->selectWith($select);

return $resultSet;
}

public function getWaitingJobs()
{
$select = new Select();
$select->from('job');
$select->join('client', 'job.clientid = client.clientid', array('clientname' => 'name'));
$select->order('job.jobid DESC');
$select->where("jobstatus = 'F' OR
jobstatus = 'S' OR
jobstatus = 'm' OR
jobstatus = 'M' OR
jobstatus = 's' OR
jobstatus = 'j' OR
jobstatus = 'c' OR
jobstatus = 'd' OR
jobstatus = 't' OR
jobstatus = 'p'");

$resultSet = $this->tableGateway->selectWith($select);

return $resultSet;
}

public function getLast24HoursSuccessfulJobs()
{
$current_time = date("Y-m-d H:i:s",time());
Expand Down
File renamed without changes.
Expand Up @@ -12,7 +12,7 @@ class JobControllerTest extends AbstractHttpControllerTestCase
public function setUp()
{
$this->setApplicationConfig(
include '/srv/www/htdocs/barbossa/config/application.config.php'
include './config/application.config.php'
);
}

Expand Down
File renamed without changes.

0 comments on commit 326664f

Please sign in to comment.