Skip to content

Commit

Permalink
Merge pull request #182 from pentium10/master
Browse files Browse the repository at this point in the history
Highlight paused tubes
  • Loading branch information
pentium10 authored Feb 4, 2022
2 parents 0f1ec60 + f8fa58e commit 88254f0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/BeanstalkInterface.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getServerStats() {
public function getTubesStats() {
$stats = array();
foreach ($this->getTubes() as $tube) {
$stats[] = $this->getTubeStats($tube);
$stats[$tube] = $this->getTubeStats($tube);
}
return $stats;
}
Expand Down Expand Up @@ -135,8 +135,8 @@ public function getTubeStats($tube) {
continue;
}

$stats[] = array(
'key' => $nameTube[$key],
$stats[$key] = array(
'key' => $key,
'value' => $value,
'descr' => isset($descr[$key]) ? $descr[$key] : '');
}
Expand Down
20 changes: 14 additions & 6 deletions lib/tpl/allTubes.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,30 @@
</thead>
<tbody>
<?php foreach ((is_array($tubes) ? $tubes : array()) as $tubeItem): ?>
<tr>
<td name="<?php echo $key ?>"><a href="./?server=<?php echo $server ?>&tube=<?php echo urlencode($tubeItem) ?>"><?php echo $tubeItem ?></a>
<?php
$arr_tubeStats = $tplVars['tubesStats'][$tubeItem];
$tubeStats = array();
foreach ($arr_tubeStats as $key => $arr) {
$tubeStats[$key] = $arr['value'];
}
?>
<tr class="<?php echo ($tubeStats['pause-time-left'] > '0') ? 'tr-tube-paused' : ''; ?>"
title="<?php echo ($tubeStats['pause-time-left'] > '0') ? 'Pause seconds left: ' . $tubeStats['pause-time-left'] : ''; ?>"
>
<td id="<?php echo 'tube-' . htmlspecialchars($tubeItem) ?>"><a href="./?server=<?php echo urlencode($server) ?>&tube=<?php echo urlencode($tubeItem) ?>"><?php echo htmlspecialchars($tubeItem) ?></a>
</td>
<?php $tubeStats = $console->getTubeStatValues($tubeItem) ?>
<?php
foreach ($fields as $key => $item):
$classes = array("td-$key");
if (!in_array($key, $visible)) {
$classes[] = 'hide' ;
$classes[] = 'hide';
}
if (isset($tubeStats[$key]) && $tubeStats[$key] != '0') {
$classes[] = 'hasValue';
}
$cssClass = '' ;
$cssClass = '';
if (count($classes) > 0) {
$cssClass = ' class = "' . join(' ', $classes) . '"' ;
$cssClass = ' class = "' . join(' ', $classes) . '"';
}
?>
<td<?php echo $cssClass ?>><?php echo isset($tubeStats[$key]) ? $tubeStats[$key] : '' ?></td>
Expand Down
8 changes: 5 additions & 3 deletions lib/tpl/currentTubeJobsSummaryTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
</thead>
<tbody>
<?php foreach (array($tube) as $tubeItem): ?>
<tr>
<td name="<?php echo $key ?>"><?php echo $tubeItem ?></td>
<?php $tubeStats = $console->getTubeStatValues($tubeItem) ?>
<?php $tubeStats = $console->getTubeStatValues($tubeItem) ?>
<tr class="<?php echo ($tubeStats['pause-time-left'] > '0')? 'tr-tube-paused': ''; ?>"
title="<?php echo ($tubeStats['pause-time-left'] > '0')? 'Pause seconds left: ' . $tubeStats['pause-time-left'] : ''; ?>"
>
<td id="<?php echo 'tube-' . $tubeItem ?>"><?php echo $tubeItem ?></td>
<?php
foreach ($fields as $key => $item):
$classes = array("td-$key");
Expand Down
5 changes: 5 additions & 0 deletions public/css/customer.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ ol.inside, ul.inside {
font-weight: bolder;
background-color: #FFF3DD;
}

/** Highlight paused tubes */
tr.tr-tube-paused {
border-left: 6px solid #FFA49A;
}

0 comments on commit 88254f0

Please sign in to comment.