Yaniv Bronhaim has uploaded a new change for review.

Change subject: webadmin: Set password auth field as default for reinstall 
after installFailed
......................................................................

webadmin: Set password auth field as default for reinstall after installFailed

Change-Id: I458e99a6351cd38d71a9949fb3044af5cfafd673
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.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
3 files changed, 25 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/22919/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
index a53985e..2e39108 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
@@ -875,6 +875,7 @@
 
         InstallModel model = new InstallModel();
         setWindow(model);
+        model.setVds(getEntity());
         model.setTitle(constants.installHostTitle());
         model.setHashName("install_host"); //$NON-NLS-1$
         model.getOVirtISO().setIsAvailable(false);
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 de0bdcd..fc914bf 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
@@ -1,6 +1,7 @@
 package org.ovirt.engine.ui.uicommonweb.models.hosts;
 
 import 
org.ovirt.engine.core.common.action.VdsOperationActionParameters.AuthenticationMethod;
+import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
 import org.ovirt.engine.ui.frontend.INewAsyncCallback;
 import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
@@ -18,6 +19,7 @@
     private static final UIConstants constants = 
ConstantsManager.getInstance().getConstants();
 
     private EntityModel privateUserPassword;
+    private VDS vds;
 
     public EntityModel getUserPassword() {
         return privateUserPassword;
@@ -109,6 +111,15 @@
         return getNetworkProviderModel().getInterfaceMappings();
     }
 
+    public void setVds(VDS v) {
+        vds = v;
+    }
+
+    public VDS getVds() {
+        return vds;
+    }
+
+
     public InstallModel() {
         setUserPassword(new EntityModel());
         setOVirtISO(new ListModel());
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 d175b93..10f0ae7 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
@@ -1,6 +1,7 @@
 package org.ovirt.engine.ui.webadmin.section.main.view.popup.host;
 
 import 
org.ovirt.engine.core.common.action.VdsOperationActionParameters.AuthenticationMethod;
+import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.mode.ApplicationMode;
 import org.ovirt.engine.core.compat.RpmVersion;
 import org.ovirt.engine.ui.common.idhandler.WithElementId;
@@ -156,15 +157,21 @@
     public void edit(final InstallModel model) {
         driver.edit(model);
 
-        rbPublicKey.setValue(true);
-        model.setAuthenticationMethod(AuthenticationMethod.PublicKey);
-        displayPassPkWindow(false);
+        if (model.getVds().getStatus() == VDSStatus.InstallFailed) {
+            rbPassword.setValue(true);
+            model.setAuthenticationMethod(AuthenticationMethod.Password);
+            displayPasswordField(true);
+        } else {
+            rbPublicKey.setValue(true);
+            model.setAuthenticationMethod(AuthenticationMethod.PublicKey);
+            displayPasswordField(false);
+        }
 
         rbPassword.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
             @Override
             public void onValueChange(ValueChangeEvent<Boolean> event) {
                 model.setAuthenticationMethod(AuthenticationMethod.Password);
-                displayPassPkWindow(true);
+                displayPasswordField(true);
             }
         });
 
@@ -172,7 +179,7 @@
             @Override
             public void onValueChange(ValueChangeEvent<Boolean> event) {
                 model.setAuthenticationMethod(AuthenticationMethod.PublicKey);
-                displayPassPkWindow(false);
+                displayPasswordField(false);
             }
         });
         // TODO: remove setIsChangable when configured ssh username is enabled
@@ -181,7 +188,7 @@
         networkProviderWidget.edit(model.getNetworkProviderModel());
     }
 
-    private void displayPassPkWindow(boolean isPasswordVisible) {
+    private void displayPasswordField(boolean isPasswordVisible) {
         if (isPasswordVisible) {
             
passwordEditor.getElement().getStyle().setVisibility(Visibility.VISIBLE);
             
publicKeyEditor.getElement().getStyle().setVisibility(Visibility.HIDDEN);


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I458e99a6351cd38d71a9949fb3044af5cfafd673
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to