Open chevdor opened 2 months ago
I see the issue directly in the browser:
I see the URL changing but the page does not reload with A
.
I could fetch the following error in the console:
vendor.js:119 TypeError: Cannot read properties of undefined (reading 'widget_margin')
at new DashboardViewController (http://domopi2:8080/habpanel/app/dashboard/dashboard.view.controller.js:14:32)
at Object.instantiate (http://domopi2:8080/habpanel/vendor/vendor.js:42:109)
at http://domopi2:8080/habpanel/vendor/vendor.js:91:374
at Object.link (http://domopi2:8080/habpanel/vendor/vendor.js:332:274)
at http://domopi2:8080/habpanel/vendor/vendor.js:16:71
at sa (http://domopi2:8080/habpanel/vendor/vendor.js:82:244)
at n (http://domopi2:8080/habpanel/vendor/vendor.js:68:6)
at g (http://domopi2:8080/habpanel/vendor/vendor.js:59:428)
at http://domopi2:8080/habpanel/vendor/vendor.js:59:67
at http://domopi2:8080/habpanel/vendor/vendor.js:64:67 <main class="container ng-scope" snap-content="" snap-opt-disable="'right'" snap-opt-hyperextensible="false" ng-view="" ng-class="{ 'image-bg': settings.background_image, kiosk: kioskMode }" ng-style="{ 'background-image': (settings.background_image) ? 'url(' + settings.background_image +')' : '' }">
I ended up deleting my "first" dashboard as I think it was "corrupted". Surprising though since I built the second dashboard by simply copying all the widgets from A to B and B works just fine. So when I mentioned "First/Default" Dashboard above is NOT relevant. The issue is that somehow, my A Dashboard got corrupted, still loads as default dashboard but does not when switched to.
Background
HabPanel allows OH to control the currently displayed Dashboard using one of the panel settings:![image](https://github.com/openhab/openhab-webui/assets/738724/1890ce6f-35ab-4086-9a2c-d7ad10a13a7c)
It is usually defined as an item such as:
The idea is that changing the content of the string, HabPanel will switch to that Dashboard, should the string match an existing Dashboard. Simple, yet very powerful.
Sample use case
I was experimenting with a simple use case that I provide here only to illustrate how I got there.
Let's consider I have 3 dashboards:
A
:Main
B
:Doors & Windows
C
:Foobar
Below I will refer to Dasboards A, B and C since what they are does not matter much.
In my case, usually, HabPanel shows
Main
(A). When a door or window is opened, it will switch toDoors & Windows
(B). After N seconds, it will come back toMain
(A).Nice story but that does not work.
The problem
The rule switching A -> B works fine. A window is opened (for instance), OH will update the
HabPanel_Screen
content and the B Dashboard will be shown.So far, everthing works as expected.
The issue is related to coming back to Dashboard A. I am using a timer (but that part does not matter) and switching back to A is simply ignored.
Expected behavior
Considering 2 Dashboards both of the following work:
A
toB
B
back toA
A
being the main "default" dashboard.Steps to reproduce
A
), create a second dashboardString HabPanel_Screen "HabPanel Screen" <screen>
HabPanel_Screen
to switch dashboardYour environment
Browser console
Browser network traffic
Additional information
It is important to notice that I run into this issue ONLY if
A
is the first/default dashboard. It you already have a dashboard and create 2 new dashboards for the test, it will be working all fine as it does for me.