Daniel Erez has uploaded a new change for review.

Change subject: webadmin: cluster quota in import VM from data SD dialog
......................................................................

webadmin: cluster quota in import VM from data SD dialog

Import VM/Template from data SD dialog:
introduced cluster quota column.

Change-Id: I85244d2eea3c3224bf7aac413db30bc31016741f
Signed-off-by: Daniel Erez <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterEntityModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterTemplateModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterVmModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportEntityData.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.ui.xml
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterTemplatePopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterVmPopupView.java
9 files changed, 180 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/28727/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index bcc947c..4d7d146 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
@@ -879,6 +879,22 @@
                 aQuery);
     }
 
+    public static void getAllQuotasByClusterId(AsyncQuery aQuery, Guid 
clusterId) {
+        aQuery.converterCallback = new IAsyncConverter() {
+            @Override
+            public Object Convert(Object source, AsyncQuery _asyncQuery)
+            {
+                if (source == null) {
+                    return new ArrayList<Quota>();
+                }
+                return (ArrayList<Quota>) source;
+            }
+        };
+        
Frontend.getInstance().runQuery(VdcQueryType.GetAllRelevantQuotasForVdsGroup,
+                new IdQueryParameters(clusterId),
+                aQuery);
+    }
+
     public static void isSoundcardEnabled(AsyncQuery aQuery, Guid vmId) {
         aQuery.converterCallback = new IAsyncConverter() {
             @Override
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterEntityModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterEntityModel.java
index f8a4adc..ed2d8c9 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterEntityModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterEntityModel.java
@@ -1,31 +1,46 @@
 package org.ovirt.engine.ui.uicommonweb.models.storage;
 
+import org.ovirt.engine.core.common.businessentities.Quota;
+import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum;
 import org.ovirt.engine.core.common.businessentities.StoragePool;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
+import org.ovirt.engine.core.common.queries.IdQueryParameters;
+import org.ovirt.engine.core.common.queries.VdcQueryParametersBase;
+import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
+import org.ovirt.engine.ui.frontend.Frontend;
 import org.ovirt.engine.ui.frontend.INewAsyncCallback;
 import org.ovirt.engine.ui.uicommonweb.Linq;
 import org.ovirt.engine.ui.uicommonweb.UICommand;
 import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
+import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
 import org.ovirt.engine.ui.uicommonweb.models.ListModel;
 import org.ovirt.engine.ui.uicommonweb.models.Model;
 import org.ovirt.engine.ui.uicommonweb.models.vms.ImportEntityData;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
+import org.ovirt.engine.ui.uicompat.FrontendMultipleQueryAsyncResult;
+import org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 public abstract class RegisterEntityModel extends Model {
 
     private UICommand cancelCommand;
     private ListModel<ImportEntityData> entities;
     private ListModel<VDSGroup> cluster;
+    private EntityModel<Map<Guid, List<Quota>>> clusterQuotasMap;
     private Guid storageDomainId;
+    private StoragePool storagePool;
 
     public RegisterEntityModel() {
         setEntities(new ListModel());
         setCluster(new ListModel());
+        setClusterQuotasMap(new EntityModel<Map<Guid, List<Quota>>>());
+        getClusterQuotasMap().setEntity(new HashMap<Guid, List<Quota>>());
     }
 
     protected abstract void onSave();
@@ -49,7 +64,7 @@
             @Override
             public void onSuccess(Object target, Object returnValue) {
                 ArrayList<StoragePool> storagePools = (ArrayList<StoragePool>) 
returnValue;
-                StoragePool storagePool = storagePools.size() > 0 ? 
storagePools.get(0) : null;
+                storagePool = storagePools.size() > 0 ? storagePools.get(0) : 
null;
                 if (storagePool == null) {
                     return;
                 }
@@ -67,10 +82,40 @@
 
                         getCluster().setItems(clusters);
                         
getCluster().setSelectedItem(Linq.firstOrDefault(clusters));
+
+                        updateClusterQuota(clusters);
                     }
                 }), storagePool.getId(), true, false);
+
             }
         }), storageDomainId);
