Ravi Nori has uploaded a new change for review.

Change subject: webadmin: Password field is not validate on host install
......................................................................

webadmin: Password field is not validate on host install

When the host is reinstalled and the password is
choosen as authntication mechanism, empty password
should display an error.

If the user is on Network tab the general tab is selected
and the field is highlighted in red indicating that
it can't be empty.

Change-Id: I3745852a0b1b33e5ba04583e911bbbc90fd8d796
Bug-Url: https://bugzilla.redhat.com/1086798
Signed-off-by: Ravi Nori <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.ui.xml
4 files changed, 49 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/27324/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
index 625aa7c..8be3765 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
@@ -1323,6 +1323,13 @@
     {
         final VDS host = (VDS) getSelectedItem();
         InstallModel model = (InstallModel) getWindow();
+        final boolean isOVirt = host.getVdsType() == VDSType.oVirtNode;
+
+        if (!model.validate(isOVirt))
+        {
+            model.setTabToSelect(new EntityModel<Integer>(0));
+            return;
+        }
 
         UpdateVdsActionParameters param = new UpdateVdsActionParameters();
         param.setvds(host);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallModel.java
index 2f83cd6..67393cb 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallModel.java
@@ -13,6 +13,7 @@
 import org.ovirt.engine.ui.uicommonweb.validation.IValidation;
 import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
+import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
 import org.ovirt.engine.ui.uicompat.UIConstants;
 
 public class InstallModel extends Model {
@@ -120,6 +121,16 @@
         return vds;
     }
 
+    private EntityModel<Integer> tabToSelect;
+
+    public EntityModel<Integer> getTabToSelect() {
+        return tabToSelect;
+    }
+
+    public void setTabToSelect(EntityModel<Integer> value) {
+        tabToSelect = value;
+        onPropertyChanged(new PropertyChangedEventArgs("SelectTab")); 
//$NON-NLS-1$
+    }
 
     public InstallModel() {
         setUserPassword(new EntityModel<String>());
@@ -134,6 +145,7 @@
         getUserName().setIsChangable(false);
         setPublicKey(new EntityModel<String>());
         getPublicKey().setEntity(constants.empty());
+        setTabToSelect(new EntityModel<Integer>());
         fetchPublicKey();
 
         setNetworkProviderModel(new HostNetworkProviderModel());
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.java
index 50d216d..5409db6 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.java
@@ -8,6 +8,7 @@
 import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
 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.dialog.tab.DialogTabPanel;
 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.StringEntityModelLabelEditor;
@@ -17,6 +18,10 @@
 import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer;
 import org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper;
 import org.ovirt.engine.ui.uicommonweb.models.hosts.InstallModel;
+import org.ovirt.engine.ui.uicompat.Event;
+import org.ovirt.engine.ui.uicompat.EventArgs;
+import org.ovirt.engine.ui.uicompat.IEventListener;
+import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
 import org.ovirt.engine.ui.webadmin.ApplicationConstants;
 import org.ovirt.engine.ui.webadmin.ApplicationResources;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.host.HostInstallPopupPresenterWidget;
@@ -105,6 +110,14 @@
 
     @UiField
     @Ignore
+    DialogTabPanel tabPanel;
+
+    @UiField
+    @Ignore
+    DialogTab hostPopupGeneralTab;
+
+    @UiField
+    @Ignore
     DialogTab networkProviderTab;
 
     private final Driver driver = GWT.create(Driver.class);
@@ -152,7 +165,22 @@
     @Override
     public void edit(final InstallModel model) {
         driver.edit(model);
+        model.getPropertyChangedEvent().addListener(new IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                InstallModel installModel = (InstallModel) sender;
 
+                if ("SelectTab".equals(((PropertyChangedEventArgs) 
args).propertyName)) { //$NON-NLS-1$
+                    if (installModel.getTabToSelect().getEntity() != null) {
+                        if(installModel.getTabToSelect().getEntity() == 0) {
+                            tabPanel.switchTab(hostPopupGeneralTab);
+                        } else {
+                            tabPanel.switchTab(networkProviderTab);
+                        }
+                    }
+                }
+            }
+        });
         boolean installedFailed = model.getVds().getStatus() == 
VDSStatus.InstallFailed;
         model.setAuthenticationMethod(installedFailed ? 
AuthenticationMethod.Password: AuthenticationMethod.PublicKey);
         displayPasswordField(installedFailed);
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.ui.xml
index 7002d4a..d99c213 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostInstallPopupView.ui.xml
@@ -56,9 +56,9 @@
 
     <d:SimpleDialogPanel width="700px" height="400px">
         <d:content>
-            <t:DialogTabPanel height="100%">
+            <t:DialogTabPanel ui:field="tabPanel" height="100%">
                 <t:tab>
-                    <t:DialogTab label="{constants.hostPopupGeneralTabLabel}">
+                    <t:DialogTab ui:field="hostPopupGeneralTab" 
label="{constants.hostPopupGeneralTabLabel}">
                         <t:content>
                             <g:VerticalPanel width="100%" 
addStyleNames="{style.content}">
                                 <g:Label ui:field="authLabel" 
addStyleNames="{style.headerAuthLabel}"/>


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

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

Reply via email to