forked from Shared/esg
Add health check and retry logic and circuit breaker
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="color-scheme" content="dark light" />
|
||||
<title>Inquiry Gateway Console</title>
|
||||
<link rel="stylesheet" href="/dashboard/styles.css" />
|
||||
<script defer src="/dashboard/app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
<section id="loginView" class="auth-card">
|
||||
<div class="brand-mark">ESG</div>
|
||||
<p class="eyebrow">External Services Gateway</p>
|
||||
<h1>Operations console</h1>
|
||||
<p class="muted">Sign in with the seeded SUPER_ADMIN account to inspect health, logs, and inquiries.</p>
|
||||
<form id="loginForm" class="stack">
|
||||
<label>Username<input id="username" name="username" autocomplete="username" required /></label>
|
||||
<label>Password<input id="password" name="password" type="password" autocomplete="current-password" required /></label>
|
||||
<button class="primary" type="submit">Sign in</button>
|
||||
</form>
|
||||
<p id="loginError" class="error" role="alert"></p>
|
||||
</section>
|
||||
|
||||
<section id="appView" class="hidden">
|
||||
<header class="topbar">
|
||||
<div>
|
||||
<p class="eyebrow">External Services Gateway</p>
|
||||
<h1>Operations console</h1>
|
||||
</div>
|
||||
<div class="topbar-actions">
|
||||
<span id="profileLabel" class="pill"></span>
|
||||
<button id="logoutButton" class="ghost" type="button">Sign out</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div id="appError" class="error banner" role="alert"></div>
|
||||
|
||||
<section class="grid two">
|
||||
<article class="panel health-panel">
|
||||
<div class="panel-heading"><h2>System health</h2><button id="refreshHealth" class="icon-button" type="button" title="Refresh health">↻</button></div>
|
||||
<div id="healthStatus" class="health-status"><span class="status-dot"></span><span>Loading…</span></div>
|
||||
<pre id="healthOutput" class="code compact">Loading readiness details…</pre>
|
||||
</article>
|
||||
<article class="panel">
|
||||
<div class="panel-heading"><h2>Inquiry metrics</h2><button id="refreshMetrics" class="icon-button" type="button" title="Refresh metrics">↻</button></div>
|
||||
<div class="metric-grid">
|
||||
<div><span>Total requests</span><strong id="metricTotal">—</strong></div>
|
||||
<div><span>Evaluated</span><strong id="metricEvaluated">—</strong></div>
|
||||
<div><span>Success rate*</span><strong id="metricSuccess">—</strong></div>
|
||||
<div><span>Operational failures</span><strong id="metricFailure">—</strong></div>
|
||||
<div><span>No-match results</span><strong id="metricNoMatch">—</strong></div>
|
||||
<div><span>Avg duration</span><strong id="metricDuration">—</strong></div>
|
||||
</div>
|
||||
<p class="metric-note">* Success rate excludes valid provider responses with no matching policy or owner.</p>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-heading"><div><p class="eyebrow">Manual request</p><h2>Run an inquiry</h2></div></div>
|
||||
<form id="inquiryForm" class="inquiry-form">
|
||||
<label>Inquiry type
|
||||
<select id="inquiryType">
|
||||
<option value="person">Person</option>
|
||||
<option value="realEstate">Real estate</option>
|
||||
<option value="sheba">Sheba</option>
|
||||
<option value="shahkar">Shahkar</option>
|
||||
<option value="postalCode">Postal code</option>
|
||||
<option value="legalPerson">Legal person</option>
|
||||
<option value="carByPlate">Car by plate</option>
|
||||
<option value="carByChassis">Car by chassis</option>
|
||||
<option value="thirdPartyCar">Third-party car</option>
|
||||
<option value="policyByChassis">Policy by chassis</option>
|
||||
<option value="policyByPlate">Policy by plate</option>
|
||||
<option value="policyByNationalCode">Policy by national code</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Idempotency key <input id="idempotencyKey" /></label>
|
||||
<div class="request-toolbar wide">
|
||||
<span id="inquiryHint" class="muted"></span>
|
||||
<button id="toggleRawButton" class="ghost" type="button">Use JSON mode</button>
|
||||
</div>
|
||||
<div id="fieldMode" class="wide">
|
||||
<div id="inquiryFields" class="form-fields"></div>
|
||||
</div>
|
||||
<div id="rawMode" class="wide hidden">
|
||||
<label>JSON payload
|
||||
<textarea id="inquiryPayload" rows="9" spellcheck="false"></textarea>
|
||||
</label>
|
||||
<button id="applyJsonButton" class="ghost" type="button">Apply JSON to form fields</button>
|
||||
</div>
|
||||
<button class="primary" type="submit">Send inquiry</button>
|
||||
</form>
|
||||
<pre id="inquiryOutput" class="code response-box">The formatted response will appear here.</pre>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-heading"><div><p class="eyebrow">Batch input</p><h2>Test plate inquiries from JSON</h2></div></div>
|
||||
<p class="muted">Choose a JSON or TXT file, or paste a JSON array. For Parsian third-party plate inquiries, use <strong>Car by plate</strong>; the other routes remain available only for diagnostics.</p>
|
||||
<div class="batch-controls">
|
||||
<label>JSON/TXT file<input id="batchFile" type="file" accept=".json,.txt,application/json,text/plain" /></label>
|
||||
<label>Delay between requests (ms)<input id="batchDelay" type="number" min="0" max="10000" step="100" value="0" /></label>
|
||||
</div>
|
||||
<label class="wide">Input preview / paste JSON
|
||||
<textarea id="batchPayload" rows="8" spellcheck="false" placeholder='[{"nationalCode":"4311402422","plk1":"12","plk2":"ب","plk3":"345","plksrl":"67"}]'></textarea>
|
||||
</label>
|
||||
<div class="endpoint-list">
|
||||
<span class="muted">Endpoints</span>
|
||||
<label class="checkbox"><input type="checkbox" name="batchEndpoint" value="carByPlate" checked /> Car by plate</label>
|
||||
<label class="checkbox"><input type="checkbox" name="batchEndpoint" value="thirdPartyCar" /> Third-party car (diagnostic)</label>
|
||||
<label class="checkbox"><input type="checkbox" name="batchEndpoint" value="policyByPlate" /> Policy by plate (diagnostic)</label>
|
||||
</div>
|
||||
<div class="batch-actions">
|
||||
<button id="runBatchButton" class="primary" type="button">Run batch test</button>
|
||||
<button id="stopBatchButton" class="ghost hidden" type="button">Stop after current request</button>
|
||||
<span id="batchSummary" class="muted"></span>
|
||||
</div>
|
||||
<progress id="batchProgress" class="batch-progress hidden" max="1" value="0"></progress>
|
||||
<div class="table-wrap"><table><thead><tr><th>#</th><th>Input</th><th>Endpoint</th><th>Status</th><th>Tracking code</th><th>Message</th></tr></thead><tbody id="batchResultsBody"></tbody></table></div>
|
||||
<p id="batchOutput" class="table-hint" role="status">Click a request row to expand its full response.</p>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-heading"><div><p class="eyebrow">MongoDB audit trail</p><h2>Recent inquiry logs</h2></div><div class="panel-actions"><button id="refreshLogs" class="ghost" type="button">Refresh logs</button><button id="clearLogsButton" class="danger" type="button">Clear all logs</button></div></div>
|
||||
<div class="table-wrap"><table><thead><tr><th>Time</th><th>Type</th><th>Provider</th><th>Status</th><th>Duration</th><th>Tracking code</th></tr></thead><tbody id="logsBody"></tbody></table></div>
|
||||
<p id="logOutput" class="table-hint" role="status">Click a request row to expand its masked request and response.</p>
|
||||
</section>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user