Icon is now not visible when you are not logged in --> #5

This commit is contained in:
BrokenFire 2017-08-28 00:30:45 +02:00
parent a47f21e2f9
commit a2061658fd
3 changed files with 6 additions and 7 deletions

View File

@ -13,16 +13,11 @@ $(function() {
self.printerState = parameters[2]; self.printerState = parameters[2];
self.confirmation = undefined; self.confirmation = undefined;
self.onAfterBinding = function() { self.onAfterBinding = function() {
self.confirmation = $("#confirmation"); self.confirmation = $("#confirmation");
self.settings = self.allSettings.settings.plugins.simpleemergencystop; self.settings = self.allSettings.settings.plugins.simpleemergencystop;
}; };
self.click = function () { self.click = function () {
if(self.settings.confirmationDialog()) if(self.settings.confirmationDialog())
self.confirmation.modal("show"); self.confirmation.modal("show");
@ -30,6 +25,7 @@ $(function() {
self.sendCommand() self.sendCommand()
}; };
self.sendCommand = function () { self.sendCommand = function () {
$.ajax({ $.ajax({
url: API_BASEURL+"plugin/simpleemergencystop", url: API_BASEURL+"plugin/simpleemergencystop",
@ -47,6 +43,9 @@ $(function() {
}; };
self.visibleTest = function () {
return self.loginState.isUser() && self.printerState.isOperational()
};
} }

View File

@ -1,4 +1,4 @@
<a data-bind="click: click, visible: loginState.isUser && printerState.isOperational" href="#"> <a data-bind="click: click, visible: visibleTest()" href="#">
<i class="icon-warning-sign" style="color: red"></i> <i class="icon-warning-sign" style="color: red"></i>
</a> </a>

View File

@ -14,7 +14,7 @@ plugin_package = "octoprint_simpleemergencystop"
plugin_name = "OctoPrint-SimpleEmergencyStop" plugin_name = "OctoPrint-SimpleEmergencyStop"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.2.0" plugin_version = "0.2.1"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module # module