refactor(components): split components.js into separate files and add loader; app waits for components before init

This commit is contained in:
2025-08-31 14:00:33 +02:00
parent 83d252f3cc
commit cc7fa0fa00
11 changed files with 3124 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
(function(){
// Simple readiness flag once all component constructors are present
function allReady(){
return !!(window.PrimaryNodeComponent && window.ClusterMembersComponent && window.NodeDetailsComponent && window.FirmwareComponent && window.ClusterViewComponent && window.FirmwareViewComponent && window.TopologyGraphComponent && window.MemberCardOverlayComponent && window.ClusterStatusComponent);
}
window.waitForComponentsReady = function(timeoutMs = 5000){
return new Promise((resolve, reject) => {
const start = Date.now();
(function check(){
if (allReady()) return resolve(true);
if (Date.now() - start > timeoutMs) return reject(new Error('Components did not load in time'));
setTimeout(check, 25);
})();
});
};
})();