From b7dbfd5cfcef47d7acc4b329c199061f1f530c32 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 13 Aug 2016 00:33:41 +0100 Subject: [PATCH] Only reload catalogue when requested --- editor/js/ui/palette-editor.js | 36 ++++++++++++++++++++-------------- editor/sass/mixins.scss | 4 +++- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/editor/js/ui/palette-editor.js b/editor/js/ui/palette-editor.js index d44564a06..b4e3c5afd 100644 --- a/editor/js/ui/palette-editor.js +++ b/editor/js/ui/palette-editor.js @@ -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...
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...
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() { @@ -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'); + } } } }); @@ -608,6 +613,7 @@ RED.palette.editor = (function() { var refreshButton = $('').appendTo(refreshSpan); refreshButton.click(function(e) { e.preventDefault(); + loadedList = []; initInstallTab(); }) diff --git a/editor/sass/mixins.scss b/editor/sass/mixins.scss index b83605962..58bd7de1e 100644 --- a/editor/sass/mixins.scss +++ b/editor/sass/mixins.scss @@ -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; } }