Permalink
Browse files

Handle adding to an existing group to fill multiple columns

That will happen if (number of disks per row) * 2 <= (available disks)
  • Loading branch information...
william-gr committed Jun 6, 2013
1 parent 3789f26 commit 2cf7d57bbd5a6e51a1762f8a9ab50293baf41f03
Showing with 6 additions and 4 deletions.
  1. +6 −4 gui/freeadmin/static/lib/js/freeadmin/VolumeManager.js
@@ -221,11 +221,13 @@ define([
* rest drives as spare row.
*/
if(diskg.disks.length > 0 && diskg.disks[0].sizeBytes == me.sizeBytes) {
- if(me.disks.length >= diskg.getDisksPerRow()) {
- for(var i=0,len=diskg.getDisksPerRow(),row=diskg.rows;i<len;i++) {
- me.disks[0].addToRow(diskg, row, i);
+ var perRow = diskg.getDisksPerRow();
+ var newRows = Math.floor(me.disks.length / perRow);
+ if(newRows > 0) {
+ for(var i=0,len=newRows*perRow,row=diskg.rows;i<len;i++) {
+ me.disks[0].addToRow(diskg, Math.floor(diskg.disks.length / perRow), diskg.disks.length % perRow);
}
- diskg.rows++;
+ diskg.rows += newRows;
}
diskg._adjustSize();
if(me.disks.length > 0) {

0 comments on commit 2cf7d57

Please sign in to comment.