Panel: duplicate now always adds the duplicated panel on the same row instead of creating a new row, Closes #1185
This commit is contained in:
@@ -117,18 +117,8 @@ function (angular, $, kbn, _, moment) {
|
|||||||
var newPanel = angular.copy(panel);
|
var newPanel = angular.copy(panel);
|
||||||
newPanel.id = this.getNextPanelId();
|
newPanel.id = this.getNextPanelId();
|
||||||
|
|
||||||
while(rowIndex < this.rows.length) {
|
var currentRow = this.rows[rowIndex];
|
||||||
var currentRow = this.rows[rowIndex];
|
currentRow.panels.push(newPanel);
|
||||||
if (this.rowSpan(currentRow) <= 9) {
|
|
||||||
currentRow.panels.push(newPanel);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newRow = angular.copy(row);
|
|
||||||
newRow.panels = [newPanel];
|
|
||||||
this.rows.push(newRow);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
p.formatDate = function(date, format) {
|
p.formatDate = function(date, format) {
|
||||||
|
|||||||
@@ -70,16 +70,6 @@ define([
|
|||||||
expect(dashboard.rows[0].panels[1].id).to.be(11);
|
expect(dashboard.rows[0].panels[1].id).to.be(11);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('duplicate should add row if there is no space left', function() {
|
|
||||||
var panel = { span: 12, attr: '123' };
|
|
||||||
dashboard.rows = [{ panels: [panel] }];
|
|
||||||
dashboard.duplicatePanel(panel, dashboard.rows[0]);
|
|
||||||
|
|
||||||
expect(dashboard.rows[0].panels[0].span).to.be(12);
|
|
||||||
expect(dashboard.rows[0].panels.length).to.be(1);
|
|
||||||
expect(dashboard.rows[1].panels[0].attr).to.be('123');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when creating dashboard with editable false', function() {
|
describe('when creating dashboard with editable false', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user