[dashboard] Keep old layout intact and return a list of the new format
@@ -50,17 +50,20 @@ function loadSearchLayout(viewModel, json_layout) {
// End dashboard lib
function layoutToGridster(vm) {
- fullLayout(vm);
-
var numCols = 12;
var defaultWidgetHeight = 2;
+ var layout = []
- $.each(vm.columns()[0].rows(), function (indexY, row) {
+ $.each(vm.columns(), function (indexY, column) {
+ $.each(column.rows(), function (indexY, row) {
var rowColSize = numCols / row.widgets().length; // Full length of row if 1 widget
$.each(row.widgets(), function (indexX, widget) {
- console.log({col: 1 + indexY * defaultWidgetHeight, row: 1 + indexX * rowColSize, size_x: rowColSize, size_y: defaultWidgetHeight, id: widget.id()});
+ layout.push({col: 1 + indexY * defaultWidgetHeight, row: 1 + indexX * rowColSize, size_x: rowColSize, size_y: defaultWidgetHeight, id: widget.id()});
+ });
});
});
+
+ return layout;
}
var Query = function (vm, query) {
