mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
aafcfef387
commit
1e37fed90b
@ -338,11 +338,13 @@ RED.palette.editor = (function() {
|
|||||||
var catalogueCount;
|
var catalogueCount;
|
||||||
var catalogueLoadStatus = [];
|
var catalogueLoadStatus = [];
|
||||||
var catalogueLoadStart;
|
var catalogueLoadStart;
|
||||||
|
var catalogueLoadErrors = false;
|
||||||
|
|
||||||
var activeSort = sortModulesAZ;
|
var activeSort = sortModulesAZ;
|
||||||
|
|
||||||
function handleCatalogResponse(catalog,index,v) {
|
function handleCatalogResponse(err,catalog,index,v) {
|
||||||
catalogueLoadStatus.push(v);
|
catalogueLoadStatus.push(err||v);
|
||||||
|
if (!err) {
|
||||||
if (v.modules) {
|
if (v.modules) {
|
||||||
v.modules.forEach(function(m) {
|
v.modules.forEach(function(m) {
|
||||||
loadedIndex[m.id] = m;
|
loadedIndex[m.id] = m;
|
||||||
@ -360,14 +362,21 @@ RED.palette.editor = (function() {
|
|||||||
loadedList = loadedList.concat(v.modules);
|
loadedList = loadedList.concat(v.modules);
|
||||||
}
|
}
|
||||||
searchInput.searchBox('count',loadedList.length);
|
searchInput.searchBox('count',loadedList.length);
|
||||||
|
} else {
|
||||||
|
catalogueLoadErrors = true;
|
||||||
|
}
|
||||||
if (catalogueCount > 1) {
|
if (catalogueCount > 1) {
|
||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>"+catalogueLoadStatus.length+"/"+catalogueCount);
|
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>"+catalogueLoadStatus.length+"/"+catalogueCount);
|
||||||
}
|
}
|
||||||
if (catalogueLoadStatus.length === catalogueCount) {
|
if (catalogueLoadStatus.length === catalogueCount) {
|
||||||
|
if (catalogueLoadErrors) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.catalogLoadFailed',{url: catalog}),"error",false,8000);
|
||||||
|
}
|
||||||
var delta = 250-(Date.now() - catalogueLoadStart);
|
var delta = 250-(Date.now() - catalogueLoadStart);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$("#palette-module-install-shade").hide();
|
$("#palette-module-install-shade").hide();
|
||||||
},Math.max(delta,0));
|
},Math.max(delta,0));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,6 +388,7 @@ RED.palette.editor = (function() {
|
|||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading'));
|
$(".palette-module-shade-status").html(RED._('palette.editor.loading'));
|
||||||
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
||||||
catalogueLoadStatus = [];
|
catalogueLoadStatus = [];
|
||||||
|
catalogueLoadErrors = false;
|
||||||
catalogueCount = catalogues.length;
|
catalogueCount = catalogues.length;
|
||||||
if (catalogues.length > 1) {
|
if (catalogues.length > 1) {
|
||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>0/"+catalogues.length);
|
$(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>0/"+catalogues.length);
|
||||||
@ -387,8 +397,10 @@ RED.palette.editor = (function() {
|
|||||||
catalogueLoadStart = Date.now();
|
catalogueLoadStart = Date.now();
|
||||||
catalogues.forEach(function(catalog,index) {
|
catalogues.forEach(function(catalog,index) {
|
||||||
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
||||||
handleCatalogResponse(catalog,index,v);
|
handleCatalogResponse(null,catalog,index,v);
|
||||||
refreshNodeModuleList();
|
refreshNodeModuleList();
|
||||||
|
}).fail(function(jqxhr, textStatus, error) {
|
||||||
|
handleCatalogResponse(jqxhr,catalog,index);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -292,6 +292,7 @@
|
|||||||
"sortRecent": "recent",
|
"sortRecent": "recent",
|
||||||
"more": "+ __count__ more",
|
"more": "+ __count__ more",
|
||||||
"errors": {
|
"errors": {
|
||||||
|
"catalogLoadFailed": "Failed to load node catalogue.<br>Check the browser console for more information",
|
||||||
"installFailed": "Failed to install: __module__<br>__message__<br>Check the log for more information",
|
"installFailed": "Failed to install: __module__<br>__message__<br>Check the log for more information",
|
||||||
"removeFailed": "Failed to remove: __module__<br>__message__<br>Check the log for more information"
|
"removeFailed": "Failed to remove: __module__<br>__message__<br>Check the log for more information"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user