Changeset 0.25.4 (#164)
This commit is contained in:
@@ -362,7 +362,7 @@ Object.assign(UI, {
|
||||
titleEl.textContent = teamName;
|
||||
}
|
||||
document.getElementById('teamAdminPicker').style.display = 'none';
|
||||
document.getElementById('teamAdminContent').style.display = '';
|
||||
document.getElementById('teamAdminContent').style.display = 'flex';
|
||||
|
||||
// Reset forms (null-safe — not all form containers may exist)
|
||||
['settingsTeamAddMember', 'settingsTeamAddPersona', 'settingsTeamProviderForm'].forEach(id => {
|
||||
@@ -607,13 +607,18 @@ Object.assign(UI, {
|
||||
async loadUserRoles() {
|
||||
const el = document.getElementById('userRolesConfig');
|
||||
const notice = document.getElementById('userRolesDisabled');
|
||||
const tabBtn = document.getElementById('settingsRolesTabBtn');
|
||||
if (!el) return;
|
||||
|
||||
// Only show if BYOK is enabled
|
||||
const byokAllowed = App.policies?.allow_user_byok === 'true';
|
||||
if (tabBtn) tabBtn.style.display = byokAllowed ? '' : 'none';
|
||||
if (!byokAllowed) return;
|
||||
if (!byokAllowed) {
|
||||
el.style.display = 'none';
|
||||
if (notice) {
|
||||
notice.innerHTML = '<p style="color:var(--text-2);font-size:13px;">BYOK (Bring Your Own Key) must be enabled by your admin before you can configure model role overrides.</p>';
|
||||
notice.style.display = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if user has personal providers
|
||||
try {
|
||||
@@ -623,7 +628,10 @@ Object.assign(UI, {
|
||||
|
||||
if (personalProviders.length === 0) {
|
||||
el.style.display = 'none';
|
||||
if (notice) notice.style.display = '';
|
||||
if (notice) {
|
||||
notice.innerHTML = '<p style="color:var(--text-2);font-size:13px;">Add a personal provider in <strong>My Providers</strong> first to configure model role overrides.</p>';
|
||||
notice.style.display = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
el.style.display = '';
|
||||
@@ -789,7 +797,21 @@ Object.assign(UI, {
|
||||
el.innerHTML = '<div class="empty-hint">No models available</div>';
|
||||
return;
|
||||
}
|
||||
el.innerHTML = models.map(m => {
|
||||
|
||||
const hiddenCount = models.filter(m => {
|
||||
const cfgId = m.config_id || m.provider_config_id || '';
|
||||
return App.hiddenModels.has((cfgId || '') + ':' + (m.model_id || m.id));
|
||||
}).length;
|
||||
const visibleCount = models.length - hiddenCount;
|
||||
|
||||
let html = `<div style="display:flex;align-items:center;gap:8px;margin-bottom:12px;">
|
||||
<span class="text-muted" style="font-size:12px">${visibleCount} visible, ${hiddenCount} hidden of ${models.length} total</span>
|
||||
<div style="flex:1"></div>
|
||||
<button class="btn-small" onclick="bulkSetUserModelVisibility(true)">Show All</button>
|
||||
<button class="btn-small" onclick="bulkSetUserModelVisibility(false)">Hide All</button>
|
||||
</div>`;
|
||||
|
||||
html += models.map(m => {
|
||||
const mid = m.model_id || m.id;
|
||||
const cfgId = m.config_id || m.provider_config_id || '';
|
||||
const compositeKey = (cfgId || '') + ':' + mid;
|
||||
@@ -808,6 +830,7 @@ Object.assign(UI, {
|
||||
<button class="admin-model-toggle ${toggleCls}" onclick="toggleUserModelVisibility('${esc(mid)}', '${esc(cfgId)}', ${hidden})" title="${hidden ? 'Show in selector' : 'Hide from selector'}">${toggleLabel}</button>
|
||||
</div>`;
|
||||
}).join('');
|
||||
el.innerHTML = html;
|
||||
} catch (e) { el.innerHTML = `<div class="error-hint">${esc(e.message)}</div>`; }
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user