Fix issue #7 (#10)

* Fix save 0 steps/mm- now it shows an error if steps<-0
This commit is contained in:
Sergiu Toporjinschi
2022-02-14 22:57:26 +02:00
committed by GitHub
parent 6a02270135
commit 29ff606e33
16 changed files with 75 additions and 216 deletions
@@ -1,7 +1,8 @@
$(function () {
function CalibrationToolsGeneralViewModel(parameters) {
this.loginState = parameters[0];
this.decimal3 = function (defaultVal) {
var self = this;
self.decimal3 = function (defaultVal) {
return {
numeric: {
decimals: 3,
@@ -9,7 +10,7 @@ $(function () {
}
}
}
this.isSmall = ko.observable($("#tab_plugin_CalibrationTools").width() < 800);
self.isSmall = ko.observable($("#tab_plugin_CalibrationTools").width() < 800);
ko.extenders.numeric = function (target, options) {
var returnObs = ko.pureComputed({
read: target,
@@ -24,9 +25,33 @@ $(function () {
return returnObs;
};
this.onStartupComplete = function () {
self.onStartupComplete = function () {
this.isSmall($("#tabs_content").width() < 800);
}
self.notify = function (title, message, type, hide) {
new PNotify({
title: title,
text: message,
type: type,
hide: hide
});
}
self.notifyError = function (title, message) {
self.notify(title, message, 'error', false);
}
self.notifyInfo = function (title, message) {
self.notify(title, message, 'info', true);
}
self.notifyWarning = function (title, message) {
self.notify(title, message, 'warning', false);
}
self.failedFunction = function (response) {
self.notifyError("Error", response.responseJSON.error);
}
self.round = function (number, decimals) {
decimals = decimals ? decimals : 3;
return +(Math.round(number + ("e+" + decimals)) + ("e-" + decimals));
}
}
OCTOPRINT_VIEWMODELS.push({
// This is the constructor to call for instantiating the plugin