Files
Unified_Dashboard_Suite_Go/web/bulk-api-tester/static/js/renderMain.txt
T

107 lines
6.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
renderMain() {
if (!this.state.activeSpaceId) {
// Render Spaces Dashboard Grid View
const spacesCardsHTML = this.state.spaces.map(s => {
const count = s.collections ? s.collections.length : 0;
const notifCount = s.notifications ? s.notifications.length : 0;
const theme = s.theme || 'violet';
return `
<div class="space-card space-card-${theme}" onclick="App.openSpace('${s.id}')">
<div class="space-card-icon">
<i class="fa-solid fa-cubes"></i>
${notifCount > 0 ? `<span class="space-card-notif-badge">${notifCount}</span>` : ''}
</div>
<div class="space-card-info">
<h3>${this.escapeHTML(s.name)}</h3>
<span>${count} Collections</span>
</div>
<div class="space-card-actions" onclick="event.stopPropagation();">
<button class="btn btn-ghost" style="color:var(--text-muted); padding:4px;" onclick="App.renameSpace('${s.id}')" title="Rename Space">
<i class="fa-solid fa-pencil" style="font-size:12px;"></i>
</button>
${this.state.spaces.length > 1 ? `
<button class="btn btn-ghost" style="color:var(--danger); padding:4px;" onclick="App.deleteSpace('${s.id}')" title="Delete Space">
<i class="fa-solid fa-trash" style="font-size:12px;"></i>
</button>
` : ''}
</div>
</div>
`;
}).join('');
const dashboardHTML = `
<div class="spaces-dashboard">
<div class="spaces-dash-header">
<h2>Workspaces</h2>
<p>Select a workspace to access its collections, endpoints, and history.</p>
</div>
<div class="spaces-grid">
${spacesCardsHTML}
<div class="space-card create-space-card" onclick="App.createSpace()">
<div class="space-card-icon"><i class="fa-solid fa-circle-plus"></i></div>
<div class="space-card-info">
<h3>Create New Space</h3>
<span>Add a clean workspace</span>
</div>
</div>
</div>
</div>
`;
const headerHTML = `
<div class="app-header">
<div class="brand" style="cursor:pointer;" onclick="App.showSpacesDashboard()"><i class="fa-solid fa-fire"></i> PHOENIX</div>
<div style="font-size:13px; color:var(--text-muted); font-weight:600;">
Workspace Dashboard
</div>
<div></div>
</div>
`;
this.dom.mainPanel.innerHTML = headerHTML + dashboardHTML;
return;
}
const isBulkStart = this.checkBulkStart();
const bulk = this.state.bulk;
const activeSpace = this.state.spaces.find(s => s.id === this.state.activeSpaceId);
// Tab Strip (Postman-like)
const tabStripHTML = `
<div class="main-tab-strip">
${this.tabs.map((tab, i) => {
const isActive = i === this.activeTabIndex;
const tabName = tab.name || (tab.url ? tab.url.split('/').pop() || 'Request' : 'Untitled');
const displayName = tabName.length > 20 ? tabName.substring(0, 20) + '…' : tabName;
const method = tab.method || 'GET';
const mc = { GET:'var(--m-get)', POST:'var(--m-post)', PUT:'var(--m-put)', DELETE:'var(--m-delete)', PATCH:'var(--m-patch)' }[method] || 'var(--text-3)';
return `
<div class="main-tab ${isActive ? 'active' : ''}"
onclick="App.switchTab(${i})"
title="${this.escapeHTML(tab.name || tab.url || 'Untitled')}"
style="
display:flex;align-items:center;gap:6px;
padding:0 12px;min-width:120px;max-width:190px;
height:100%;cursor:pointer;flex-shrink:0;
position:relative;overflow:hidden;
user-select:none;white-space:nowrap;
border-right:1px solid var(--border-2);
background:${isActive ? 'var(--bg-app)' : 'var(--bg-sidebar)'};
color:${isActive ? 'var(--text-1)' : 'var(--text-3)'};
border-bottom:2px solid ${isActive ? 'var(--ph)' : 'transparent'};
transition:background 0.12s,color 0.12s;
"
onmouseover="if(!this.classList.contains('active')){this.style.background='var(--bg-elevated)';this.style.color='var(--text-2)';}"
onmouseout="if(!this.classList.contains('active')){this.style.background='var(--bg-sidebar)';this.style.color='var(--text-3)';}">
<span style="font-size:9px;font-weight:800;color:${mc};letter-spacing:0.03em;flex-shrink:0;font-family:var(--font-ui);">${method}</span>
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:12px;font-weight:${isActive ? '600' : '500'};">${this.escapeHTML(displayName)}</span>
<button onclick="event.stopPropagation();App.closeTab(${i})"
style="background:none;border:none;cursor:pointer;color:${isActive ? 'var(--text-2)' : 'var(--text-4)'};padding:2px 3px;border-radius:3px;line-height:1;font-size:14px;flex-shrink:0;transition:background 0.1s,color 0.1s;"
onmouseover="this.style.background='var(--danger-dim)';this.style.color='var(--danger)'"
onmouseout="this.style.background='none';this.style.color='${isActive ? 'var(--text-2)' : 'var(--text-4)'}}'"
title="Close tab">×</button>
</div>
`;
}).join('')}