diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js index 3c81b6e2c..a34c7851c 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js @@ -385,13 +385,11 @@ RED.palette.editor = (function() { var catalogueCount; var catalogueLoadStatus = []; var catalogueLoadStart; - var catalogueLoadErrors = false; var activeSort = sortModulesRelevance; function refreshCatalogues (done) { catalogueLoadStatus = []; - catalogueLoadErrors = false; catalogueCount = catalogues.length; loadedList = [] loadedIndex = {} @@ -401,10 +399,9 @@ RED.palette.editor = (function() { const url = catalogues[index]; $.getJSON(url, {_: new Date().getTime()},function(v) { loadedCatalogs.push({ index: index, url: url, name: v.name, updated_at: v.updated_at, modules_count: (v.modules || []).length }) - handleCatalogResponse(null,{ url: url, name: v.name},index,v); + handleCatalogResponse({ url: url, name: v.name},index,v); }).fail(function(jqxhr, textStatus, error) { console.warn("Error loading catalog",url,":",error); - handleCatalogResponse(jqxhr,url,index); }).always(function() { handled++; if (handled === catalogueCount) { @@ -419,47 +416,31 @@ RED.palette.editor = (function() { } } - function handleCatalogResponse(err,catalog,index,v) { - const url = catalog.url - catalogueLoadStatus.push(err); - if (!err) { - if (v.modules) { - v.modules = v.modules.filter(function(m) { - if (RED.utils.checkModuleAllowed(m.id,m.version,installAllowList,installDenyList)) { - loadedIndex[m.id] = m; - m.index = [m.id]; - if (m.keywords) { - m.index = m.index.concat(m.keywords); - } - if (m.types) { - m.index = m.index.concat(m.types); - } - if (m.updated_at) { - m.timestamp = new Date(m.updated_at).getTime(); - } else { - m.timestamp = 0; - } - m.index = m.index.join(",").toLowerCase(); - m.catalog = catalog; - m.catalogIndex = index; - return true; + function handleCatalogResponse(catalog,index,v) { + if (v.modules) { + v.modules = v.modules.filter(function(m) { + if (RED.utils.checkModuleAllowed(m.id,m.version,installAllowList,installDenyList)) { + loadedIndex[m.id] = m; + m.index = [m.id]; + if (m.keywords) { + m.index = m.index.concat(m.keywords); } - return false; - }) - loadedList = loadedList.concat(v.modules); - } - } else { - catalogueLoadErrors = true; - } - if (catalogueLoadStatus.length === catalogueCount) { - if (catalogueLoadErrors) { - RED.notify(RED._('palette.editor.errors.catalogLoadFailed',{url: url}),"error",false,8000); - } - var delta = 250-(Date.now() - catalogueLoadStart); - setTimeout(function() { - $("#red-ui-palette-module-install-shade").hide(); - },Math.max(delta,0)); - + if (m.types) { + m.index = m.index.concat(m.types); + } + if (m.updated_at) { + m.timestamp = new Date(m.updated_at).getTime(); + } else { + m.timestamp = 0; + } + m.index = m.index.join(",").toLowerCase(); + m.catalog = catalog; + m.catalogIndex = index; + return true; + } + return false; + }) + loadedList = loadedList.concat(v.modules); } } @@ -472,6 +453,7 @@ RED.palette.editor = (function() { $(".red-ui-palette-module-shade-status").text(RED._('palette.editor.loading')); $("#red-ui-palette-module-install-shade").show(); + catalogueLoadStart = Date.now() refreshCatalogues(function () { refreshNodeModuleList(); updateCatalogFilter(loadedCatalogs)