Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Add UI field for Neutron physical network
......................................................................

webadmin: Add UI field for Neutron physical network

The same UI field was being used for both the oVirt label and the
Neutron physical network, and only its interpretation changed
according to context, which was confusing.

As usual, had to change some styling for things to look decent (some
of it is related to unresolved Look & Feel feature issues).

Change-Id: I6b90800cf5948b35283bef03d8e2f95384799c80
Bug-Url: https://bugzilla.redhat.com/1108069
Bug-Url: https://bugzilla.redhat.com/1121546
Signed-off-by: Lior Vernia <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
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/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml
M packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
6 files changed, 46 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/31667/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
index 62aba31..32a3e94 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
@@ -41,7 +41,13 @@
         getExport().setEntity(getNetwork().isExternal());
         getExport().setIsChangable(false);
         getExternalProviders().setIsChangable(false);
-        getNetworkLabel().setSelectedItem(getNetwork().getLabel());
+
+        if (getNetwork().isExternal()) {
+            getNeutronPhysicalNetwork().setEntity(getNetwork().getLabel());
+        } else {
+            getNetworkLabel().setSelectedItem(getNetwork().getLabel());
+        }
+
         toggleProfilesAvailability();
     }
 
@@ -66,13 +72,14 @@
 
     @Override
     protected void onExportChanged() {
+        super.onExportChanged();
         if (getExport().getEntity()) {
             getHasVLanTag().setIsChangable(false);
             getVLanTag().setIsChangable(false);
             getIsVmNetwork().setIsChangable(false);
             getNetworkLabel().setIsChangable(false);
+            getNeutronPhysicalNetwork().setIsChangable(false);
         }
-        super.onExportChanged();
     }
 
     @Override
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 c2ea6ef..473fed6 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
@@ -3,7 +3,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -58,7 +57,7 @@
     private EntityModel<Boolean> export;
     private ListModel<Provider> externalProviders;
     private ListModel<String> networkLabel;
-    private Collection<String> dcLabels;
+    private EntityModel<String> neutronPhysicalNetwork;
     private EntityModel<String> privateComment;
     private EntityModel<Integer> privateVLanTag;
     private EntityModel<Boolean> privateIsStpEnabled;
@@ -109,6 +108,7 @@
                 onExportChanged();
             }
         });
+        setNeutronPhysicalNetwork(new EntityModel<String>());
 
         setNetworkLabel(new ListModel<String>());
         setExternalProviders(new ListModel<Provider>());
