clqms-be/public/swagger/index.html
OpenCode Bot 9946978487 chore: refresh CLQMS backend baseline
Re-synced controllers, configs, libraries, seeds, and docs with the latest API expectations and response helpers.
2026-04-08 16:07:19 +07:00

236 lines
6.4 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CLQMS API Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5/swagger-ui.css">
<style>
* { box-sizing: border-box; }
:root {
--sidebar-bg: #f8f9fa;
--sidebar-border: #dee2e6;
--text-primary: #212529;
--text-secondary: #495057;
--accent-color: #49cc90;
--hover-bg: rgba(0,0,0,0.05);
--active-bg: rgba(73, 204, 144, 0.1);
--toggle-bg: #e9ecef;
}
[data-theme="dark"] {
--sidebar-bg: #1a1a1a;
--sidebar-border: #333;
--text-primary: #e9ecef;
--text-secondary: #adb5bd;
--accent-color: #5cb85c;
--hover-bg: rgba(255,255,255,0.05);
--active-bg: rgba(92, 184, 92, 0.15);
--toggle-bg: #333;
}
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
display: flex;
}
#sidebar {
width: 260px;
height: 100vh;
background: var(--sidebar-bg);
border-right: 1px solid var(--sidebar-border);
overflow-y: auto;
position: fixed;
left: 0;
top: 0;
padding: 20px 0;
transition: background 0.3s, border-color 0.3s;
}
#sidebar h2 {
margin: 0 0 20px 0;
padding: 0 20px;
font-size: 18px;
color: var(--text-primary);
font-weight: 600;
}
.nav-link {
display: block;
padding: 10px 20px;
color: var(--text-secondary);
text-decoration: none;
font-size: 14px;
border-left: 3px solid transparent;
transition: all 0.2s;
cursor: pointer;
}
.nav-link:hover {
background: var(--hover-bg);
color: var(--text-primary);
}
.nav-link.active {
border-left-color: var(--accent-color);
background: var(--active-bg);
color: var(--text-primary);
font-weight: 500;
}
#swagger-ui {
margin-left: 260px;
width: calc(100% - 260px);
min-height: 100vh;
}
[data-theme="dark"] body {
background: #0d1117;
}
[data-theme="dark"] #swagger-ui {
background: #0d1117;
}
[data-theme="dark"] .swagger-ui {
filter: invert(100%) hue-rotate(180deg);
}
[data-theme="dark"] .swagger-ui .topbar img,
[data-theme="dark"] .swagger-ui svg,
[data-theme="dark"] .swagger-ui img,
[data-theme="dark"] .swagger-ui .authorization__btn svg,
[data-theme="dark"] .swagger-ui .expand-methods svg,
[data-theme="dark"] .swagger-ui .expand-operation svg,
[data-theme="dark"] .swagger-ui .copy-to-clipboard svg,
[data-theme="dark"] .swagger-ui .opblock-control-arrow svg {
filter: invert(100%) hue-rotate(180deg);
}
.theme-toggle {
position: fixed;
bottom: 20px;
left: 20px;
width: 50px;
height: 50px;
border-radius: 50%;
background: var(--toggle-bg);
border: 2px solid var(--sidebar-border);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
transition: all 0.3s;
z-index: 1000;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.theme-toggle:hover {
transform: scale(1.1);
}
@media (max-width: 768px) {
body { display: block; }
#sidebar {
width: 100%;
height: auto;
max-height: 200px;
position: relative;
border-right: none;
border-bottom: 1px solid var(--sidebar-border);
}
#swagger-ui {
margin-left: 0;
width: 100%;
}
.theme-toggle {
bottom: 10px;
right: 10px;
left: auto;
}
}
</style>
</head>
<body>
<nav id="sidebar">
<h2>Resources</h2>
<div id="nav-links"></div>
</nav>
<button class="theme-toggle" id="themeToggle" title="Toggle theme">
<span id="themeIcon">🌙</span>
</button>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
<script>
// Theme management
const themeToggle = document.getElementById('themeToggle');
const themeIcon = document.getElementById('themeIcon');
const html = document.documentElement;
const savedTheme = localStorage.getItem('swagger-theme') || 'light';
html.setAttribute('data-theme', savedTheme);
updateThemeIcon(savedTheme);
themeToggle.addEventListener('click', () => {
const currentTheme = html.getAttribute('data-theme');
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
html.setAttribute('data-theme', newTheme);
localStorage.setItem('swagger-theme', newTheme);
updateThemeIcon(newTheme);
});
function updateThemeIcon(theme) {
themeIcon.textContent = theme === 'light' ? '🌙' : '☀️';
}
const ui = SwaggerUIBundle({
url: '../api-docs.bundled.yaml',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis],
layout: 'BaseLayout',
onComplete: () => buildSidebar()
});
function buildSidebar() {
const container = document.getElementById('nav-links');
const tags = document.querySelectorAll('.opblock-tag-section');
if (!tags.length) {
setTimeout(buildSidebar, 500);
return;
}
container.innerHTML = '';
tags.forEach(tag => {
const header = tag.querySelector('.opblock-tag');
if (!header) return;
const name = header.getAttribute('data-tag') || header.textContent;
const id = header.id;
const link = document.createElement('a');
link.className = 'nav-link';
link.textContent = name;
link.onclick = (e) => {
e.preventDefault();
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' });
document.querySelectorAll('.nav-link').forEach(l => l.classList.remove('active'));
link.classList.add('active');
};
container.appendChild(link);
});
}
</script>
</body>
</html>