thingsboard
thingsboard copied to clipboard
After changing dashboard state to another dashboard state the top panel is doubled.
Component
- UI
Description After changing dashboard state to another dashboard state the top panel is doubled (see below). How to fix?
default state
after changing the state to another dashboard state
Environment
- OS: Windows 10
- ThingsBoard: 3.4.4 PE
- Browser: Chrome
I'm navigating to another dashboard with this function:
function openDashboardState(dashboardId, stateId) {
var params = {
entityId: entityId,
entityName: entityName,
currentStateId: widgetContext.stateController
.getStateId()
};
var stateObject = {
id: stateId,
params: {}
};
stateObject.params = params;
var state = objToBase64URI([stateObject]);
let url = "/dashboards/" + dashboardId +
"?state=" + state + "";
widgetContext.router.navigateByUrl(url);
}
function objToBase64URI(obj) {
return encodeURIComponent(objToBase64(obj));
}
function objToBase64(obj) {
const json = JSON.stringify(obj);
return btoa(encodeURIComponent(json).replace(
/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1) {
return String.fromCharCode(Number('0x' +
p1));
}));
}
This problem is solved by changing the url:
stateObject.params = params; var state = objToBase64URI([stateObject]); let url = "/dashboard/" + dashboardId + "?state=" + state + ""; widgetContext.router.navigateByUrl(url);