Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Remove NICs from VM Guide Me
......................................................................

webadmin: Remove NICs from VM Guide Me

Since virtual network interfaces can now be added in the add VM dialog
itself, there's no longer need for them to take part in the following
Guide Me flow.

Change-Id: I870e7898f788e691741bfc4bc1b24c898ab4100b
Bug-Url: https://bugzilla.redhat.com/1024249
Signed-off-by: Lior Vernia <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideDiskModel.java
D 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
4 files changed, 11 insertions(+), 178 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/20768/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideDiskModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideDiskModel.java
index affb3a3..9e8398a 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideDiskModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideDiskModel.java
@@ -11,11 +11,6 @@
     @Override
     protected void postSave() {
         super.postSave();
-        sourceModel.postAction();
-    }
-
-    protected void cancel() {
-        super.cancel();
-        sourceModel.resetData();
+        sourceModel.updateOptions();
     }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java
deleted file mode 100644
index d3326c3..0000000
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.ovirt.engine.ui.uicommonweb.models.vms;
-
-import java.util.ArrayList;
-
-import org.ovirt.engine.core.common.businessentities.VmBase;
-import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
-import org.ovirt.engine.core.compat.Guid;
-import org.ovirt.engine.core.compat.Version;
-import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
-import org.ovirt.engine.ui.uicompat.ConstantsManager;
-
-public class NewGuideVmInterfaceModel extends NewVmInterfaceModel {
-
-    public static NewGuideVmInterfaceModel createInstance(VmBase vm,
-            Guid dcId,
-            Version clusterCompatibilityVersion,
-            ArrayList<VmNetworkInterface> vmNicList,
-            EntityModel sourceModel) {
-        NewGuideVmInterfaceModel instance = new NewGuideVmInterfaceModel(vm, 
dcId, clusterCompatibilityVersion, vmNicList, sourceModel);
-        instance.init();
-        return instance;
-    }
-
-    protected NewGuideVmInterfaceModel(VmBase vm,
-            Guid dcId,
-            Version clusterCompatibilityVersion,
-            ArrayList<VmNetworkInterface> vmNicList,
-            EntityModel sourceModel) {
-        super(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel);
-        
setTitle(ConstantsManager.getInstance().getConstants().newNetworkInterfaceTitle());
-        setHashName("new_network_interface_vms_guide"); //$NON-NLS-1$
-    }
-
-    @Override
-    public void postOnSave() {
-        super.postOnSave();
-        getSourceModel().postAction();
-    }
-
-    @Override
-    public VmGuideModel getSourceModel() {
-        return (VmGuideModel) super.getSourceModel();
-    }
-
-    @Override
-    protected void cancel() {
-        super.cancel();
-        getSourceModel().resetData();
-    }
-
-}
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java
index fc0552d..56b5efe 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java
@@ -1,10 +1,9 @@
 package org.ovirt.engine.ui.uicommonweb.models.vms;
 
-import java.util.ArrayList;
+import java.util.Collection;
 
 import org.ovirt.engine.core.common.businessentities.Disk;
 import org.ovirt.engine.core.common.businessentities.VM;
-import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import org.ovirt.engine.core.compat.StringHelper;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
 import org.ovirt.engine.ui.frontend.Frontend;
@@ -14,24 +13,14 @@
 import org.ovirt.engine.ui.uicommonweb.models.GuideModel;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
 
-@SuppressWarnings("unused")
 public class VmGuideModel extends GuideModel
 {
-    public final String VmConfigureNetworkInterfacesAction = 
ConstantsManager.getInstance()
-            .getConstants()
-            .vmConfigureNetworkInterfacesAction();
-    public final String VmAddAnotherNetworkInterfaceAction = 
ConstantsManager.getInstance()
-            .getConstants()
-            .vmAddAnotherNetworkInterfaceAction();
     public final String VmConfigureVirtualDisksAction = 
ConstantsManager.getInstance()
             .getConstants()
             .vmConfigureVirtualDisksAction();
     public final String VmAddAnotherVirtualDiskAction = 
ConstantsManager.getInstance()
             .getConstants()
             .vmAddAnotherVirtualDiskAction();
-
-    private ArrayList<VmNetworkInterface> nics;
-    private ArrayList<Disk> disks;
 
     @Override
     public VM getEntity()
@@ -46,51 +35,7 @@
         updateOptions();
     }
 
