diff --git a/octoprint_SpoolManager/static/js/SpoolManager-SpoolSelectionTableComp.js b/octoprint_SpoolManager/static/js/SpoolManager-SpoolSelectionTableComp.js index 6a565e57..1a055b33 100644 --- a/octoprint_SpoolManager/static/js/SpoolManager-SpoolSelectionTableComp.js +++ b/octoprint_SpoolManager/static/js/SpoolManager-SpoolSelectionTableComp.js @@ -62,6 +62,7 @@ function SpoolSelectionTableComp() { self.allColors = params.allColorsKOArray; self.selectSpoolFunction = params.selectSpoolFunction; + self.isLoadingSpoolsSelectorData = params.isLoadingSpoolsSelectorData; ////////////////////////////////////////////////////////////////////// internal field variables diff --git a/octoprint_SpoolManager/static/js/SpoolManager.js b/octoprint_SpoolManager/static/js/SpoolManager.js index 1ba9bf3e..b61f558f 100644 --- a/octoprint_SpoolManager/static/js/SpoolManager.js +++ b/octoprint_SpoolManager/static/js/SpoolManager.js @@ -107,6 +107,8 @@ $(function() { let hasInitializedSpoolsSelector = false; + self.isLoadingSpoolsSelectorData = ko.observable(false); + //////////////////////////////////////////////////////////////////////////////////////////////// HELPER FUNCTION const handleSpoolDialogClose = (params) => { const { @@ -539,7 +541,7 @@ $(function() { self.selectSpoolForSidebar(toolIndex, null); } - const loadSpoolSelectorData = async function () { + const _loadSpoolSelectorDataCore = async function () { const fetchSpoolsQueryParams = { filterName: "all", from: 0, @@ -574,6 +576,15 @@ $(function() { }); self.allSpoolsForSidebar(allSpoolItems); }; + const loadSpoolSelectorData = async function () { + self.isLoadingSpoolsSelectorData(true); + + const result = await _loadSpoolSelectorDataCore(); + + self.isLoadingSpoolsSelectorData(false); + + return result; + }; const updateAvailableSpoolSlots = () => { const currentProfileData = self.settingsViewModel.printerProfiles.currentProfileData(); diff --git a/octoprint_SpoolManager/templates/SpoolManager_dialog_editSpool.jinja2 b/octoprint_SpoolManager/templates/SpoolManager_dialog_editSpool.jinja2 index 512418da..8029448c 100644 --- a/octoprint_SpoolManager/templates/SpoolManager_dialog_editSpool.jinja2 +++ b/octoprint_SpoolManager/templates/SpoolManager_dialog_editSpool.jinja2 @@ -601,7 +601,8 @@ allMaterialsKOArray: spoolDialog.allMaterials, allVendorsKOArray: spoolDialog.allVendors, allColorsKOArray: spoolDialog.allColors, - selectSpoolFunction: spoolDialog.copySpoolItemFromTemplate + selectSpoolFunction: spoolDialog.copySpoolItemFromTemplate, + isLoadingSpoolsSelectorData: ko.observable(false) "> -
+
diff --git a/octoprint_SpoolManager/templates/SpoolManager_tab_spoolSelection_comp.jinja2 b/octoprint_SpoolManager/templates/SpoolManager_tab_spoolSelection_comp.jinja2 index 0f6bb3e6..2b8db421 100644 --- a/octoprint_SpoolManager/templates/SpoolManager_tab_spoolSelection_comp.jinja2 +++ b/octoprint_SpoolManager/templates/SpoolManager_tab_spoolSelection_comp.jinja2 @@ -1,30 +1,36 @@