Skip to content

Commit

Permalink
fix(util/grid): pass smoke test for redMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
Duologic committed Jan 5, 2024
1 parent e119d38 commit 79fe602
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
24 changes: 17 additions & 7 deletions custom/util/grid.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,26 @@ local panelUtil = import './panel.libsonnet';
],
),
makeGrid(panels, panelWidth=8, panelHeight=8, startY=0):
local sanitizedPanels = std.map(
local sanitizePanels(ps) = std.map(
function(p)
panelUtil.sanitizePanel(p)
+ (
if p.type != 'row'
then { gridPos+: { h: panelHeight, w: panelWidth } }
else {}
local sanePanel = panelUtil.sanitizePanel(p);
(
if p.type == 'row'
then sanePanel + {
panels: sanitizePanels(sanePanel.panels),
}
else sanePanel + {
gridPos+: {
h: panelHeight,
w: panelWidth,
},
}
),
panels
ps
);

local sanitizedPanels = sanitizePanels(panels);

local grouped = panelUtil.groupPanelsInRows(sanitizedPanels);

local panelsBeforeRows = panelUtil.getPanelsBeforeNextRow(grouped);
Expand Down
24 changes: 17 additions & 7 deletions gen/grafonnet-v10.1.0/custom/util/grid.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,26 @@ local panelUtil = import './panel.libsonnet';
],
),
makeGrid(panels, panelWidth=8, panelHeight=8, startY=0):
local sanitizedPanels = std.map(
local sanitizePanels(ps) = std.map(
function(p)
panelUtil.sanitizePanel(p)
+ (
if p.type != 'row'
then { gridPos+: { h: panelHeight, w: panelWidth } }
else {}
local sanePanel = panelUtil.sanitizePanel(p);
(
if p.type == 'row'
then sanePanel + {
panels: sanitizePanels(sanePanel.panels),
}
else sanePanel + {
gridPos+: {
h: panelHeight,
w: panelWidth,
},
}
),
panels
ps
);

local sanitizedPanels = sanitizePanels(panels);

local grouped = panelUtil.groupPanelsInRows(sanitizedPanels);

local panelsBeforeRows = panelUtil.getPanelsBeforeNextRow(grouped);
Expand Down

0 comments on commit 79fe602

Please sign in to comment.