repeat panel: minor refactor

This commit is contained in:
Alexander Zobnin
2018-01-30 14:19:10 +03:00
parent 1c95da8f23
commit 526960058a
2 changed files with 9 additions and 21 deletions

View File

@@ -342,7 +342,6 @@ export class DashboardModel {
let minWidth = panel.minSpan || 6;
let xPos = 0;
let yPos = panel.gridPos.y;
let yOffset = 0;
for (let index = 0; index < selectedOptions.length; index++) {
let option = selectedOptions[index];
@@ -353,11 +352,10 @@ export class DashboardModel {
copy.scopedVars[variable.name] = option;
if (panel.repeatDirection === REPEAT_DIR_VERTICAL) {
copy.gridPos.y = yPos;
yPos += copy.gridPos.h;
if (index > 0) {
yOffset += copy.gridPos.h;
yPos += copy.gridPos.h;
}
copy.gridPos.y = yPos;
} else {
// set width based on how many are selected
// assumed the repeated panels should take up full row width
@@ -371,12 +369,12 @@ export class DashboardModel {
if (xPos + copy.gridPos.w > GRID_COLUMN_COUNT) {
xPos = 0;
yPos += copy.gridPos.h;
yOffset += copy.gridPos.h;
}
}
}
// Update gridPos for panels below
let yOffset = yPos - panel.gridPos.y;
if (yOffset > 0) {
let panelBelowIndex = panelIndex + selectedOptions.length;
for (let i = panelBelowIndex; i < this.panels.length; i++) {