convert admin entrypoint to module
This commit is contained in:
parent
e575d34387
commit
d91611947e
3 changed files with 29 additions and 28 deletions
|
|
@ -510,7 +510,7 @@
|
|||
<script type="module" src="/js/calculators.js"></script>
|
||||
<script type="module" src="/js/bedside/index.js"></script>
|
||||
<script defer src="/js/learningHub.js"></script>
|
||||
<script defer src="/js/admin.js?v=7.1.3"></script>
|
||||
<script type="module" src="/js/admin.js?v=7.1.3"></script>
|
||||
|
||||
<!-- ═══════════ IMAGE LIGHTBOX (global overlay — triggered by any
|
||||
[data-img-src] button in any tab; lives here so it exists in the
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ function adminFlashButtonBackground(btn, color) {
|
|||
setTimeout(function() { if (btn) btn.style.background = ''; }, 2000);
|
||||
}
|
||||
|
||||
(function() {
|
||||
{
|
||||
|
||||
var loaded = false;
|
||||
let loaded = false;
|
||||
|
||||
// Load admin panel when admin tab is activated
|
||||
document.addEventListener('tabChanged', function(e) {
|
||||
|
|
@ -280,16 +280,16 @@ function adminFlashButtonBackground(btn, color) {
|
|||
.catch(function() { showToast('Request failed', 'error'); });
|
||||
}
|
||||
|
||||
var esc = adminEscapeHtml;
|
||||
const esc = adminEscapeHtml;
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ADMIN CMS — Announcements, Feature Flags, Email, AI Prompts
|
||||
// ============================================================
|
||||
(function() {
|
||||
{
|
||||
|
||||
var cmsLoaded = false;
|
||||
let cmsLoaded = false;
|
||||
|
||||
// Load CMS when admin tab is opened (via tabChanged event or click)
|
||||
document.addEventListener('tabChanged', function(e) {
|
||||
|
|
@ -681,14 +681,14 @@ function adminFlashButtonBackground(btn, color) {
|
|||
});
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ADMIN CLINICAL ASSISTANT SETTINGS
|
||||
// ============================================================
|
||||
(function() {
|
||||
var loaded = false;
|
||||
var defaults = {
|
||||
{
|
||||
let loaded = false;
|
||||
const defaults = {
|
||||
behavior: 'You are a concise pediatric clinical assistant. Use retrieved context only for factual claims. If the user input is a greeting or too vague, answer briefly and ask what they want to look up. Synthesize across sources and cite factual claims with the exact provided source numbers like [1]. Do not invent, renumber, merge, or move citations.'
|
||||
};
|
||||
|
||||
|
|
@ -854,13 +854,13 @@ function adminFlashButtonBackground(btn, color) {
|
|||
}
|
||||
function getValue(id) { var el = document.getElementById(id); return el ? el.value.trim() : ''; }
|
||||
function setValue(id, value) { var el = document.getElementById(id); if (el) el.value = value; }
|
||||
var escAssistant = adminEscapeHtml;
|
||||
})();
|
||||
const escAssistant = adminEscapeHtml;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ADMIN MODEL MANAGEMENT — Discover, search, enable/disable, custom models
|
||||
// ============================================================
|
||||
(function() {
|
||||
{
|
||||
|
||||
document.addEventListener('tabChanged', function(e) {
|
||||
if (e.detail && e.detail.tab === 'admin') {
|
||||
|
|
@ -887,7 +887,7 @@ function adminFlashButtonBackground(btn, color) {
|
|||
}
|
||||
});
|
||||
|
||||
var esc = adminEscapeHtml;
|
||||
const esc = adminEscapeHtml;
|
||||
|
||||
function loadAdminModels() {
|
||||
fetch('/api/admin/config/models', { headers: getAuthHeaders() })
|
||||
|
|
@ -1194,12 +1194,12 @@ function adminFlashButtonBackground(btn, color) {
|
|||
});
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ADMIN TTS MANAGEMENT
|
||||
// ============================================================
|
||||
(function() {
|
||||
{
|
||||
document.addEventListener('tabChanged', function(e) {
|
||||
if (e.detail && e.detail.tab === 'admin') loadTTSConfig();
|
||||
});
|
||||
|
|
@ -1215,7 +1215,7 @@ function adminFlashButtonBackground(btn, color) {
|
|||
if (e.target.id === 'admin-tts-search' && e.key === 'Enter') { e.preventDefault(); discoverTTS(); }
|
||||
});
|
||||
|
||||
var esc = adminEscapeHtml;
|
||||
const esc = adminEscapeHtml;
|
||||
|
||||
function loadTTSConfig() {
|
||||
fetch('/api/admin/config/tts', { headers: getAuthHeaders() })
|
||||
|
|
@ -1376,15 +1376,15 @@ function adminFlashButtonBackground(btn, color) {
|
|||
return new Blob([bytes], { type: type });
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ADMIN STT MANAGEMENT
|
||||
// ============================================================
|
||||
(function() {
|
||||
var mediaRecorder = null;
|
||||
var audioChunks = [];
|
||||
var recording = false;
|
||||
{
|
||||
let mediaRecorder = null;
|
||||
let audioChunks = [];
|
||||
let recording = false;
|
||||
|
||||
document.addEventListener('tabChanged', function(e) {
|
||||
if (e.detail && e.detail.tab === 'admin') loadSTTConfig();
|
||||
|
|
@ -1401,7 +1401,7 @@ function adminFlashButtonBackground(btn, color) {
|
|||
if (e.target.id === 'admin-stt-search' && e.key === 'Enter') { e.preventDefault(); discoverSTT(); }
|
||||
});
|
||||
|
||||
var esc = adminEscapeHtml;
|
||||
const esc = adminEscapeHtml;
|
||||
|
||||
function loadSTTConfig() {
|
||||
fetch('/api/admin/config/stt', { headers: getAuthHeaders() })
|
||||
|
|
@ -1564,12 +1564,12 @@ function adminFlashButtonBackground(btn, color) {
|
|||
reader.readAsDataURL(blob);
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ADMIN EMBEDDING MODELS MANAGEMENT
|
||||
// ============================================================
|
||||
(function() {
|
||||
{
|
||||
document.addEventListener('tabChanged', function(e) {
|
||||
if (e.detail && e.detail.tab === 'admin') loadEmbeddingConfig();
|
||||
});
|
||||
|
|
@ -1585,7 +1585,7 @@ function adminFlashButtonBackground(btn, color) {
|
|||
if (e.target.id === 'admin-embed-search' && e.key === 'Enter') { e.preventDefault(); discoverEmbeddings(); }
|
||||
});
|
||||
|
||||
var esc = adminEscapeHtml;
|
||||
const esc = adminEscapeHtml;
|
||||
|
||||
function loadEmbeddingConfig() {
|
||||
fetch('/api/admin/config/embeddings', { headers: getAuthHeaders() })
|
||||
|
|
@ -1719,4 +1719,4 @@ function adminFlashButtonBackground(btn, color) {
|
|||
});
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ const path = require('node:path');
|
|||
const moduleEntrypoints = [
|
||||
'public/js/calculators.js',
|
||||
'public/js/clinicalAssistant.js',
|
||||
'public/js/admin.js',
|
||||
'public/js/notes.js',
|
||||
'public/js/wellVisit.js'
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue