Alexander Wels has uploaded a new change for review.

Change subject: Revert "webadmin: cluster guide me datacenter"
......................................................................

Revert "webadmin: cluster guide me datacenter"

This reverts commit 11d5777f8bc8f970a56bb661ab77e35b0cdeac7b.

Change-Id: I38db944a4ccd5bc81ac2b69d23058b02ddbdf461
Signed-off-by: Alexander Wels <aw...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
D 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/AddDataCenterClusterPopupPresenterWidget.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/guide/GuidePopupPresenterWidget.java
D 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.java
D 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.ui.xml
8 files changed, 172 insertions(+), 435 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/40821/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
index a418331..b14a121 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
@@ -223,12 +223,11 @@
                     return;
                 }
 
-                getListModel().setSelectedItems(null);
-                getListModel().setSelectedItem(null);
                 // Clear "IsSelected"
                 for (EntityModel entity : (List<EntityModel>) 
getListModel().getItems()) {
                     entity.setIsSelected(false);
                 }
+                getListModel().setSelectedItems(null);
 
                 // Set "IsSelected"
                 SelectionModel<? super EntityModel> selectionModel = 
EntityModelCellTable.this.getSelectionModel();
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
index 242da0c..f0f29d0 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
@@ -10,7 +10,6 @@
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters;
 import org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters;
-import org.ovirt.engine.core.common.action.VdsGroupOperationParameters;
 import org.ovirt.engine.core.common.businessentities.StoragePool;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
@@ -40,33 +39,27 @@
 import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback;
 import org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback;
 
-public class ClusterGuideModel extends GuideModel {
+@SuppressWarnings("unused")
+public class ClusterGuideModel extends GuideModel
+{
 
-    //Action command names
-    private static final String ADD_DATA_CENTER = "AddDataCenter"; 
//$NON-NLS-1$
-    private static final String CANCEL_CONFIRM_WITH_FOCUS = 
"CancelConfirmWithFocus"; //$NON-NLS-1$
-    private static final String CANCEL_CONFIRM = "CancelConfirm"; //$NON-NLS-1$
-    private static final String CANCEL = "Cancel"; //$NON-NLS-1$
-    private static final String ON_SELECT_HOST = "OnSelectHost"; //$NON-NLS-1$
-    private static final String SELECT_HOST = "SelectHost"; //$NON-NLS-1$
-    private static final String ON_ADD_HOST = "OnAddHost"; //$NON-NLS-1$
-    private static final String ON_CONFIRM_PM_HOST = "OnConfirmPMHost"; 
//$NON-NLS-1$
-    private static final String ADD_HOST = "AddHost"; //$NON-NLS-1$
-    private static final String ON_ADD_DATACENTER = "OnAddDataCenter"; 
//$NON-NLS-1$
-
-    //Pop-up and button titles.
-    private final String clusterConfigureHostsActionTitle =
-            
ConstantsManager.getInstance().getConstants().configureHostClusterGuide();
-    private final String clusterAddAnotherHostActionTitle =
-            
ConstantsManager.getInstance().getConstants().addAnotherHostClusterGuide();
-    private final String selectHostsActionTitle =
-            
ConstantsManager.getInstance().getConstants().selectHostsClusterGuide();
-    private final String addDataCenterTitle = 
ConstantsManager.getInstance().getConstants().addDataCenter();
-    private final String noAvailableActions = 
ConstantsManager.getInstance().getConstants().guidePopupNoActionsLabel();
+    public final String ClusterConfigureHostsAction = 
ConstantsManager.getInstance()
+            .getConstants()
+            .configureHostClusterGuide();
+    public final String ClusterAddAnotherHostAction = 
ConstantsManager.getInstance()
+            .getConstants()
+            .addAnotherHostClusterGuide();
+    public final String SelectHostsAction = 
ConstantsManager.getInstance().getConstants().selectHostsClusterGuide();
 
     @Override
-    public VDSGroup getEntity() {
+    public VDSGroup getEntity()
+    {
         return (VDSGroup) ((super.getEntity() instanceof VDSGroup) ? 
super.getEntity() : null);
+    }
+
+    public void setEntity(VDSGroup value)
+    {
+        super.setEntity(value);
     }
 
     @Override
@@ -94,16 +87,16 @@
                     }
                 }), getEntity().getName());
 
