Backup #658

ID658
Dateipfad/var/www/dev.campus.systemische-tools.de/src/View/content-pipeline/run-status.php
Version1
Typ modified
Größe10.8 KB
Hashb018e66bac1a2b0960363ceb8e15b5a70f85c54967a35050b254c90e522da88f
Datum2025-12-23 04:52:21
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Edit-Operation
Datei existiert Ja

Dateiinhalt

<?php ob_start(); ?>

<h1>Pipeline Status</h1>
<p class="subtitle"><?= htmlspecialchars($pipeline['name']) ?> &rarr; Run #<?= $run['id'] ?></p>

<div class="status-page"
     id="status-container"
     data-poll-url="/content-pipeline/<?= $pipeline['id'] ?>/run/<?= $run['id'] ?>/poll">

    <!-- Status Badge -->
    <div class="status-header">
        <span class="badge badge--large" id="status-badge" data-status="<?= $run['status'] ?>">
            <?= $run['status'] ?>
        </span>
        <span class="stall-warning" id="stall-warning" style="display: none;">
            Keine Aktivitaet seit 60s
        </span>
    </div>

    <!-- Info Cards -->
    <div class="status-cards">
        <div class="status-card">
            <div class="status-card__icon">&#128196;</div>
            <div class="status-card__label">Schritt</div>
            <div class="status-card__value" id="current-step"><?= htmlspecialchars($run['current_step'] ?? 'Initialisierung') ?></div>
        </div>
        <div class="status-card">
            <div class="status-card__icon">&#128193;</div>
            <div class="status-card__label">Aktuelles Dokument</div>
            <div class="status-card__value status-card__value--small" id="current-document"><?= htmlspecialchars($run['current_document'] ?? '-') ?></div>
        </div>
        <div class="status-card">
            <div class="status-card__icon">&#9200;</div>
            <div class="status-card__label">Zeit</div>
            <div class="status-card__value" id="elapsed-time">00:00</div>
            <div class="status-card__sub" id="estimated-time"></div>
        </div>
    </div>

    <!-- Progress Bar -->
    <div class="progress-section">
        <div class="progress-label">
            <span>Dokumente: <span id="docs-processed">0</span>/<span id="docs-total">0</span></span>
            <span id="progress-percent">0%</span>
        </div>
        <div class="progress-bar">
            <div class="progress-bar__fill" id="progress-fill" style="width: 0%"></div>
        </div>
    </div>

    <!-- Stats -->
    <div class="stats-row">
        <div class="stat-box">
            <div class="stat-box__value" id="chunks-count">0</div>
            <div class="stat-box__label">Chunks</div>
        </div>
        <div class="stat-box">
            <div class="stat-box__value" id="embeddings-count">0</div>
            <div class="stat-box__label">Embeddings</div>
        </div>
        <div class="stat-box stat-box--danger">
            <div class="stat-box__value" id="failed-count">0</div>
            <div class="stat-box__label">Fehler</div>
        </div>
    </div>

    <!-- 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>

    <!-- Actions -->
    <div class="action-bar">
        <form action="/content-pipeline/<?= $pipeline['id'] ?>/run/<?= $run['id'] ?>/cancel" method="POST" id="cancel-form">
            <input type="hidden" name="_csrf_token" value="<?= htmlspecialchars($_SESSION['_csrf_token'] ?? '') ?>">
            <button type="submit" class="btn btn--danger" id="cancel-btn" <?= $run['status'] !== 'running' ? 'disabled' : '' ?>>
                Abbrechen
            </button>
        </form>
        <a href="/content-pipeline/<?= $pipeline['id'] ?>" class="btn btn--secondary">Zurueck zur Pipeline</a>
    </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-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.status-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.status-card__icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.status-card__label {
    font-size: 0.75rem;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.status-card__value {
    font-size: 1.25rem;
    font-weight: bold;
    word-break: break-word;
}

.status-card__value--small {
    font-size: 0.9rem;
    font-weight: normal;
}

.status-card__sub {
    font-size: 0.8rem;
    color: var(--text-muted, #666);
}

.progress-section {
    margin-bottom: 1.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-bar {
    height: 24px;
    background: var(--bg-muted, #e9ecef);
    border-radius: 12px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #007bff), var(--success-color, #28a745));
    transition: width 0.5s ease;
    border-radius: 12px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-muted, #f5f5f5);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-box--danger .stat-box__value {
    color: var(--danger-color, #dc3545);
}

.stat-box__value {
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-box__label {
    font-size: 0.8rem;
    color: var(--text-muted, #666);
}

.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;
}

.action-bar {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.action-bar form {
    display: inline;
}

@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;

    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';
        const estimatedEl = document.getElementById('estimated-time');
        if (data.estimated_formatted) {
            estimatedEl.textContent = '~' + data.estimated_formatted + ' verbleibend';
        } else {
            estimatedEl.textContent = '';
        }

        // Progress
        document.getElementById('docs-processed').textContent = data.documents_processed;
        document.getElementById('docs-total').textContent = data.documents_total;
        document.getElementById('progress-percent').textContent = data.progress + '%';
        document.getElementById('progress-fill').style.width = data.progress + '%';

        // 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

Herunterladen

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