🐛 Disable Set button when no rate is entered

This commit is contained in:
Gina Häußge committed 2020-08-11 11:58:52 +02:00
1 parent 4d82f2a4c6
commit 5ca20f741a
2 files changed
+12 -6

No files matched your search

@@ -285,7 +285,10 @@ $(function() {
self.feedRateBusy = ko.observable(false);
self.feedRateResetter = ko.observable();
self.sendFeedRateCommand = function () {
var rate = _.parseInt(self.feedRate());
var rate = self.feedRate();
if (!rate) return;
rate = _.parseInt(self.feedRate());
self.feedRateBusy(true);
OctoPrint.printer.setFeedrate(rate)
.done(function() {
@@ -321,7 +324,10 @@ $(function() {
self.flowRateBusy = ko.observable(false);
self.flowRateResetter = ko.observable();
self.sendFlowRateCommand = function () {
var rate = _.parseInt(self.flowRate());
var rate = self.flowRate();
if (!rate) return;
rate = _.parseInt(self.flowRate());
self.flowRateBusy(true);
OctoPrint.printer.setFlowrate(rate)
.done(function() {
+4 -4
View File
@@ -82,9 +82,9 @@
<div id="control-jog-feedrate" class="jog-panel">
<label>{{ _('Feed rate modifier:') }} <a class="text-info" href="javascript:void(0)" data-bind="popover: {placement: 'top', trigger: 'hover', title: '{{ _('Please note!') }}', content: '{{ _('The feed rate can only be set, it cannot be read back from the firmware due to a limitation of the communication protocol. There is no way to show the current setting.') }}'}"><i class="fa fa-info-circle"></i></a></label>
<div class="input-append control-box">
<input type="number" class="input-mini" min="1" step="1" data-bind="value: feedRate, event: { blur: resetFeedRateDisplay, focus: cancelFeedRateDisplayReset }, css: { pulsate_text_opacity: feedRateResetter() !== undefined }">
<input type="number" class="input-mini" min="1" step="1" data-bind="textInput: feedRate, event: { blur: resetFeedRateDisplay, focus: cancelFeedRateDisplayReset }, css: { pulsate_text_opacity: feedRateResetter() !== undefined }">
<span class="add-on">%</span>
<button class="btn" data-bind="enable: isOperational(), click: function() { $root.sendFeedRateCommand() }">Set</button>
<button class="btn" data-bind="enable: isOperational() && feedRate(), click: function() { $root.sendFeedRateCommand() }">Set</button>
</div>
</div>
</div>
@@ -112,9 +112,9 @@
<div id="control-jog-flowrate" class="jog-panel">
<label>{{ _('Flow rate modifier:') }} <a class="text-info" href="javascript:void(0)" data-bind="popover: {placement: 'top', trigger: 'hover', title: '{{ _('Please note!') }}', content: '{{ _('The flow rate can only be set, it cannot be read back from the firmware due to a limitation of the communication protocol. There is no way to show the current setting.') }}'}"><i class="fa fa-info-circle"></i></a></label>
<div class="input-append control-box">
<input type="number" class="input-mini" min="1" step="1" data-bind="value: flowRate, event: { blur: resetFlowRateDisplay, focus: cancelFlowRateDisplayReset }, css: { pulsate_text_opacity: flowRateResetter() !== undefined }">
<input type="number" class="input-mini" min="1" step="1" data-bind="textInput: flowRate, event: { blur: resetFlowRateDisplay, focus: cancelFlowRateDisplayReset }, css: { pulsate_text_opacity: flowRateResetter() !== undefined }">
<span class="add-on">%</span>
<button class="btn" data-bind="enable: isOperational(), click: function() { $root.sendFlowRateCommand() }">Set</button>
<button class="btn" data-bind="enable: isOperational() && flowRate(), click: function() { $root.sendFlowRateCommand() }">Set</button>
</div>
</div>
</div>