MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / getDashboardLayout

Function getDashboardLayout

client/src/modules/getDashboardLayout.js:3–25  ·  view source on GitHub ↗
(charts)

Source from the content-addressed store, hash-verified

1import { widthSize } from "./layoutBreakpoints";
2
3export default function getDashboardLayout(charts) {
4 const layouts = Object.keys(widthSize).reduce((acc, key) => {
5 acc[key] = [];
6 return acc;
7 }, {});
8
9 charts.forEach((chart) => {
10 if (chart.layout) {
11 Object.keys(chart.layout).forEach((key) => {
12 layouts[key].push({
13 i: chart.id.toString(),
14 x: chart.layout[key][0] || 0,
15 y: chart.layout[key][1] || 0,
16 w: chart.layout[key][2],
17 h: chart.layout[key][3],
18 minW: 2,
19 });
20 });
21 }
22 });
23
24 return layouts;
25}

Callers 2

_getNewChartLayoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected