Only reload catalogue when requested

This commit is contained in:
Nick O'Leary 2016-08-13 00:33:41 +01:00
parent cdc7ab562a
commit b7dbfd5cfc
2 changed files with 24 additions and 16 deletions

View File

@ -340,22 +340,24 @@ RED.palette.editor = (function() {
} }
function initInstallTab() { function initInstallTab() {
loadedList = []; if (loadedList.length === 0) {
packageList.editableList('empty'); loadedList = [];
$(".palette-module-shade-status").html("Loading catalogues..."); packageList.editableList('empty');
var catalogues = RED.settings.theme('palette.catalogues')||['http://catalogue.nodered.org/catalogue.json']; $(".palette-module-shade-status").html("Loading catalogues...");
catalogueLoadStatus = []; var catalogues = RED.settings.theme('palette.catalogues')||['http://catalogue.nodered.org/catalogue.json'];
catalogueCount = catalogues.length; catalogueLoadStatus = [];
if (catalogues.length > 1) { catalogueCount = catalogues.length;
$(".palette-module-shade-status").html("Loading catalogues...<br>0/"+catalogues.length); if (catalogues.length > 1) {
$(".palette-module-shade-status").html("Loading catalogues...<br>0/"+catalogues.length);
}
$("#palette-module-install-shade").show();
catalogueLoadStart = Date.now();
catalogues.forEach(function(catalog,index) {
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
handleCatalogResponse(catalog,index,v);
})
});
} }
$("#palette-module-install-shade").show();
catalogueLoadStart = Date.now();
catalogues.forEach(function(catalog,index) {
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
handleCatalogResponse(catalog,index,v);
})
});
} }
function refreshFilteredItems() { function refreshFilteredItems() {
@ -571,6 +573,9 @@ RED.palette.editor = (function() {
searchInput.searchBox('count',filteredList.length+" / "+loadedList.length); searchInput.searchBox('count',filteredList.length+" / "+loadedList.length);
} else { } else {
searchInput.searchBox('count',loadedList.length); searchInput.searchBox('count',loadedList.length);
if (searchTerm.length === 0) {
packageList.editableList('empty');
}
} }
} }
}); });
@ -608,6 +613,7 @@ RED.palette.editor = (function() {
var refreshButton = $('<a href="#" class="sidebar-header-button"><i class="fa fa-refresh"></i></a>').appendTo(refreshSpan); var refreshButton = $('<a href="#" class="sidebar-header-button"><i class="fa fa-refresh"></i></a>').appendTo(refreshSpan);
refreshButton.click(function(e) { refreshButton.click(function(e) {
e.preventDefault(); e.preventDefault();
loadedList = [];
initInstallTab(); initInstallTab();
}) })

View File

@ -83,12 +83,14 @@
@include workspace-button; @include workspace-button;
color: $workspace-button-color-selected; color: $workspace-button-color-selected;
background:$workspace-button-background-active; background:$workspace-button-background-active;
transition: all 0.1s ease-in-out;
margin-bottom: 1px;
&.selected:not(.disabled) { &.selected:not(.disabled) {
color: $workspace-button-color; color: $workspace-button-color;
background: $workspace-button-background; background: $workspace-button-background;
border-bottom-width: 2px; border-bottom-width: 2px;
border-bottom-color: $form-input-border-selected-color; border-bottom-color: $form-input-border-selected-color;
margin-bottom: 0;
} }
} }