Skip to content

Commit

Permalink
Remove obsolete code in SVG dashboards (#677)
Browse files Browse the repository at this point in the history
Remove parts of legacy switch handling core in SVG dashboards
  • Loading branch information
KraPete authored Dec 16, 2024
1 parent 46bbf81 commit 2411018
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 9 additions & 15 deletions app/scripts/react-directives/view-svg-dashboard/pageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ViewSvgDashboardPageStore {
this.editFn = null;
this.moveToDashboardFn = null;
this.dashboardId = null;
this.switchValueFn = null;
this.key = Math.random();
this.dashboardIndex = 0;
this.editAccessLevelStore = new AccessLevelStore(rolesFactory);
Expand Down Expand Up @@ -51,10 +50,6 @@ class ViewSvgDashboardPageStore {
this.channelValues,
id => this?.editFn(id),
id => this.moveToDashboard(id),
(channel, value) => {
let cell = this.deviceData.cell(channel);
cell.value = cell.value == value.on ? value.off : value.on;
},
(channel, value) => this.switchValue(channel, value)
);
store.setForceFullscreen(this.forceFullscreen);
Expand Down Expand Up @@ -112,8 +107,15 @@ class ViewSvgDashboardPageStore {
}

switchValue(channel, value) {
let cell = this.deviceData.cell(channel);
cell.value = cell.value == value.on ? value.off : value.on;
if (!this.deviceData) {
return;
}
try {
const cell = this.deviceData.cell(channel);
cell.value = cell.value === value.on ? value.off : value.on;
} catch (e) {
// Do nothing if cell is not found
}
}

editDashboard() {
Expand All @@ -128,14 +130,6 @@ class ViewSvgDashboardPageStore {
this.moveToDashboardFn = moveToDashboardFn;
}

setSwitchValueFn(switchValueFn) {
this.switchValueFn = switchValueFn;
}

switchValue(channel, value) {
this?.switchValueFn(channel, value);
}

moveToDashboard(dashboardId) {
if (this.dashboardId != dashboardId) {
this.setLoading(true);
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-mqtt-homeui (2.107.2) stable; urgency=medium

* Fix switch handling in SVG dashboards

-- Petr Krasnoshchekov <[email protected]> Fri, 13 Dec 2024 12:19:22 +0500

wb-mqtt-homeui (2.107.1) stable; urgency=medium

* Fix mqtt channels value cell's width
Expand Down

0 comments on commit 2411018

Please sign in to comment.