fixed SPA

This commit is contained in:
2025-12-16 15:23:40 +01:00
parent 1555dc02e9
commit 2809d18c12
13 changed files with 3096 additions and 1026 deletions

View File

@@ -2,299 +2,20 @@
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Automationen Post Tracker</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" sizes="32x32" href="assets/app-icon-64.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="automation.css">
<script>
(function redirectToShell() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
params.set('view', 'automation');
const target = `index.html${params.toString() ? `?${params}` : ''}${url.hash}`;
window.location.replace(target);
})();
</script>
</head>
<body>
<div class="auto-shell">
<header class="auto-hero">
<div class="hero-head">
<div class="hero-text">
<a class="back-link" href="index.html">← Zurück zur App</a>
<p class="eyebrow">Automatisierte Requests</p>
<h1>Request Automationen</h1>
</div>
<div class="hero-actions">
<button class="ghost-btn" id="openImportBtn" type="button">📥 Vorlage importieren</button>
<button class="primary-btn" id="newAutomationBtn" type="button">+ Neue Automation</button>
</div>
</div>
<div class="hero-stats" id="heroStats"></div>
</header>
<main class="auto-grid">
<section class="panel list-panel">
<div class="panel-header">
<div>
<p class="panel-eyebrow">Geplante Requests</p>
<h2>Automationen</h2>
</div>
<div class="panel-actions">
<input id="tableFilterInput" class="filter-input" type="search" placeholder="Filtern nach Name/Typ…" />
<button class="ghost-btn" id="refreshBtn" type="button">Aktualisieren</button>
</div>
</div>
<div id="listStatus" class="list-status" aria-live="polite"></div>
<div class="table-wrap" id="automationTable">
<table class="auto-table">
<thead>
<tr>
<th data-sort-column="name">Name<span class="sort-indicator"></span></th>
<th data-sort-column="next">Nächster Lauf<span class="sort-indicator"></span></th>
<th data-sort-column="last">Letzter Lauf<span class="sort-indicator"></span></th>
<th data-sort-column="status">Status<span class="sort-indicator"></span></th>
<th data-sort-column="runs">#Läufe<span class="sort-indicator"></span></th>
<th>Aktionen</th>
</tr>
<tr class="table-filter-row">
<th><input id="filterName" type="search" placeholder="Name/Typ/E-Mail/URL"></th>
<th><input id="filterNext" type="search" placeholder="z.B. heute"></th>
<th><input id="filterLast" type="search" placeholder="z.B. HTTP 200"></th>
<th>
<select id="filterStatus">
<option value="">Alle</option>
<option value="success">OK</option>
<option value="error">Fehler</option>
</select>
</th>
<th><input id="filterRuns" type="number" min="0" placeholder="≥"></th>
<th></th>
</tr>
</thead>
<tbody id="requestTableBody" class="list"></tbody>
</table>
</div>
</section>
</main>
<section class="panel runs-panel">
<div class="panel-header">
<div>
<p class="panel-eyebrow">Verlauf</p>
<h2>Run-Historie</h2>
</div>
<p class="runs-hint">Letzte Läufe der ausgewählten Automation.</p>
</div>
<div id="runsStatus" class="runs-status" aria-live="polite"></div>
<ul id="runsList" class="runs-list"></ul>
</section>
</div>
<div id="formModal" class="modal" hidden>
<div class="modal__backdrop" id="formModalBackdrop"></div>
<div class="modal__content" role="dialog" aria-modal="true" aria-labelledby="modalTitle">
<div class="modal__header">
<div>
<p class="panel-eyebrow" id="formModeLabel">Neue Automation</p>
<h2 id="modalTitle">Request & Zeitplan</h2>
</div>
<button class="ghost-btn" id="modalCloseBtn" type="button">×</button>
</div>
<form id="automationForm" class="form-grid" novalidate>
<div class="field">
<label for="typeSelect">Typ</label>
<select id="typeSelect">
<option value="request">HTTP Request</option>
<option value="email">E-Mail</option>
<option value="flow">Flow (bis 3 Schritte)</option>
</select>
</div>
<div class="field">
<label for="nameInput">Name *</label>
<input id="nameInput" type="text" placeholder="API Ping (stündlich)" required maxlength="160">
</div>
<div class="field">
<label for="descriptionInput">Notizen</label>
<textarea id="descriptionInput" rows="2" placeholder="Kurzbeschreibung oder Zweck"></textarea>
</div>
<div class="field" data-section="http">
<label for="urlInput">URL-Template *</label>
<input id="urlInput" type="url" placeholder="https://api.example.com/{{date}}/trigger" required>
</div>
<div class="field inline" data-section="http">
<label for="methodSelect">Methode</label>
<select id="methodSelect">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
</select>
</div>
<div class="field inline">
<label for="activeToggle">Aktiv</label>
<label class="switch">
<input type="checkbox" id="activeToggle" checked>
<span class="switch-slider"></span>
<span class="switch-label">Plan aktiv</span>
</label>
</div>
<div class="field" data-section="http">
<label for="headersInput">Headers (Key: Value pro Zeile oder JSON)</label>
<textarea id="headersInput" rows="3" placeholder="Authorization: Bearer {{token}}\nContent-Type: application/json"></textarea>
</div>
<div class="field" data-section="http">
<label for="bodyInput">Body (optional, Templates möglich)</label>
<textarea id="bodyInput" rows="5" placeholder='{"date":"{{date}}","id":"{{uuid}}"}'></textarea>
</div>
<div class="field full" data-section="email">
<label for="emailToInput">E-Mail Empfänger *</label>
<input id="emailToInput" type="text" placeholder="max@example.com, lisa@example.com">
</div>
<div class="field full" data-section="email">
<label for="emailSubjectInput">Betreff *</label>
<input id="emailSubjectInput" type="text" placeholder="Status Update {{date}}">
</div>
<div class="field full" data-section="email">
<label for="emailBodyInput">Body *</label>
<textarea id="emailBodyInput" rows="6" placeholder="Hallo,\nheutiger Status: {{uuid}}"></textarea>
</div>
<div class="field full" data-section="flow">
<div class="template-hint">
<p class="template-title">Flow Schritte</p>
<p class="template-copy">Max. 3 Schritte, Kontext steht als {{step1_json}}, {{step1_text}}, {{step1_status_code}} usw. im nächsten Schritt zur Verfügung.</p>
</div>
</div>
<div class="field" data-section="flow">
<label for="flowStep1Url">Step 1 URL *</label>
<input id="flowStep1Url" type="url" placeholder="https://api.example.com/first">
</div>
<div class="field inline" data-section="flow">
<label for="flowStep1Method">Step 1 Methode</label>
<select id="flowStep1Method">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
</select>
</div>
<div class="field" data-section="flow">
<label for="flowStep1Headers">Step 1 Headers</label>
<textarea id="flowStep1Headers" rows="2" placeholder="Authorization: Bearer {{token}}"></textarea>
</div>
<div class="field" data-section="flow">
<label for="flowStep1Body">Step 1 Body</label>
<textarea id="flowStep1Body" rows="3" placeholder='{"id":"{{uuid}}"}'></textarea>
</div>
<div class="field" data-section="flow">
<label for="flowStep2Url">Step 2 URL (optional)</label>
<input id="flowStep2Url" type="url" placeholder="https://api.example.com/second">
</div>
<div class="field inline" data-section="flow">
<label for="flowStep2Method">Step 2 Methode</label>
<select id="flowStep2Method">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="PATCH">PATCH</option>
<option value="DELETE">DELETE</option>
</select>
</div>
<div class="field" data-section="flow">
<label for="flowStep2Headers">Step 2 Headers</label>
<textarea id="flowStep2Headers" rows="2" placeholder="Authorization: Bearer {{token}}"></textarea>
</div>
<div class="field" data-section="flow">
<label for="flowStep2Body">Step 2 Body</label>
<textarea id="flowStep2Body" rows="3" placeholder='{"fromStep1":"{{step1_json.id}}"}'></textarea>
</div>
<div class="field inline">
<label for="intervalPreset">Intervall</label>
<select id="intervalPreset">
<option value="hourly">Jede Stunde</option>
<option value="daily">Jeden Tag</option>
<option value="custom">Eigene Minuten</option>
</select>
</div>
<div class="field inline">
<label for="intervalMinutesInput">Intervall (Minuten)</label>
<input id="intervalMinutesInput" type="number" min="5" max="20160" step="5" value="60">
</div>
<div class="field inline">
<label for="jitterInput">Varianz (Minuten)</label>
<input id="jitterInput" type="number" min="0" max="120" step="5" value="10">
<small>Auslösung erfolgt zufällig +0…Varianz Min nach dem Intervall.</small>
</div>
<div class="field inline">
<label for="startAtInput">Start ab</label>
<input id="startAtInput" type="datetime-local">
</div>
<div class="field inline">
<label for="runUntilInput">Läuft bis</label>
<input id="runUntilInput" type="datetime-local">
</div>
<div class="field full">
<div class="template-hint">
<p class="template-title">Platzhalter</p>
<table class="placeholder-table">
<tbody id="placeholderTableBody"></tbody>
</table>
<p class="placeholder-hint">Beispiele beziehen sich auf den aktuellen Zeitpunkt.</p>
</div>
</div>
<div class="field full">
<div class="preview-panel">
<div class="preview-header">
<div>
<p class="panel-eyebrow">Vorschau</p>
<h3>Aufgelöste Werte</h3>
</div>
<button class="secondary-btn" type="button" id="refreshPreviewBtn">Aktualisieren</button>
</div>
<div class="preview-grid">
<div class="preview-block">
<p class="preview-label">URL</p>
<pre id="previewUrl" class="preview-value"></pre>
</div>
<div class="preview-block">
<p class="preview-label">Headers</p>
<pre id="previewHeaders" class="preview-value"></pre>
</div>
<div class="preview-block">
<p class="preview-label">Body</p>
<pre id="previewBody" class="preview-value"></pre>
</div>
</div>
<p class="preview-hint">Die Vorschau nutzt die aktuellen Formularwerte und füllt Platzhalter ({{date}}, {{uuid}}, …) mit Beispielwerten.</p>
</div>
</div>
<div class="field full modal-actions">
<div id="formStatus" class="form-status" aria-live="polite"></div>
<div class="panel-actions">
<button class="ghost-btn" id="resetFormBtn" type="button">Zurücksetzen</button>
<button class="primary-btn" id="saveBtn" type="submit">Speichern</button>
</div>
</div>
</form>
</div>
</div>
<div id="importModal" class="modal" hidden>
<div class="modal__backdrop" id="importModalBackdrop"></div>
<div class="modal__content" role="dialog" aria-modal="true" aria-labelledby="importTitle">
<div class="modal__header">
<div>
<p class="panel-eyebrow">Import</p>
<h2 id="importTitle">Vorlage einfügen</h2>
</div>
<button class="ghost-btn" id="importCloseBtn" type="button">×</button>
</div>
<p class="import-hint">Füge hier "Copy as cURL", "Copy as fetch" oder Powershell ein. Header, Methode, Body und URL werden übernommen.</p>
<textarea id="importInput" rows="7" placeholder="curl https://api.example.com -X POST -H 'Authorization: Bearer token' --data '{\"hello\":\"world\"}'"></textarea>
<div class="modal-actions">
<div id="importStatus" class="import-status" aria-live="polite"></div>
<button class="secondary-btn" id="applyImportBtn" type="button">Vorlage übernehmen</button>
</div>
</div>
</div>
<script src="vendor/list.min.js"></script>
<script src="automation.js"></script>
<p>Weiterleitung zur Automations-Ansicht…</p>
</body>
</html>