+    }
+
+    public void updateClusterQuota(ArrayList<VDSGroup> clusters) {
+        if (!isQuotaEnabled()) {
+            return;
+        }
+
+        List<VdcQueryType> queries = new ArrayList<VdcQueryType>();
+        List<VdcQueryParametersBase> params = new 
ArrayList<VdcQueryParametersBase>();
+        for (VDSGroup cluster : clusters) {
+            queries.add(VdcQueryType.GetAllRelevantQuotasForVdsGroup);
+            params.add(new IdQueryParameters(cluster.getId()));
+        }
+
+        Frontend.getInstance().runMultipleQueries(queries, params, new 
IFrontendMultipleQueryAsyncCallback() {
+            @Override
+            public void executed(FrontendMultipleQueryAsyncResult result) {
+                Map<Guid, List<Quota>> clusterQuotasMap = new HashMap<Guid, 
List<Quota>>();
+                for (int i = 0; i < result.getReturnValues().size(); i++) {
+                    List<Quota> quotas = 
result.getReturnValues().get(i).getReturnValue();
+                    Guid clusterId = ((IdQueryParameters) 
result.getParameters().get(i)).getId();
+
+                    clusterQuotasMap.put(clusterId, quotas);
+                }
+                getClusterQuotasMap().setEntity(clusterQuotasMap);
+            }
+        });
     }
 
     @Override
@@ -118,4 +163,16 @@
     public void setStorageDomainId(Guid storageDomainId) {
         this.storageDomainId = storageDomainId;
     }
+
+    public EntityModel<Map<Guid, List<Quota>>> getClusterQuotasMap() {
+        return clusterQuotasMap;
+    }
+
+    public void setClusterQuotasMap(EntityModel<Map<Guid, List<Quota>>> 
clusterQuotasMap) {
+        this.clusterQuotasMap = clusterQuotasMap;
+    }
+
+    public boolean isQuotaEnabled() {
+        return storagePool.getQuotaEnforcementType() != 
QuotaEnforcementTypeEnum.DISABLED;
+    }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterTemplateModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterTemplateModel.java
index df5ad40..d00eb05 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterTemplateModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterTemplateModel.java
@@ -6,6 +6,7 @@
 import org.ovirt.engine.core.common.action.VdcActionParametersBase;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.businessentities.BusinessEntity;
+import org.ovirt.engine.core.common.businessentities.Quota;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.ui.frontend.Frontend;
@@ -20,12 +21,14 @@
         for (ImportEntityData entityData : getEntities().getItems()) {
             BusinessEntity<Guid> entity = (BusinessEntity<Guid>) 
entityData.getEntity();
             VDSGroup vdsGroup = entityData.getCluster().getSelectedItem();
+            Quota quota = isQuotaEnabled() ? 
entityData.getClusterQuota().getSelectedItem() : null;
 
             ImportVmTemplateParameters params = new 
ImportVmTemplateParameters();
             params.setContainerId(entity.getId());
             params.setStorageDomainId(getStorageDomainId());
-            params.setVdsGroupId(vdsGroup != null ? vdsGroup.getId() : null);
             params.setImagesExistOnTargetStorageDomain(true);
+            params.setVdsGroupId(vdsGroup != null ? vdsGroup.getId() : null);
+            params.setQuotaId(quota != null ? quota.getId() : null);
 
             parameters.add(params);
         }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterVmModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterVmModel.java
index bd327c0..feb2ce4 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterVmModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/RegisterVmModel.java
@@ -4,6 +4,7 @@
 import org.ovirt.engine.core.common.action.VdcActionParametersBase;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.businessentities.BusinessEntity;
+import org.ovirt.engine.core.common.businessentities.Quota;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.ui.frontend.Frontend;
@@ -20,12 +21,14 @@
         for (ImportEntityData entityData : getEntities().getItems()) {
             BusinessEntity<Guid> entity = (BusinessEntity<Guid>) 
entityData.getEntity();
             VDSGroup vdsGroup = entityData.getCluster().getSelectedItem();
+            Quota quota = isQuotaEnabled() ? 
entityData.getClusterQuota().getSelectedItem() : null;
 
             ImportVmParameters params = new ImportVmParameters();
             params.setContainerId(entity.getId());
             params.setStorageDomainId(getStorageDomainId());
-            params.setVdsGroupId(vdsGroup != null ? vdsGroup.getId() : null);
             params.setImagesExistOnTargetStorageDomain(true);
+            params.setVdsGroupId(vdsGroup != null ? vdsGroup.getId() : null);
+            params.setQuotaId(quota != null ? quota.getId() : null);
 
             parameters.add(params);
         }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportEntityData.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportEntityData.java
index e24a8ea..79e4ea0 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportEntityData.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportEntityData.java
@@ -1,6 +1,7 @@
 package org.ovirt.engine.ui.uicommonweb.models.vms;
 
 import org.ovirt.engine.core.common.businessentities.ArchitectureType;
+import org.ovirt.engine.core.common.businessentities.Quota;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
 import org.ovirt.engine.ui.uicommonweb.models.ListModel;
@@ -13,10 +14,12 @@
     boolean isExistsInSystem;
     private EntityModel clone;
     private ListModel<VDSGroup> cluster;
+    private ListModel<Quota> clusterQuota;
 
     public ImportEntityData() {
         setClone(new EntityModel(false));
         setCluster(new ListModel());
+        setClusterQuota(new ListModel());
     }
 
     public Object getEntity() {
@@ -51,6 +54,14 @@
         this.cluster = cluster;
     }
 
+    public ListModel<Quota> getClusterQuota() {
+        return clusterQuota;
+    }
+
+    public void setClusterQuota(ListModel<Quota> clusterQuota) {
+        this.clusterQuota = clusterQuota;
+    }
+
     public void selectClusterByName(String name) {
         for (VDSGroup vdsGroup : getCluster().getItems()) {
             if (vdsGroup.getName().equals(name)) {
@@ -70,6 +81,25 @@
         return names;
     }
 
+    public void selectClusterQuotaByName(String name) {
+        for (Quota quota : getClusterQuota().getItems()) {
+            if (quota.getQuotaName().equals(name)) {
+                getClusterQuota().setSelectedItem(quota);
+                break;
+            }
+        }
+    }
+
+    public List<String> getClusterQuotaNames() {
+        List<String> names = new ArrayList<String>();
+        if (getClusterQuota().getItems() != null) {
+            for (Quota quota : getClusterQuota().getItems()) {
+                names.add(quota.getQuotaName());
+            }
+        }
+        return names;
+    }
+
     public abstract ArchitectureType getArchType();
 
     public abstract String getName();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.java
index 840140a..cb92c13 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.java
@@ -1,7 +1,10 @@
 package org.ovirt.engine.ui.webadmin.section.main.view.popup.storage;
 
 import java.util.ArrayList;
+import java.util.List;
 
+import org.ovirt.engine.core.common.businessentities.Quota;
+import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
 import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
 import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
@@ -21,7 +24,6 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.editor.client.SimpleBeanEditorDriver;
 import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.cellview.client.Column;
@@ -49,8 +51,7 @@
 
     protected RegisterEntityInfoPanel registerEntityInfoPanel;
 
-    @UiField
-    WidgetStyle style;
+    private RegisterEntityModel registerEntityModel;
 
     @UiField
     SplitLayoutPanel splitLayoutPanel;
@@ -70,16 +71,12 @@
         initTables();
         initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
         ViewIdHandler.idHandler.generateAndSetIds(this);
-        localize(constants);
-        addStyles();
         driver.initialize(this);
 
-        createEntityTable();
-        createInfoPanel();
         asWidget().enableResizeSupport(true);
     }
 
-    abstract void createEntityTable();
+    abstract void createEntityTable(RegisterEntityModel model);
     abstract void createInfoPanel();
 
     private void initTables() {
@@ -91,17 +88,21 @@
         splitLayoutPanel = new SplitLayoutPanel(4);
     }
 
-    private void addStyles() {
+    private void createTables(RegisterEntityModel model) {
+        createEntityTable(model);
+        createInfoPanel();
+        entityTable.asEditor().edit(model.getEntities());
     }
 
-    private void localize(ApplicationConstants constants) {
+    private void refreshEntityTable() {
+        entityTable.asEditor().edit(entityTable.asEditor().flush());
+        entityTable.redraw();
     }
 
     @Override
-    public void edit(RegisterEntityModel model) {
+    public void edit(final RegisterEntityModel model) {
+        registerEntityModel = model;
         driver.edit(model);
-
-        entityTable.asEditor().edit(model.getEntities());
 
         model.getEntities().getSelectedItemChangedEvent().addListener(new 
IEventListener() {
             @Override
@@ -112,17 +113,26 @@
             }
         });
 
+        model.getCluster().getItemsChangedEvent().addListener(new 
IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                createTables(model);
+            }
+        });
+
         model.getCluster().getSelectedItemChangedEvent().addListener(new 
IEventListener() {
             @Override
             public void eventRaised(Event ev, Object sender, EventArgs args) {
-                refreshTable();
+                refreshEntityTable();
             }
         });
-    }
 
-    private void refreshTable() {
-        entityTable.asEditor().edit(entityTable.asEditor().flush());
-        entityTable.redraw();
+        model.getClusterQuotasMap().getEntityChangedEvent().addListener(new 
IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                refreshEntityTable();
+            }
+        });
     }
 
     @Override
