- Updated Card.js to improve generation time handling and display logic. - Simplified SidebarView.js by removing unnecessary timeout logic and added event dispatching on close. - Enhanced collectionsController.js with localized strings for collection management dialogs and messages. - Removed auto scan trigger from AssetsManagerPanel.js and improved scroll restoration logic. - Added localization support in customRootsController.js for folder management prompts and messages. - Updated gridController.js to include localized messages for grid interactions. - Enhanced sidebarController.js to persist sidebar open/close state. - Improved sortController.js to use localized sort option labels. - Added sidebar open state management in panelState.js. - Enhanced customPopoverView.js and filterPopoverView.js with localized labels and button texts. - Updated headerView.js to include version information and link to GitHub repository. - Improved statusDot.js with localized tool capabilities and status messages.
61 lines
1.9 KiB
JavaScript
61 lines
1.9 KiB
JavaScript
/**
|
||
* Bootstrap - Auto-scan and initialization
|
||
*/
|
||
|
||
import { get, post } from "../api/client.js";
|
||
import { ENDPOINTS } from "../api/endpoints.js";
|
||
import { APP_CONFIG } from "./config.js";
|
||
|
||
// Auto-scan state (once per session)
|
||
let startupScanDone = false;
|
||
|
||
/**
|
||
* Trigger background scan as soon as the ComfyUI frontend loads (if enabled).
|
||
* This helps warming the DB before the Assets Manager panel is opened.
|
||
*/
|
||
export async function triggerStartupScan() {
|
||
if (!APP_CONFIG || typeof APP_CONFIG !== "object") return;
|
||
if (!APP_CONFIG.AUTO_SCAN_ON_STARTUP) return;
|
||
if (startupScanDone) return;
|
||
startupScanDone = true;
|
||
|
||
try {
|
||
console.log("📂 Majoor [ℹ️]: Starting startup scan of output directory...");
|
||
|
||
const result = await post(ENDPOINTS.SCAN, {
|
||
recursive: true,
|
||
incremental: true,
|
||
fast: true,
|
||
background_metadata: true
|
||
});
|
||
|
||
if (result.ok) {
|
||
const stats = result.data;
|
||
console.log(`📂 Majoor [✅]: Startup scan complete! Added: ${stats.added}, Updated: ${stats.updated}, Skipped: ${stats.skipped}`);
|
||
} else {
|
||
console.warn("📂 Majoor [⚠️]: Startup scan failed:", result.error);
|
||
}
|
||
} catch (error) {
|
||
console.error("📂 Majoor [❌]: Startup scan error:", error);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Test API connection
|
||
*/
|
||
export async function testAPI() {
|
||
try {
|
||
console.log("📂 Majoor: Testing API connection...");
|
||
const data = await get(ENDPOINTS.HEALTH);
|
||
|
||
if (data?.ok) {
|
||
console.log("📂 Majoor [✅]: API connection successful!");
|
||
console.log("📂 Majoor [ℹ️]: Health status:", data.data.overall);
|
||
} else {
|
||
console.error("📂 Majoor [❌]: API health check failed:", data?.error);
|
||
}
|
||
} catch (error) {
|
||
console.error("📂 Majoor [❌]: Failed to connect to API:", error);
|
||
}
|
||
}
|