function to check if user and printer is operational
clean up the jinja a bit too
This commit is contained in:
		| @@ -7,10 +7,16 @@ $(function() { | ||||
|         var self = this; | ||||
| 		//see if we're logged in and the printer is operational (for en/disable of button) | ||||
|         self.loginState = parameters[0]; | ||||
|         self.terminal = parameters[1]; | ||||
|          | ||||
|         self.printerState = parameters[1]; | ||||
|  		 | ||||
| 		self.enableEstop = ko.pureComputed(function() { | ||||
|             return self.printerState.isOperational() && self.loginState.isUser(); | ||||
|         }); | ||||
| 		 | ||||
| 		self.sendEstopCommand = function () { | ||||
|             OctoPrint.control.sendGcode("M112"); //should this ever be a variable? M112 universal? | ||||
| 			if (self.enableEstop()) { | ||||
| 				OctoPrint.control.sendGcode("M112");  | ||||
| 			}; | ||||
|         }; | ||||
|     } | ||||
|  | ||||
| @@ -18,7 +24,7 @@ $(function() { | ||||
|         construct: EstopViewModel, | ||||
|         dependencies: [ | ||||
| 			"loginStateViewModel",  | ||||
| 			"terminalViewModel", | ||||
| 			"printerStateViewModel", | ||||
| 			], | ||||
|         elements: ["#sidebar_plugin_estop"] | ||||
|     }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user