Merge branch 'master' of github.com:thingsboard/thingsboard into feature/dashboard-sync
This commit is contained in:
commit
bfc8231d87
@ -141,8 +141,10 @@ public class ThingsboardInstallService {
|
||||
log.info("Upgrading ThingsBoard from version 3.7.0 to 3.8.0 ...");
|
||||
databaseEntitiesUpgradeService.upgradeDatabase("3.7.0");
|
||||
case "3.8.0":
|
||||
log.info("Upgrading ThingsBoard from version 3.8.0 to 3.9.0 ...");
|
||||
databaseEntitiesUpgradeService.upgradeDatabase("3.8.0");
|
||||
log.info("Upgrading ThingsBoard from version 3.8.0 to 3.8.1 ...");
|
||||
case "3.8.1":
|
||||
log.info("Upgrading ThingsBoard from version 3.8.1 to 3.9.0 ...");
|
||||
databaseEntitiesUpgradeService.upgradeDatabase("3.8.1");
|
||||
//TODO DON'T FORGET to update switch statement in the CacheCleanupService if you need to clear the cache
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -106,7 +106,7 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
||||
log.warn("Failed to execute update script for device profile rule nodes due to: ", e);
|
||||
}
|
||||
}
|
||||
case "3.8.0" -> updateSchema("3.8.0", 3008000, "3.9.0", 3009000);
|
||||
case "3.8.1" -> updateSchema("3.8.1", 3008001, "3.9.0", 3009000);
|
||||
default -> throw new RuntimeException("Unsupported fromVersion '" + fromVersion + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -749,12 +749,57 @@ export class DashboardUtilsService {
|
||||
widget.sizeY = 1;
|
||||
}
|
||||
}
|
||||
const widgets: WidgetLayout[] = [];
|
||||
for (const w of Object.keys(layout.widgets)) {
|
||||
const widget = layout.widgets[w];
|
||||
widget.row = Math.round(widget.row * ratio);
|
||||
widget.col = Math.round(widget.col * ratio);
|
||||
widget.sizeX = Math.round(widget.sizeX * ratio);
|
||||
widget.sizeY = Math.round(widget.sizeY * ratio);
|
||||
widget.sizeX = Math.max(1, Math.round(widget.sizeX * ratio));
|
||||
widget.sizeY = Math.max(1, Math.round(widget.sizeY * ratio));
|
||||
widgets.push(widget);
|
||||
}
|
||||
widgets.sort((w1, w2) => {
|
||||
let res = w1.col - w2.col;
|
||||
if (res === 0) {
|
||||
res = w1.row - w2.row;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
for (const widget of widgets) {
|
||||
for (const widget2 of widgets) {
|
||||
if (widget !== widget2) {
|
||||
const left = widget.col;
|
||||
const right = widget.col + widget.sizeX;
|
||||
const top = widget.row;
|
||||
const bottom = widget.row + widget.sizeY;
|
||||
const left2 = widget2.col;
|
||||
const right2 = widget2.col + widget2.sizeX;
|
||||
const top2 = widget2.row;
|
||||
const bottom2 = widget2.row + widget2.sizeY;
|
||||
if (left < right2 && right > left2 &&
|
||||
top < bottom2 && bottom > top2 ) {
|
||||
let horizontalOverlapFixed = false;
|
||||
if (right - left2 === 1) {
|
||||
if (widget.sizeX > 1) {
|
||||
widget.sizeX--;
|
||||
horizontalOverlapFixed = true;
|
||||
} else if (widget2.sizeX > 1) {
|
||||
widget2.col++;
|
||||
widget2.sizeX--;
|
||||
horizontalOverlapFixed = true;
|
||||
}
|
||||
}
|
||||
if (!horizontalOverlapFixed && (bottom - top2) === 1) {
|
||||
if (widget.sizeY > 1) {
|
||||
widget.sizeY--;
|
||||
} else if (widget2.sizeY > 1) {
|
||||
widget2.row++;
|
||||
widget2.sizeY--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user