Alona Kaplan has uploaded a new change for review.

Change subject: When creating a network the management network should be chosen
......................................................................

When creating a network the management network should be chosen

- If the management network is in the valid network list, it should be the
default selection.
- If empty network is part of the valid network list it should be the last
one displayed.

Change-Id: I196b5381bacf6352397eaecf625333ece93de785
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=903287
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
2 files changed, 15 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/11650/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java
index dec9509..71b430d 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java
@@ -78,6 +78,12 @@
 
     @Override
     protected void initSelectedNetwork(ArrayList<Network> networks) {
+        for (Network network : networks) {
+            if (ENGINE_NETWORK_NAME.equals(network.getName())) {
+                getNetwork().setSelectedItem(network);
+                return;
+            }
+        }
         getNetwork().setSelectedItem(networks.size() > 0 ? networks.get(0) : 
null);
     }
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
index 8afd0ac..bc34670 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
@@ -35,6 +35,8 @@
 @SuppressWarnings("unused")
 public abstract class VmInterfaceModel extends Model
 {
+    public static String ENGINE_NETWORK_NAME;
+
     private boolean privateIsNew;
     private EntityModel privateName;
     private ListModel privateNetwork;
@@ -64,6 +66,10 @@
             ArrayList<VmNetworkInterface> vmNicList,
             EntityModel sourceModel)
     {
+        // get management network name
+        ENGINE_NETWORK_NAME =
+                (String) 
AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.ManagementNetwork);
+
         this.vm = vm;
         this.vmNicList = vmNicList;
         this.sourceModel = sourceModel;
@@ -437,9 +443,6 @@
             public void OnSuccess(Object model1, Object result1)
             {
                 ArrayList<Network> networks = new ArrayList<Network>();
-                if (hotUpdateSupported) {
-                    networks.add(null);
-                }
                 for (Network a : (ArrayList<Network>) result1)
                 {
                     if (a.getCluster().getStatus() == 
NetworkStatus.OPERATIONAL && a.isVmNetwork())
@@ -447,6 +450,9 @@
                         networks.add(a);
                     }
                 }
+                if (hotUpdateSupported) {
+                    networks.add(null);
+                }
 
                 getNetwork().setItems(networks);
                 initSelectedNetwork(networks);


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

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

Reply via email to