Tomas Jelinek has uploaded a new change for review. Change subject: vm popup redesign ......................................................................
vm popup redesign Change-Id: I3e4fa5b35c0ee7939d6c7024508944d2ce653d5e Signed-off-by: Tomas Jelinek <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.ui.xml A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/RunOnceCloudInitWidget.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmPopupCloudInitWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml A frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/BaseVmInitStyle.css A frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/RunOnceVmInitStyle.css A frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/VmPopupVmInitStyle.css M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/CloudInitModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java 14 files changed, 243 insertions(+), 218 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/00/23200/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index cdd9c9c..eb7aa10 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -136,20 +136,26 @@ @DefaultStringValue("Password") String runOncePopupSysPrepPasswordLabel(); - @DefaultStringValue("Cloud-Init") - String runOncePopupCloudInitLabel(); - @DefaultStringValue("Boot Sequence:") String runOncePopupBootSequenceLabel(); + + @DefaultStringValue("Use Cloud-Init/Sysprep") + String configureViaCloudInitSysprep(); @DefaultStringValue("VM Hostname") String cloudInitHostnameLabel(); + @DefaultStringValue("Authentication") + String cloudInitAuthenticationLabel(); + @DefaultStringValue("SSH Authorized Keys") String cloudInitAuthorizedKeysLabel(); - @DefaultStringValue("Regenerate System SSH Keys") + @DefaultStringValue("Regenerate SSH Keys") String cloudInitRegenerateKeysLabel(); + + @DefaultStringValue("Configure Time Zone") + String cloudInitConfigureTimeZoneLabel(); @DefaultStringValue("Time Zone") String cloudInitTimeZoneLabel(); @@ -160,6 +166,9 @@ @DefaultStringValue("Verify Root Password") String cloudInitRootPasswordVerificationLabel(); + @DefaultStringValue("Networks") + String cloudInitNetworskLabel(); + @DefaultStringValue("Network") String cloudInitNetworkLabel(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java index 4d2336f..e4542ea 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java @@ -76,6 +76,7 @@ import org.ovirt.engine.ui.common.widget.table.column.TextColumnWithTooltip; import org.ovirt.engine.ui.common.widget.uicommon.popup.vm.CloudInitWidget; import org.ovirt.engine.ui.common.widget.uicommon.popup.vm.PopupWidgetConfigMap; +import org.ovirt.engine.ui.common.widget.uicommon.popup.vm.VmPopupCloudInitWidget; import org.ovirt.engine.ui.common.widget.uicommon.storage.DisksAllocationView; import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; @@ -362,8 +363,7 @@ @UiField @Ignore - public CloudInitWidget cloudInitEditor; - + public VmPopupCloudInitWidget cloudInitEditor; // ==Console Tab== @UiField diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml index 58cba13..f8c4afc 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml @@ -435,7 +435,7 @@ <g:FlowPanel> <g:Label addStyleNames="{style.sectionLabel}" text="{constants.initialRunWindows}" /> <e:ListModelListBoxEditor ui:field="domainEditor" /> - <vm:CloudInitWidget ui:field="cloudInitEditor"/> + <vm:VmPopupCloudInitWidget ui:field="cloudInitEditor"/> </g:FlowPanel> </t:content> </t:DialogTab> diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.java index 0cd0df9..d3349de 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.java @@ -2,11 +2,14 @@ import java.util.Map; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.user.cellview.client.CellTable; import org.ovirt.engine.ui.common.CommonApplicationConstants; import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; import org.ovirt.engine.ui.common.idhandler.WithElementId; import org.ovirt.engine.ui.common.widget.Align; import org.ovirt.engine.ui.common.widget.ComboBox; +import org.ovirt.engine.ui.common.widget.dialog.AdvancedParametersExpander; import org.ovirt.engine.ui.common.widget.editor.EntityModelCheckBoxEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelPasswordBoxEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelTextAreaEditor; @@ -31,7 +34,7 @@ import com.google.gwt.user.client.ui.PushButton; import com.google.gwt.user.client.ui.Widget; -public class CloudInitWidget extends AbstractModelBoundPopupWidget<CloudInitModel> { +public abstract class CloudInitWidget extends AbstractModelBoundPopupWidget<CloudInitModel> { interface Driver extends SimpleBeanEditorDriver<CloudInitModel, CloudInitWidget> { } @@ -48,6 +51,17 @@ private static final CommonApplicationConstants constants = GWT.create(CommonApplicationConstants.class); + public static interface BasicStyle extends CssResource { + String DEFAULT_CSS = "org/ovirt/engine/ui/common/css/BaseVmInitStyle.css"; + + String someStyle(); + } + + public static interface Resources extends ClientBundle { + @Source({ CellTable.Style.DEFAULT_CSS}) + BasicStyle createStyle(); + } + interface Style extends CssResource { String displayNone(); } @@ -55,10 +69,14 @@ @UiField Style style; - @UiField(provided = true) - @Path(value = "hostnameEnabled.entity") + @UiField + @Path(value = "isCloudInitEnabled.entity") @WithElementId - EntityModelCheckBoxEditor hostnameEnabledEditor; + EntityModelCheckBoxEditor cloudInitEnabledEditor; + + @UiField + @Ignore + FlowPanel cloudInitOptionsContent; @UiField @Path(value = "hostname.entity") @@ -70,12 +88,6 @@ @WithElementId EntityModelTextBoxEditor domainEditor; - - @UiField(provided = true) - @Path(value = "authorizedKeysEnabled.entity") - @WithElementId - EntityModelCheckBoxEditor authorizedKeysEnabledEditor; - @UiField @Path(value = "authorizedKeys.entity") @WithElementId @@ -86,13 +98,13 @@ @WithElementId EntityModelTextAreaEditor customScriptEditor; - @UiField(provided = true) + @UiField @Path(value = "regenerateKeysEnabled.entity") @WithElementId EntityModelCheckBoxEditor regenerateKeysEnabledEditor; - @UiField(provided = true) + @UiField @Path(value = "timeZoneEnabled.entity") @WithElementId EntityModelCheckBoxEditor timeZoneEnabledEditor; @@ -102,11 +114,13 @@ @WithElementId ListModelListBoxEditor<Object> timeZoneEditor; + @UiField + @Ignore + AdvancedParametersExpander authenticationExpander; - @UiField(provided = true) - @Path(value = "rootPasswordEnabled.entity") - @WithElementId - EntityModelCheckBoxEditor rootPasswordEnabledEditor; + @UiField + @Ignore + FlowPanel authenticationExpanderContent; @UiField @Path(value = "rootPassword.entity") @@ -118,6 +132,14 @@ @WithElementId EntityModelPasswordBoxEditor rootPasswordVerificationEditor; + + @UiField + @Ignore + AdvancedParametersExpander networkExpander; + + @UiField + @Ignore + FlowPanel networkExpanderContent; @UiField(provided = true) @Path(value = "networkEnabled.entity") @@ -153,11 +175,11 @@ @UiField @Ignore - Label customScriptLabel; + AdvancedParametersExpander customScriptExpander; @UiField @Ignore - Label domainLabel; + FlowPanel customScriptExpanderContent; @UiField @Ignore @@ -209,26 +231,32 @@ @WithElementId EntityModelTextBoxEditor dnsSearchDomains; + public CloudInitWidget(BasicStyle style) { + style.ensureInjected(); - public CloudInitWidget() { initCheckBoxEditors(); initListBoxEditors(); initComboBoxEditors(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); + + initAdvancedParameterExpanders(); localize(); addStyles(); ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); + + networkComboBox.addStyleName(style.someStyle()); + } + + private void initAdvancedParameterExpanders() { + authenticationExpander.initWithContent(authenticationExpanderContent.getElement()); + networkExpander.initWithContent(networkExpanderContent.getElement()); + customScriptExpander.initWithContent(customScriptExpanderContent.getElement()); } void initCheckBoxEditors() { - hostnameEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); - authorizedKeysEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); - regenerateKeysEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); - timeZoneEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); - rootPasswordEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); networkEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); networkDhcpEditor = new EntityModelCheckBoxEditor(Align.RIGHT); networkStartOnBootEditor = new EntityModelCheckBoxEditor(Align.RIGHT); @@ -255,13 +283,19 @@ void localize() { - hostnameEnabledEditor.setLabel(constants.cloudInitHostnameLabel()); - authorizedKeysEnabledEditor.setLabel(constants.cloudInitAuthorizedKeysLabel()); + + cloudInitEnabledEditor.setLabel(constants.configureViaCloudInitSysprep()); + + hostnameEditor.setLabel(constants.cloudInitHostnameLabel()); + authorizedKeysEditor.setLabel(constants.cloudInitAuthorizedKeysLabel()); regenerateKeysEnabledEditor.setLabel(constants.cloudInitRegenerateKeysLabel()); - timeZoneEnabledEditor.setLabel(constants.cloudInitTimeZoneLabel()); - rootPasswordEnabledEditor.setLabel(constants.cloudInitRootPasswordLabel()); + timeZoneEnabledEditor.setLabel(constants.cloudInitConfigureTimeZoneLabel()); + timeZoneEditor.setLabel(constants.cloudInitTimeZoneLabel()); + rootPasswordEditor.setLabel(constants.cloudInitRootPasswordLabel()); rootPasswordVerificationEditor.setLabel(constants.cloudInitRootPasswordVerificationLabel()); + networkEnabledEditor.setLabel(constants.cloudInitNetworkLabel()); + domainEditor.setLabel(constants.domainVmPopup()); String sep = "|"; //$NON-NLS-1$ // sequence is: <select label> | [+] <add label> | [-] <remove label> @@ -297,8 +331,14 @@ dnsServers.setTitle(constants.cloudInitDnsServersToolTip()); dnsSearchDomains.setTitle(constants.cloudInitDnsSearchDomainsToolTip()); - customScriptLabel.setText(constants.customScriptLabel()); - domainLabel.setText(constants.domainVmPopup()); + networkExpander.setTitleWhenExpended(constants.cloudInitNetworskLabel()); + networkExpander.setTitleWhenCollapsed(constants.cloudInitNetworskLabel()); + + authenticationExpander.setTitleWhenExpended(constants.cloudInitAuthenticationLabel()); + authenticationExpander.setTitleWhenCollapsed(constants.cloudInitAuthenticationLabel()); + + customScriptExpander.setTitleWhenExpended(constants.customScriptLabel()); + customScriptExpander.setTitleWhenCollapsed(constants.customScriptLabel()); } void addStyles() { @@ -373,27 +413,6 @@ } void initializeEnabledCBBehavior(final CloudInitModel model) { - // Initialize default checkbox state and add event listeners for user-initiated changes - if (model.getHostnameEnabled().getEntity() != null) { - hostnameEnabledEditor.setEnabled((Boolean) model.getHostnameEnabled().getEntity()); - } - model.getHostnameEnabled().getEntityChangedEvent().addListener(new IEventListener() { - @Override - public void eventRaised(Event ev, Object sender, EventArgs args) { - hostnameEditor.setEnabled((Boolean) model.getHostnameEnabled().getEntity()); - } - }); - - if (model.getAuthorizedKeysEnabled().getEntity() != null) { - authorizedKeysEnabledEditor.setEnabled((Boolean) model.getAuthorizedKeysEnabled().getEntity()); - } - model.getAuthorizedKeysEnabled().getEntityChangedEvent().addListener(new IEventListener() { - @Override - public void eventRaised(Event ev, Object sender, EventArgs args) { - authorizedKeysEditor.setEnabled((Boolean) model.getAuthorizedKeysEnabled().getEntity()); - } - }); - if (model.getRegenerateKeysEnabled().getEntity() != null) { regenerateKeysEnabledEditor.setEnabled((Boolean) model.getRegenerateKeysEnabled().getEntity()); } @@ -405,17 +424,6 @@ @Override public void eventRaised(Event ev, Object sender, EventArgs args) { timeZoneEditor.setEnabled((Boolean) model.getTimeZoneEnabled().getEntity()); - } - }); - - if (model.getRootPasswordEnabled().getEntity() != null) { - rootPasswordEnabledEditor.setEnabled((Boolean) model.getRootPasswordEnabled().getEntity()); - } - model.getRootPasswordEnabled().getEntityChangedEvent().addListener(new IEventListener() { - @Override - public void eventRaised(Event ev, Object sender, EventArgs args) { - rootPasswordEditor.setEnabled((Boolean) model.getRootPasswordEnabled().getEntity()); - rootPasswordVerificationEditor.setEnabled((Boolean) model.getRootPasswordEnabled().getEntity()); } }); @@ -433,8 +441,15 @@ } }); - } + model.getIsCloudInitEnabled().getEntityChangedEvent().addListener(new IEventListener() { + @Override + public void eventRaised(Event ev, Object sender, EventArgs args) { + boolean selected = (Boolean) model.getIsCloudInitEnabled().getEntity(); + cloudInitOptionsContent.setVisible(selected); + } + }); + } @Override public CloudInitModel flush() { diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.ui.xml index 4096433..eae9acb 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/CloudInitWidget.ui.xml @@ -3,7 +3,7 @@ <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor" - xmlns:l="urn:import:org.ovirt.engine.ui.common.widget.label" + xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog" xmlns:w="urn:import:org.ovirt.engine.ui.common.widget"> <ui:with field='resources' type='org.ovirt.engine.ui.common.CommonApplicationResources' /> @@ -49,83 +49,74 @@ .displayNone { display: none !important; } - .dnsDivider { - margin: 0px 5px 5px 5px; - border: 0; - height: 1px; - color: #444444; - background-color: #444444; - } + + .customScript { + width: 400px; + } + + .cloudInitLabel { + font-weight: bold; + } </ui:style> <g:FlowPanel ui:field="cloudInitOptions" addStyleNames="{style.verticalPanel}"> - <g:FlowPanel addStyleNames="{style.horizontalPanel}"> - <e:EntityModelCheckBoxEditor ui:field="hostnameEnabledEditor" addStyleNames="{style.optionCheckbox}" /> - <e:EntityModelTextBoxEditor ui:field="hostnameEditor" addStyleNames="{style.primaryOption}" /> - </g:FlowPanel> + <e:EntityModelCheckBoxEditor ui:field="cloudInitEnabledEditor" labelStyleName="{style.cloudInitLabel}"/> - <g:FlowPanel addStyleNames="{style.horizontalPanel} {style.comboBoxControlMargin}"> - <g:Label ui:field="domainLabel" /> - <e:EntityModelTextBoxEditor ui:field="domainEditor" /> - </g:FlowPanel> + <g:FlowPanel ui:field="cloudInitOptionsContent"> + <g:FlowPanel> + <e:EntityModelTextBoxEditor ui:field="hostnameEditor" addStyleNames="{style.primaryOption}" /> + <e:EntityModelTextBoxEditor ui:field="domainEditor" addStyleNames="{style.primaryOption}" /> + <e:EntityModelCheckBoxEditor ui:field="timeZoneEnabledEditor" addStyleNames="{style.primaryOption}" /> + <e:ListModelListBoxEditor ui:field="timeZoneEditor" addStyleNames="{style.primaryOption}" /> + </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.horizontalPanel}"> - <e:EntityModelCheckBoxEditor ui:field="timeZoneEnabledEditor" addStyleNames="{style.optionCheckbox}" /> - <e:ListModelListBoxEditor ui:field="timeZoneEditor" addStyleNames="{style.primaryOption}" /> - </g:FlowPanel> + <d:AdvancedParametersExpander ui:field="authenticationExpander"/> - <g:HTMLPanel><hr class="{style.dnsDivider}" /></g:HTMLPanel> + <g:FlowPanel ui:field="authenticationExpanderContent"> + <e:EntityModelPasswordBoxEditor ui:field="rootPasswordEditor" addStyleNames="{style.primaryOption}" /> + <e:EntityModelPasswordBoxEditor ui:field="rootPasswordVerificationEditor" addStyleNames="{style.primaryOption}" /> + <e:EntityModelTextAreaEditor ui:field="authorizedKeysEditor" addStyleNames="{style.primaryOption}" /> + <e:EntityModelCheckBoxEditor ui:field="regenerateKeysEnabledEditor" addStyleNames="{style.primaryOption}" /> + </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.horizontalPanel}"> - <e:EntityModelCheckBoxEditor ui:field="rootPasswordEnabledEditor" addStyleNames="{style.optionCheckbox}" /> - <e:EntityModelPasswordBoxEditor ui:field="rootPasswordEditor" addStyleNames="{style.primaryOption}" /> - </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.nestedOption}"> - <e:EntityModelPasswordBoxEditor ui:field="rootPasswordVerificationEditor" /> - </g:FlowPanel> + <d:AdvancedParametersExpander ui:field="networkExpander"/> + <g:FlowPanel ui:field="networkExpanderContent" addStyleNames="{style.primaryOption}" > + <e:EntityModelTextBoxEditor ui:field="dnsServers" /> + <e:EntityModelTextBoxEditor ui:field="dnsSearchDomains" /> - <g:FlowPanel addStyleNames="{style.horizontalPanel}"> - <e:EntityModelCheckBoxEditor ui:field="authorizedKeysEnabledEditor" addStyleNames="{style.optionCheckbox}" /> - <e:EntityModelTextAreaEditor ui:field="authorizedKeysEditor" addStyleNames="{style.primaryOption}" /> - </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.horizontalPanel}"> - <e:EntityModelCheckBoxEditor ui:field="regenerateKeysEnabledEditor" addStyleNames="{style.optionCheckbox}" /> - </g:FlowPanel> + <g:FlowPanel> + <e:EntityModelCheckBoxEditor ui:field="networkEnabledEditor" addStyleNames="{style.optionCheckbox}" /> + <w:ComboBox ui:field="networkComboBox" addStyleNames="{style.primaryOptionComboBox}" /> + </g:FlowPanel> + <g:FlowPanel addStyleNames="{style.horizontalPanel} {style.comboBoxControlMargin}"> + <g:Label ui:field="networkSelectLabel" /> + <g:Label ui:field="networkLabelSepSelectAdd" addStyleNames="{style.labelSep}" /> + <g:PushButton ui:field="networkAddButton" addStyleNames="{style.buttonStyle}"> + <g:upFace image='{resources.increaseIcon}' /> + </g:PushButton> + <g:Label ui:field="networkAddLabel" /> + <g:Label ui:field="networkLabelSepAddRemove" addStyleNames="{style.labelSep}" /> + <g:PushButton ui:field="networkRemoveButton" addStyleNames="{style.buttonStyle}"> + <g:upFace image='{resources.decreaseIcon}' /> + </g:PushButton> + <g:Label ui:field="networkRemoveLabel" /> + </g:FlowPanel> + <g:FlowPanel ui:field="networkOptions" addStyleNames="{style.nestedOption}"> + <e:EntityModelCheckBoxEditor ui:field="networkDhcpEditor" /> + <e:EntityModelTextBoxEditor ui:field="networkIpAddressEditor" /> + <e:EntityModelTextBoxEditor ui:field="networkNetmaskEditor" /> + <e:EntityModelTextBoxEditor ui:field="networkGatewayEditor" /> + <e:EntityModelCheckBoxEditor ui:field="networkStartOnBootEditor" /> + </g:FlowPanel> + </g:FlowPanel> - <g:HTMLPanel><hr class="{style.dnsDivider}" /></g:HTMLPanel> + <d:AdvancedParametersExpander ui:field="customScriptExpander" addStyleNames="{style.verticalPanel}"/> + <g:FlowPanel ui:field="customScriptExpanderContent" > + <e:EntityModelTextAreaEditor ui:field="customScriptEditor" + labelStyleName="{style.displayNone}" + contentWidgetStyleName="{style.customScript}, {style.primaryOption}" /> + </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.horizontalPanel}"> - <e:EntityModelCheckBoxEditor ui:field="networkEnabledEditor" addStyleNames="{style.optionCheckbox}" /> - <w:ComboBox ui:field="networkComboBox" addStyleNames="{style.primaryOptionComboBox}" /> - </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.horizontalPanel} {style.comboBoxControlMargin}"> - <g:Label ui:field="networkSelectLabel" /> - <g:Label ui:field="networkLabelSepSelectAdd" addStyleNames="{style.labelSep}" /> - <g:PushButton ui:field="networkAddButton" addStyleNames="{style.buttonStyle}"> - <g:upFace image='{resources.increaseIcon}' /> - </g:PushButton> - <g:Label ui:field="networkAddLabel" /> - <g:Label ui:field="networkLabelSepAddRemove" addStyleNames="{style.labelSep}" /> - <g:PushButton ui:field="networkRemoveButton" addStyleNames="{style.buttonStyle}"> - <g:upFace image='{resources.decreaseIcon}' /> - </g:PushButton> - <g:Label ui:field="networkRemoveLabel" /> - </g:FlowPanel> - <g:FlowPanel ui:field="networkOptions" addStyleNames="{style.nestedOption}"> - <e:EntityModelCheckBoxEditor ui:field="networkDhcpEditor" /> - <e:EntityModelTextBoxEditor ui:field="networkIpAddressEditor" /> - <e:EntityModelTextBoxEditor ui:field="networkNetmaskEditor" /> - <e:EntityModelTextBoxEditor ui:field="networkGatewayEditor" /> - <e:EntityModelCheckBoxEditor ui:field="networkStartOnBootEditor" /> - <g:HTMLPanel><hr class="{style.dnsDivider}" /></g:HTMLPanel> - <e:EntityModelTextBoxEditor ui:field="dnsServers" /> - <e:EntityModelTextBoxEditor ui:field="dnsSearchDomains" /> - </g:FlowPanel> - - <g:FlowPanel addStyleNames="{style.horizontalPanel} {style.comboBoxControlMargin}"> - <g:Label ui:field="customScriptLabel" /> - <e:EntityModelTextAreaEditor ui:field="customScriptEditor" addStyleNames="{style.primaryOption}" /> - </g:FlowPanel> - + </g:FlowPanel> </g:FlowPanel> </ui:UiBinder> diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/RunOnceCloudInitWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/RunOnceCloudInitWidget.java new file mode 100644 index 0000000..8a08925 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/RunOnceCloudInitWidget.java @@ -0,0 +1,23 @@ +package org.ovirt.engine.ui.common.widget.uicommon.popup.vm; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; + +public class RunOnceCloudInitWidget extends CloudInitWidget { + + public interface CustomStyleResource extends CloudInitWidget.Resources { + + interface Style extends BasicStyle { + } + + @Override + @ClientBundle.Source({ CloudInitWidget.BasicStyle.DEFAULT_CSS, "org/ovirt/engine/ui/common/css/RunOnceVmInitStyle.css" }) + Style createStyle(); + } + + public RunOnceCloudInitWidget() { + super(((CustomStyleResource) GWT.create(CustomStyleResource.class)).createStyle()); + } +} + + diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmPopupCloudInitWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmPopupCloudInitWidget.java new file mode 100644 index 0000000..1d892ce --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmPopupCloudInitWidget.java @@ -0,0 +1,22 @@ +package org.ovirt.engine.ui.common.widget.uicommon.popup.vm; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; + +public class VmPopupCloudInitWidget extends CloudInitWidget { + + public interface CustomStyleResource extends CloudInitWidget.Resources { + + interface Style extends BasicStyle { + } + + @Override + @ClientBundle.Source({ CloudInitWidget.BasicStyle.DEFAULT_CSS, "org/ovirt/engine/ui/common/css/VmPopupVmInitStyle.css" }) + Style createStyle(); + } + + public VmPopupCloudInitWidget() { + super(((CustomStyleResource) GWT.create(CustomStyleResource.class)).createStyle()); + } + +} diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java index 4f42c18..ae83199 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java @@ -68,7 +68,6 @@ String attachImageSelectbox(); - String cloudInitLabel(); } @UiField @@ -101,7 +100,7 @@ @UiField @Ignore @WithElementId("cloudInitWidget") - CloudInitWidget cloudInitWidget; + RunOnceCloudInitWidget cloudInitWidget; @UiField @WithElementId @@ -194,11 +193,6 @@ @Path(value = "sysPrepPassword.entity") @WithElementId("sysPrepPassword") EntityModelTextBoxEditor sysPrepPasswordEditor; - - @UiField(provided = true) - @Path(value = "isCloudInitEnabled.entity") - @WithElementId("isCloudInitEnabled") - EntityModelCheckBoxEditor cloudInitEnabledEditor; @UiField(provided = true) @Path(value = "displayConsole_Vnc_IsSelected.entity") @@ -297,9 +291,6 @@ sysPrepUserNameEditor.setLabel(constants.runOncePopupSysPrepUserNameLabel()); sysPrepPasswordEditor.setLabel(constants.runOncePopupSysPrepPasswordLabel()); - // Linux Cloud-Init - cloudInitEnabledEditor.setLabel(constants.runOncePopupCloudInitLabel()); - // Display Protocol displayConsoleVncEditor.setLabel(constants.runOncePopupDisplayConsoleVncLabel()); displayConsoleSpiceEditor.setLabel(constants.runOncePopupDisplayConsoleSpiceLabel()); @@ -314,7 +305,6 @@ runAsStatelessEditor = new EntityModelCheckBoxEditor(Align.RIGHT); runAndPauseEditor = new EntityModelCheckBoxEditor(Align.RIGHT); useAlternateCredentialsEditor = new EntityModelCheckBoxEditor(Align.RIGHT); - cloudInitEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT); } void initRadioButtonEditors() { @@ -379,7 +369,6 @@ isoImageEditor.addLabelStyleName(style.attachImageSelectBoxLabel()); floppyImageEditor.addContentWidgetStyleName(style.attachImageSelectbox()); isoImageEditor.addContentWidgetStyleName(style.attachImageSelectbox()); - cloudInitEnabledEditor.addContentWidgetStyleName(style.cloudInitLabel()); } @Override @@ -398,13 +387,6 @@ } }); - object.getIsCloudInitEnabled().getEntityChangedEvent().addListener(new IEventListener() { - @Override - public void eventRaised(Event ev, Object sender, EventArgs args) { - boolean selected = (Boolean) object.getIsCloudInitEnabled().getEntity(); - cloudInitWidget.setVisible(selected); - } - }); object.getIsSysprepEnabled().getEntityChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml index 9578df4..08fa1e7 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml @@ -142,9 +142,6 @@ border: 1px solid transparent; } - .cloudInitLabel { - font-weight: bold !important; - } </ui:style> <g:FlowPanel> @@ -206,8 +203,7 @@ </g:VerticalPanel> <g:VerticalPanel ui:field="cloudInitSubPanel" addStyleNames="{style.initialRunPanel}"> - <e:EntityModelCheckBoxEditor ui:field="cloudInitEnabledEditor" /> - <vm:CloudInitWidget ui:field="cloudInitWidget"/> + <vm:RunOnceCloudInitWidget ui:field="cloudInitWidget"/> </g:VerticalPanel> </g:FlowPanel> </g:DisclosurePanel> diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/BaseVmInitStyle.css b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/BaseVmInitStyle.css new file mode 100644 index 0000000..5b6f374 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/BaseVmInitStyle.css @@ -0,0 +1,3 @@ +.someStyle { + +} \ No newline at end of file diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/RunOnceVmInitStyle.css b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/RunOnceVmInitStyle.css new file mode 100644 index 0000000..ae09b52 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/RunOnceVmInitStyle.css @@ -0,0 +1,3 @@ +.someStyle { + background-color: red; +} \ No newline at end of file diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/VmPopupVmInitStyle.css b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/VmPopupVmInitStyle.css new file mode 100644 index 0000000..c5a3fac --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/css/VmPopupVmInitStyle.css @@ -0,0 +1,3 @@ +.someStyle { + background-color: blue; +} \ No newline at end of file diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/CloudInitModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/CloudInitModel.java index 0e9c42b..34900d4 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/CloudInitModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/CloudInitModel.java @@ -30,15 +30,12 @@ import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.Event; import org.ovirt.engine.ui.uicompat.EventArgs; +import org.ovirt.engine.ui.uicompat.IEventListener; public class CloudInitModel extends Model { - private EntityModel privateHostnameEnabled; - public EntityModel getHostnameEnabled() { - return privateHostnameEnabled; - } - private void setHostnameEnabled(EntityModel value) { - privateHostnameEnabled = value; + public boolean getHostnameEnabled() { + return !StringHelper.isNullOrEmpty((String) getHostname().getEntity()); } private EntityModel privateHostname; @@ -65,13 +62,20 @@ privateCustomScript = value; } - - private EntityModel privateAuthorizedKeysEnabled; - public EntityModel getAuthorizedKeysEnabled() { - return privateAuthorizedKeysEnabled; + public boolean getAuthorizedKeysEnabled() { + return StringHelper.isNullOrEmpty((String) getRootPassword().getEntity()); } - private void setAuthorizedKeysEnabled(EntityModel value) { - privateAuthorizedKeysEnabled = value; + + private EntityModel privateIsCloudInitEnabled; + + public EntityModel getIsCloudInitEnabled() + { + return privateIsCloudInitEnabled; + } + + private void setIsCloudInitEnabled(EntityModel value) + { + privateIsCloudInitEnabled = value; } private EntityModel privateAuthorizedKeys; @@ -108,13 +112,8 @@ privateTimeZoneList = value; } - - private EntityModel privateRootPasswordEnabled; - public EntityModel getRootPasswordEnabled() { - return privateRootPasswordEnabled; - } - private void setRootPasswordEnabled(EntityModel value) { - privateRootPasswordEnabled = value; + public boolean getRootPasswordEnabled() { + return StringHelper.isNullOrEmpty((String) getRootPassword().getEntity()); } private EntityModel privateRootPassword; @@ -310,16 +309,15 @@ } public CloudInitModel() { - setHostnameEnabled(new EntityModel()); + setIsCloudInitEnabled(new EntityModel()); + setHostname(new EntityModel()); setDomain(new EntityModel()); - setAuthorizedKeysEnabled(new EntityModel()); setAuthorizedKeys(new EntityModel()); setCustomScript(new EntityModel()); setRegenerateKeysEnabled(new EntityModel()); setTimeZoneEnabled(new EntityModel()); setTimeZoneList(new ListModel()); - setRootPasswordEnabled(new EntityModel()); setRootPassword(new EntityModel()); setRootPasswordVerification(new EntityModel()); @@ -361,11 +359,10 @@ } public void init(final VmBase vm) { - getHostnameEnabled().setEntity(false); - getAuthorizedKeysEnabled().setEntity(false); + getIsCloudInitEnabled().setEntity(vm.getVmInit() != null); + getRegenerateKeysEnabled().setEntity(false); getTimeZoneEnabled().setEntity(false); - getRootPasswordEnabled().setEntity(false); getNetworkEnabled().setEntity(false); getAttachmentEnabled().setEntity(false); @@ -391,7 +388,6 @@ VmInit vmInit = (vm != null) ? vm.getVmInit() : null; if (vmInit != null) { if (!StringHelper.isNullOrEmpty(vmInit.getHostname())) { - getHostnameEnabled().setEntity(true); getHostname().setEntity(vmInit.getHostname()); } getDomain().setEntity(vmInit.getDomain()); @@ -408,12 +404,10 @@ } if (!StringHelper.isNullOrEmpty(vmInit.getRootPassword())) { - getRootPasswordEnabled().setEntity(true); getRootPassword().setEntity(vmInit.getRootPassword()); getRootPasswordVerification().setEntity(vmInit.getRootPassword()); } if (!StringHelper.isNullOrEmpty(vmInit.getAuthorizedKeys())) { - getAuthorizedKeysEnabled().setEntity(true); getAuthorizedKeys().setEntity(vmInit.getAuthorizedKeys()); } if (vmInit.getRegenerateKeys() != null) { @@ -428,15 +422,12 @@ public boolean validate() { getHostname().setIsValid(true); - if ((Boolean) getHostnameEnabled().getEntity()) { + if (getHostnameEnabled()) { getHostname().validateEntity(new IValidation[] { new HostnameValidation() }); } getDomain().setIsValid(true); getAuthorizedKeys().setIsValid(true); - if ((Boolean) getAuthorizedKeysEnabled().getEntity()) { - getAuthorizedKeys().validateEntity(new IValidation[] { new NotEmptyValidation() }); - } getTimeZoneList().setIsValid(true); if ((Boolean) getTimeZoneEnabled().getEntity()) { @@ -445,11 +436,11 @@ getRootPassword().setIsValid(true); getRootPasswordVerification().setIsValid(true); - if ((Boolean) getRootPasswordEnabled().getEntity()) { + if (getRootPasswordEnabled()) { getRootPassword().validateEntity(new IValidation[] { new NotEmptyValidation() }); if (getRootPassword().getIsValid()) { - if (!((String) getRootPassword().getEntity()) - .equals((String) getRootPasswordVerification().getEntity())) { + if (!(getRootPassword().getEntity()) + .equals(getRootPasswordVerification().getEntity())) { ArrayList<String> reasons = new ArrayList<String>(); reasons.add(rootPasswordMatchMessage); getRootPassword().setInvalidityReasons(reasons); @@ -547,7 +538,7 @@ public VmInit buildCloudInitParameters() { VmInit vmInit = new VmInit(); - if ((Boolean) getHostnameEnabled().getEntity()) { + if (getHostnameEnabled()) { vmInit.setHostname((String) getHostname().getEntity()); } vmInit.setDomain((String) getDomain().getEntity()); @@ -556,10 +547,10 @@ Map.Entry<String, String> entry = (Map.Entry<String, String>) getTimeZoneList().getSelectedItem(); vmInit.setTimeZone(entry.getKey()); } - if ((Boolean) getRootPasswordEnabled().getEntity()) { + if (getRootPasswordEnabled()) { vmInit.setRootPassword((String) getRootPassword().getEntity()); } - if ((Boolean) getAuthorizedKeysEnabled().getEntity()) { + if (getAuthorizedKeysEnabled()) { vmInit.setAuthorizedKeys((String) getAuthorizedKeys().getEntity()); } if ((Boolean) getRegenerateKeysEnabled().getEntity()) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java index 73e153b..1631637 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java @@ -273,18 +273,6 @@ privateCloudInitModel = value; } - private EntityModel privateIsCloudInitEnabled; - - public EntityModel getIsCloudInitEnabled() - { - return privateIsCloudInitEnabled; - } - - private void setIsCloudInitEnabled(EntityModel value) - { - privateIsCloudInitEnabled = value; - } - private EntityModel privateIsCloudInitPossible; public EntityModel getIsCloudInitPossible() @@ -489,8 +477,8 @@ && (Boolean) getAttachFloppy().getEntity() && "[sysprep]".equals(getFloppyImage().getSelectedItem())) { //$NON-NLS-1$ return InitializationType.Sysprep; - } else if (getIsCloudInitEnabled().getEntity() != null - && (Boolean) getIsCloudInitEnabled().getEntity()) { + } else if (getCloudInit().getIsCloudInitEnabled().getEntity() != null + && (Boolean) getCloudInit().getIsCloudInitEnabled().getEntity()) { return InitializationType.CloudInit; } else { return InitializationType.None; @@ -564,7 +552,6 @@ getUseAlternateCredentials().getEntityChangedEvent().addListener(this); // Initial Boot tab - Cloud-Init - setIsCloudInitEnabled(new EntityModel()); setIsCloudInitPossible(new EntityModel()); setCloudInit(new CloudInitModel()); @@ -692,7 +679,7 @@ params.setSysPrepPassword((String) getSysPrepPassword().getEntity()); } - if (getIsCloudInitEnabled() != null && (Boolean) getIsCloudInitEnabled().getEntity()) { + if (getCloudInit().getIsCloudInitEnabled() != null && (Boolean) getCloudInit().getIsCloudInitEnabled().getEntity()) { params.setVmInit(getCloudInit().buildCloudInitParameters()); } @@ -963,7 +950,7 @@ getIsSysprepPossible().setEntity(getIsWindowsOS()); getIsSysprepEnabled().setEntity(getInitializationType() == InitializationType.Sysprep); getIsCloudInitPossible().setEntity(getIsLinuxOS()); - getIsCloudInitEnabled().setEntity(getInitializationType() == InitializationType.CloudInit); + getCloudInit().getIsCloudInitEnabled().setEntity(getInitializationType() == InitializationType.CloudInit); } public boolean validate() { -- To view, visit http://gerrit.ovirt.org/23200 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e4fa5b35c0ee7939d6c7024508944d2ce653d5e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
