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

Commit

Permalink
Flash messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed Nov 21, 2013
1 parent 926cfe8 commit bf21051
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 6 deletions.
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
110 changes: 104 additions & 6 deletions module/Dashboard/view/dashboard/dashboard/index.phtml
Expand Up @@ -85,9 +85,58 @@ $flash->setMessageOpenFormat('
<!-- RUNNING JOBS -->
<?php if(count($this->runningJobs) > 0) : ?>

<?php
// TODO
?>
<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">
Expand All @@ -101,9 +150,58 @@ $flash->setMessageOpenFormat('
<!-- WAITING JOBS -->
<?php if(count($this->waitingJobs) > 0) : ?>

<?php
// TODO
?>
<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">
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

0 comments on commit bf21051

Please sign in to comment.