Files
scoutiq/resources/views/admin/sources/index.php

60 lines
3.2 KiB
PHP

<div class="page-header">
<div>
<h1>Data Sources</h1>
<p>Manage RSS feeds and API sources for data collection</p>
</div>
<a href="/admin/sources/create" class="btn btn-primary">+ Add Source</a>
</div>
<?php if ($flashSuccess = $this->session->getFlash('success')): ?>
<div class="alert alert-success"><span><?= $this->escape($flashSuccess) ?></span></div>
<?php endif; ?>
<?php if ($flashError = $this->session->getFlash('error')): ?>
<div class="alert alert-error"><span><?= $this->escape($flashError) ?></span></div>
<?php endif; ?>
<div class="glass-panel" style="overflow-x: auto;">
<table class="data-table">
<thead>
<tr>
<th>Name</th>
<th>URL</th>
<th>Type</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php if (empty($sources)): ?>
<tr><td colspan="5" style="text-align: center; padding: 40px; color: var(--text-muted);">No data sources configured.</td></tr>
<?php else: ?>
<?php foreach ($sources as $source): ?>
<tr>
<td style="font-weight: 600;"><?= $this->escape($source['name']) ?></td>
<td style="max-width: 300px; overflow: hidden; text-overflow: ellipsis;">
<a href="<?= $this->escape($source['url']) ?>" target="_blank" style="font-size: 0.85rem;"><?= $this->escape($source['url']) ?></a>
</td>
<td><span class="badge badge-source-<?= $source['type'] ?>"><?= $this->escape($source['type']) ?></span></td>
<td><span class="badge <?= $source['status'] === 'active' ? 'badge-active' : 'badge-inactive' ?>"><?= $this->escape($source['status']) ?></span></td>
<td>
<a href="/admin/sources/<?= $source['id'] ?>/run" class="btn btn-sm btn-primary" onclick="return confirm('Run collector on this source?')">Run</a>
<a href="/admin/sources/<?= $source['id'] ?>/edit" class="btn btn-sm btn-secondary">Edit</a>
<a href="/admin/sources/<?= $source['id'] ?>/delete" class="btn btn-sm btn-secondary" onclick="return confirm('Delete this source?')">Delete</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
<style>
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
.data-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; }
.data-table tr:hover { background: rgba(255,255,255,0.02); }
.badge-source-rss { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.badge-source-api { background: rgba(52, 211, 153, 0.2); color: #34d399; }
.badge-active { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.badge-inactive { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
</style>