mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
repeat panel: minor refactor
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user