mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
aafcfef387
commit
1e37fed90b
@ -338,36 +338,45 @@ 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 (v.modules) {
|
if (!err) {
|
||||||
v.modules.forEach(function(m) {
|
if (v.modules) {
|
||||||
loadedIndex[m.id] = m;
|
v.modules.forEach(function(m) {
|
||||||
m.index = [m.id];
|
loadedIndex[m.id] = m;
|
||||||
if (m.keywords) {
|
m.index = [m.id];
|
||||||
m.index = m.index.concat(m.keywords);
|
if (m.keywords) {
|
||||||
}
|
m.index = m.index.concat(m.keywords);
|
||||||
if (m.updated_at) {
|
}
|
||||||
m.timestamp = new Date(m.updated_at).getTime();
|
if (m.updated_at) {
|
||||||
} else {
|
m.timestamp = new Date(m.updated_at).getTime();
|
||||||
m.timestamp = 0;
|
} else {
|
||||||
}
|
m.timestamp = 0;
|
||||||
m.index = m.index.join(",").toLowerCase();
|
}
|
||||||
})
|
m.index = m.index.join(",").toLowerCase();
|
||||||
loadedList = loadedList.concat(v.modules);
|
})
|
||||||
|
loadedList = loadedList.concat(v.modules);
|
||||||
|
}
|
||||||
|
searchInput.searchBox('count',loadedList.length);
|
||||||
|
} else {
|
||||||
|
catalogueLoadErrors = true;
|
||||||
}
|
}
|
||||||
searchInput.searchBox('count',loadedList.length);
|
|
||||||
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