Backup #669
| ID | 669 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/View/content-pipeline/run-status.php |
| Version | 12 |
| Typ |
modified |
| Größe | 9.5 KB |
| Hash | 7466db83df2f874d1042271dd5022500db74c105b8363f8bababb8d74e2bf26b |
| Datum | 2025-12-23 05:07:52 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php ob_start(); ?>
<h1>Pipeline Status</h1>
<p class="subtitle"><?= htmlspecialchars($pipeline['name']) ?> → Run #<?= $run['id'] ?></p>
<div class="status-page"
id="status-container"
data-poll-url="/content-pipeline/<?= $pipeline['id'] ?>/run/<?= $run['id'] ?>/poll">
<!-- Status Badge + Cancel -->
<div class="status-header">
<span class="badge badge--large" id="status-badge" data-status="<?= $run['status'] ?>">
<?= $run['status'] ?>
</span>
<form action="/content-pipeline/<?= $pipeline['id'] ?>/run/<?= $run['id'] ?>/cancel" method="POST" id="cancel-form" class="status-header__cancel">
<input type="hidden" name="_csrf_token" value="<?= htmlspecialchars($_SESSION['_csrf_token'] ?? '') ?>">
<button type="submit" class="btn btn--danger btn--small" id="cancel-btn" <?= $run['status'] !== 'running' ? 'disabled' : '' ?>>
Abbrechen
</button>
</form>
<span class="stall-warning" id="stall-warning" style="display: none;">
Keine Aktivitaet seit 60s
</span>
</div>
<!-- Status Info -->
<ul class="status-info">
<li><span class="status-info__label">Schritt:</span> <span class="status-info__value" id="current-step"><?= htmlspecialchars($run['current_step'] ?? 'Initialisierung') ?></span></li>
<li><span class="status-info__label">Dokument:</span> <span class="status-info__value" id="current-document"><?= htmlspecialchars($run['current_document'] ?? '-') ?></span></li>
<li><span class="status-info__label">Zeit:</span> <span class="status-info__value" id="elapsed-time">00:00</span></li>
<li><span class="status-info__label">ETA:</span> <span class="status-info__value" id="eta-time">-</span></li>
<li><span class="status-info__label">Chunks:</span> <span class="status-info__value" id="chunks-count"><?= (int) ($run['chunks_created'] ?? 0) ?></span></li>
<li><span class="status-info__label">Embeddings:</span> <span class="status-info__value" id="embeddings-count"><?= (int) ($run['embeddings_created'] ?? 0) ?></span></li>
<li><span class="status-info__label">Fehler:</span> <span class="status-info__value status-info__value--danger" id="failed-count"><?= (int) ($run['documents_failed'] ?? 0) ?></span></li>
</ul>
<!-- Live Log -->
<div class="log-section">
<h3>Live Log</h3>
<pre class="log-output" id="log-output"><?= htmlspecialchars($run['log_tail'] ?? 'Warte auf Ausgabe...') ?></pre>
</div>
<!-- Error Display -->
<div class="error-section" id="error-section" style="display: <?= $run['error_log'] ? 'block' : 'none' ?>;">
<h3>Fehler</h3>
<pre class="error-output" id="error-output"><?= htmlspecialchars($run['error_log'] ?? '') ?></pre>
</div>
</div>
<style>
.subtitle {
color: var(--text-muted, #666);
margin-top: -0.5rem;
margin-bottom: 1.5rem;
}
.status-page {
max-width: 800px;
}
.status-header {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
}
.badge--large {
font-size: 1rem;
padding: 0.5rem 1rem;
text-transform: uppercase;
}
.badge[data-status="running"] {
background: var(--info-color, #0066cc);
color: white;
animation: pulse 2s infinite;
}
.badge[data-status="completed"] {
background: var(--success-color, #28a745);
color: white;
}
.badge[data-status="failed"] {
background: var(--danger-color, #dc3545);
color: white;
}
.badge[data-status="cancelled"] {
background: var(--warning-color, #ffc107);
color: #333;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
.stall-warning {
background: var(--warning-bg, #fff3cd);
color: var(--warning-color, #856404);
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.85rem;
animation: blink 1s infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.status-info {
list-style: none;
padding: 0;
margin: 0 0 1.5rem 0;
}
.status-info li {
display: flex;
padding: 0.25rem 0;
}
.status-info__label {
color: var(--text-muted, #666);
min-width: 100px;
}
.status-info__value {
font-family: monospace;
}
.status-info__value--danger {
color: var(--danger-color, #dc3545);
}
.log-section, .error-section {
margin-bottom: 1.5rem;
}
.log-section h3, .error-section h3 {
margin-bottom: 0.5rem;
font-size: 1rem;
}
.log-output {
background: var(--bg-dark, #1e1e1e);
color: var(--text-light, #d4d4d4);
padding: 1rem;
border-radius: 6px;
font-family: monospace;
font-size: 0.8rem;
max-height: 300px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-word;
}
.error-output {
background: var(--danger-bg, #f8d7da);
color: var(--danger-color, #721c24);
padding: 1rem;
border-radius: 6px;
font-family: monospace;
font-size: 0.8rem;
max-height: 200px;
overflow-y: auto;
white-space: pre-wrap;
}
.status-header__cancel {
margin: 0;
}
@media (max-width: 600px) {
.status-cards, .stats-row {
grid-template-columns: 1fr;
}
}
</style>
<script>
(function() {
const container = document.getElementById('status-container');
const pollUrl = container.dataset.pollUrl;
let pollInterval = null;
let isTerminal = false;
// ETA calculation state
let progressHistory = [];
function calculateETA(data) {
// Calculate progress based on documents processed
const total = data.documents_total || 1;
const processed = data.documents_processed || 0;
const progress = processed / total;
// Track progress changes for rate calculation
const now = Date.now();
progressHistory.push({ time: now, progress: progress });
// Keep only last 10 data points
if (progressHistory.length > 10) {
progressHistory.shift();
}
// Need at least 2 points and some progress
if (progressHistory.length < 2 || progress <= 0) {
return '-';
}
// Calculate average rate over recent history
const oldest = progressHistory[0];
const newest = progressHistory[progressHistory.length - 1];
const timeDiff = (newest.time - oldest.time) / 1000; // seconds
const progressDiff = newest.progress - oldest.progress;
if (timeDiff <= 0 || progressDiff <= 0) {
return '-';
}
const rate = progressDiff / timeDiff; // progress per second
const remaining = 1 - progress;
const etaSeconds = Math.round(remaining / rate);
const hours = Math.floor(etaSeconds / 3600);
const minutes = Math.floor((etaSeconds % 3600) / 60);
const seconds = etaSeconds % 60;
return String(hours).padStart(2, '0') + ':' +
String(minutes).padStart(2, '0') + ':' +
String(seconds).padStart(2, '0');
}
function updateUI(data) {
// Status Badge
const badge = document.getElementById('status-badge');
badge.textContent = data.status;
badge.dataset.status = data.status;
// Stall Warning
document.getElementById('stall-warning').style.display = data.is_stalled ? 'inline' : 'none';
// Current Step & Document
document.getElementById('current-step').textContent = data.current_step || 'Warte...';
document.getElementById('current-document').textContent = data.current_document || '-';
// Time
document.getElementById('elapsed-time').textContent = data.elapsed_formatted || '00:00';
// ETA calculation
const eta = calculateETA(data);
document.getElementById('eta-time').textContent = eta;
// Stats
document.getElementById('chunks-count').textContent = data.chunks_created;
document.getElementById('embeddings-count').textContent = data.embeddings_created;
document.getElementById('failed-count').textContent = data.documents_failed;
// Log
if (data.log_tail) {
const logEl = document.getElementById('log-output');
logEl.textContent = data.log_tail;
logEl.scrollTop = logEl.scrollHeight;
}
// Error
if (data.error_log) {
document.getElementById('error-section').style.display = 'block';
document.getElementById('error-output').textContent = data.error_log;
}
// Cancel Button
document.getElementById('cancel-btn').disabled = data.is_terminal;
// Stop polling if terminal
if (data.is_terminal && !isTerminal) {
isTerminal = true;
stopPolling();
}
}
function poll() {
fetch(pollUrl)
.then(response => response.json())
.then(data => {
updateUI(data);
})
.catch(error => {
console.error('Polling error:', error);
});
}
function startPolling() {
poll(); // Initial poll
pollInterval = setInterval(poll, 2000); // Poll every 2s
}
function stopPolling() {
if (pollInterval) {
clearInterval(pollInterval);
pollInterval = null;
}
}
// Start polling on page load
startPolling();
// Stop polling when page is hidden
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
stopPolling();
} else if (!isTerminal) {
startPolling();
}
});
})();
</script>
<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 1925 |
19 |
modified |
11.2 KB |
2025-12-28 01:20 |
| 1703 |
18 |
modified |
11.1 KB |
2025-12-27 12:21 |
| 1702 |
17 |
modified |
10.9 KB |
2025-12-27 12:21 |
| 884 |
16 |
modified |
10.9 KB |
2025-12-23 15:25 |
| 674 |
15 |
modified |
10.9 KB |
2025-12-23 05:13 |
| 671 |
14 |
modified |
10.5 KB |
2025-12-23 05:08 |
| 670 |
13 |
modified |
10.1 KB |
2025-12-23 05:08 |
| 669 |
12 |
modified |
9.5 KB |
2025-12-23 05:07 |
| 668 |
11 |
modified |
9.5 KB |
2025-12-23 05:07 |
| 667 |
10 |
modified |
10.2 KB |
2025-12-23 05:04 |
| 666 |
9 |
modified |
10.2 KB |
2025-12-23 05:04 |
| 665 |
8 |
modified |
10.3 KB |
2025-12-23 04:59 |
| 664 |
7 |
modified |
10.3 KB |
2025-12-23 04:59 |
| 663 |
6 |
modified |
9.2 KB |
2025-12-23 04:59 |
| 662 |
5 |
modified |
9.9 KB |
2025-12-23 04:59 |
| 661 |
4 |
modified |
10.6 KB |
2025-12-23 04:57 |
| 660 |
3 |
modified |
10.6 KB |
2025-12-23 04:52 |
| 659 |
2 |
modified |
11.2 KB |
2025-12-23 04:52 |
| 658 |
1 |
modified |
10.8 KB |
2025-12-23 04:52 |
← Zurück zur Übersicht