Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Hide profiles tab if network is non-VM
......................................................................

webadmin: Hide profiles tab if network is non-VM

A non-VM network cannot have profiles associated with it, so the
profiles tab of the add/edit network dialog is now hidden whenever the
VM network checkbox isn't marked. If the network is non-VM, then
whatever's in the (hidden) profiles tab is ignored.

Change-Id: I0cb1d77310a88c58d89b997e6fb7a974d06b009e
Bug-Url: https://bugzilla.redhat.com/1007286
Signed-off-by: Lior Vernia <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java
3 files changed, 22 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/20086/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
index 54932e8..4e5796a 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
@@ -438,11 +438,15 @@
     protected abstract void executeSave();
 
     protected void postSaveAction(Guid networkGuid, boolean succeeded) {
-        if (succeeded)
-        {
-            performProfilesActions(networkGuid);
+        if (succeeded) {
+            if ((Boolean) getIsVmNetwork().getEntity()) {
+                performProfilesActions(networkGuid);
+                stopProgress();
+            } else {
+                stopProgress();
+                cancel();
+            }
         }
-        stopProgress();
     }
 
     protected abstract void performProfilesActions(Guid networkGuid);
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java
index 2cd7db2..c7f359f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java
@@ -18,6 +18,7 @@
 
         void updateVisibility();
 
+        void toggleProfilesVisibility(boolean visible);
     }
 
     public AbstractNetworkPopupPresenterWidget(EventBus eventBus, V view) {
@@ -41,6 +42,14 @@
                 }
             }
         });
+
+        getView().toggleProfilesVisibility((Boolean) 
model.getIsVmNetwork().getEntity());
+        model.getIsVmNetwork().getEntityChangedEvent().addListener(new 
IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                getView().toggleProfilesVisibility((Boolean) 
model.getIsVmNetwork().getEntity());
+            }
+        });
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java
index c1e92a8..0b7bcc7 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java
@@ -366,6 +366,11 @@
         messageLabel.setVisible(false);
     }
 
+    @Override
+    public void toggleProfilesVisibility(boolean visible) {
+        profilesTab.setVisible(visible);
+    }
+
     interface WidgetStyle extends CssResource {
         String mtuEditor();
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cb1d77310a88c58d89b997e6fb7a974d06b009e
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