feat: migrate api-tokens.html to wd-* design system
This commit is contained in:
parent
daa203a43e
commit
a84bc3ecfe
1 changed files with 61 additions and 61 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>API Tokens — Dragonflight</title>
|
||||
<link rel="stylesheet" href="css/common.css">
|
||||
<link rel="stylesheet" href="/dist/app.css">
|
||||
<style>
|
||||
.token-card {
|
||||
background: var(--bg-surface);
|
||||
|
|
@ -73,65 +73,65 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="shell">
|
||||
<div class="wd-shell" style="display:flex;min-height:100vh;">
|
||||
|
||||
<!-- Sidebar -->
|
||||
<nav class="sidebar" aria-label="Main navigation">
|
||||
<div class="sidebar-brand">
|
||||
<img src="img/dragon-logo.png?v=1" alt="Dragonflight" class="sidebar-logo">
|
||||
<span class="sidebar-brand-name">Dragonflight</span>
|
||||
<nav class="wd-sidebar" aria-label="Main navigation">
|
||||
<div class="wd-sidebar-header">
|
||||
<img src="img/dragon-logo.png?v=1" alt="Dragonflight" style="width:18px;height:18px;">
|
||||
<span class="wd-sidebar-brand">Dragonflight</span>
|
||||
</div>
|
||||
<nav class="sidebar-nav">
|
||||
<a href="home.html" class="nav-item">
|
||||
<div class="wd-sidebar-nav">
|
||||
<a href="home.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 7l6-5 6 5v7a1 1 0 0 1-1 1h-3v-5H6v5H3a1 1 0 0 1-1-1z"/></svg>
|
||||
Home
|
||||
</a>
|
||||
<a href="index.html" class="nav-item">
|
||||
<a href="index.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="1" width="6" height="6" rx="1"/><rect x="9" y="1" width="6" height="6" rx="1"/><rect x="1" y="9" width="6" height="6" rx="1"/><rect x="9" y="9" width="6" height="6" rx="1"/></svg>
|
||||
Library
|
||||
</a>
|
||||
<a href="projects.html" class="nav-item">
|
||||
<a href="projects.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M1 4a1 1 0 0 1 1-1h4l2 2h5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1z"/></svg>
|
||||
Projects
|
||||
</a>
|
||||
<a href="upload.html" class="nav-item">
|
||||
<a href="upload.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M8 11V3M5 6l3-3 3 3"/><path d="M2 13h12"/></svg>
|
||||
Ingest
|
||||
</a>
|
||||
<a href="recorders.html" class="nav-item">
|
||||
<a href="recorders.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="4" width="10" height="8" rx="1"/><path d="M11 7l4-2v6l-4-2"/></svg>
|
||||
Recorders
|
||||
</a>
|
||||
<a href="capture.html" class="nav-item">
|
||||
<a href="capture.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="3"/><circle cx="8" cy="8" r="6.5"/></svg>
|
||||
Capture
|
||||
</a>
|
||||
<a href="jobs.html" class="nav-item">
|
||||
<a href="jobs.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 4h12M2 8h8M2 12h5"/></svg>
|
||||
Jobs
|
||||
</a>
|
||||
<a href="edit.html" class="nav-item" target="_blank" rel="noopener">
|
||||
<a href="edit.html" class="wd-nav-item" target="_blank" rel="noopener">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 13l1.5-3.5L11 2l3 3-7.5 7.5L3 14zM10 3l3 3"/></svg>
|
||||
Editor
|
||||
</a>
|
||||
<div class="sidebar-section-label">Admin</div>
|
||||
<a href="users.html" class="nav-item">
|
||||
<div class="wd-sidebar-section">Admin</div>
|
||||
<a href="users.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="6" cy="5" r="2.5"/><path d="M1 13c0-2.8 2.2-5 5-5s5 2.2 5 5"/><circle cx="12" cy="5" r="2"/><path d="M15 12c0-1.9-1.3-3.5-3-4"/></svg>
|
||||
Users
|
||||
</a>
|
||||
<a href="tokens.html" class="nav-item">
|
||||
<a href="tokens.html" class="wd-nav-item">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="6" cy="10" r="3.5"/><path d="M8.7 7.3L13 3M11.5 3.5l1.5 1.5M13.5 2.5l1 1"/></svg>
|
||||
Tokens
|
||||
</a>
|
||||
</nav>
|
||||
<div class="sidebar-footer">
|
||||
<div class="sidebar-user">
|
||||
<div class="sidebar-user-avatar" id="userAvatar">?</div>
|
||||
<div class="sidebar-user-info">
|
||||
<div class="sidebar-user-name" id="userName">—</div>
|
||||
<div class="sidebar-user-role" id="userRole"></div>
|
||||
</div>
|
||||
<div class="wd-sidebar-footer">
|
||||
<div class="wd-sidebar-user">
|
||||
<div class="wd-sidebar-user-avatar" id="userAvatar">?</div>
|
||||
<div class="wd-sidebar-user-info">
|
||||
<div class="wd-sidebar-user-name" id="userName">—</div>
|
||||
<div class="wd-sidebar-user-role" id="userRole"></div>
|
||||
</div>
|
||||
<button class="btn btn-ghost" id="logoutBtn" title="Sign out" style="padding:0;width:24px;height:24px;flex-shrink:0;">
|
||||
<button class="wd-btn wd-btn--ghost wd-btn--sm wd-btn--icon wd-sidebar-user-logout" id="logoutBtn" title="Sign out">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" width="14" height="14"><path d="M10 8H3M6 5l-3 3 3 3"/><path d="M7 3h5a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H7"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -139,20 +139,20 @@
|
|||
</nav>
|
||||
|
||||
<!-- Main -->
|
||||
<div class="main">
|
||||
<header class="topbar">
|
||||
<div class="topbar-left">
|
||||
<div style="flex:1;display:flex;flex-direction:column;">
|
||||
<header class="wd-topbar">
|
||||
<div class="wd-topbar-left">
|
||||
<span class="page-title">API Tokens</span>
|
||||
</div>
|
||||
<div class="topbar-right">
|
||||
<button class="btn btn-primary btn-sm" onclick="openNewTokenPanel()">
|
||||
<div class="wd-topbar-right">
|
||||
<button class="wd-btn wd-btn--primary wd-btn--sm" onclick="openNewTokenPanel()">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M8 2v12M2 8h12"/></svg>
|
||||
New token
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="page-content">
|
||||
<div style="flex:1;overflow:auto;padding:24px;">
|
||||
<div style="max-width:680px;margin-bottom:var(--sp-5);">
|
||||
<p class="text-sm text-secondary" style="line-height:1.7;">
|
||||
API tokens let scripts and integrations authenticate as you without using your password.
|
||||
|
|
@ -171,7 +171,7 @@
|
|||
<div class="new-token-banner-warning">
|
||||
⚠ This is the only time this token will be shown. Copy it now.
|
||||
</div>
|
||||
<button class="btn btn-secondary btn-sm copy-btn" onclick="copyToken()">Copy to clipboard</button>
|
||||
<button class="wd-btn wd-btn--secondary wd-btn--sm copy-btn" onclick="copyToken()">Copy to clipboard</button>
|
||||
</div>
|
||||
|
||||
<!-- Token list -->
|
||||
|
|
@ -179,14 +179,14 @@
|
|||
<div style="color:var(--text-tertiary);font-size:var(--text-sm)">Loading…</div>
|
||||
</div>
|
||||
|
||||
<div id="tokensEmpty" class="empty-state" style="display:none;padding:var(--sp-12) 0;">
|
||||
<div class="empty-state-icon">
|
||||
<div id="tokensEmpty" class="wd-empty" style="display:none;padding:var(--sp-12) 0;">
|
||||
<div class="wd-empty-icon">
|
||||
<svg viewBox="0 0 40 40" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="15" cy="25" r="8"/><path d="M21 19l10-10M28 10l3 3M30 8l2 2"/></svg>
|
||||
</div>
|
||||
<div class="empty-state-title">No tokens yet</div>
|
||||
<div class="empty-state-body">Create a token to authenticate API requests without a password.</div>
|
||||
<div class="empty-state-actions">
|
||||
<button class="btn btn-primary btn-sm" onclick="openNewTokenPanel()">New token</button>
|
||||
<div class="wd-empty-title">No tokens yet</div>
|
||||
<div class="wd-empty-body">Create a token to authenticate API requests without a password.</div>
|
||||
<div class="wd-empty-actions">
|
||||
<button class="wd-btn wd-btn--primary wd-btn--sm" onclick="openNewTokenPanel()">New token</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -194,23 +194,23 @@
|
|||
</div>
|
||||
|
||||
<!-- New token slide panel -->
|
||||
<div class="slide-overlay" id="tokenOverlay" onclick="closeNewTokenPanel()"></div>
|
||||
<div class="slide-panel" id="tokenPanel">
|
||||
<div class="slide-panel-header">
|
||||
<span class="slide-panel-title">New API token</span>
|
||||
<button class="btn btn-ghost btn-sm" onclick="closeNewTokenPanel()" style="padding:0;width:28px;height:28px;">
|
||||
<div class="wd-slide-overlay" id="tokenOverlay" onclick="closeNewTokenPanel()"></div>
|
||||
<div class="wd-slide-panel" id="tokenPanel">
|
||||
<div class="wd-slide-panel-header">
|
||||
<span class="wd-slide-panel-title">New API token</span>
|
||||
<button class="wd-btn wd-btn--ghost wd-btn--sm" onclick="closeNewTokenPanel()" style="padding:0;width:28px;height:28px;">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 3l10 10M13 3L3 13"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="slide-panel-body">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="tokenName">Token name</label>
|
||||
<div class="wd-slide-panel-body">
|
||||
<div class="wd-form-group">
|
||||
<label class="wd-label" for="tokenName">Token name</label>
|
||||
<input type="text" id="tokenName" placeholder="e.g. Premiere Plugin, CI/CD Script">
|
||||
<div class="form-hint">A label to help you remember what this token is for.</div>
|
||||
<div class="wd-hint">A label to help you remember what this token is for.</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="tokenExpiry">Expiry</label>
|
||||
<select id="tokenExpiry">
|
||||
<div class="wd-form-group">
|
||||
<label class="wd-label" for="tokenExpiry">Expiry</label>
|
||||
<select id="tokenExpiry" class="wd-select">
|
||||
<option value="">No expiry</option>
|
||||
<option value="30">30 days</option>
|
||||
<option value="90">90 days</option>
|
||||
|
|
@ -218,13 +218,13 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="slide-panel-footer">
|
||||
<button class="btn btn-ghost" onclick="closeNewTokenPanel()">Cancel</button>
|
||||
<button class="btn btn-primary" id="createTokenBtn" onclick="createNewToken()">Create token</button>
|
||||
<div class="wd-slide-panel-footer">
|
||||
<button class="wd-btn wd-btn--ghost" onclick="closeNewTokenPanel()">Cancel</button>
|
||||
<button class="wd-btn wd-btn--primary" id="createTokenBtn" onclick="createNewToken()">Create token</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast-container" id="toastContainer" aria-live="polite"></div>
|
||||
<div class="wd-toast-container" id="toastContainer" aria-live="polite"></div>
|
||||
|
||||
<script src="js/api.js?v=6"></script>
|
||||
<script>
|
||||
|
|
@ -271,7 +271,7 @@
|
|||
· Expires: ${isExpired ? '<span style="color:var(--status-red)">Expired</span>' : expires}
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-danger btn-sm" onclick="confirmRevoke('${t.id}',${esc(JSON.stringify(t.name))})">Revoke</button>
|
||||
<button class="wd-btn wd-btn--danger wd-btn--sm" onclick="confirmRevoke('${t.id}',${esc(JSON.stringify(t.name))})">Revoke</button>
|
||||
</div>`;
|
||||
}).join('');
|
||||
}
|
||||
|
|
@ -279,13 +279,13 @@
|
|||
function openNewTokenPanel() {
|
||||
document.getElementById('tokenName').value = '';
|
||||
document.getElementById('tokenExpiry').value = '';
|
||||
document.getElementById('tokenPanel').classList.add('open');
|
||||
document.getElementById('tokenOverlay').classList.add('open');
|
||||
document.getElementById('tokenPanel').classList.add('is-open');
|
||||
document.getElementById('tokenOverlay').classList.add('is-open');
|
||||
}
|
||||
|
||||
function closeNewTokenPanel() {
|
||||
document.getElementById('tokenPanel').classList.remove('open');
|
||||
document.getElementById('tokenOverlay').classList.remove('open');
|
||||
document.getElementById('tokenPanel').classList.remove('is-open');
|
||||
document.getElementById('tokenOverlay').classList.remove('is-open');
|
||||
}
|
||||
|
||||
async function createNewToken() {
|
||||
|
|
@ -336,7 +336,7 @@
|
|||
info: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><path d="M8 7v5M8 5v.5"/></svg>`,
|
||||
};
|
||||
const el = document.createElement('div');
|
||||
el.className = `toast toast--${type}`;
|
||||
el.className = `wd-toast wd-toast--${type}`;
|
||||
el.innerHTML = `<div class="toast-icon">${icons[type]||icons.info}</div><div class="toast-body"><div class="toast-title">${esc(title)}</div>${msg?`<div class="toast-msg">${esc(msg)}</div>`:''}</div>`;
|
||||
document.getElementById('toastContainer').appendChild(el);
|
||||
setTimeout(() => el.remove(), 4000);
|
||||
|
|
|
|||
Loading…
Reference in a new issue