Skip to content

Commit

Permalink
Display next run datetime.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Oct 26, 2024
1 parent 837f5b7 commit 9e1abd4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Admin/SchedulerRowsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function edit($id = null) {
if ($this->SchedulerRows->save($row)) {
$this->Flash->success(__('The row has been saved.'));

return $this->redirect(['action' => 'index']);
return $this->redirect(['action' => 'view', $id]);
}
$this->Flash->error(__('The row could not be saved. Please, try again.'));
}
Expand Down
4 changes: 2 additions & 2 deletions templates/Admin/QueueScheduler/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
</td>
<td>
<?php if ($schedulerRow->last_run) { ?>
<div><small>Last run: <?php echo $this->Time->nice($schedulerRow->last_run); ?></small></div>
<div><small><?= __('Last Run') ?>: <?php echo $this->Time->nice($schedulerRow->last_run); ?></small></div>
<?php } ?>
<?php
$nextRun = $schedulerRow->next_run ?: $schedulerRow->calculateNextRun();
?>
<?php if ($nextRun) { ?>
<div><small>Next run: <?php echo $this->Time->nice($nextRun); ?></small></div>
<div><small><?= __('Next Run') ?>: <?php echo $this->Time->nice($nextRun); ?></small></div>
<?php } ?>
</td>
<td class="actions">
Expand Down
8 changes: 6 additions & 2 deletions templates/Admin/SchedulerRows/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@
<?php } ?>

<?php if ($row->last_run) { ?>
<div><small>Last run: <?php echo $this->Time->nice($row->last_run); ?></small></div>
<div><small><?= __('Last Run') ?>: <?php echo $this->Time->nice($row->last_run); ?></small></div>
<?php } ?>
<?php
$nextRun = $row->next_run ?: $row->calculateNextRun();
?>
<?php if ($nextRun) { ?>
<div><small>Next run: <?php echo $this->Time->nice($nextRun); ?></small></div>
<?php if (!$row->enabled) { ?>
<div class="canceled"><small><del><?= __('Next Run') ?>: <?php echo $this->Time->nice($nextRun); ?></del></small></div>
<?php } else { ?>
<div><small><?= __('Next Run') ?>: <?php echo $this->Time->nice($nextRun); ?></small></div>
<?php } ?>
<?php } ?>
</td>
<td><?= $this->Time->nice($row->created) ?></td>
Expand Down
14 changes: 11 additions & 3 deletions templates/Admin/SchedulerRows/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
<h2><?= h($row->name) ?></h2>

<table class="table table-striped">
<tr>
<th><?= __('Type') ?></th>
<td><?= $row::types($row->type) ?></td>
</tr>
<tr>
<th><?= __('Frequency') ?></th>
<td><?= h($row->frequency) ?></td>
</tr>
<tr>
<th><?= __('Type') ?></th>
<td><?= $row::types($row->type) ?></td>
<th><?= __('Enabled') ?></th>
<td><?= $this->element('QueueScheduler.yes_no', ['value' => $row->enabled]) ?> <?= $row->enabled ? __('Yes') : __('No'); ?></td>
</tr>
<tr>
<th><?= __('Last Run') ?></th>
Expand All @@ -37,7 +41,11 @@
<tr>
<th><?= __('Next Run') ?></th>
<td>
<?= $this->Time->nice($nextRun) ?>
<?php if (!$row->enabled) { ?>
<div class="canceled"><del><?php echo $this->Time->nice($nextRun); ?></del></div>
<?php } else { ?>
<div><?php echo $this->Time->nice($nextRun); ?></div>
<?php } ?>
<div>
(<?php echo $this->Time->timeAgoInWords($nextRun); ?>)
</div>
Expand Down

0 comments on commit 9e1abd4

Please sign in to comment.