handle startup errors

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-07-22 10:19:30 -04:00
parent 36c356785e
commit 41269b05c0
7 changed files with 19 additions and 6 deletions
+4
View File
@@ -60,6 +60,10 @@ function changelogNavigate(found) {
async function initChangelog() {
const search = gradioApp().querySelector('#changelog_search > label> textarea');
const md = gradioApp().getElementById('changelog_markdown');
if (!search || !md) {
error('initChangelog', 'Missing search or markdown elements');
return;
}
const searchChangelog = async (e) => {
if (changelogElements.length < 100) changelogElements = getAllChildren(md);
const found = [];
+4
View File
@@ -469,6 +469,10 @@ async function initGallery() { // triggered on gradio change to monitor when ui
el.files = gradioApp().getElementById('tab-gallery-files');
el.status = gradioApp().getElementById('tab-gallery-status');
el.search = gradioApp().querySelector('#tab-gallery-search textarea');
if (!el.folders || !el.files || !el.status || !el.search) {
error('initGallery', 'Missing gallery elements');
return;
}
el.search.addEventListener('input', gallerySearch);
el.btnSend = gradioApp().getElementById('tab-gallery-send-image');
document.getElementById('tab-gallery-files').style.height = opts.logmonitor_show ? '75vh' : '85vh';
+4
View File
@@ -181,6 +181,10 @@ async function initSettings() {
if (settingsInitialized) return;
settingsInitialized = true;
const tabNavElements = gradioApp().querySelector('#settings > .tab-nav');
if (!tabNavElements) {
error('initSettings', 'No tab nav elements found');
return;
}
const tabNavButtons = gradioApp().querySelectorAll('#settings > .tab-nav > button');
const tabElements = gradioApp().querySelectorAll('#settings > div:not(.tab-nav)');
const observer = new MutationObserver((mutations) => {