Lior Vernia has uploaded a new change for review. Change subject: webadmin: Improved design of Provider popup ......................................................................
webadmin: Improved design of Provider popup Redesigned the dialog with the help of Eldan. Also added tenant name widget that appears when the Provider type is OpenStack Network. Change-Id: If5f1e855c0036aa35f4ab891f2481cc74281f3c5 Signed-off-by: Lior Vernia <lver...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/ProviderModel.java 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 4 files changed, 99 insertions(+), 31 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/15651/1 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 c09f472..596f64d 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 @@ -6,6 +6,7 @@ import org.ovirt.engine.core.common.action.ProviderParameters; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; +import org.ovirt.engine.core.common.businessentities.MultiTenantProviderProperties; import org.ovirt.engine.core.common.businessentities.Provider; import org.ovirt.engine.core.common.businessentities.ProviderType; import org.ovirt.engine.core.common.errors.VdcBllErrors; @@ -52,6 +53,7 @@ private EntityModel requiresAuthentication = new EntityModel(); private EntityModel username = new EntityModel(); private EntityModel password = new EntityModel(); + private EntityModel tenantName = new EntityModel(); private UICommand testCommand; private EntityModel testResult = new EntityModel(); @@ -83,6 +85,10 @@ return password; } + public EntityModel getTenantName() { + return tenantName; + } + public UICommand getTestCommand() { return testCommand; } @@ -106,6 +112,13 @@ boolean authenticationRequired = (Boolean) requiresAuthentication.getEntity(); getUsername().setIsChangable(authenticationRequired); getPassword().setIsChangable(authenticationRequired); + getTenantName().setIsChangable(authenticationRequired); + } + }); + getType().getSelectedItemChangedEvent().addListener(new IEventListener() { + @Override + public void eventRaised(Event ev, Object sender, EventArgs args) { + getTenantName().setIsAvailable(((ProviderType) getType().getSelectedItem()) == ProviderType.OPENSTACK_NETWORK); } }); @@ -115,10 +128,14 @@ getRequiresAuthentication().setEntity(provider.isRequiringAuthentication()); getUsername().setEntity(provider.getUsername()); getPassword().setEntity(provider.getPassword()); + getTenantName().setIsAvailable(false); List<ProviderType> allTypes = Arrays.asList(ProviderType.values()); getType().setItems(allTypes); getType().setSelectedItem(provider.getType()); + if (getTenantName().getIsAvailable()) { + getTenantName().setEntity(((MultiTenantProviderProperties) provider.getAdditionalProperties()).getTenantName()); + } UICommand tempVar = new UICommand(CMD_SAVE, this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); @@ -158,6 +175,9 @@ if (authenticationRequired) { provider.setUsername((String) username.getEntity()); provider.setPassword((String) password.getEntity()); + if (getTenantName().getIsAvailable()) { + provider.setAdditionalProperties(new MultiTenantProviderProperties((String) getTenantName().getEntity())); + } } } 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 f517043..8f9a579 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 @@ -2723,11 +2723,14 @@ @DefaultStringValue("Description") String descriptionProvider(); - @DefaultStringValue("URL") + @DefaultStringValue("Provider URL") String urlProvider(); @DefaultStringValue("Test") String testProvider(); + + @DefaultStringValue("Test succeeded, managed to access provider.") + String testSuccessMessage(); @DefaultStringValue("Requires Authentication") String requiresAuthenticationProvider(); @@ -2738,6 +2741,9 @@ @DefaultStringValue("Password") String passwordProvider(); + @DefaultStringValue("Tenant Name") + String tenantName(); + @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 e3a3b37..0c3d915 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 @@ -24,6 +24,7 @@ import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Label; import com.google.inject.Inject; public class ProviderPopupView extends AbstractModelBoundPopupView<ProviderModel> implements ProviderPopupPresenterWidget.ViewDef { @@ -40,20 +41,22 @@ ViewIdHandler idHandler = GWT.create(ViewIdHandler.class); } + private final ApplicationConstants constants; + @UiField @Path(value = "name.entity") @WithElementId EntityModelTextBoxEditor nameEditor; - @UiField(provided = true) - @Path(value = "type.selectedItem") - @WithElementId - ListModelListBoxEditor<Object> typeEditor; - @UiField @Path(value = "description.entity") @WithElementId EntityModelTextBoxEditor descriptionEditor; + + @UiField(provided = true) + @Path(value = "type.selectedItem") + @WithElementId + ListModelListBoxEditor<Object> typeEditor; @UiField @Path(value = "url.entity") @@ -65,6 +68,10 @@ @UiField Image testResultImage; + + @UiField + @Ignore + Label testResultMessage; @UiField(provided = true) @Path(value = "requiresAuthentication.entity") @@ -82,6 +89,11 @@ EntityModelPasswordBoxEditor passwordEditor; @UiField + @Path(value = "tenantName.entity") + @WithElementId + EntityModelTextBoxEditor tenantNameEditor; + + @UiField Style style; private ApplicationResources resources; @@ -95,6 +107,7 @@ requiresAuthenticationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.resources = resources; + this.constants = constants; initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); localize(constants); @@ -104,13 +117,14 @@ void localize(ApplicationConstants constants) { nameEditor.setLabel(constants.nameProvider()); - typeEditor.setLabel(constants.typeProvider()); descriptionEditor.setLabel(constants.descriptionProvider()); + typeEditor.setLabel(constants.typeProvider()); urlEditor.setLabel(constants.urlProvider()); testButton.setLabel(constants.testProvider()); requiresAuthenticationEditor.setLabel(constants.requiresAuthenticationProvider()); usernameEditor.setLabel(constants.usernameProvider()); passwordEditor.setLabel(constants.passwordProvider()); + tenantNameEditor.setLabel(constants.tenantName()); } @Override @@ -134,7 +148,7 @@ interface Style extends CssResource { String contentStyle(); - String testResultImageStyle(); + String testResultImage(); } @Override @@ -145,7 +159,7 @@ @Override public void setTestResultImage(String errorMessage) { testResultImage.setResource(errorMessage.isEmpty() ? resources.logNormalImage() : resources.logErrorImage()); - testResultImage.setStylePrimaryName(style.testResultImageStyle()); - testResultImage.setTitle(errorMessage); + testResultImage.setStylePrimaryName(style.testResultImage()); + testResultMessage.setText(errorMessage.isEmpty() ? constants.testSuccessMessage() : errorMessage); } } 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 4e7e61f..d19abdd 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 @@ -8,40 +8,68 @@ .contentStyle { } + .generalTabTopDecorator { + background-color: #D3D3D3; + margin-bottom: 8px; + padding-top: 6px; + padding-bottom: 6px; + } + .sectionStyle { margin-top: 20px; } - .testButtonStyle { - float: right; - margin-right: 10px; + .authField { + padding-left: 10px; } - .testResultImageStyle { + .testResultImage { + float: left; + vertical-align: middle; + margin-left: 3px; + } + + .testResultMessage { + float: left; + vertical-align: middle; + margin-left: 5px; + font-size: 8pt; + } + + .testButton { float: right; - margin-top: 3px; + vertical-align: middle; + margin-right: 10px; } </ui:style> - <d:SimpleDialogPanel width="450px" height="340px"> + <d:SimpleDialogPanel width="450px" height="450px"> <d:content> - <g:FlowPanel> - <g:FlowPanel> - <e:EntityModelTextBoxEditor ui:field="nameEditor" /> - <e:ListModelListBoxEditor ui:field="typeEditor" /> - <e:EntityModelTextBoxEditor ui:field="descriptionEditor" /> - <e:EntityModelTextBoxEditor ui:field="urlEditor" /> + <g:DockLayoutPanel> + <g:center> <g:FlowPanel> - <w:UiCommandButton ui:field="testButton" addStyleNames="{style.testButtonStyle}" /> - <g:Image ui:field="testResultImage" /> + <g:FlowPanel addStyleNames="{style.generalTabTopDecorator}"> + <e:EntityModelTextBoxEditor ui:field="nameEditor" /> + <e:EntityModelTextBoxEditor ui:field="descriptionEditor" /> + <e:ListModelListBoxEditor ui:field="typeEditor" /> + </g:FlowPanel> + <g:FlowPanel addStyleNames="{style.sectionStyle}"> + <e:EntityModelTextBoxEditor ui:field="urlEditor" /> + <e:EntityModelCheckBoxEditor ui:field="requiresAuthenticationEditor" /> + <e:EntityModelTextBoxEditor ui:field="usernameEditor" addStyleNames="{style.authField}" /> + <e:EntityModelPasswordBoxEditor ui:field="passwordEditor" addStyleNames="{style.authField}" /> + <e:EntityModelTextBoxEditor ui:field="tenantNameEditor" addStyleNames="{style.authField}" /> + </g:FlowPanel> </g:FlowPanel> - </g:FlowPanel> - <g:FlowPanel addStyleNames="{style.sectionStyle}"> - <e:EntityModelCheckBoxEditor ui:field="requiresAuthenticationEditor" /> - <e:EntityModelTextBoxEditor ui:field="usernameEditor" /> - <e:EntityModelPasswordBoxEditor ui:field="passwordEditor" /> - </g:FlowPanel> - </g:FlowPanel> + </g:center> + <g:south size="30"> + <g:FlowPanel> + <g:Image ui:field="testResultImage" addStyleNames="{style.testResultImage}" /> + <g:Label ui:field="testResultMessage" addStyleNames="{style.testResultMessage}" /> + <w:UiCommandButton ui:field="testButton" addStyleNames="{style.testButton}" /> + </g:FlowPanel> + </g:south> + </g:DockLayoutPanel> </d:content> </d:SimpleDialogPanel> -- To view, visit http://gerrit.ovirt.org/15651 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If5f1e855c0036aa35f4ab891f2481cc74281f3c5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <lver...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches