diff --git a/octoprint_simplyprint/__init__.py b/octoprint_simplyprint/__init__.py index 474668e..6cfbbbc 100644 --- a/octoprint_simplyprint/__init__.py +++ b/octoprint_simplyprint/__init__.py @@ -43,6 +43,7 @@ Events.CONNECTED, Events.DISCONNECTING, Events.DISCONNECTED, + Events.CLIENT_AUTHED, Events.STARTUP, Events.SHUTDOWN, diff --git a/octoprint_simplyprint/static/js/SimplyPrint.js b/octoprint_simplyprint/static/js/SimplyPrint.js index 511e529..cf3f639 100644 --- a/octoprint_simplyprint/static/js/SimplyPrint.js +++ b/octoprint_simplyprint/static/js/SimplyPrint.js @@ -66,6 +66,15 @@ $(function () { self.loading = ko.observable(true); + self.ws_connected_server = ko.observable(); + self.current_endpoint = ko.observable(); + self.SimplyPrintPanelURL = ko.pureComputed(function(){ + return (self.current_endpoint() === "test") ? "https://rewrite.simplyprint.io/panel" : "https://simplyprint.io/panel"; + }); + self.SimplyPrintEndpoint = ko.pureComputed(function(){ + return "SimplyPrint active on " + self.current_endpoint() + " endpoint."; + }); + self.onAfterBinding = function () { // Chose #wizard_plugin_corewizard_onlinecheck because it seemed likely it would be there for all first time if (!self.settingsViewModel.settings.plugins.SimplyPrint.is_set_up() && !$('#wizard_plugin_corewizard_onlinecheck').length) { @@ -78,14 +87,14 @@ $(function () { } self.loading(false); - } + }; self.onWizardFinish = function(){ // Show the welcome dialog if corewizard was open if (!self.settingsViewModel.settings.plugins.SimplyPrint.is_set_up() && $('#wizard_plugin_corewizard_onlinecheck').length) { $('#SimplyPrintWelcome').modal("show"); } - } + }; function SetupRecommended() { setTimeout(function () { @@ -112,7 +121,7 @@ $(function () { SetupRecommended(); } }); - } + }; $("body").on("click", "#navbar_systemmenu ul li:nth-child(4)", function () { if (!self.settingsViewModel.settings.plugins.SimplyPrint.is_set_up()) { @@ -240,10 +249,10 @@ $(function () { /*$("#wizard_dialog .button-finish[name='finish']").on("click", function () { $("#simplyprint_dialog").modal("show"); });*/ - } + }; self.pluginsLoadedCheck = function () { - let pluginSettings = self.settingsViewModel.settings.plugins.SimplyPrint + let pluginSettings = self.settingsViewModel.settings.plugins.SimplyPrint; if ($("#settings_plugin_pluginmanager_pluginlist tbody").html().length) { //Plugins have been loaded (being called from the API async, not loaded with the page) if (typeof pluginSettings.sp_installed_plugins === "undefined" || !Array.isArray(pluginSettings.sp_installed_plugins) || !pluginSettings.sp_installed_plugins.length) { @@ -271,14 +280,14 @@ $(function () { } else { setTimeout(self.pluginsLoadedCheck, 500); } - } + }; self.ManagedBySimplyPrintAlert = function (extra = "", onlyPartly = false) { return `