mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Simplify error reporting
This commit is contained in:
parent
a69a35aacf
commit
4ff748c1c1
@ -385,13 +385,11 @@ RED.palette.editor = (function() {
|
|||||||
var catalogueCount;
|
var catalogueCount;
|
||||||
var catalogueLoadStatus = [];
|
var catalogueLoadStatus = [];
|
||||||
var catalogueLoadStart;
|
var catalogueLoadStart;
|
||||||
var catalogueLoadErrors = false;
|
|
||||||
|
|
||||||
var activeSort = sortModulesRelevance;
|
var activeSort = sortModulesRelevance;
|
||||||
|
|
||||||
function refreshCatalogues (done) {
|
function refreshCatalogues (done) {
|
||||||
catalogueLoadStatus = [];
|
catalogueLoadStatus = [];
|
||||||
catalogueLoadErrors = false;
|
|
||||||
catalogueCount = catalogues.length;
|
catalogueCount = catalogues.length;
|
||||||
loadedList = []
|
loadedList = []
|
||||||
loadedIndex = {}
|
loadedIndex = {}
|
||||||
@ -401,10 +399,9 @@ RED.palette.editor = (function() {
|
|||||||
const url = catalogues[index];
|
const url = catalogues[index];
|
||||||
$.getJSON(url, {_: new Date().getTime()},function(v) {
|
$.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 })
|
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) {
|
}).fail(function(jqxhr, textStatus, error) {
|
||||||
console.warn("Error loading catalog",url,":",error);
|
console.warn("Error loading catalog",url,":",error);
|
||||||
handleCatalogResponse(jqxhr,url,index);
|
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
handled++;
|
handled++;
|
||||||
if (handled === catalogueCount) {
|
if (handled === catalogueCount) {
|
||||||
@ -419,10 +416,7 @@ RED.palette.editor = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCatalogResponse(err,catalog,index,v) {
|
function handleCatalogResponse(catalog,index,v) {
|
||||||
const url = catalog.url
|
|
||||||
catalogueLoadStatus.push(err);
|
|
||||||
if (!err) {
|
|
||||||
if (v.modules) {
|
if (v.modules) {
|
||||||
v.modules = v.modules.filter(function(m) {
|
v.modules = v.modules.filter(function(m) {
|
||||||
if (RED.utils.checkModuleAllowed(m.id,m.version,installAllowList,installDenyList)) {
|
if (RED.utils.checkModuleAllowed(m.id,m.version,installAllowList,installDenyList)) {
|
||||||
@ -448,19 +442,6 @@ RED.palette.editor = (function() {
|
|||||||
})
|
})
|
||||||
loadedList = loadedList.concat(v.modules);
|
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));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initInstallTab() {
|
function initInstallTab() {
|
||||||
@ -472,6 +453,7 @@ RED.palette.editor = (function() {
|
|||||||
|
|
||||||
$(".red-ui-palette-module-shade-status").text(RED._('palette.editor.loading'));
|
$(".red-ui-palette-module-shade-status").text(RED._('palette.editor.loading'));
|
||||||
$("#red-ui-palette-module-install-shade").show();
|
$("#red-ui-palette-module-install-shade").show();
|
||||||
|
catalogueLoadStart = Date.now()
|
||||||
refreshCatalogues(function () {
|
refreshCatalogues(function () {
|
||||||
refreshNodeModuleList();
|
refreshNodeModuleList();
|
||||||
updateCatalogFilter(loadedCatalogs)
|
updateCatalogFilter(loadedCatalogs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user