-    private void updateOptionsData() {
-        nics = null;
-        disks = null;
-        AsyncDataProvider.getVmNicList(new AsyncQuery(this,
-                new INewAsyncCallback() {
-                    @Override
-                    public void onSuccess(Object target, Object returnValue) {
-                        VmGuideModel vmGuideModel = (VmGuideModel) target;
-                        ArrayList<VmNetworkInterface> nics =
-                                (ArrayList<VmNetworkInterface>) returnValue;
-                        vmGuideModel.nics = nics;
-                        vmGuideModel.updateOptionsPostData();
-                    }
-                }), getEntity().getId());
-        AsyncDataProvider.getVmDiskList(new AsyncQuery(this,
-                new INewAsyncCallback() {
-                    @Override
-                    public void onSuccess(Object target, Object returnValue) {
-                        VmGuideModel vmGuideModel = (VmGuideModel) target;
-                        ArrayList<Disk> disks = (ArrayList<Disk>) returnValue;
-                        vmGuideModel.disks = disks;
-                        vmGuideModel.updateOptionsPostData();
-                    }
-                }), getEntity().getId());
-    }
-
-    private void updateOptionsPostData() {
-        if (nics == null || disks == null) {
-            return;
-        }
-
-        // Add NIC action.
-        UICommand addNicAction = new UICommand("AddNetwork", this); 
//$NON-NLS-1$
-
-        if (nics.isEmpty())
-        {
-            addNicAction.setTitle(VmConfigureNetworkInterfacesAction);
-            getCompulsoryActions().add(addNicAction);
-        }
-        else
-        {
-            addNicAction.setTitle(VmAddAnotherNetworkInterfaceAction);
-            getOptionalActions().add(addNicAction);
-        }
-
+    private void updateOptionsPostData(Collection<Disk> disks) {
         // Add disk action.
         UICommand addDiskAction = new UICommand("AddDisk", this); //$NON-NLS-1$
 
@@ -108,7 +53,7 @@
         stopProgress();
     }
 
-    private void updateOptions()
+    public void updateOptions()
     {
         getCompulsoryActions().clear();
         getOptionalActions().clear();
@@ -117,52 +62,13 @@
         {
             startProgress(null);
 
-            updateOptionsData();
-        }
-    }
-
-    public void resetData() {
-        nics = null;
-        disks = null;
-    }
-
-    private void addNetworkUpdateData() {
-        nics = null;
-        AsyncDataProvider.getVmNicList(new AsyncQuery(this,
-                new INewAsyncCallback() {
-                    @Override
-                    public void onSuccess(Object target, Object returnValue) {
-                        VmGuideModel vmGuideModel = (VmGuideModel) target;
-                        ArrayList<VmNetworkInterface> nics =
-                                (ArrayList<VmNetworkInterface>) returnValue;
-                        vmGuideModel.nics = nics;
-                        vmGuideModel.addNetworkPostData();
-                    }
-                }), getEntity().getId());
-    }
-
-    private void addNetworkPostData() {
-        if (nics == null) {
-            return;
-        }
-
-        VmInterfaceModel model =
-                
NewGuideVmInterfaceModel.createInstance(getEntity().getStaticData(), 
getEntity().getStoragePoolId(),
-                        getEntity().getVdsGroupCompatibilityVersion(),
-                        nics,
-                        this);
-        setWindow(model);
-
-        stopProgress();
-    }
-
-    public void addNetwork()
-    {
-        if (getEntity() != null)
-        {
-            startProgress(null);
-
-            addNetworkUpdateData();
+            AsyncDataProvider.getVmDiskList(new AsyncQuery(this,
+                    new INewAsyncCallback() {
+                        @Override
+                        public void onSuccess(Object target, Object 
returnValue) {
+                            updateOptionsPostData((Collection<Disk>) 
returnValue);
+                        }
+                    }), getEntity().getId());
         }
     }
 
@@ -186,15 +92,8 @@
         model.initialize();
     }
 
-    public void postAction()
-    {
-        resetData();
-        updateOptions();
-    }
-
     public void cancel()
     {
-        resetData();
         setWindow(null);
         Frontend.Unsubscribe();
     }
@@ -204,10 +103,6 @@
     {
         super.executeCommand(command);
 
-        if (StringHelper.stringsEqual(command.getName(), "AddNetwork")) 
//$NON-NLS-1$
-        {
-            addNetwork();
-        }
         if (StringHelper.stringsEqual(command.getName(), "AddDisk")) 
//$NON-NLS-1$
         {
             addDisk();
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 3c8129f..e65c855 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
@@ -1357,12 +1357,6 @@
     @DefaultStringValue("Allocation can be modified only when importing a 
single VM")
     String allocCanBeModifiedOnlyWhenImportSingleVm();
 
-    @DefaultStringValue("Configure Network Interfaces")
-    String vmConfigureNetworkInterfacesAction();
-
-    @DefaultStringValue("Add another Network Interface")
-    String vmAddAnotherNetworkInterfaceAction();
-
     @DefaultStringValue("Configure Virtual Disks")
     String vmConfigureVirtualDisksAction();
 


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

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

Reply via email to