@@ -268,6 +268,14 @@
 
     public void setNetworkLabel(ListModel<String> networkLabel) {
         this.networkLabel = networkLabel;
+    }
+
+    public EntityModel<String> getNeutronPhysicalNetwork() {
+        return neutronPhysicalNetwork;
+    }
+
+    private void setNeutronPhysicalNetwork(EntityModel<String> 
neutronPhysicalNetwork) {
+        this.neutronPhysicalNetwork = neutronPhysicalNetwork;
     }
 
     public EntityModel<String> getComment() {
@@ -576,7 +584,8 @@
         network.setComment(getComment().getEntity());
         network.setVmNetwork(getIsVmNetwork().getEntity());
 
-        String label = getNetworkLabel().getSelectedItem();
+        String label = getExport().getEntity() ?
+                getNeutronPhysicalNetwork().getEntity() : 
getNetworkLabel().getSelectedItem();
         network.setLabel(label == null || !label.isEmpty() ? label : null);
 
         network.setMtu(0);
@@ -734,12 +743,10 @@
     protected void onExportChanged() {
         boolean externalNetwork = getExport().getEntity();
 
+        getNetworkLabel().setIsChangable(!externalNetwork);
+        getNeutronPhysicalNetwork().setIsChangable(externalNetwork);
         getQos().setIsChangable(!externalNetwork);
         getAddQosCommand().setIsExecutionAllowed(!externalNetwork);
-
-        String label = getNetworkLabel().getSelectedItem();
-        getNetworkLabel().setItems(externalNetwork ? new HashSet<String>() : 
dcLabels);
-        getNetworkLabel().setSelectedItem(label);
 
         updateMtuSelectorsChangeability();
     }
@@ -751,7 +758,9 @@
 
                     @Override
                     public void onSuccess(Object model, Object returnValue) {
-                        dcLabels = (Collection<String>) returnValue;
+                        String label = getNetworkLabel().getSelectedItem();
+                        getNetworkLabel().setItems((Collection<String>) 
returnValue);
+                        getNetworkLabel().setSelectedItem(label);
                         stopProgress();
                         onExportChanged();
                     }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 932acb4..badc349 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -205,6 +205,9 @@
     @DefaultStringValue("External Provider")
     String externalProviderLabel();
 
+    @DefaultStringValue("Physical Network")
+    String neutronPhysicalNetwork();
+
     @DefaultStringValue("Host Provider")
     String hostProviderTabLabel();
 
@@ -228,9 +231,6 @@
 
     @DefaultStringValue("Network Label")
     String networkLabel();
-
-    @DefaultStringValue("For a Neutron external network, this maps to the name 
of the physical network.")
-    String networkLabelInfo();
 
     @DefaultStringValue("Label")
     String networkLabelNetworksTab();
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 a237c8e..eba7185 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
@@ -8,7 +8,6 @@
 import org.ovirt.engine.ui.common.idhandler.WithElementId;
 import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
 import org.ovirt.engine.ui.common.widget.Align;
-import org.ovirt.engine.ui.common.widget.EntityModelWidgetWithInfo;
 import org.ovirt.engine.ui.common.widget.UiCommandButton;
 import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
 import org.ovirt.engine.ui.common.widget.dialog.tab.DialogTab;
@@ -16,10 +15,9 @@
 import 
org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable.SelectionMode;
 import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
 import org.ovirt.engine.ui.common.widget.editor.ListModelRadioGroupEditor;
-import org.ovirt.engine.ui.common.widget.editor.ListModelSuggestBoxOnlyEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.IntegerEntityModelTextBoxOnlyEditor;
-import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelLabel;
+import 
org.ovirt.engine.ui.common.widget.editor.generic.ListModelSuggestBoxEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxEditor;
 import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer;
 import org.ovirt.engine.ui.common.widget.table.column.CheckboxColumn;
@@ -101,6 +99,11 @@
     @WithElementId("externalProviders")
     public ListModelListBoxEditor<Provider> externalProviderEditor;
 
+    @UiField
+    @Path(value = "neutronPhysicalNetwork.entity")
+    @WithElementId("neutronPhysicalNetwork")
+    public StringEntityModelTextBoxEditor neutronPhysicalNetwork;
+
     @UiField(provided = true)
     @Path(value = "isVmNetwork.entity")
     public final EntityModelCheckBoxEditor isVmNetworkEditor;
@@ -120,14 +123,9 @@
     @Path(value = "mtu.entity")
     public IntegerEntityModelTextBoxOnlyEditor mtuEditor;
 
+    @UiField
     @Path(value = "networkLabel.selectedItem")
-    public ListModelSuggestBoxOnlyEditor networkLabel;
-
-    @Ignore
-    public StringEntityModelLabel networkLabelLabel;
-
-    @UiField(provided = true)
-    public EntityModelWidgetWithInfo<String> networkLabelWithInfo;
+    public ListModelSuggestBoxEditor networkLabel;
 
     @UiField(provided = true)
     @Path(value = "qos.selectedItem")
@@ -218,10 +216,6 @@
         vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT);
         mtuEditor = new IntegerEntityModelTextBoxOnlyEditor();
         createSubnetEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
-        networkLabelLabel = new StringEntityModelLabel();
-        networkLabel = new ListModelSuggestBoxOnlyEditor();
-        networkLabelWithInfo = new 
EntityModelWidgetWithInfo<String>(networkLabelLabel, networkLabel);
-        
networkLabelWithInfo.setExplanation(templates.italicText(constants.networkLabelInfo()));
         this.clustersTable = new 
EntityModelCellTable<ListModel<NetworkClusterModel>>(SelectionMode.NONE, true);
         initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
         initEntityModelCellTable(constants, templates);
@@ -242,7 +236,8 @@
         exportLabel.setText(constants.exportLabel());
         exportEditor.setLabel(constants.exportCheckboxLabel());
         externalProviderEditor.setLabel(constants.externalProviderLabel());
-        networkLabelLabel.setText(constants.networkLabel());
+        neutronPhysicalNetwork.setLabel(constants.neutronPhysicalNetwork());
+        networkLabel.setLabel(constants.networkLabel());
         commentEditor.setLabel(constants.commentLabel());
         isVmNetworkEditor.setLabel(constants.vmNetworkLabel());
         vlanTagging.setLabel(constants.enableVlanTagLabel());
@@ -266,8 +261,8 @@
         isVmNetworkEditor.asCheckBox().addStyleName(style.vmNetworkStyle());
         vlanTagging.addContentWidgetStyleName(style.noPadding());
         vlanTagging.asCheckBox().addStyleName(style.noPadding());
-        networkLabelLabel.addStyleName(style.noPadding());
-        networkLabelLabel.addStyleName(style.inlineBlock());
+        networkLabel.addLabelStyleName(style.noPadding());
+        networkLabel.addLabelStyleName(style.inlineBlock());
         qosEditor.addLabelStyleName(style.noPadding());
         qosEditor.addLabelStyleName(style.inlineBlock());
     }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml
index e22539a..7daad12 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml
@@ -43,6 +43,7 @@
 
         .noPadding {
             padding: 0px !important;
+            top: 0 !important;
         }
 
         .mtuSelector {
@@ -77,13 +78,13 @@
         }
 
         .propertyWidth {
-            width: 340px;
+            width: 338px;
         }
 
         .mtuLabel {
             width: 230px;
             position: relative;
-            top: -25px;
+            top: -25px !important;
         }
 
         .inlineBlock {
@@ -110,9 +111,11 @@
                                     <g:Label ui:field="exportLabel" 
addStyleNames="{style.mainLabel}" />
                                     <ge:EntityModelCheckBoxEditor 
ui:field="exportEditor" />
                                     <e:ListModelListBoxEditor 
ui:field="externalProviderEditor" addStyleNames="{style.dependentField}" />
+                                    <ge:StringEntityModelTextBoxEditor 
ui:field="neutronPhysicalNetwork" addStyleNames="{style.dependentField}" />
                                 </g:FlowPanel>
                                 <g:FlowPanel 
addStyleNames="{style.sectionStyle}">
                                     <g:Label ui:field="mainLabel" 
addStyleNames="{style.mainLabel}" />
+                                    <ge:ListModelSuggestBoxEditor 
ui:field="networkLabel" addStyleNames="{style.dependentField} 
{style.propertyWidth}" />
                                     <g:HorizontalPanel 
addStyleNames="{style.dependentField}">
                                         <ge:EntityModelCheckBoxEditor 
ui:field="vlanTagging"/>
                                         
<ge:IntegerEntityModelTextBoxOnlyEditor ui:field="vlanTag" />
@@ -122,7 +125,6 @@
                                         <g:Image 
resource="{resources.networkVm}" addStyleNames="{style.vmNetworkImage}" />
                                     </g:HorizontalPanel>
                                     <e:ListModelRadioGroupEditor 
ui:field="mtuSelectorEditor" addStyleNames="{style.dependentField}" />
-                                    <w:EntityModelWidgetWithInfo 
ui:field="networkLabelWithInfo" addStyleNames="{style.dependentField} 
{style.propertyWidth} anpv_networkLabelPanel_pfly_fix" />
                                     <g:HorizontalPanel 
verticalAlignment="ALIGN_MIDDLE" visible="false">
                                         <e:ListModelListBoxEditor 
ui:field="qosEditor" addStyleNames="{style.dependentField} 
{style.propertyWidth}" />
                                         <w:UiCommandButton 
ui:field="addQosButton" addStyleNames="{style.qosStyle}" />
diff --git a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css 
b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
index af162ae..9c54f7b 100644
--- a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
+++ b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
@@ -473,23 +473,3 @@
     position: relative !important;
     top: 3px !important;
 }
-.anpv_networkLabelPanel_pfly_fix {
-    margin-top: 6px;
-}
-.anpv_networkLabelPanel_pfly_fix .avw_contentWidget_pfly_fix {
-    position: relative !important;
-    left: -141px !important;
-}
-.anpv_networkLabelPanel_pfly_fix .emwwi_label_pfly_fix {
-    padding-bottom: 5px !important;
-}
-.anpv_networkLabelPanel_pfly_fix .emwwi_infoIcon_pfly_fix {
-    position: relative !important;
-    left: 40px !important;
-}
-.anpv_networkLabelPanel_pfly_fix .emwwi_outerPanel_pfly_fix {
-    width: inherit !important;
-}
-.anpv_networkLabelPanel_pfly_fix .emwwi_outerPanel_pfly_fix {
-    width: inherit !important;
-}


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

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

Reply via email to