This commit is contained in:
parent
4c159fbabc
commit
5119ab736d
@ -2,9 +2,11 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
|
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/static/css/shutdownprinter.css" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/static/css/mystromswitch.css" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/static/js/shutdownprinter.js" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/templates/shutdownprinter_settings.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/templates/shutdownprinter_sidebar.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
@ -14,8 +14,6 @@ from octoprint.util import RepeatedTimer
|
|||||||
class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
||||||
octoprint.plugin.AssetPlugin,
|
octoprint.plugin.AssetPlugin,
|
||||||
octoprint.plugin.TemplatePlugin,
|
octoprint.plugin.TemplatePlugin,
|
||||||
octoprint.plugin.SimpleApiPlugin,
|
|
||||||
octoprint.plugin.EventHandlerPlugin,
|
|
||||||
octoprint.plugin.StartupPlugin):
|
octoprint.plugin.StartupPlugin):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -124,7 +122,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
self._shutdown_printer_enabled = self.lastCheckBoxValue
|
self._shutdown_printer_enabled = self.lastCheckBoxValue
|
||||||
|
|
||||||
def get_assets(self):
|
def get_assets(self):
|
||||||
return dict(js=["js/shutdownprinter.js"], css=["css/shutdownprinter.css"])
|
return dict(js=["js/mystromswitch.js"], css=["css/mystromswitch.css"])
|
||||||
|
|
||||||
def get_template_configs(self):
|
def get_template_configs(self):
|
||||||
return [dict(type="sidebar",
|
return [dict(type="sidebar",
|
||||||
@ -171,13 +169,13 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
eventManager().fire(Events.SETTINGS_UPDATED)
|
eventManager().fire(Events.SETTINGS_UPDATED)
|
||||||
if data["eventView"] == True:
|
if data["eventView"] == True:
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
self._plugin_manager.send_plugin_message(self._identifier,
|
||||||
dict(shutdownprinterEnabled=self._shutdown_printer_enabled,
|
dict(mystromswitchEnabled=self._shutdown_printer_enabled,
|
||||||
type="timeout", timeout_value=self._timeout_value))
|
type="timeout", timeout_value=self._timeout_value))
|
||||||
|
|
||||||
def on_event(self, event, payload):
|
def on_event(self, event, payload):
|
||||||
|
|
||||||
# if event == Events.CLIENT_OPENED:
|
# if event == Events.CLIENT_OPENED:
|
||||||
# self._plugin_manager.send_plugin_message(self._identifier, dict(shutdownprinterEnabled=self._shutdown_printer_enabled, type="timeout", timeout_value=self._timeout_value))
|
# self._plugin_manager.send_plugin_message(self._identifier, dict(mystromswitchEnabled=self._shutdown_printer_enabled, type="timeout", timeout_value=self._timeout_value))
|
||||||
# return
|
# return
|
||||||
|
|
||||||
if not self._shutdown_printer_enabled:
|
if not self._shutdown_printer_enabled:
|
||||||
@ -258,12 +256,12 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
|
|
||||||
self._timeout_value -= 1
|
self._timeout_value -= 1
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
self._plugin_manager.send_plugin_message(self._identifier,
|
||||||
dict(shutdownprinterEnabled=self._shutdown_printer_enabled,
|
dict(mystromswitchEnabled=self._shutdown_printer_enabled,
|
||||||
type="timeout", timeout_value=self._timeout_value))
|
type="timeout", timeout_value=self._timeout_value))
|
||||||
if self._printer.get_state_id() == "PRINTING" and self._printer.is_printing() == True:
|
if self._printer.get_state_id() == "PRINTING" and self._printer.is_printing() == True:
|
||||||
self._timeout_value = 0
|
self._timeout_value = 0
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
self._plugin_manager.send_plugin_message(self._identifier,
|
||||||
dict(shutdownprinterEnabled=self._shutdown_printer_enabled,
|
dict(mystromswitchEnabled=self._shutdown_printer_enabled,
|
||||||
type="timeout", timeout_value=self._timeout_value))
|
type="timeout", timeout_value=self._timeout_value))
|
||||||
self._abort_timer.cancel()
|
self._abort_timer.cancel()
|
||||||
self._abort_timer = None
|
self._abort_timer = None
|
||||||
@ -412,7 +410,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
|
|
||||||
def get_update_information(self):
|
def get_update_information(self):
|
||||||
return dict(
|
return dict(
|
||||||
shutdownprinter=dict(
|
mystromswitch=dict(
|
||||||
displayName="OctoPrint-MyStromSwitch",
|
displayName="OctoPrint-MyStromSwitch",
|
||||||
displayVersion=self._plugin_version,
|
displayVersion=self._plugin_version,
|
||||||
|
|
||||||
|
38
octoprint_mystromswitch/static/css/mystromswitch.css
Normal file
38
octoprint_mystromswitch/static/css/mystromswitch.css
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* #touch body #sidebar_plugin_mystromswitch_wrapper .accordion-heading { */
|
||||||
|
/* display: block !important; */
|
||||||
|
/* pointer-events: none; */
|
||||||
|
/* margin: 40px -30px 0; */
|
||||||
|
/* padding: .5rem 30px; */
|
||||||
|
/* background-color: #00B0FF; */
|
||||||
|
/* color: black; */
|
||||||
|
/* } */
|
||||||
|
/* #touch body #sidebar_plugin_mystromswitch_wrapper .accordion-heading>a, #touch body #sidebar_plugin_mystromswitch_wrapper .accordion-heading>a i { */
|
||||||
|
/* color: black; */
|
||||||
|
/* font-size: 1.4375rem; */
|
||||||
|
/* padding-right: 0; */
|
||||||
|
/* padding-left: 0; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* #touch body #sidebar_plugin_mystromswitch > label { */
|
||||||
|
/* display: block; */
|
||||||
|
/* background:#333; */
|
||||||
|
/* padding-left: 50px; */
|
||||||
|
/* padding-top: 15px; */
|
||||||
|
/* padding-bottom: 15px; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* #touch body #sidebar_plugin_mystromswitch { */
|
||||||
|
/* pointer-events: auto; */
|
||||||
|
/* margin: 0px -30px 0; */
|
||||||
|
/* padding-right: 15px; */
|
||||||
|
/* padding-left: 15px; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
.shutdownPrinterHideCancelBtnConfirm {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#touch body #tabs #sidebar_plugin_mystromswitch_wrapper_link a:before, #touch body #navbar #all_touchui_settings #sidebar_plugin_mystromswitch_wrapper_link a:before,#touch body #tabs #sidebar_plugin_mystromswitch_wrapper_link2 a:before, #touch body #navbar #all_touchui_settings #sidebar_plugin_mystromswitch_wrapper_link2 a:before {
|
||||||
|
content: "\f011";
|
||||||
|
}
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
/* #touch body #sidebar_plugin_shutdownprinter_wrapper .accordion-heading { */
|
|
||||||
/* display: block !important; */
|
|
||||||
/* pointer-events: none; */
|
|
||||||
/* margin: 40px -30px 0; */
|
|
||||||
/* padding: .5rem 30px; */
|
|
||||||
/* background-color: #00B0FF; */
|
|
||||||
/* color: black; */
|
|
||||||
/* } */
|
|
||||||
/* #touch body #sidebar_plugin_shutdownprinter_wrapper .accordion-heading>a, #touch body #sidebar_plugin_shutdownprinter_wrapper .accordion-heading>a i { */
|
|
||||||
/* color: black; */
|
|
||||||
/* font-size: 1.4375rem; */
|
|
||||||
/* padding-right: 0; */
|
|
||||||
/* padding-left: 0; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* #touch body #sidebar_plugin_shutdownprinter > label { */
|
|
||||||
/* display: block; */
|
|
||||||
/* background:#333; */
|
|
||||||
/* padding-left: 50px; */
|
|
||||||
/* padding-top: 15px; */
|
|
||||||
/* padding-bottom: 15px; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* #touch body #sidebar_plugin_shutdownprinter { */
|
|
||||||
/* pointer-events: auto; */
|
|
||||||
/* margin: 0px -30px 0; */
|
|
||||||
/* padding-right: 15px; */
|
|
||||||
/* padding-left: 15px; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
.shutdownPrinterHideCancelBtnConfirm {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#touch body #tabs #sidebar_plugin_shutdownprinter_wrapper_link a:before, #touch body #navbar #all_touchui_settings #sidebar_plugin_shutdownprinter_wrapper_link a:before,#touch body #tabs #sidebar_plugin_shutdownprinter_wrapper_link2 a:before, #touch body #navbar #all_touchui_settings #sidebar_plugin_shutdownprinter_wrapper_link2 a:before {
|
|
||||||
content: "\f011";
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
function ShutdownPrinterViewModel(parameters) {
|
function mystromswitchViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.loginState = parameters[0];
|
self.loginState = parameters[0];
|
||||||
@ -7,12 +7,12 @@ $(function() {
|
|||||||
self.printer = parameters[2];
|
self.printer = parameters[2];
|
||||||
|
|
||||||
|
|
||||||
self.shutdownprinterEnabled = ko.observable();
|
self.mystromswitchEnabled = ko.observable();
|
||||||
|
|
||||||
self.testButtonChangeStatus = function (stat) {
|
self.testButtonChangeStatus = function (stat) {
|
||||||
$("#tester_shutdownprinter_gcode").prop("disabled", stat);
|
$("#tester_mystromswitch_gcode").prop("disabled", stat);
|
||||||
$("#tester_shutdownprinter_api").prop("disabled", stat);
|
$("#tester_mystromswitch_api").prop("disabled", stat);
|
||||||
$("#tester_shutdownprinter_api_custom").prop("disabled", stat);
|
$("#tester_mystromswitch_api_custom").prop("disabled", stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.eventChangeCheckToRadio = function (id, listOff) {
|
self.eventChangeCheckToRadio = function (id, listOff) {
|
||||||
@ -34,12 +34,12 @@ $(function() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#tester_shutdownprinter_gcode").on("click", function () {
|
$("#tester_mystromswitch_gcode").on("click", function () {
|
||||||
self.settings.saveData();
|
self.settings.saveData();
|
||||||
$(this).children("i").show();
|
$(this).children("i").show();
|
||||||
setTimeout(function (current) {
|
setTimeout(function (current) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -55,12 +55,12 @@ $(function() {
|
|||||||
}, 1000, $(this));
|
}, 1000, $(this));
|
||||||
|
|
||||||
});
|
});
|
||||||
$("#tester_shutdownprinter_api").on("click", function () {
|
$("#tester_mystromswitch_api").on("click", function () {
|
||||||
self.settings.saveData();
|
self.settings.saveData();
|
||||||
$(this).children("i").show();
|
$(this).children("i").show();
|
||||||
setTimeout(function (current) {
|
setTimeout(function (current) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -76,12 +76,12 @@ $(function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#tester_shutdownprinter_api_custom").on("click", function () {
|
$("#tester_mystromswitch_api_custom").on("click", function () {
|
||||||
self.settings.saveData();
|
self.settings.saveData();
|
||||||
$(this).children("i").show();
|
$(this).children("i").show();
|
||||||
setTimeout(function (current) {
|
setTimeout(function (current) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -97,22 +97,22 @@ $(function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
self.listOffMode = [
|
self.listOffMode = [
|
||||||
{"id" : "#shutdownprinter_mode_shutdown_gcode"},
|
{"id" : "#mystromswitch_mode_shutdown_gcode"},
|
||||||
{"id" : "#shutdownprinter_mode_shutdown_api"},
|
{"id" : "#mystromswitch_mode_shutdown_api"},
|
||||||
{"id" : "#shutdownprinter_mode_shutdown_api_custom"},
|
{"id" : "#mystromswitch_mode_shutdown_api_custom"},
|
||||||
]
|
]
|
||||||
self.listOffHTTPMethode = [
|
self.listOffHTTPMethode = [
|
||||||
{"id" : "#shutdownprinter_api_custom_GET"},
|
{"id" : "#mystromswitch_api_custom_GET"},
|
||||||
{"id" : "#shutdownprinter_api_custom_POST"},
|
{"id" : "#mystromswitch_api_custom_POST"},
|
||||||
{"id" : "#shutdownprinter_api_custom_PUT"}
|
{"id" : "#mystromswitch_api_custom_PUT"}
|
||||||
]
|
]
|
||||||
self.eventChangeCheckToRadio("#shutdownprinter_mode_shutdown_gcode", self.listOffMode);
|
self.eventChangeCheckToRadio("#mystromswitch_mode_shutdown_gcode", self.listOffMode);
|
||||||
self.eventChangeCheckToRadio("#shutdownprinter_mode_shutdown_api", self.listOffMode);
|
self.eventChangeCheckToRadio("#mystromswitch_mode_shutdown_api", self.listOffMode);
|
||||||
self.eventChangeCheckToRadio("#shutdownprinter_mode_shutdown_api_custom", self.listOffMode);
|
self.eventChangeCheckToRadio("#mystromswitch_mode_shutdown_api_custom", self.listOffMode);
|
||||||
|
|
||||||
self.eventChangeCheckToRadio("#shutdownprinter_api_custom_GET", self.listOffHTTPMethode);
|
self.eventChangeCheckToRadio("#mystromswitch_api_custom_GET", self.listOffHTTPMethode);
|
||||||
self.eventChangeCheckToRadio("#shutdownprinter_api_custom_POST", self.listOffHTTPMethode);
|
self.eventChangeCheckToRadio("#mystromswitch_api_custom_POST", self.listOffHTTPMethode);
|
||||||
self.eventChangeCheckToRadio("#shutdownprinter_api_custom_PUT", self.listOffHTTPMethode);
|
self.eventChangeCheckToRadio("#mystromswitch_api_custom_PUT", self.listOffHTTPMethode);
|
||||||
|
|
||||||
// Hack to remove automatically added Cancel button
|
// Hack to remove automatically added Cancel button
|
||||||
// See https://github.com/sciactive/pnotify/issues/141
|
// See https://github.com/sciactive/pnotify/issues/141
|
||||||
@ -135,7 +135,7 @@ $(function() {
|
|||||||
notice.get().trigger("pnotify.cancel", [notice, value]);
|
notice.get().trigger("pnotify.cancel", [notice, value]);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
addClass: 'shutdownPrinterHideCancelBtnConfirm',
|
addClass: 'mystromswitchHideCancelBtnConfirm',
|
||||||
promptTrigger: true,
|
promptTrigger: true,
|
||||||
click: function(notice, value){
|
click: function(notice, value){
|
||||||
notice.remove();
|
notice.remove();
|
||||||
@ -162,7 +162,7 @@ $(function() {
|
|||||||
if (counter < 10) {
|
if (counter < 10) {
|
||||||
if (document.getElementById("touch") != null && document.getElementById("printer") != null && document.getElementById("printer") != null && document.getElementById("touch").querySelector("#printer").querySelector("#files_wrapper")) {
|
if (document.getElementById("touch") != null && document.getElementById("printer") != null && document.getElementById("printer") != null && document.getElementById("touch").querySelector("#printer").querySelector("#files_wrapper")) {
|
||||||
var newParent = document.getElementById("files_wrapper").parentNode;
|
var newParent = document.getElementById("files_wrapper").parentNode;
|
||||||
newParent.insertBefore(document.getElementById('sidebar_plugin_shutdownprinter_wrapper'), document.getElementById("files_wrapper"));
|
newParent.insertBefore(document.getElementById('sidebar_plugin_mystromswitch_wrapper'), document.getElementById("files_wrapper"));
|
||||||
} else {
|
} else {
|
||||||
setTimeout(self.touchUIMoveElement, 1000, self, ++counter);
|
setTimeout(self.touchUIMoveElement, 1000, self, ++counter);
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ $(function() {
|
|||||||
|
|
||||||
self.onUserLoggedIn = function() {
|
self.onUserLoggedIn = function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -193,7 +193,7 @@ $(function() {
|
|||||||
contentType: "application/json; charset=UTF-8"
|
contentType: "application/json; charset=UTF-8"
|
||||||
})
|
})
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
command: "status"
|
command: "status"
|
||||||
@ -201,7 +201,7 @@ $(function() {
|
|||||||
context:self,
|
context:self,
|
||||||
contentType: "application/json; charset=UTF-8"
|
contentType: "application/json; charset=UTF-8"
|
||||||
}).done(function(data, textStatus, jqXHR ){
|
}).done(function(data, textStatus, jqXHR ){
|
||||||
this.shutdownprinterEnabled(data == "True" ? true : false);
|
this.mystromswitchEnabled(data == "True" ? true : false);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,10 +216,10 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.onShutdownPrinterEvent = function() {
|
self.onmystromswitchEvent = function() {
|
||||||
if (self.shutdownprinterEnabled()) {
|
if (self.mystromswitchEnabled()) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -230,7 +230,7 @@ $(function() {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -242,14 +242,14 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.shutdownprinterEnabled.subscribe(self.onShutdownPrinterEvent, self);
|
self.mystromswitchEnabled.subscribe(self.onmystromswitchEvent, self);
|
||||||
|
|
||||||
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||||
if (plugin != "shutdownprinter" && plugin != "octoprint_shutdownprinter") {
|
if (plugin != "mystromswitch" && plugin != "octoprint_mystromswitch") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.shutdownprinterEnabled(data.shutdownprinterEnabled);
|
self.mystromswitchEnabled(data.mystromswitchEnabled);
|
||||||
if (data.type == "timeout") {
|
if (data.type == "timeout") {
|
||||||
if ((data.timeout_value != null) && (data.timeout_value > 0)) {
|
if ((data.timeout_value != null) && (data.timeout_value > 0)) {
|
||||||
self.timeoutPopupOptions.text = self.timeoutPopupText + data.timeout_value;
|
self.timeoutPopupOptions.text = self.timeoutPopupText + data.timeout_value;
|
||||||
@ -272,7 +272,7 @@ $(function() {
|
|||||||
self.timeoutPopup.remove();
|
self.timeoutPopup.remove();
|
||||||
self.timeoutPopup = undefined;
|
self.timeoutPopup = undefined;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "plugin/shutdownprinter",
|
url: API_BASEURL + "plugin/mystromswitch",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -285,8 +285,8 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push([
|
OCTOPRINT_VIEWMODELS.push([
|
||||||
ShutdownPrinterViewModel,
|
mystromswitchViewModel,
|
||||||
["loginStateViewModel", "settingsViewModel", "printerStateViewModel"],
|
["loginStateViewModel", "settingsViewModel", "printerStateViewModel"],
|
||||||
$(".sidebar_plugin_shutdownprinter").get(0)
|
$(".sidebar_plugin_mystromswitch").get(0)
|
||||||
]);
|
]);
|
||||||
});
|
});
|
@ -5,25 +5,25 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" id="shutdownprinter_mode_shutdown_gcode" data-bind="checked: settings.plugins.shutdownprinter._mode_shutdown_gcode">activate this mode
|
<input type="checkbox" id="mystromswitch_mode_shutdown_gcode" data-bind="checked: settings.plugins.mystromswitch._mode_shutdown_gcode">activate this mode
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{ _('GCODE') }}</label>
|
<label class="control-label">{{ _('GCODE') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.shutdownprinter.gcode">
|
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mystromswitch.gcode">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{ _('Parameter (IP or other)') }}</label>
|
<label class="control-label">{{ _('Parameter (IP or other)') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.shutdownprinter.url">
|
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mystromswitch.url">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button id="tester_shutdownprinter_gcode" type="button" class="btn btn-primary pull-right"><i class="fa fa-spinner fa-spin" data-bind="visible: sending" style="display: none;"></i>Test</button>
|
<button id="tester_mystromswitch_gcode" type="button" class="btn btn-primary pull-right"><i class="fa fa-spinner fa-spin" data-bind="visible: sending" style="display: none;"></i>Test</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" id="shutdownprinter_mode_shutdown_api" data-bind="checked: settings.plugins.shutdownprinter._mode_shutdown_api">activate this mode
|
<input type="checkbox" id="mystromswitch_mode_shutdown_api" data-bind="checked: settings.plugins.mystromswitch._mode_shutdown_api">activate this mode
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
<label class="control-label">{{ _('api key (key octoprint)') }}</label>
|
<label class="control-label">{{ _('api key (key octoprint)') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="text" class="input" data-bind="value: settings.plugins.shutdownprinter.api_key_plugin">
|
<input type="text" class="input" data-bind="value: settings.plugins.mystromswitch.api_key_plugin">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<label class="control-label">{{ _('Plugin ID') }}</label>
|
<label class="control-label">{{ _('Plugin ID') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="text" class="input" data-bind="value: settings.plugins.shutdownprinter.api_plugin_name">
|
<input type="text" class="input" data-bind="value: settings.plugins.mystromswitch.api_plugin_name">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -58,19 +58,19 @@
|
|||||||
<label class="control-label">{{ _('Port') }}</label>
|
<label class="control-label">{{ _('Port') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="number" min='0' class="input-mini text-right" data-bind="value: settings.plugins.shutdownprinter.api_plugin_port">
|
<input type="number" min='0' class="input-mini text-right" data-bind="value: settings.plugins.mystromswitch.api_plugin_port">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">JSON</label>
|
<label class="control-label">JSON</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<textarea rows="4" class="block" data-bind="value: settings.plugins.shutdownprinter.api_json_command"></textarea>
|
<textarea rows="4" class="block" data-bind="value: settings.plugins.mystromswitch.api_json_command"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button id="tester_shutdownprinter_api" type="button" class="btn btn-primary pull-right"><i class="fa fa-spinner fa-spin" data-bind="visible: sending" style="display: none;"></i>Test</button>
|
<button id="tester_mystromswitch_api" type="button" class="btn btn-primary pull-right"><i class="fa fa-spinner fa-spin" data-bind="visible: sending" style="display: none;"></i>Test</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@ -78,44 +78,44 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" id="shutdownprinter_mode_shutdown_api_custom" data-bind="checked: settings.plugins.shutdownprinter._mode_shutdown_api_custom">activate this mode
|
<input type="checkbox" id="mystromswitch_mode_shutdown_api_custom" data-bind="checked: settings.plugins.mystromswitch._mode_shutdown_api_custom">activate this mode
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" id="shutdownprinter_api_custom_GET" data-bind="checked: settings.plugins.shutdownprinter.api_custom_GET">GET
|
<input type="checkbox" id="mystromswitch_api_custom_GET" data-bind="checked: settings.plugins.mystromswitch.api_custom_GET">GET
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" id="shutdownprinter_api_custom_POST" data-bind="checked: settings.plugins.shutdownprinter.api_custom_POST">POST
|
<input type="checkbox" id="mystromswitch_api_custom_POST" data-bind="checked: settings.plugins.mystromswitch.api_custom_POST">POST
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" id="shutdownprinter_api_custom_PUT" data-bind="checked: settings.plugins.shutdownprinter.api_custom_PUT">PUT
|
<input type="checkbox" id="mystromswitch_api_custom_PUT" data-bind="checked: settings.plugins.mystromswitch.api_custom_PUT">PUT
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{ _('URL') }}</label>
|
<label class="control-label">{{ _('URL') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.shutdownprinter.api_custom_url">
|
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mystromswitch.api_custom_url">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">header (json format)</label>
|
<label class="control-label">header (json format)</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<textarea rows="4" class="block" data-bind="value: settings.plugins.shutdownprinter.api_custom_json_header"></textarea>
|
<textarea rows="4" class="block" data-bind="value: settings.plugins.mystromswitch.api_custom_json_header"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">body</label>
|
<label class="control-label">body</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<textarea rows="4" class="block" data-bind="value: settings.plugins.shutdownprinter.api_custom_body"></textarea>
|
<textarea rows="4" class="block" data-bind="value: settings.plugins.mystromswitch.api_custom_body"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button id="tester_shutdownprinter_api_custom" type="button" class="btn btn-primary pull-right"><i class="fa fa-spinner fa-spin" data-bind="visible: sending" style="display: none;"></i>Test</button>
|
<button id="tester_mystromswitch_api_custom" type="button" class="btn btn-primary pull-right"><i class="fa fa-spinner fa-spin" data-bind="visible: sending" style="display: none;"></i>Test</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@ -124,7 +124,7 @@
|
|||||||
<label class="control-label">Abort Timeout</label>
|
<label class="control-label">Abort Timeout</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="number" class="input-mini text-right" data-bind="value: settings.plugins.shutdownprinter.abortTimeout">
|
<input type="number" class="input-mini text-right" data-bind="value: settings.plugins.mystromswitch.abortTimeout">
|
||||||
<span class="add-on">sec</span>
|
<span class="add-on">sec</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -132,7 +132,7 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="checked: settings.plugins.shutdownprinter.rememberCheckBox"> Remember the value of "Shutdown Printer after print finishes"
|
<input type="checkbox" data-bind="checked: settings.plugins.mystromswitch.rememberCheckBox"> Remember the value of "Shutdown Printer after print finishes"
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -141,14 +141,14 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="checked: settings.plugins.shutdownprinter.printFailed"> Event print failed
|
<input type="checkbox" data-bind="checked: settings.plugins.mystromswitch.printFailed"> Event print failed
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="checked: settings.plugins.shutdownprinter.printCancelled"> Event print cancelled
|
<input type="checkbox" data-bind="checked: settings.plugins.mystromswitch.printCancelled"> Event print cancelled
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -157,7 +157,7 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" shutdownPrinterTemperatureTarget="true" data-bind="checked: settings.plugins.shutdownprinter.temperatureTarget"> Enable temperature target
|
<input type="checkbox" mystromswitchTemperatureTarget="true" data-bind="checked: settings.plugins.mystromswitch.temperatureTarget"> Enable temperature target
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -165,7 +165,7 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="text" class="input" data-bind="value: settings.plugins.shutdownprinter.extraCommand">
|
<input type="text" class="input" data-bind="value: settings.plugins.mystromswitch.extraCommand">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -173,7 +173,7 @@
|
|||||||
<label class="control-label">{{ _('Temperature') }}</label>
|
<label class="control-label">{{ _('Temperature') }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="number" min='0' class="input-mini text-right" data-bind="value: settings.plugins.shutdownprinter.temperatureValue">
|
<input type="number" min='0' class="input-mini text-right" data-bind="value: settings.plugins.mystromswitch.temperatureValue">
|
||||||
<span class="add-on">°C</span>
|
<span class="add-on">°C</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,6 +1,6 @@
|
|||||||
<div class="sidebar_plugin_shutdownprinter">
|
<div class="sidebar_plugin_mystromswitch">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="enable: loginState.isUser(), checked: shutdownprinterEnabled">
|
<input type="checkbox" data-bind="enable: loginState.isUser(), checked: mystromswitchEnabled">
|
||||||
{{ _('Shutdown Printer after print finishes') }}
|
{{ _('Shutdown Printer after print finishes') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user