Skip to content

Commit

Permalink
Only reload catalogue when requested
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Aug 12, 2016
1 parent cdc7ab5 commit b7dbfd5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
36 changes: 21 additions & 15 deletions editor/js/ui/palette-editor.js
Expand Up @@ -340,22 +340,24 @@ RED.palette.editor = (function() {
}

function initInstallTab() {
loadedList = [];
packageList.editableList('empty');
$(".palette-module-shade-status").html("Loading catalogues...");
var catalogues = RED.settings.theme('palette.catalogues')||['http://catalogue.nodered.org/catalogue.json'];
catalogueLoadStatus = [];
catalogueCount = catalogues.length;
if (catalogues.length > 1) {
$(".palette-module-shade-status").html("Loading catalogues...<br>0/"+catalogues.length);
if (loadedList.length === 0) {
loadedList = [];
packageList.editableList('empty');
$(".palette-module-shade-status").html("Loading catalogues...");
var catalogues = RED.settings.theme('palette.catalogues')||['http://catalogue.nodered.org/catalogue.json'];
catalogueLoadStatus = [];
catalogueCount = 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() {
Expand Down Expand Up @@ -571,6 +573,9 @@ RED.palette.editor = (function() {
searchInput.searchBox('count',filteredList.length+" / "+loadedList.length);
} else {
searchInput.searchBox('count',loadedList.length);
if (searchTerm.length === 0) {
packageList.editableList('empty');
}
}
}
});
Expand Down Expand Up @@ -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);
refreshButton.click(function(e) {
e.preventDefault();
loadedList = [];
initInstallTab();
})

Expand Down
4 changes: 3 additions & 1 deletion editor/sass/mixins.scss
Expand Up @@ -83,12 +83,14 @@
@include workspace-button;
color: $workspace-button-color-selected;
background:$workspace-button-background-active;

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

Expand Down

0 comments on commit b7dbfd5

Please sign in to comment.