-        AsyncDataProvider.getInstance().getHostList(new AsyncQuery(this, new 
INewAsyncCallback() {
-                @Override
-                public void onSuccess(Object target, Object returnValue) {
-                    ClusterGuideModel clusterGuideModel = (ClusterGuideModel) 
target;
-                    ArrayList<VDS> hosts = (ArrayList<VDS>) returnValue;
-                    clusterGuideModel.allHosts = hosts;
-                    clusterGuideModel.updateOptionsNonLocalFS();
-                }
-            }
-        ));
+        AsyncDataProvider.getInstance().getHostList(new AsyncQuery(this,
+                                                                   new 
INewAsyncCallback() {
+                                                                       
@Override
+                                                                       public 
void onSuccess(Object target, Object returnValue) {
+                                                                           
ClusterGuideModel clusterGuideModel = (ClusterGuideModel) target;
+                                                                           
ArrayList<VDS> hosts = (ArrayList<VDS>) returnValue;
+                                                                           
clusterGuideModel.allHosts = hosts;
+                                                                           
clusterGuideModel.updateOptionsNonLocalFS();
+                                                                       }
+                                                                   }));
         if (getEntity().supportsGlusterService()) {
             AsyncDataProvider.getInstance().isAnyHostUpInCluster(new 
AsyncQuery(this,
                     new INewAsyncCallback() {
@@ -140,21 +133,26 @@
             return;
         }
         // Add host action.
-        UICommand addHostAction = new UICommand(ADD_HOST, this);
+        UICommand addHostAction = new UICommand("AddHost", this); //$NON-NLS-1$
 
-        if (hosts.size() > 1) {
+        if (hosts.size() > 1)
+        {
             hosts.remove(0);
         }
 
-        if (hosts.isEmpty()) {
-            addHostAction.setTitle(clusterConfigureHostsActionTitle);
+        if (hosts.isEmpty())
+        {
+            addHostAction.setTitle(ClusterConfigureHostsAction);
             getCompulsoryActions().add(addHostAction);
-        } else if (isAnyUpHostInCluster()) {
-            addHostAction.setTitle(clusterAddAnotherHostActionTitle);
+        }
+        else if (isAnyUpHostInCluster())
+        {
+            addHostAction.setTitle(ClusterAddAnotherHostAction);
             getOptionalActions().add(addHostAction);
         }
 
-        if (getEntity().getStoragePoolId() == null) {
+        if (getEntity().getStoragePoolId() == null)
+        {
             
addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance()
                     .getConstants()
                     .theClusterIsntAttachedToADcClusterGuide());
@@ -163,23 +161,29 @@
         }
 
         ArrayList<VDS> availableHosts = new ArrayList<VDS>();
-        for (VDS vds : allHosts) {
+        for (VDS vds : allHosts)
+        {
             if (!getEntity().getId().equals(vds.getVdsGroupId())
                     && (vds.getStatus() == VDSStatus.Maintenance || 
vds.getStatus() == VDSStatus.PendingApproval)
-                    && vds.getSupportedClusterVersionsSet() != null
-                    && 
vds.getSupportedClusterVersionsSet().contains(getEntity().getCompatibilityVersion()))
 {
+                    && vds.getSupportedClusterVersionsSet() != null &&
+                    
vds.getSupportedClusterVersionsSet().contains(getEntity().getCompatibilityVersion()))
+            {
                 availableHosts.add(vds);
             }
         }
         // Select host action.
-        UICommand selectHostAction = new UICommand(SELECT_HOST, this);
+        UICommand selectHostAction = new UICommand("SelectHost", this); 
//$NON-NLS-1$
 
-        if (availableHosts.size() > 0) {
-            if (hosts.isEmpty()) {
-                selectHostAction.setTitle(selectHostsActionTitle);
+        if (availableHosts.size() > 0)
+        {
+            if (hosts.isEmpty())
+            {
+                selectHostAction.setTitle(SelectHostsAction);
                 getCompulsoryActions().add(selectHostAction);
-            } else if (isAnyUpHostInCluster()) {
-                selectHostAction.setTitle(selectHostsActionTitle);
+            }
+            else if (isAnyUpHostInCluster())
+            {
+                selectHostAction.setTitle(SelectHostsAction);
                 getOptionalActions().add(selectHostAction);
             }
         }
@@ -189,12 +193,13 @@
 
     private void updateOptionsLocalFS() {
 
-        UICommand addHostAction = new UICommand(ADD_HOST, this);
-        addHostAction.setTitle(clusterAddAnotherHostActionTitle);
-        UICommand selectHost = new UICommand(SELECT_HOST, this);
-        selectHost.setTitle(selectHostsActionTitle);
+        UICommand addHostAction = new UICommand("AddHost", this); //$NON-NLS-1$
+        addHostAction.setTitle(ClusterAddAnotherHostAction);
+        UICommand selectHost = new UICommand("SelectHost", this); //$NON-NLS-1$
+        selectHost.setTitle(SelectHostsAction);
 
-        if (localStorageHost != null) {
+        if (localStorageHost != null)
+        {
             String hasHostReason =
                 ConstantsManager.getInstance()
                     .getConstants()
@@ -215,100 +220,34 @@
         stopProgress();
     }
 
-    private void updateOptions() {
+    private void updateOptions()
+    {
         getCompulsoryActions().clear();
         getOptionalActions().clear();
 
-        if (getEntity() == null) {
-            return;
-        }
-        startProgress(null);
-        if (getEntity().getStoragePoolId() != null) {
-            //Datacenter associated with this cluster.
-            AsyncDataProvider.getInstance().getDataCenterById(new 
AsyncQuery(this, new INewAsyncCallback() {
-                    @Override
-                    public void onSuccess(Object target, Object returnValue) {
-                        ClusterGuideModel model = (ClusterGuideModel) target;
-                        model.dataCenter = (StoragePool) returnValue;
+        if (getEntity() != null && getEntity().getStoragePoolId() != null)
+        {
+            startProgress(null);
 
-                        if (model.dataCenter == null
-                                || !model.dataCenter.isLocal()) {
-                            model.updateOptionsNonLocalFSData();
-                        } else {
-                            model.updateOptionsLocalFSData();
-                        }
-                    }
-                }), getEntity().getStoragePoolId());
-        } else {
-            //No data-center associated with this cluster.
-            AsyncDataProvider.getInstance().getDataCenterList(new 
AsyncQuery(this, new INewAsyncCallback() {
-                    @Override
-                    public void onSuccess(Object target, Object returnValue) {
-                        ClusterGuideModel model = (ClusterGuideModel) target;
-                        @SuppressWarnings("unchecked")
-                        List<StoragePool> dataCenters = 
(ArrayList<StoragePool>) returnValue;
-                        final List<StoragePool> localDataCenters = new 
ArrayList<StoragePool>();
-                        boolean enableButton = false;
-                        for (StoragePool dataCenter: dataCenters) {
-                            //Find at least one compatible data-center, so we 
can show the button.
-                            if 
(model.getEntity().getCompatibilityVersion().compareTo(
-                                    dataCenter.getCompatibilityVersion()) >= 0 
) {
-                                if (dataCenter.isLocal()) {
-                                    //Check if there are any clusters 
associated with this data-center already.
-                                    localDataCenters.add(dataCenter);
-                                } else {
-                                    enableButton = true;
-                                    break;
-                                }
+            AsyncDataProvider.getInstance().getDataCenterById(new 
AsyncQuery(this,
+                    new INewAsyncCallback() {
+                        @Override
+                        public void onSuccess(Object target, Object 
returnValue) {
+                            ClusterGuideModel model = (ClusterGuideModel) 
target;
+                            model.dataCenter = (StoragePool) returnValue;
+
+                            if (model.dataCenter == null
+                                    || !model.dataCenter.isLocal())
+                            {
+                                model.updateOptionsNonLocalFSData();
+                            }
+                            else
+                            {
+                                model.updateOptionsLocalFSData();
                             }
                         }
-                        if (enableButton || localDataCenters.isEmpty()) {
-                            
model.updateOptionsRequiredAddDataCenter(enableButton);
-                        } else {
-                            
model.updateOptionsRequiredAddDataCenter(localDataCenters);
-                        }
-                    }
-                }
-            ));
+                    }), getEntity().getStoragePoolId());
         }
-    }
-
-    protected void updateOptionsRequiredAddDataCenter(final List<StoragePool> 
localDataCenters) {
-        AsyncDataProvider.getInstance().getClusterList(new AsyncQuery(this,
-            new INewAsyncCallback() {
-                @Override
-                public void onSuccess(Object target, Object returnValue) {
-                    ClusterGuideModel model = (ClusterGuideModel) target;
-                    List<StoragePool> localDataCenterWithCluster = new 
ArrayList<StoragePool>();
-                    @SuppressWarnings("unchecked")
-                    List<VDSGroup> clusters = (List<VDSGroup>) returnValue;
-                    for (StoragePool dataCenter: localDataCenters) {
-                        for (VDSGroup cluster: clusters) {
-                            if (cluster.getStoragePoolId() != null &&
-                                    
cluster.getStoragePoolId().equals(dataCenter.getId())) {
-                                localDataCenterWithCluster.add(dataCenter);
-                                break;
-                            }
-                        }
-                    }
-                    localDataCenters.removeAll(localDataCenterWithCluster);
-                    
model.updateOptionsRequiredAddDataCenter(!localDataCenters.isEmpty());
-                }
-            })
-        );
-    }
-
-    protected void updateOptionsRequiredAddDataCenter(boolean enableButton) {
-        if (enableButton) {
-            // Add data-center action.
-            UICommand addDataCenterAction = new UICommand(ADD_DATA_CENTER, 
this);
-            addDataCenterAction.setTitle(addDataCenterTitle);
-            addDataCenterAction.setIsAvailable(enableButton);
-            getOptionalActions().add(addDataCenterAction);
-        } else {
-            setNote(new EntityModel<String>(noAvailableActions));
-        }
-        stopProgress();
     }
 
     private boolean isUpHostCheckCompleted() {
@@ -333,7 +272,8 @@
         isAnyHostUpInCluster = null;
     }
 
-    public void selectHost() {
+    public void selectHost()
+    {
         final ArrayList<VDSGroup> clusters = new ArrayList<VDSGroup>();
         clusters.add(getEntity());
 
@@ -368,20 +308,25 @@
                 }), getEntity().getStoragePoolId());
     }
 
-    public void onSelectHost() {
+    public void onSelectHost()
+    {
         MoveHost model = (MoveHost) getWindow();
 
-        if (model.getProgress() != null) {
+        if (model.getProgress() != null)
+        {
             return;
         }
 
-        if (!model.validate()) {
+        if (!model.validate())
+        {
             return;
         }
 
         model.setSelectedHosts(new ArrayList<VDS>());
-        for (EntityModel a : Linq.<EntityModel> cast(model.getItems())) {
-            if (a.getIsSelected()) {
+        for (EntityModel a : Linq.<EntityModel> cast(model.getItems()))
+        {
+            if (a.getIsSelected())
+            {
                 model.getSelectedHosts().add((VDS) a.getEntity());
             }
         }
@@ -390,9 +335,11 @@
 
         ArrayList<VdcActionParametersBase> paramerterList =
                 new ArrayList<VdcActionParametersBase>();
-        for (VDS host : model.getSelectedHosts()) {
+        for (VDS host : model.getSelectedHosts())
+        {
             // Try to change host's cluster as neccessary.
-            if (host.getVdsGroupId() != null && 
!host.getVdsGroupId().equals(cluster.getId())) {
+            if (host.getVdsGroupId() != null && 
!host.getVdsGroupId().equals(cluster.getId()))
+            {
                 paramerterList.add(new 
ChangeVDSClusterParameters(cluster.getId(), host.getId()));
 
             }
@@ -407,11 +354,14 @@
                         ArrayList<VDS> hosts = ((MoveHost) 
clusterGuideModel.getWindow()).getSelectedHosts();
                         ArrayList<VdcReturnValueBase> retVals =
                                 (ArrayList<VdcReturnValueBase>) 
result.getReturnValue();
-                        if (retVals != null && hosts.size() == retVals.size()) 
{
+                        if (retVals != null && hosts.size() == retVals.size())
+                        {
                             int i = 0;
-                            for (VDS selectedHost : hosts) {
+                            for (VDS selectedHost : hosts)
+                            {
                                 if (selectedHost.getStatus() == 
VDSStatus.PendingApproval && retVals.get(i) != null
-                                        && retVals.get(i).getSucceeded()) {
+                                        && retVals.get(i).getSucceeded())
+                                {
                                     
Frontend.getInstance().runAction(VdcActionType.ApproveVds,
                                             new 
ApproveVdsParameters(selectedHost.getId()));
                                 }
@@ -427,79 +377,8 @@
                 this);
     }
 
-    private void addDataCenter() {
-        AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery(this, 
new INewAsyncCallback() {
-            @Override
-            public void onSuccess(Object target, Object returnValue) {
-                ClusterGuideModel guideModel = (ClusterGuideModel) target;
-                @SuppressWarnings("unchecked")
-                List<StoragePool> allDataCenters = (List<StoragePool>) 
returnValue;
-                List<EntityModel<StoragePool>> filteredDataCenters = new 
ArrayList<EntityModel<StoragePool>>();
-                List<StoragePool> localDataCenters = new 
ArrayList<StoragePool>();
-                for (StoragePool dataCenter: allDataCenters) {
-                    //Find at least one compatible data-center, so we can show 
the button.
-                    if 
(guideModel.getEntity().getCompatibilityVersion().compareTo(
-                            dataCenter.getCompatibilityVersion()) >= 0) {
-                        if (dataCenter.isLocal()) {
-                            //Check if there are any clusters associated with 
this data-center already.
-                            localDataCenters.add(dataCenter);
-                        } else {
-                            filteredDataCenters.add(new 
EntityModel<StoragePool>(dataCenter));
-                        }
-                    }
-                }
-                if (localDataCenters.isEmpty()) {
-                    displayAddDataCenter(filteredDataCenters);
-                } else {
-                    verifyLocalDataCenterNoCluster(filteredDataCenters, 
localDataCenters);
-                }
-            }
-
-        }
-    ));
-
-    }
-
-    private void verifyLocalDataCenterNoCluster(final 
List<EntityModel<StoragePool>> filteredDataCenters,
-            final List<StoragePool> localDataCenters) {
-        AsyncDataProvider.getInstance().getClusterList(new AsyncQuery(this, 
new INewAsyncCallback() {
-                @Override
-                public void onSuccess(Object target, Object returnValue) {
-                    List<StoragePool> localDataCenterWithCluster = new 
ArrayList<StoragePool>();
-                    @SuppressWarnings("unchecked")
-                    List<VDSGroup> clusters = (List<VDSGroup>) returnValue;
-                    for (StoragePool dataCenter: localDataCenters) {
-                        for (VDSGroup cluster: clusters) {
-                            if (cluster.getStoragePoolId() != null &&
-                                    
cluster.getStoragePoolId().equals(dataCenter.getId())) {
-                                localDataCenterWithCluster.add(dataCenter);
-                                break;
-                            }
-                        }
-                    }
-                    localDataCenters.removeAll(localDataCenterWithCluster);
-                    for (StoragePool dataCenter: localDataCenters) {
-                        filteredDataCenters.add(new 
EntityModel<StoragePool>(dataCenter));
-                    }
-                    displayAddDataCenter(filteredDataCenters);
-                }
-            })
-        );
-    }
-
-    private void displayAddDataCenter(List<EntityModel<StoragePool>> 
dataCenters) {
-        ListModel<EntityModel<StoragePool>> dataCentersModel = new 
ListModel<EntityModel<StoragePool>>();
-        dataCentersModel.setItems(dataCenters);
-        dataCentersModel.setTitle(addDataCenterTitle);
-        dataCentersModel.setHashName("add_datacenter"); //$NON-NLS-1$
-        setWindow(dataCentersModel);
-        UICommand tempVar = 
UICommand.createDefaultOkUiCommand(ON_ADD_DATACENTER, ClusterGuideModel.this);
-        dataCentersModel.getCommands().add(tempVar);
-        UICommand tempVar2 = UICommand.createCancelUiCommand(CANCEL, 
ClusterGuideModel.this);
-        dataCentersModel.getCommands().add(tempVar2);
-    }
-
-    public void addHost() {
+    public void addHost()
+    {
         HostModel model = new NewHostModel();
         setWindow(model);
         
model.setTitle(ConstantsManager.getInstance().getConstants().newHostTitle());
@@ -513,26 +392,28 @@
         model.getCluster().setIsChangeable(false);
 
         AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery(this,
-             new INewAsyncCallback() {
-                 @Override
-                 public void onSuccess(Object target, Object returnValue) {
-                     ClusterGuideModel clusterGuideModel = (ClusterGuideModel) 
target;
-                     HostModel model = (HostModel) 
clusterGuideModel.getWindow();
+                                                                         new 
INewAsyncCallback() {
+                                                                             
@Override
+                                                                             
public void onSuccess(Object target, Object returnValue) {
+                                                                               
  ClusterGuideModel clusterGuideModel = (ClusterGuideModel) target;
+                                                                               
  HostModel model = (HostModel) clusterGuideModel.getWindow();
 
-                     ArrayList<StoragePool> dataCenters = 
(ArrayList<StoragePool>) returnValue;
-                     model.getDataCenter().setItems(dataCenters);
-                     if (getEntity().getStoragePoolId() != null) {
-                         
model.getDataCenter().setSelectedItem(Linq.firstOrDefault(dataCenters,
-                               new 
Linq.DataCenterPredicate(clusterGuideModel.getEntity().getStoragePoolId())));
-                     }
-                     model.getDataCenter().setIsChangeable(false);
+                                                                               
  ArrayList<StoragePool> dataCenters = (ArrayList<StoragePool>) returnValue;
+                                                                               
  model.getDataCenter().setItems(dataCenters);
+                                                                               
  if (getEntity().getStoragePoolId() != null) {
+                                                                               
      model.getDataCenter().setSelectedItem(Linq.firstOrDefault(dataCenters,
+                                                                               
                                                                new 
Linq.DataCenterPredicate(clusterGuideModel.getEntity()
+                                                                               
                                                                                
                     .getStoragePoolId())));
+                                                                               
  }
+                                                                               
  model.getDataCenter().setIsChangeable(
+                                                                               
          false);
 
-                     UICommand tempVar = 
UICommand.createDefaultOkUiCommand("OnConfirmPMHost", clusterGuideModel); 
//$NON-NLS-1$
-                     model.getCommands().add(tempVar);
-                     UICommand tempVar2 = 
UICommand.createCancelUiCommand("Cancel", clusterGuideModel); //$NON-NLS-1$
-                     model.getCommands().add(tempVar2);
-                 }
-             }));
+                                                                               
  UICommand tempVar = UICommand.createDefaultOkUiCommand("OnConfirmPMHost", 
clusterGuideModel); //$NON-NLS-1$
+                                                                               
  model.getCommands().add(tempVar);
+                                                                               
  UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", 
clusterGuideModel); //$NON-NLS-1$
+                                                                               
  model.getCommands().add(tempVar2);
+                                                                             }
+                                                                         }));
 
         ListModel<VDSGroup> clusterModel = model.getCluster();
         if (clusterModel.getSelectedItem() != null) {
@@ -549,15 +430,18 @@
         }
     }
 
-    public void onConfirmPMHost() {
+    public void onConfirmPMHost()
+    {
         HostModel model = (HostModel) getWindow();
 
-        if (!model.validate()) {
+        if (!model.validate())
+        {
             return;
         }
 
         if (!model.getIsPm().getEntity()
-                && ApplicationModeHelper.getUiMode() != 
ApplicationMode.GlusterOnly) {
+                && ApplicationModeHelper.getUiMode() != 
ApplicationMode.GlusterOnly)
+        {
             ConfirmationModel confirmModel = new ConfirmationModel();
             setConfirmWindow(confirmModel);
             
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().powerManagementConfigurationTitle());
@@ -569,53 +453,26 @@
             confirmModel.getCommands().add(tempVar);
             UICommand tempVar2 = 
UICommand.createCancelUiCommand("CancelConfirmWithFocus", this); //$NON-NLS-1$
             confirmModel.getCommands().add(tempVar2);
-        } else {
+        }
+        else
+        {
             onAddHost();
         }
     }
 
-    public void onAddDataCenter() {
-
-        @SuppressWarnings("unchecked")
-        ListModel<EntityModel<StoragePool>> dataCentersModel = 
(ListModel<EntityModel<StoragePool>>)getWindow();
-        EntityModel<StoragePool> dataCenter = 
dataCentersModel.getSelectedItem();
-
-        if (dataCenter != null) {
-            VDSGroup cluster = getEntity();
-            cluster.setStoragePoolId(dataCenter.getEntity().getId());
-            dataCentersModel.startProgress(null);
-
-            Frontend.getInstance().runAction(VdcActionType.UpdateVdsGroup, new 
VdsGroupOperationParameters(cluster),
-                new IFrontendActionAsyncCallback() {
-                    @Override
-                    public void executed(FrontendActionAsyncResult result) {
-
-                        if (result.getReturnValue().getSucceeded()) {
-                            //Succeeded, close this window.
-                            ClusterGuideModel guideModel = (ClusterGuideModel) 
result.getState();
-                            guideModel.postAction();
-                        }
-                        //Close popup window.
-                        setWindow(null);
-
-                    }
-                },
-            this);
-        } else {
-            setWindow(null);
-        }
-    }
-
-    public void onAddHost() {
+    public void onAddHost()
+    {
         cancelConfirm();
 
         HostModel model = (HostModel) getWindow();
 
-        if (model.getProgress() != null) {
+        if (model.getProgress() != null)
+        {
             return;
         }
 
-        if (!model.validate()) {
+        if (!model.validate())
+        {
             return;
         }
 
@@ -691,32 +548,38 @@
         return agents;
     }
 
-    public void postOnAddHost(VdcReturnValueBase returnValue) {
+    public void postOnAddHost(VdcReturnValueBase returnValue)
+    {
         HostModel model = (HostModel) getWindow();
 
         model.stopProgress();
 
-        if (returnValue != null && returnValue.getSucceeded()) {
+        if (returnValue != null && returnValue.getSucceeded())
+        {
             cancel();
             postAction();
         }
     }
 
-    private void postAction() {
+    private void postAction()
+    {
         resetData();
         updateOptions();
     }
 
-    public void cancel() {
+    public void cancel()
+    {
         resetData();
         setWindow(null);
     }
 
-    public void cancelConfirm() {
+    public void cancelConfirm()
+    {
         setConfirmWindow(null);
     }
 
-    public void cancelConfirmWithFocus() {
+    public void cancelConfirmWithFocus()
+    {
         setConfirmWindow(null);
 
         HostModel hostModel = (HostModel) getWindow();
@@ -724,38 +587,41 @@
     }
 
     @Override
-    public void executeCommand(UICommand command) {
+    public void executeCommand(UICommand command)
+    {
         super.executeCommand(command);
 
-        if (ADD_HOST.equals(command.getName())) {
+        if ("AddHost".equals(command.getName())) //$NON-NLS-1$
+        {
             addHost();
         }
-        if (ON_CONFIRM_PM_HOST.equals(command.getName())) {
+        if ("OnConfirmPMHost".equals(command.getName())) //$NON-NLS-1$
+        {
             onConfirmPMHost();
         }
-        if (ON_ADD_HOST.equals(command.getName())) {
+        if ("OnAddHost".equals(command.getName())) //$NON-NLS-1$
+        {
             onAddHost();
         }
-        if (SELECT_HOST.equals(command.getName())) {
+        if ("SelectHost".equals(command.getName())) //$NON-NLS-1$
+        {
             selectHost();
         }
-        if (ON_SELECT_HOST.equals(command.getName())) {
+        if ("OnSelectHost".equals(command.getName())) //$NON-NLS-1$
+        {
             onSelectHost();
         }
-        if (CANCEL.equals(command.getName())) {
+        if ("Cancel".equals(command.getName())) //$NON-NLS-1$
+        {
             cancel();
         }
-        if (CANCEL_CONFIRM.equals(command.getName())) {
+        if ("CancelConfirm".equals(command.getName())) //$NON-NLS-1$
+        {
             cancelConfirm();
         }
-        if (CANCEL_CONFIRM_WITH_FOCUS.equals(command.getName())) {
+        if ("CancelConfirmWithFocus".equals(command.getName())) //$NON-NLS-1$
+        {
             cancelConfirmWithFocus();
-        }
-        if (ADD_DATA_CENTER.equals(command.getName())) {
-            addDataCenter();
-        }
-        if (ON_ADD_DATACENTER.equals(command.getName())) {
-            onAddDataCenter();
         }
     }
 }
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
index 95aa5ff..85a1492 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
@@ -1,6 +1,5 @@
 package org.ovirt.engine.ui.uicompat;
 
-import com.google.gwt.i18n.client.Constants;
 import org.ovirt.engine.core.common.businessentities.VmPool;
 
 import com.google.gwt.i18n.client.Constants;
@@ -1068,12 +1067,6 @@
 
     @DefaultStringValue("Configure Host")
     String configureHostClusterGuide();
-
-    @DefaultStringValue("No actions available on cluster.")
-    String guidePopupNoActionsLabel();
-
-    @DefaultStringValue("Attach Cluster to Data Center")
-    String addDataCenter();
 
     @DefaultStringValue("Add another Host")
     String addAnotherHostClusterGuide();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
index 2204447..f6ff0dd 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
@@ -22,7 +22,6 @@
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.StorageQosPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.SystemPermissionsRemoveConfirmationPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.bookmark.BookmarkPopupPresenterWidget;
-import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.AddDataCenterClusterPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterManageNetworkPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookContentPopupPresenterWidget;
@@ -282,7 +281,6 @@
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.PermissionsPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.SystemPermissionsRemoveConfirmationPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.bookmark.BookmarkPopupView;
-import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.AddDataCenterClusterPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.ClusterManageNetworkPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.ClusterPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.GlusterHookContentPopupView;
@@ -1271,11 +1269,6 @@
         bindPresenterWidget(VolumeProfileStatisticsPopupPresenterWidget.class,
                 VolumeProfileStatisticsPopupPresenterWidget.ViewDef.class,
                 VolumeProfileStatisticsPopupView.class);
-
-        bindPresenterWidget(AddDataCenterClusterPopupPresenterWidget.class,
-                AddDataCenterClusterPopupPresenterWidget.ViewDef.class,
-                AddDataCenterClusterPopupView.class);
-
         // Host
         bindPresenterWidget(HostPopupPresenterWidget.class,
                 HostPopupPresenterWidget.ViewDef.class,
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/AddDataCenterClusterPopupPresenterWidget.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/AddDataCenterClusterPopupPresenterWidget.java
deleted file mode 100644
index e455d08..0000000
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/AddDataCenterClusterPopupPresenterWidget.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster;
-
-import org.ovirt.engine.core.common.businessentities.StoragePool;
-import 
org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget;
-import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
-import org.ovirt.engine.ui.uicommonweb.models.ListModel;
-
-import com.google.gwt.event.shared.EventBus;
-import com.google.inject.Inject;
-
-public class AddDataCenterClusterPopupPresenterWidget extends 
AbstractModelBoundPopupPresenterWidget
-    <ListModel<EntityModel<StoragePool>>, 
AddDataCenterClusterPopupPresenterWidget.ViewDef> {
-
-    public interface ViewDef extends 
AbstractModelBoundPopupPresenterWidget.ViewDef<ListModel<EntityModel<StoragePool>>>
 {
-    }
-
-    @Inject
-    public AddDataCenterClusterPopupPresenterWidget(EventBus eventBus, ViewDef 
view) {
-        super(eventBus, view);
-    }
-}
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/guide/GuidePopupPresenterWidget.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/guide/GuidePopupPresenterWidget.java
index ed626fc..e4926ad 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/guide/GuidePopupPresenterWidget.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/guide/GuidePopupPresenterWidget.java
@@ -6,7 +6,6 @@
 import org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel;
 import org.ovirt.engine.ui.uicommonweb.models.GuideModel;
 import org.ovirt.engine.ui.uicommonweb.models.Model;
-import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.AddDataCenterClusterPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.datacenter.FindMultiStoragePopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.datacenter.FindSingleStoragePopupPresenterWidget;
@@ -36,7 +35,6 @@
     private final Provider<FindSingleStoragePopupPresenterWidget> 
singleStoragePopupProvider;
     private final Provider<FindMultiStoragePopupPresenterWidget> 
multiStoragePopupProvider;
     private final Provider<StorageForceCreatePopupPresenterWidget> 
forceCreateConfirmPopupProvider;
-    private final Provider<AddDataCenterClusterPopupPresenterWidget> 
addDatacenterClusterPopupProvider;
 
     @Inject
     public GuidePopupPresenterWidget(EventBus eventBus, ViewDef view,
@@ -50,8 +48,7 @@
             Provider<VmDiskAttachPopupPresenterWidget> 
vmDiskAttachPopupPopupProvider,
             Provider<MoveHostPopupPresenterWidget> moveHostPopupProvider,
             Provider<FindSingleStoragePopupPresenterWidget> 
singleStoragePopupProvider,
-            Provider<FindMultiStoragePopupPresenterWidget> 
multiStoragePopupProvider,
-            Provider<AddDataCenterClusterPopupPresenterWidget> 
addDatacenterClusterPopupProvider) {
+            Provider<FindMultiStoragePopupPresenterWidget> 
multiStoragePopupProvider) {
         super(eventBus, view, defaultConfirmPopupProvider);
         this.forceCreateConfirmPopupProvider = forceCreateConfirmPopupProvider;
         this.clusterPopupProvider = clusterPopupProvider;
@@ -63,7 +60,6 @@
         this.moveHostPopupProvider = moveHostPopupProvider;
         this.singleStoragePopupProvider = singleStoragePopupProvider;
         this.multiStoragePopupProvider = multiStoragePopupProvider;
-        this.addDatacenterClusterPopupProvider = 
addDatacenterClusterPopupProvider;
     }
 
     @Override
@@ -93,8 +89,6 @@
             return vmDiskPopupPopupProvider.get();
         } else if (lastExecutedCommandName.equals("AttachDisk")) { 
//$NON-NLS-1$
             return vmDiskAttachPopupPopupProvider.get();
-        } else if (lastExecutedCommandName.equals("AddDataCenter")) { 
//$NON-NLS-1$
-            return addDatacenterClusterPopupProvider.get();
         } else {
             return super.getModelPopup(source, lastExecutedCommand, 
windowModel);
         }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.java
deleted file mode 100644
index b831e2c..0000000
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster;
-
-import org.ovirt.engine.core.common.businessentities.StoragePool;
-import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
-import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
-import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable;
-import 
org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn;
-import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
-import org.ovirt.engine.ui.uicommonweb.models.ListModel;
-import org.ovirt.engine.ui.webadmin.ApplicationConstants;
-import org.ovirt.engine.ui.webadmin.gin.AssetProvider;
-import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.AddDataCenterClusterPopupPresenterWidget;
-
-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.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.inject.Inject;
-
-public class AddDataCenterClusterPopupView extends 
AbstractModelBoundPopupView<ListModel<EntityModel<StoragePool>>>
-    implements AddDataCenterClusterPopupPresenterWidget.ViewDef {
-
-    interface ViewUiBinder extends UiBinder<SimpleDialogPanel, 
AddDataCenterClusterPopupView> {
-        ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
-    }
-
-    interface Driver extends 
SimpleBeanEditorDriver<ListModel<EntityModel<StoragePool>>, 
AddDataCenterClusterPopupView> {
-    }
-    private static final ApplicationConstants constants = 
AssetProvider.getConstants();
-
-    @UiField(provided = true)
-    EntityModelCellTable<ListModel<EntityModel<StoragePool>>> dataCentersTable;
-
-    @Inject
-    public AddDataCenterClusterPopupView(EventBus eventBus) {
-        super(eventBus);
-        dataCentersTable = new 
EntityModelCellTable<ListModel<EntityModel<StoragePool>>>(false, false);
-        initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
-        initTableColumns();
-    }
-
-    private void initTableColumns() {
-        dataCentersTable.addColumn(new 
AbstractEntityModelTextColumn<StoragePool>() {
-            @Override
-            public String getText(StoragePool entity) {
-                return entity.getName();
-            }
-        }, constants.dataCenter());
-
-        dataCentersTable.addColumn(new 
AbstractEntityModelTextColumn<StoragePool>() {
-            @Override
-            public String getText(StoragePool entity) {
-                return entity.getCompatibilityVersion().getValue();
-            }
-        }, constants.comptVersDc());
-    }
-
-    @Override
-    public void edit(ListModel<EntityModel<StoragePool>> object) {
-        dataCentersTable.asEditor().edit(object);
-    }
-
-    @Override
-    public ListModel<EntityModel<StoragePool>> flush() {
-        return dataCentersTable.asEditor().flush();
-    }
-
-}
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.ui.xml
deleted file mode 100644
index 5f4adc6..0000000
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/AddDataCenterClusterPopupView.ui.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
-    xmlns:g="urn:import:com.google.gwt.user.client.ui" 
xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog"
-    xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor">
-
-    <ui:style>
-    </ui:style>
-
-    <d:SimpleDialogPanel width="400px" height="250px">
-        <d:content>
-            <g:ScrollPanel>
-                <e:EntityModelCellTable ui:field="dataCentersTable"/>
-            </g:ScrollPanel>
-        </d:content>
-    </d:SimpleDialogPanel>
-
-</ui:UiBinder>
\ No newline at end of file


-- 
To view, visit https://gerrit.ovirt.org/40821
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38db944a4ccd5bc81ac2b69d23058b02ddbdf461
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <aw...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to