mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-14 12:48:03 +00:00
Auto scan cookbook hardware when cache is missing
This commit is contained in:
@@ -80,6 +80,7 @@ export let _cachedModelIds = null; // repo IDs already downloaded
|
|||||||
// after the user has switched servers.
|
// after the user has switched servers.
|
||||||
let _hwfitFetchToken = 0;
|
let _hwfitFetchToken = 0;
|
||||||
let _dismissedHwChips = new Set();
|
let _dismissedHwChips = new Set();
|
||||||
|
let _hwfitAutoScanStarted = new Set();
|
||||||
// Permanently removed (X-clicked) chips. Separate from _dismissedHwChips
|
// Permanently removed (X-clicked) chips. Separate from _dismissedHwChips
|
||||||
// so the ranker treats "off" and "removed" the same (both ignore the
|
// so the ranker treats "off" and "removed" the same (both ignore the
|
||||||
// hardware) but the UI keeps "off" chips visible to toggle back on,
|
// hardware) but the UI keeps "off" chips visible to toggle back on,
|
||||||
@@ -592,12 +593,29 @@ export async function _hwfitFetch(fresh = false, opts = {}) {
|
|||||||
if (!allowNetwork) {
|
if (!allowNetwork) {
|
||||||
_hwfitCache = null;
|
_hwfitCache = null;
|
||||||
_hwfitRenderHw(hw, null);
|
_hwfitRenderHw(hw, null);
|
||||||
list.innerHTML = '<div class="hwfit-loading" style="flex-direction:column;gap:8px;text-align:center;"><div>No cached scan yet</div><div style="font-size:11px;opacity:0.55;max-width:420px;line-height:1.4;">Test hardware and rank models for this server.</div><button type="button" class="hwfit-gpu-btn hwfit-empty-scan-btn" style="height:26px;padding:3px 10px;">Scan</button></div>';
|
const loadingDiv = document.createElement('div');
|
||||||
list.querySelector('.hwfit-empty-scan-btn')?.addEventListener('click', () => {
|
loadingDiv.className = 'hwfit-loading';
|
||||||
_resetGpuToggleState();
|
loadingDiv.style.cssText = 'flex-direction:column;gap:6px;text-align:center;';
|
||||||
_hwfitFetch(true);
|
loadingDiv.appendChild(wp.element);
|
||||||
});
|
const loadingTitle = document.createElement('div');
|
||||||
try { wp.destroy(); } catch {}
|
loadingTitle.textContent = 'No cached scan yet';
|
||||||
|
loadingTitle.style.cssText = 'font-size:12px;opacity:0.7;';
|
||||||
|
const loadingLbl = document.createElement('div');
|
||||||
|
loadingLbl.textContent = 'Scanning hardware…';
|
||||||
|
loadingLbl.style.cssText = 'font-size:11px;opacity:0.55;max-width:420px;line-height:1.4;';
|
||||||
|
loadingDiv.appendChild(loadingTitle);
|
||||||
|
loadingDiv.appendChild(loadingLbl);
|
||||||
|
list.innerHTML = '';
|
||||||
|
list.appendChild(loadingDiv);
|
||||||
|
if (!_hwfitAutoScanStarted.has(_sig)) {
|
||||||
|
_hwfitAutoScanStarted.add(_sig);
|
||||||
|
setTimeout(() => {
|
||||||
|
if (_tk === _hwfitFetchToken) {
|
||||||
|
_resetGpuToggleState();
|
||||||
|
_hwfitFetch(true, { autoFromEmpty: true });
|
||||||
|
}
|
||||||
|
}, 60);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Show spinner while scanning — stack the spinner above a text label
|
// Show spinner while scanning — stack the spinner above a text label
|
||||||
|
|||||||
Reference in New Issue
Block a user