Arik Hadas has uploaded a new change for review.

Change subject: webadmin: v2v
......................................................................

webadmin: v2v

Change-Id: Ief6e8fcff0ed8f5160aeaece8f5ed6a6c3b97725
Signed-off-by: Arik Hadas <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Enums.java
M 
frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/Enums.properties
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/provider/ProviderPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.ui.xml
7 files changed, 80 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/29380/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java
index 22ccf20..e3a9ccf 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java
@@ -16,6 +16,7 @@
 
     public static final String SCHEME_HTTP = "http"; //$NON-NLS-1$
     public static final String SCHEME_HTTPS = "https"; //$NON-NLS-1$
+    public static final String SCHEME_ESXI = "esxi"; //$NON-NLS-1$
 
     private static final RegExp PATTERN_URI =
             RegExp.compile("^(?:(.*)://)?([^/]*)(/.*)?$", "i"); //$NON-NLS-1$ 
$NON-NLS-2$
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
index b0168c8..e17ba01 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java
@@ -12,6 +12,7 @@
 import org.ovirt.engine.core.common.businessentities.Provider;
 import org.ovirt.engine.core.common.businessentities.ProviderType;
 import org.ovirt.engine.core.common.businessentities.TenantProviderProperties;
+import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.errors.VdcBllErrors;
 import org.ovirt.engine.core.common.queries.ConfigurationValues;
 import org.ovirt.engine.core.compat.StringHelper;
@@ -65,8 +66,11 @@
     private ListModel<ProviderType> type;
     private UICommand testCommand;
     private EntityModel<String> testResult = new EntityModel<String>();
+    private EntityModel<Boolean> verifyCertificate = new 
EntityModel<Boolean>();
 
     private NeutronAgentModel neutronAgentModel = new NeutronAgentModel();
+
+    private ListModel<VDS> proxyHost = new ListModel<VDS>();
 
     public EntityModel<String> getName() {
         return name;
@@ -84,6 +88,10 @@
         return getNeutronAgentModel().getPluginType();
     }
 
+    public ListModel<VDS> getProxyHost() {
+        return proxyHost;
+    }
+
     public EntityModel<String> getDescription() {
         return description;
     }
@@ -94,6 +102,10 @@
 
     public EntityModel<Boolean> getRequiresAuthentication() {
         return requiresAuthentication;
+    }
+
+    public EntityModel<Boolean> getVerifyCertificate() {
+        return verifyCertificate;
     }
 
     public EntityModel<String> getUsername() {
@@ -132,6 +144,14 @@
         return getType().getSelectedItem() == ProviderType.OPENSTACK_IMAGE;
     }
 
+    private boolean isV2VBasedType() {
+        return isTypeESXI();
+    }
+
+    private boolean isTypeESXI() {
+        return getType().getSelectedItem() == ProviderType.ESXI;
+    }
+
     private boolean isTypeTenantAware() {
         ProviderType type = getType().getSelectedItem();
         return type == ProviderType.OPENSTACK_NETWORK || type == 
ProviderType.OPENSTACK_IMAGE;
@@ -139,6 +159,10 @@
 
     private boolean isTypeRequiresAuthentication() {
         return false;
+    }
+
+    private boolean isProxyHostNeeded() {
+        return ProviderType.ESXI.equals(type);
     }
 
     private String getDefaultUrl(ProviderType type) {
@@ -150,6 +174,8 @@
                 return "http://localhost:9696";; //$NON-NLS-1$
             case OPENSTACK_IMAGE:
                 return "http://localhost:9292";; //$NON-NLS-1$
+            case ESXI:
+                return "esxi://"; //$NON-NLS-1$
             case FOREMAN:
             default:
                 return "http://localhost";; //$NON-NLS-1$
@@ -197,6 +223,9 @@
                 boolean isNeutron = isTypeOpenStackNetwork();
                 getNeutronAgentModel().setIsAvailable(isNeutron);
 
+                getProxyHost().setIsAvailable(isV2VBasedType());
+                getVerifyCertificate().setIsAvailable(isTypeESXI());
+
                 boolean requiresAuth = isTypeRequiresAuthentication();
                 
getRequiresAuthentication().setEntity(Boolean.valueOf(requiresAuth));
                 getRequiresAuthentication().setIsChangable(!requiresAuth);
@@ -205,6 +234,10 @@
 
         getNeutronAgentModel().setIsAvailable(false);
         getTenantName().setIsAvailable(false);
+
+        getVerifyCertificate().setIsAvailable(false);
+        getProxyHost().setIsAvailable(false);
+        updateHosts();
 
         List<ProviderType> providerTypes = new 
ArrayList<ProviderType>(Arrays.asList(ProviderType.values()));
         Collections.sort(providerTypes, new Linq.ProviderTypeComparator());
@@ -221,6 +254,19 @@
         setTestCommand(new UICommand(CMD_TEST, this));
     }
 
+    private void updateHosts() {
+        AsyncQuery hostQuery = new AsyncQuery();
+        hostQuery.setModel(this);
+        hostQuery.asyncCallback = new INewAsyncCallback() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public void onSuccess(Object model, Object result) {
+                getProxyHost().setItems((List<VDS>) result);
+            }
+        };
+        AsyncDataProvider.getHostList(hostQuery);
+    }
+
     private boolean validate() {
         getName().validateEntity(new IValidation[] { new NotEmptyValidation(), 
new AsciiNameValidation() });
         getType().validateSelectedItem(new IValidation[] { new 
NotEmptyValidation() });
@@ -228,7 +274,7 @@
         getPassword().validateEntity(new IValidation[] { new 
NotEmptyValidation() });
         getTenantName().validateEntity(new IValidation[] { new 
NotEmptyValidation()} );
         getUrl().validateEntity(new IValidation[] { new NotEmptyValidation(),
-                new UrlValidation(Uri.SCHEME_HTTP, Uri.SCHEME_HTTPS) });
+                new UrlValidation(Uri.SCHEME_HTTP, Uri.SCHEME_HTTPS, 
Uri.SCHEME_ESXI) });
         getNeutronAgentModel().validate();
 
         return getName().getIsValid() && getType().getIsValid() && 