@@ -132,7 +142,7 @@
 
     protected Column getClusterColumn() {
         CustomSelectionCell customSelectionCell = new CustomSelectionCell(new 
ArrayList<String>());
-        customSelectionCell.setStyle(style.cellSelectBox());
+        customSelectionCell.setStyle("input-group col-xs-11"); //$NON-NLS-1$
 
         Column column = new Column<ImportEntityData, 
String>(customSelectionCell) {
             @Override
@@ -147,14 +157,39 @@
             @Override
             public void update(int index, ImportEntityData object, String 
value) {
                 object.selectClusterByName(value);
-
+                refreshEntityTable();
             }
         });
 
         return column;
     }
 
-    interface WidgetStyle extends CssResource {
-        String cellSelectBox();
+    protected Column getClusterQuotaColumn() {
+        CustomSelectionCell customSelectionCell = new CustomSelectionCell(new 
ArrayList<String>());
+        customSelectionCell.setStyle("input-group col-xs-11"); //$NON-NLS-1$
+
+        Column column = new Column<ImportEntityData, 
String>(customSelectionCell) {
+            @Override
+            public String getValue(ImportEntityData object) {
+                Guid clusterId = object.getCluster().getSelectedItem() != null 
?
+                        object.getCluster().getSelectedItem().getId() : null;
+                List<Quota> quotas = 
registerEntityModel.getClusterQuotasMap().getEntity().get(clusterId);
+
+                object.getClusterQuota().setItems(quotas);
+                ((CustomSelectionCell) 
getCell()).setOptions(object.getClusterQuotaNames());
+
+                return object.getClusterQuota().getSelectedItem() != null ?
+                        
object.getClusterQuota().getSelectedItem().getQuotaName() : constants.empty();
+            }
+        };
+        column.setFieldUpdater(new FieldUpdater<ImportEntityData, String>() {
+            @Override
+            public void update(int index, ImportEntityData object, String 
value) {
+                object.selectClusterQuotaByName(value);
+
+            }
+        });
+
+        return column;
     }
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.ui.xml
index 268bf0d..3f7f86d 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterEntityPopupView.ui.xml
@@ -4,7 +4,7 @@
              xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog"
              xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor">
 
-    <ui:style 
type="org.ovirt.engine.ui.webadmin.section.main.view.popup.storage.RegisterEntityPopupView.WidgetStyle">
+    <ui:style>
         .containerPanel {
             border: 1px solid #333;
             margin: 5px;
@@ -18,10 +18,6 @@
             bottom: 0px;
             left: 0px;
             right: 0px;
-        }
-
-        .cellSelectBox {
-            width: 90%;
         }
     </ui:style>
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterTemplatePopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterTemplatePopupView.java
index 61553d0..7cc45b6 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterTemplatePopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterTemplatePopupView.java
@@ -27,7 +27,7 @@
     }
 
     @Override
-    protected void createEntityTable() {
+    protected void createEntityTable(RegisterEntityModel model) {
         TextColumnWithTooltip<Object> nameColumn = new 
TextColumnWithTooltip<Object>() {
             @Override
             public String getValue(Object object) {
@@ -82,6 +82,10 @@
         entityTable.addColumn(diskColumn, constants.disksVm(), "50px"); 
//$NON-NLS-1$
 
         entityTable.addColumn(getClusterColumn(), constants.clusterVm(), 
"150px"); //$NON-NLS-1$
+
+        if (model.isQuotaEnabled()) {
+            entityTable.addColumn(getClusterQuotaColumn(), 
constants.quotaVm(), "150px"); //$NON-NLS-1$
+        }
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterVmPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterVmPopupView.java
index ade9846..e73dacd 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterVmPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/RegisterVmPopupView.java
@@ -27,7 +27,7 @@
     }
 
     @Override
-    protected void createEntityTable() {
+    protected void createEntityTable(RegisterEntityModel model) {
         TextColumnWithTooltip<Object> nameColumn = new 
TextColumnWithTooltip<Object>() {
             @Override
             public String getValue(Object object) {
@@ -82,6 +82,10 @@
         entityTable.addColumn(diskColumn, constants.disksVm(), "50px"); 
//$NON-NLS-1$
 
         entityTable.addColumn(getClusterColumn(), constants.clusterVm(), 
"150px"); //$NON-NLS-1$
+
+        if (model.isQuotaEnabled()) {
+            entityTable.addColumn(getClusterQuotaColumn(), 
constants.quotaVm(), "150px"); //$NON-NLS-1$
+        }
     }
 
     @Override


-- 
To view, visit http://gerrit.ovirt.org/28727
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85244d2eea3c3224bf7aac413db30bc31016741f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to