Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Disable button for resetting fan if it is in a rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Nama committed Jul 31, 2021
1 parent 902521f commit 98ac311
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion suckcontrol/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,19 @@ <h4 class="mdl-dialog__title">Rename Sensor</h4>
let target = document.getElementById(ident + 'value')
target.innerText = Math.ceil(sensors[idents[index]]).toString()
if (ident.includes('control')) {
// Disable slider if sensor is in controls
let slider = document.getElementById(ident + 'slider')
if (slider.value !== sensors[idents[index]]) {
// Slider won't reset while moving it
slider.value = sensors[idents[index]]
}
// Disable slider and button if sensor is in controls
let button = document.getElementById('stop' + ident)
if (controls.includes(ident)) {
slider.disabled = true
button.disabled = true
} else {
slider.disabled = false
button.disabled = false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion suckcontrol/html/sensors.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</button>
<input type="number" class="hidden" value="{{ sensor.Value|int }}">
<p class="slider">
<input id="{{ sensor.Identifier|replace('/', '') }}slider" class="mdl-slider mdl-js-slider" type="range" min="0" max="100" value="{{sensor.Value|int}}" step="1" onchange="setSlider(this.id, this.value)" {% if sensor.Identifier|replace('/', '') in controls %}disabled{% endif %}>
<input id="{{ sensor.Identifier|replace('/', '') }}slider" class="mdl-slider mdl-js-slider" type="range" min="0" max="100" value="{{sensor.Value|int}}" step="1" onchange="setSlider(this.id, this.value)">
</p>
%
{% endif %}
Expand Down

0 comments on commit 98ac311

Please sign in to comment.