Skip to content

Commit

Permalink
Javascript formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh committed Nov 4, 2023
1 parent 525235c commit cc6c1a2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
35 changes: 18 additions & 17 deletions gui/components/common/Graph.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,26 @@
}
if (mode === 'sensors') {
if (settings.graph_limit_min_max) {
let last = new_data.length - 1;
graphOpts.scales.y.min = new_data[last].alarm_min - Math.abs(new_data[last].alarm_min === 0 ? 20 : new_data[last].alarm_min * 0.2);
graphOpts.scales.y.max = new_data[last].alarm_max + Math.abs(new_data[last].alarm_max === 0 ? 20 : new_data[last].alarm_max * 0.2);
graphOpts.scales.y.ticks.includeBounds = false;
}
if (settings.graph_show_min_max_gauge) {
let values = new_data.map((point) => {
return point.value;
});
updateSensor({
id: id,
measure_min: Math.min(...values),
measure_max: Math.max(...values),
});
}
if (settings.graph_limit_min_max) {
let last = new_data.length - 1;
graphOpts.scales.y.min =
new_data[last].alarm_min - Math.abs(new_data[last].alarm_min === 0 ? 20 : new_data[last].alarm_min * 0.2);
graphOpts.scales.y.max =
new_data[last].alarm_max + Math.abs(new_data[last].alarm_max === 0 ? 20 : new_data[last].alarm_max * 0.2);
graphOpts.scales.y.ticks.includeBounds = false;
}
if (settings.graph_show_min_max_gauge) {
let values = new_data.map((point) => {
return point.value;
});
updateSensor({
id: id,
measure_min: Math.min(...values),
measure_max: Math.max(...values),
});
}
}
if ($graphs[id].period === 'day') {
graphOpts.scales.x.time.unit = 'minute';
graphOpts.scales.x.time.displayFormats.minute = 'LT';
Expand Down
10 changes: 5 additions & 5 deletions gui/modals/ButtonFormModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@
</div>
<div class="col-6 col-sm-6 col-md-6 col-lg-1">
<Switch
name="notification"
value={$formData.notification}
label={$_('buttons.settings.notification.label', { default: 'Notification' })}
help={$_('buttons.settings.notification.help', {
name="notification"
value={$formData.notification}
label={$_('buttons.settings.notification.label', { default: 'Notification' })}
help={$_('buttons.settings.notification.help', {
default: 'Toggle to enable notification messages.',
})}
})}
/>
</div>
<div class="col-6 col-sm-6 col-md-6 col-lg-1">
Expand Down
10 changes: 5 additions & 5 deletions gui/modals/RelayFormModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@
</div>
<div class="col-6 col-sm-6 col-md-6 col-lg-1">
<Switch
name="notification"
value={$formData.notification}
label={$_('relays.settings.notification.label', { default: 'Notification' })}
help={$_('relays.settings.notification.help', {
name="notification"
value={$formData.notification}
label={$_('relays.settings.notification.label', { default: 'Notification' })}
help={$_('relays.settings.notification.help', {
default: 'Toggle to enable notification messages.',
})}
})}
/>
</div>
<div class="col-6 col-sm-6 col-md-6 col-lg-1">
Expand Down
10 changes: 5 additions & 5 deletions gui/modals/SensorFormModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@
</div>
<div class="col-6 col-sm-6 col-md-6 col-lg-1">
<Switch
name="notification"
value={$formData.notification}
label={$_('sensors.settings.notification.label', { default: 'Notification' })}
help={$_('sensors.settings.notification.help', {
name="notification"
value={$formData.notification}
label={$_('sensors.settings.notification.label', { default: 'Notification' })}
help={$_('sensors.settings.notification.help', {
default: 'Toggle to enable notification messages.',
})}
})}
/>
</div>
<div class="col-6 col-sm-6 col-md-6 col-lg-1">
Expand Down

0 comments on commit cc6c1a2

Please sign in to comment.