Merge pull request #812 from influxdata/bugfix/layout-gaps

Fix layout autoflow to handle multiple cells per layout
pull/10616/head
Nathan Haugo 2017-01-27 11:26:38 -08:00 committed by GitHub
commit 5ad0292de6
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,7 @@
### Upcoming Bug Fixes
1. [#788](https://github.com/influxdata/chronograf/pull/788): Fix missing fields in data explorer when using non-default retention policy
1. [#774](https://github.com/influxdata/chronograf/issues/774): Fix gaps in layouts for hosts
### Upcoming Features
1. [#779](https://github.com/influxdata/chronograf/issues/779): Add layout for telegraf's diskio system plugin

View File

@ -86,13 +86,17 @@ export const HostPage = React.createClass({
const cellHeight = 4;
const pageWidth = 12;
const autoflowCells = autoflowLayouts.reduce((allCells, layout, i) => {
return allCells.concat(layout.cells.map((cell, j) => {
let cellCount = 0;
const autoflowCells = autoflowLayouts.reduce((allCells, layout) => {
return allCells.concat(layout.cells.map((cell) => {
const x = (cellCount * cellWidth % pageWidth);
const y = Math.floor(cellCount * cellWidth / pageWidth) * cellHeight;
cellCount += 1;
return Object.assign(cell, {
w: cellWidth,
h: cellHeight,
x: ((i + j) * cellWidth % pageWidth),
y: Math.floor(((i + j) * cellWidth / pageWidth)) * cellHeight,
x,
y,
});
}));
}, []);