getUrl().getIsValid() && getUsername().getIsValid()
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Enums.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Enums.java
index ee17626..c311961 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Enums.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Enums.java
@@ -282,6 +282,8 @@
 
     String ProviderType___FOREMAN();
 
+    String ProviderType___ESXI();
+
     String ProviderType___OPENSTACK_NETWORK();
 
     String OpenstackNetworkPluginType___LINUX_BRIDGE();
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/Enums.properties
 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/Enums.properties
index 406e754..fc1fe31 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/Enums.properties
+++ 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/Enums.properties
@@ -174,6 +174,7 @@
 JobExecutionStatus___ABORTED=Aborted
 JobExecutionStatus___UNKNOWN=Unknown
 ProviderType___FOREMAN=Foreman
+ProviderType___ESXI=VMware
 ProviderType___OPENSTACK_NETWORK=OpenStack Network
 OpenstackNetworkPluginType___LINUX_BRIDGE=Linux Bridge
 OpenstackNetworkPluginType___OPEN_VSWITCH=Open vSwitch
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 4759eea..f99ba9d 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
@@ -3217,6 +3217,12 @@
     @DefaultStringValue("Networking Plugin")
     String pluginType();
 
+    @DefaultStringValue("Proxy Host")
+    String proxyHost();
+
+    @DefaultStringValue("Verify SSL certificate")
+    String verifyCertificate();
+
     @DefaultStringValue("Add")
     String addProvider();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.java
index 8a7c4f1..7900a85 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.java
@@ -1,6 +1,7 @@
 package org.ovirt.engine.ui.webadmin.section.main.view.popup.provider;
 
 import org.ovirt.engine.core.common.businessentities.ProviderType;
+import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
 import org.ovirt.engine.ui.common.idhandler.WithElementId;
 import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
@@ -9,12 +10,13 @@
 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;
-import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
 import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
+import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.ListModelSuggestBoxEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelPasswordBoxEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxEditor;
 import org.ovirt.engine.ui.common.widget.renderer.EnumRenderer;
+import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer;
 import org.ovirt.engine.ui.uicommonweb.models.providers.ProviderModel;
 import org.ovirt.engine.ui.webadmin.ApplicationConstants;
 import org.ovirt.engine.ui.webadmin.ApplicationResources;
@@ -118,6 +120,16 @@
     @UiField
     Style style;
 
+    @UiField(provided = true)
+    @Path(value = "proxyHost.selectedItem")
+    @WithElementId("proxyHost")
+    public ListModelListBoxEditor<VDS> proxyHostEditor;
+
+    @UiField
+    @Path(value = "verifyCertificate.entity")
+    @WithElementId
+    EntityModelCheckBoxEditor verifyCertificateEditor;
+
     private final ApplicationResources resources;
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
@@ -130,6 +142,12 @@
 
         typeEditor = new ListModelListBoxEditor<ProviderType>(new 
EnumRenderer());
         requiresAuthenticationEditor = new 
EntityModelCheckBoxEditor(Align.RIGHT);
+        proxyHostEditor = new ListModelListBoxEditor<VDS>(new 
NullSafeRenderer<VDS>() {
+            @Override
+            public String renderNullSafe(VDS object) {
+                return object.getName();
+            }
+        });
 
         this.resources = resources;
         this.constants = constants;
@@ -153,6 +171,8 @@
         passwordEditor.setLabel(constants.passwordProvider());
         tenantNameEditor.setLabel(constants.tenantName());
         pluginTypeEditor.setLabel(constants.pluginType());
+        proxyHostEditor.setLabel(constants.proxyHost());
+        verifyCertificateEditor.setLabel(constants.verifyCertificate());
 
         // Agent configuration tab
         
agentConfigurationTab.setLabel(constants.providerPopupAgentConfigurationTabLabel());
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.ui.xml
index e2966ef..038ff00 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/provider/ProviderPopupView.ui.xml
@@ -65,6 +65,8 @@
                                                                        
<g:FlowPanel>
                                                                                
<ge:ListModelSuggestBoxEditor ui:field="pluginTypeEditor" />
                                                                                
<ge:StringEntityModelTextBoxEditor ui:field="urlEditor" />
+                                                                               
<ge:EntityModelCheckBoxEditor ui:field="verifyCertificateEditor" />
+                                                                               
<e:ListModelListBoxEditor ui:field="proxyHostEditor" />
                                                                        
</g:FlowPanel>
                                                                        
<g:FlowPanel addStyleNames="{style.sectionStyle}">
                                                                                
<ge:EntityModelCheckBoxEditor ui:field="requiresAuthenticationEditor" />


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

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

Reply via email to