Changeset 0.11.0 (#62)
This commit is contained in:
@@ -42,7 +42,6 @@ Object.assign(UI, {
|
||||
|
||||
switchTeamTab(tab) {
|
||||
const tabs = document.querySelectorAll('#teamAdminTabs .admin-tab');
|
||||
console.log('switchTeamTab:', tab, 'found tabs:', tabs.length);
|
||||
tabs.forEach(t => {
|
||||
t.classList.remove('active');
|
||||
if (t.dataset.ttab === tab) t.classList.add('active');
|
||||
@@ -76,6 +75,7 @@ Object.assign(UI, {
|
||||
if (tab === 'settings') await this.loadAdminSettings();
|
||||
if (tab === 'roles') await this.loadAdminRoles();
|
||||
if (tab === 'usage') await this.loadAdminUsage();
|
||||
if (tab === 'extensions') await this.loadAdminExtensions();
|
||||
},
|
||||
|
||||
async loadAdminUsers(quiet) {
|
||||
@@ -223,6 +223,56 @@ Object.assign(UI, {
|
||||
}
|
||||
},
|
||||
|
||||
async loadAdminExtensions() {
|
||||
const el = document.getElementById('adminExtensionsList');
|
||||
el.innerHTML = '<div class="loading">Loading...</div>';
|
||||
try {
|
||||
const resp = await API._get('/api/v1/admin/extensions');
|
||||
const exts = resp.data || [];
|
||||
this._adminExtensions = exts; // store for edit access
|
||||
if (exts.length === 0) {
|
||||
el.innerHTML = '<div class="text-muted" style="padding:16px">No extensions installed</div>';
|
||||
return;
|
||||
}
|
||||
el.innerHTML = exts.map(ext => {
|
||||
const statusBadge = ext.is_enabled
|
||||
? '<span class="badge-admin" style="font-size:11px">enabled</span>'
|
||||
: '<span class="badge-user" style="font-size:11px;opacity:0.5">disabled</span>';
|
||||
const systemBadge = ext.is_system
|
||||
? ' <span class="badge-user" style="font-size:11px">system</span>'
|
||||
: '';
|
||||
return `
|
||||
<div class="admin-user-row" style="padding:10px 0;align-items:flex-start">
|
||||
<div class="admin-user-info" style="flex:1">
|
||||
<div style="display:flex;align-items:center;gap:8px">
|
||||
<strong>${esc(ext.name)}</strong>
|
||||
<code style="font-size:11px;color:var(--text-3)">${esc(ext.ext_id)}</code>
|
||||
${statusBadge}${systemBadge}
|
||||
</div>
|
||||
<div class="text-muted" style="font-size:12px;margin-top:2px">
|
||||
${esc(ext.description || 'No description')}
|
||||
${ext.author ? ` · by ${esc(ext.author)}` : ''}
|
||||
· v${esc(ext.version)} · ${ext.tier}
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex;gap:6px;flex-shrink:0">
|
||||
<button class="btn-small" onclick="editAdminExtension('${ext.id}')">
|
||||
Edit
|
||||
</button>
|
||||
<button class="btn-small" onclick="toggleAdminExtension('${ext.id}', ${!ext.is_enabled})">
|
||||
${ext.is_enabled ? 'Disable' : 'Enable'}
|
||||
</button>
|
||||
<button class="btn-small btn-danger" onclick="deleteAdminExtension('${ext.id}', '${esc(ext.name)}')">
|
||||
Uninstall
|
||||
</button>
|
||||
</div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
} catch (e) {
|
||||
el.innerHTML = '<div class="text-muted" style="padding:16px">Failed to load extensions</div>';
|
||||
}
|
||||
},
|
||||
|
||||
_auditPage: 1,
|
||||
_auditPerPage: 30,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user