Skip to content

Commit 09b0903

Browse files
committed
Clarify extension
1 parent 340f9df commit 09b0903

File tree

1 file changed

+110
-90
lines changed

1 file changed

+110
-90
lines changed

src/Template/Admin/Queue/index.ctp

Lines changed: 110 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7,109 +7,129 @@ use Cake\Core\Configure;
77
<div class="page index col-xs-12">
88
<h1><?php echo __d('queue', 'Queue');?></h1>
99

10-
<h2><?php echo __d('queue', 'Status'); ?></h2>
11-
<?php if ($status) { ?>
12-
<?php
13-
$running = (time() - $status['time']) < MINUTE;
14-
?>
15-
<?php echo $this->Format->yesNo($running); ?> <?php echo $running ? __d('queue', 'Running') : __d('queue', 'Not running'); ?> (<?php echo __d('queue', 'last {0}', $this->Time->relLengthOfTime($status['time']))?>)
10+
<div class="row">
11+
<div class="col-md-6 col-xs-12">
1612

17-
<?php
18-
echo '<div><small>Currently ' . $this->Html->link($status['workers'] . ' worker(s)', ['action' => 'processes']) . ' total.</small></div>';
19-
?>
20-
<?php } else { ?>
21-
n/a
22-
<?php } ?>
13+
<h2><?php echo __d('queue', 'Status'); ?></h2>
14+
<?php if ($status) { ?>
15+
<?php
16+
$running = (time() - $status['time']) < MINUTE;
17+
?>
18+
<?php echo $this->Format->yesNo($running); ?> <?php echo $running ? __d('queue', 'Running') : __d('queue', 'Not running'); ?> (<?php echo __d('queue', 'last {0}', $this->Time->relLengthOfTime($status['time']))?>)
2319

24-
<h2><?php echo __d('queue', 'Queued Jobs'); ?></h2>
25-
<?php
26-
echo $current;
27-
?> task(s) await processing
20+
<?php
21+
echo '<div><small>Currently ' . $this->Html->link($status['workers'] . ' worker(s)', ['action' => 'processes']) . ' total.</small></div>';
22+
?>
23+
<?php } else { ?>
24+
n/a
25+
<?php } ?>
2826

29-
<ol>
30-
<?php
31-
foreach ($pendingDetails as $item) {
32-
echo '<li>' . $item['job_type'] . ' (' . $item['reference'] . '):';
33-
echo '<ul>';
34-
35-
$reset = '';
36-
if ($item['failed']) {
37-
$reset = ' ' . $this->Form->postLink('Soft reset', ['action' => 'resetJob', $item['id']], ['confirm' => 'Sure?']);
38-
$reset .= ' ' . $this->Form->postLink('Remove', ['action' => 'removeJob', $item['id']], ['confirm' => 'Sure?']);
39-
}
40-
41-
echo '<li>Created: ' . $this->Time->nice($item['created']) . '</li>';
42-
echo '<li>Fetched: ' . $this->Time->nice($item['fetched']) . '</li>';
43-
echo '<li>Status: ' . $item['status'] . '</li>';
44-
echo '<li>Progress: ' . $this->Number->toPercentage($item['progress'] * 100, 0) . '</li>';
45-
echo '<li>Failures: ' . $item['failed'] . $reset . '</li>';
46-
echo '<li>Failure Message: ' . h($item['failure_message']) . '</li>';
47-
echo '</ul>';
48-
echo '</li>';
49-
}
50-
?>
51-
</ol>
27+
<h2><?php echo __d('queue', 'Queued Jobs'); ?></h2>
28+
<?php
29+
echo $current;
30+
?> task(s) await processing
5231

53-
<h2><?php echo __d('queue', 'Statistics'); ?></h2>
54-
<ul>
55-
<?php
56-
foreach ($data as $item) {
57-
echo '<li>' . $item['job_type'] . ':';
58-
echo '<ul>';
59-
echo '<li>Finished Jobs in Database: ' . $item['num'] . '</li>';
60-
echo '<li>Average Job existence: ' . $item['alltime'] . 's</li>';
61-
echo '<li>Average Execution delay: ' . $item['fetchdelay'] . 's</li>';
62-
echo '<li>Average Execution time: ' . $item['runtime'] . 's</li>';
63-
echo '</ul>';
64-
echo '</li>';
65-
}
66-
if (empty($data)) {
67-
echo 'n/a';
68-
}
69-
?>
70-
</ul>
32+
<ol>
33+
<?php
34+
foreach ($pendingDetails as $item) {
35+
echo '<li>' . $item['job_type'] . ' (' . $item['reference'] . '):';
36+
echo '<ul>';
7137

72-
<h2>Settings</h2>
73-
<ul>
74-
<?php
75-
$configurations = Configure::read('Queue');
76-
foreach ($configurations as $key => $configuration) {
77-
echo '<li>';
78-
if (is_dir($configuration)) {
79-
$configuration = str_replace(ROOT . DS, 'ROOT' . DS, $configuration);
80-
$configuration = str_replace(DS, '/', $configuration);
81-
} elseif (is_bool($configuration)) {
82-
$configuration = $configuration ? 'true' : 'false';
83-
}
84-
echo h($key) . ': ' . h($configuration);
85-
echo '</li>';
86-
}
38+
$reset = '';
39+
if ($item['failed']) {
40+
$reset = ' ' . $this->Form->postLink('Soft reset', ['action' => 'resetJob', $item['id']], ['confirm' => 'Sure?']);
41+
$reset .= ' ' . $this->Form->postLink('Remove', ['action' => 'removeJob', $item['id']], ['confirm' => 'Sure?']);
42+
}
8743

88-
?>
89-
</ul>
44+
echo '<li>Created: ' . $this->Time->nice($item['created']) . '</li>';
45+
echo '<li>Fetched: ' . $this->Time->nice($item['fetched']) . '</li>';
46+
echo '<li>Status: ' . $item['status'] . '</li>';
47+
echo '<li>Progress: ' . $this->Number->toPercentage($item['progress'] * 100, 0) . '</li>';
48+
echo '<li>Failures: ' . $item['failed'] . $reset . '</li>';
49+
echo '<li>Failure Message: ' . h($item['failure_message']) . '</li>';
50+
echo '</ul>';
51+
echo '</li>';
52+
}
53+
?>
54+
</ol>
9055

