Yaniv Bronhaim has uploaded a new change for review. Change subject: Modifying Reinstall Host popup view ......................................................................
Modifying Reinstall Host popup view 1. Adding password or publicKey fields for authentication. 2. Adding ssh fingerprint field. Change-Id: Iff04dc81d4d2f9f7859060dcc44e7c9a59f4c03f Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=848072 Signed-off-by: Yaniv Bronhaim <[email protected]> --- 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 3 files changed, 157 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/16174/1 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 a3508f5..49a8f1b 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,13 +1,20 @@ package org.ovirt.engine.ui.uicommonweb.models.hosts; +import org.ovirt.engine.ui.frontend.AsyncQuery; +import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.ListModel; import org.ovirt.engine.ui.uicommonweb.models.Model; 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.UIConstants; @SuppressWarnings("unused") public class InstallModel extends Model { + + private static final UIConstants constants = ConstantsManager.getInstance().getConstants(); private EntityModel privateRootPassword; @@ -49,6 +56,30 @@ hostVersion = value; } + private EntityModel privateUserName; + + public EntityModel getUserName() + { + return privateUserName; + } + + private void setUserName(EntityModel value) + { + privateUserName = value; + } + + private EntityModel privatePublicKey; + + public EntityModel getPublicKey() + { + return privatePublicKey; + } + + private void setPublicKey(EntityModel value) + { + privatePublicKey = value; + } + public InstallModel() { setRootPassword(new EntityModel()); setOVirtISO(new ListModel()); @@ -56,6 +87,12 @@ setOverrideIpTables(new EntityModel()); getOverrideIpTables().setEntity(false); + setUserName(new EntityModel()); + // TODO: should be stored username and the field should be locked + getUserName().setEntity(constants.defaultUserName()); + setPublicKey(new EntityModel()); + getPublicKey().setEntity(constants.empty()); + fetchPublicKey(); } public boolean validate(boolean isOVirt) { @@ -70,4 +107,21 @@ return getRootPassword().getIsValid() && getOVirtISO().getIsValid(); } + + public void fetchPublicKey() { + AsyncQuery aQuery = new AsyncQuery(); + aQuery.setModel(this); + aQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object result) + { + String pk = (String) result; + if (pk != null && pk.length() > 0) + { + getPublicKey().setEntity(result); + } + } + }; + AsyncDataProvider.getHostPublicKey(aQuery); + } } 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 7475695..4f99b38 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,11 +1,14 @@ package org.ovirt.engine.ui.webadmin.section.main.view.popup.host; import org.ovirt.engine.core.compat.RpmVersion; +import org.ovirt.engine.ui.common.idhandler.WithElementId; 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.editor.EntityModelCheckBoxEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelLabelEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelPasswordBoxEditor; +import org.ovirt.engine.ui.common.widget.editor.EntityModelTextAreaLabelEditor; +import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxEditor; import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor; import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer; import org.ovirt.engine.ui.uicommonweb.models.hosts.InstallModel; @@ -14,11 +17,17 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.host.HostInstallPopupPresenterWidget; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.Visibility; import com.google.gwt.editor.client.SimpleBeanEditorDriver; +import com.google.gwt.editor.client.Editor.Ignore; +import com.google.gwt.editor.client.Editor.Path; +import com.google.gwt.event.logical.shared.ValueChangeEvent; +import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.EventBus; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.RadioButton; import com.google.inject.Inject; /** @@ -56,6 +65,30 @@ @UiField Label message; + @UiField + @Ignore + Label authLabel; + + @UiField(provided = true) + @Ignore + @WithElementId("rbPublicKey") + public RadioButton rbPublicKey; + + @UiField(provided = true) + @Ignore + @WithElementId("rbPassword") + public RadioButton rbPassword; + + @UiField + @Path(value = "userName.entity") + @WithElementId("userName") + EntityModelTextBoxEditor userNameEditor; + + @UiField + @Path(value = "publicKey.entity") + @WithElementId("publicKey") + EntityModelTextAreaLabelEditor publicKeyEditor; + private final Driver driver = GWT.create(Driver.class); @Inject @@ -78,18 +111,41 @@ return version.getRpmName(); } }); + rbPassword = new RadioButton("1"); //$NON-NLS-1$ + rbPublicKey = new RadioButton("1"); //$NON-NLS-1$ } void localize(ApplicationConstants constants) { - passwordEditor.setLabel(constants.hostInstallPasswordLabel()); hostVersionEditor.setLabel(constants.hostInstallHostVersionLabel()); isoEditor.setLabel(constants.hostInstallIsoLabel()); overrideIpTablesEditor.setLabel(constants.hostInstallOverrideIpTablesLabel()); + authLabel.setText(constants.hostPopupAuthLabel()); + userNameEditor.setLabel(constants.hostPopupUsernameLabel()); } @Override public void edit(final InstallModel model) { driver.edit(model); + + rbPassword.setValue(true); + passwordEditor.getElement().getStyle().setVisibility(Visibility.VISIBLE); + publicKeyEditor.getElement().getStyle().setVisibility(Visibility.HIDDEN); + + rbPassword.addValueChangeHandler(new ValueChangeHandler<Boolean>() { + @Override + public void onValueChange(ValueChangeEvent<Boolean> event) { + passwordEditor.getElement().getStyle().setVisibility(Visibility.VISIBLE); + publicKeyEditor.getElement().getStyle().setVisibility(Visibility.HIDDEN); + } + }); + + rbPublicKey.addValueChangeHandler(new ValueChangeHandler<Boolean>() { + @Override + public void onValueChange(ValueChangeEvent<Boolean> event) { + publicKeyEditor.getElement().getStyle().setVisibility(Visibility.VISIBLE); + passwordEditor.getElement().getStyle().setVisibility(Visibility.HIDDEN); + } + }); } @Override @@ -108,5 +164,4 @@ isoEditor.setFocus(true); } } - } 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 dd7dc56..e3e5550 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 @@ -8,6 +8,7 @@ xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog" xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor"> + <ui:with field='constants' type='org.ovirt.engine.ui.common.CommonApplicationConstants'/> <ui:style> .errorMessageLabel { @@ -16,17 +17,55 @@ margin-left: 5px; } + .headerAuthLabel { + font-weight: bold; + margin-top: 10px; + } + + .headerFp { + margin: 5px; + margin-bottom: 5px; + } + + .pkStyle { + resize: none; + } + + .radioButton { + margin-right: 2px; + } + + .fetchLink { + margin: 3px; + font-size: 15pt; + width: 450px; + } + + .content { + width:100%; + } </ui:style> - <d:SimpleDialogPanel width="500px" height="180px"> + <d:SimpleDialogPanel width="500px" height="250px"> <d:content> - <g:FlowPanel> - <e:EntityModelPasswordBoxEditor ui:field="passwordEditor"/> - <e:EntityModelLabelEditor ui:field="hostVersionEditor"/> - <e:ListModelListBoxEditor ui:field="isoEditor"/> + <g:VerticalPanel addStyleNames="{style.content}"> + <g:Label ui:field="authLabel" addStyleNames="{style.headerAuthLabel}"/> + <e:EntityModelTextBoxEditor ui:field="userNameEditor"/> + <g:HorizontalPanel width="100%" verticalAlignment="middle"> + <g:RadioButton ui:field="rbPassword" /> + <g:Label text="{constants.hostPasswordLabel}" /> + <e:EntityModelPasswordBoxEditor ui:field="passwordEditor" /> + <e:EntityModelLabelEditor ui:field="hostVersionEditor"/> + <e:ListModelListBoxEditor ui:field="isoEditor"/> + <g:Label ui:field="message" addStyleNames="{style.errorMessageLabel}"/> + </g:HorizontalPanel> + <g:HorizontalPanel width="100%" verticalAlignment="middle"> + <g:RadioButton ui:field="rbPublicKey" addStyleNames="{style.radioButton}" /> + <g:Label text="{constants.hostPublicKeyLable}" /> + <e:EntityModelTextAreaLabelEditor ui:field="publicKeyEditor" addStyleNames="{style.pkStyle}" /> + </g:HorizontalPanel> <e:EntityModelCheckBoxEditor ui:field="overrideIpTablesEditor"/> - <g:Label ui:field="message" addStyleNames="{style.errorMessageLabel}"/> - </g:FlowPanel> + </g:VerticalPanel> </d:content> </d:SimpleDialogPanel> -- To view, visit http://gerrit.ovirt.org/16174 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iff04dc81d4d2f9f7859060dcc44e7c9a59f4c03f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
