60 lines
2.8 KiB
PHP
60 lines
2.8 KiB
PHP
<div class="card mb-4">
|
|
<div class="card-header">История сканирования</div>
|
|
<div class="card-body">
|
|
<?php if (empty($scanJobs)): ?>
|
|
<p class="text-muted">Нет запусков сканирования.</p>
|
|
<?php else: ?>
|
|
<table class="table table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Тип</th>
|
|
<th>Статус</th>
|
|
<th>Результат</th>
|
|
<th>Запущен</th>
|
|
<th>Завершён</th>
|
|
<th>Действия</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($scanJobs as $job): ?>
|
|
<tr>
|
|
<td><?= htmlspecialchars($job->type) ?></td>
|
|
<td>
|
|
<?php
|
|
$badgeClass = match ($job->status) {
|
|
'pending' => 'bg-warning',
|
|
'running' => 'bg-info',
|
|
'done' => 'bg-success',
|
|
'failed' => 'bg-danger',
|
|
'paused' => 'bg-secondary',
|
|
'cancelled' => 'bg-dark',
|
|
default => 'bg-secondary',
|
|
};
|
|
?>
|
|
<span class="badge <?= $badgeClass ?>"><?= htmlspecialchars($job->status) ?></span>
|
|
</td>
|
|
<td>
|
|
<?php if ($job->errorMessage !== null): ?>
|
|
<span class="text-danger"><?= htmlspecialchars($job->errorMessage) ?></span>
|
|
<?php elseif ($job->resultJson !== null): ?>
|
|
<?php $result = json_decode($job->resultJson, true) ?: []; ?>
|
|
<?= isset($result['hosts_found']) ? (int)$result['hosts_found'] . ' хост(ов)' : '-' ?>
|
|
<?php else: ?>
|
|
-
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?= $job->startedAt?->format('Y-m-d H:i:s') ?? '-' ?></td>
|
|
<td><?= $job->finishedAt?->format('Y-m-d H:i:s') ?? '-' ?></td>
|
|
<td>
|
|
<a href="/discoveries?scan_job_id=<?= (int)$job->id ?>&status=all" class="btn btn-sm btn-outline-primary">
|
|
Находки
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|