91-
<h2>Trigger Test/Demo Jobs</h2>
92-
<ul>
93-
<?php
94-
foreach ($tasks as $task) {
95-
if (substr($task, 0, 11) !== 'Queue.Queue') {
96-
continue;
56+
<h2><?php echo __d('queue', 'Statistics'); ?></h2>
57+
<ul>
58+
<?php
59+
foreach ($data as $item) {
60+
echo '<li>' . $item['job_type'] . ':';
61+
echo '<ul>';
62+
echo '<li>Finished Jobs in Database: ' . $item['num'] . '</li>';
63+
echo '<li>Average Job existence: ' . $item['alltime'] . 's</li>';
64+
echo '<li>Average Execution delay: ' . $item['fetchdelay'] . 's</li>';
65+
echo '<li>Average Execution time: ' . $item['runtime'] . 's</li>';
66+
echo '</ul>';
67+
echo '</li>';
9768
}
98-
if ($task === 'Queue.QueueExecute') {
99-
continue;
69+
if (empty($data)) {
70+
echo 'n/a';
10071
}
72+
?>
73+
</ul>
10174

102-
echo '<li>';
103-
echo $this->Form->postLink($task, ['action' => 'addJob', substr($task, 11)], ['confirm' => 'Sure?']);
104-
echo '</li>';
105-
}
106-
?>
10775

108-
</ul>
76+
</div>
77+
78+
<div class="col-md-6 col-xs-12">
79+
80+
<h2>Settings</h2>
81+
Server:
82+
<ul>
83+
<li>
84+
<code>posix</code> extension enabled (optional, recommended): <?php echo $this->Format->yesNo(function_exists('posix_kill')); ?>
85+
</li>
86+
</ul>
87+
88+
Current runtime configuration:
89+
<ul>
90+
<?php
91+
$configurations = Configure::read('Queue');
92+
foreach ($configurations as $key => $configuration) {
93+
echo '<li>';
94+
if (is_dir($configuration)) {
95+
$configuration = str_replace(ROOT . DS, 'ROOT' . DS, $configuration);
96+
$configuration = str_replace(DS, '/', $configuration);
97+
} elseif (is_bool($configuration)) {
98+
$configuration = $configuration ? 'true' : 'false';
99+
}
100+
echo h($key) . ': ' . h($configuration);
101+
echo '</li>';
102+
}
103+
104+
?>
105+
</ul>
106+
107+
<h2>Trigger Test/Demo Jobs</h2>
108+
<ul>
109+
<?php
110+
foreach ($tasks as $task) {
111+
if (substr($task, 0, 11) !== 'Queue.Queue') {
112+
continue;
113+
}
114+
if ($task === 'Queue.QueueExecute') {
115+
continue;
116+
}
117+
118+
echo '<li>';
119+
echo $this->Form->postLink($task, ['action' => 'addJob', substr($task, 11)], ['confirm' => 'Sure?']);
120+
echo '</li>';
121+
}
122+
?>
123+
124+
</ul>
125+
126+
</div>
127+
</div>
128+
109129
</div>
110130

111131
<div class="actions">
112-
<ul>
113-
<li><?php echo $this->Form->postLink(__d('queue', 'Hard Reset {0}', __d('queue', 'Queued Jobs')), ['action' => 'reset'], ['confirm' => __d('queue', 'Sure? This will completely reset the queue.')]); ?></li>
132+
<ul class="list-unstyled">
133+
<li><?php echo $this->Form->postLink(__d('queue', 'Hard Reset {0}', __d('queue', 'Queued Jobs')), ['action' => 'reset'], ['confirm' => __d('queue', 'Sure? This will completely reset the queue.'), 'class' => 'btn btn-default']); ?></li>
114134
</ul>
115135
</div>

0 commit comments

Comments
 (0)