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 <lver...@redhat.com> --- 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 2 files changed, 1 insertion(+), 138 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/20754/1 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 6ab6d88..0000000 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.ovirt.engine.ui.uicommonweb.models.vms; - -import java.util.ArrayList; - -import org.ovirt.engine.core.common.businessentities.VMStatus; -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, - VMStatus.Down, - 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..211d644 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 @@ -4,7 +4,6 @@ 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,15 +13,8 @@ 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(); @@ -30,7 +22,6 @@ .getConstants() .vmAddAnotherVirtualDiskAction(); - private ArrayList<VmNetworkInterface> nics; private ArrayList<Disk> disks; @Override @@ -47,19 +38,7 @@ } 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 @@ -73,22 +52,8 @@ } private void updateOptionsPostData() { - if (nics == null || disks == null) { + if (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); } // Add disk action. @@ -122,48 +87,7 @@ } 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(); - } } public void addDisk() @@ -204,10 +128,6 @@ { super.executeCommand(command); - if (StringHelper.stringsEqual(command.getName(), "AddNetwork")) //$NON-NLS-1$ - { - addNetwork(); - } if (StringHelper.stringsEqual(command.getName(), "AddDisk")) //$NON-NLS-1$ { addDisk(); -- To view, visit http://gerrit.ovirt.org/20754 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I870e7898f788e691741bfc4bc1b24c898ab4100b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <lver...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches