Stabilize discovery workflow
This commit is contained in:
@@ -48,6 +48,9 @@
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/discoveries?range_id=<?= (int)$range->id ?>&status=all" class="btn btn-sm btn-outline-primary">
|
||||
Находки
|
||||
</a>
|
||||
<form method="POST" action="/discovery/ranges/toggle" class="d-inline">
|
||||
<input type="hidden" name="id" value="<?= $range->id ?>">
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary">
|
||||
@@ -73,93 +76,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scan Jobs -->
|
||||
<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>
|
||||
</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',
|
||||
default => 'bg-secondary',
|
||||
};
|
||||
?>
|
||||
<span class="badge <?= $badgeClass ?>"><?= htmlspecialchars($job->status) ?></span>
|
||||
</td>
|
||||
<td><?= $job->startedAt?->format('Y-m-d H:i:s') ?? '-' ?></td>
|
||||
<td><?= $job->finishedAt?->format('Y-m-d H:i:s') ?? '-' ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="active-jobs"
|
||||
hx-get="/discovery/jobs/active"
|
||||
hx-trigger="load, every 2s"
|
||||
hx-swap="innerHTML">
|
||||
<?php require dirname(__DIR__) . '/discovery/_active_jobs.php'; ?>
|
||||
</div>
|
||||
|
||||
<!-- New Hosts -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">Новые находки (<?= count($newHosts) ?>)</div>
|
||||
<div class="card-body">
|
||||
<?php if (empty($newHosts)): ?>
|
||||
<p class="text-muted">Нет новых находок.</p>
|
||||
<?php else: ?>
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>IP</th>
|
||||
<th>Hostname</th>
|
||||
<th>MAC</th>
|
||||
<th>Vendor</th>
|
||||
<th>Порты</th>
|
||||
<th>Уверенность</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($newHosts as $host): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($host->ipAddress) ?></td>
|
||||
<td><?= htmlspecialchars($host->hostname ?? '-') ?></td>
|
||||
<td><?= htmlspecialchars($host->macAddress ?? '-') ?></td>
|
||||
<td><?= htmlspecialchars($host->vendor ?? '-') ?></td>
|
||||
<td><?= empty($host->openPorts) ? '-' : implode(', ', $host->openPorts) ?></td>
|
||||
<td><?= $host->confidence ?>%</td>
|
||||
<td>
|
||||
<form method="POST" action="/devices/from-host" class="d-inline">
|
||||
<input type="hidden" name="host_id" value="<?= $host->id ?>">
|
||||
<input type="hidden" name="name" value="<?= htmlspecialchars($host->hostname ?: $host->ipAddress) ?>">
|
||||
<button type="submit" class="btn btn-sm btn-outline-primary">Создать устройство</button>
|
||||
</form>
|
||||
<form method="POST" action="/discovery/hosts/ignore" class="d-inline">
|
||||
<input type="hidden" name="host_id" value="<?= $host->id ?>">
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary">Игнорировать</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="scan-history"
|
||||
hx-get="/discovery/jobs/history"
|
||||
hx-trigger="load, every 2s"
|
||||
hx-swap="innerHTML">
|
||||
<?php require dirname(__DIR__) . '/discovery/_scan_history.php'; ?>
|
||||
</div>
|
||||
|
||||
<?php $content = ob_get_clean(); ?>
|
||||
<?php require dirname(__DIR__) . '/layout.php'; ?>
|
||||
|
||||
Reference in New Issue
Block a user