Moti Asayag has uploaded a new change for review. Change subject: webadmin: Unified messages style and add update icon ......................................................................
webadmin: Unified messages style and add update icon The messages notifying the admin about available updates shares the same content. A new icon was introduced for the update availability message. In the following patches the icon will also be added to the main tab, in addition to the host status and alert. Change-Id: I2223e928901cdbc40c4fb420851400e7ee1fb216 Signed-off-by: Moti Asayag <masa...@redhat.com> --- M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationMessages.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationResources.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostGeneralInfoPresenter.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralInfoView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/alert/InLineAlertWidget.java A frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/webadmin/images/update_available.png 6 files changed, 54 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/40631/1 diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationMessages.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationMessages.java index e25f320..47f374c 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationMessages.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationMessages.java @@ -8,7 +8,7 @@ @DefaultMessage("A new version is available; an upgrade option will appear once the Host is moved to maintenance mode.") String hostHasUpgradeAlert(); - @DefaultMessage("If you wish to upgrade or reinstall the host click here.") + @DefaultMessage("A new version is available.") String hostInMaintenanceHasUpgradeAlert(); @DefaultMessage("This host is in non responding state. Try to Activate it; If the problem persists, switch Host to Maintenance mode and try to reinstall it.") diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationResources.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationResources.java index 8d6d91a..2d2cfbc 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationResources.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationResources.java @@ -145,6 +145,9 @@ @Source("images/log_warning.gif") ImageResource alertImage(); + @Source("images/update_available.png") + ImageResource updateAvailableImage(); + @Source("images/tag_locked.png") ImageResource readOnlyTagImage(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostGeneralInfoPresenter.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostGeneralInfoPresenter.java index 6c78ac4..6831fa7 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostGeneralInfoPresenter.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/tab/host/SubTabHostGeneralInfoPresenter.java @@ -20,6 +20,7 @@ import org.ovirt.engine.ui.webadmin.ApplicationMessages; import org.ovirt.engine.ui.webadmin.gin.AssetProvider; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.HostSelectionChangeEvent; +import org.ovirt.engine.ui.webadmin.widget.alert.InLineAlertWidget.AlertType; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -63,6 +64,17 @@ * a link to an action embedded */ void addAlert(Widget widget); + + /** + * Displays a new alert in the alerts panel of the host. + * + * @param widget + * the widget used to display the alert, usually just a text label, but can also be a text label with + * a link to an action embedded + * @param type + * the type of the alert + */ + void addAlert(Widget widget, AlertType type); } @@ -115,12 +127,12 @@ // Review the alerts and add those that are active: if (model.getHasUpgradeAlert()) { if (model.getEntity().getStatus() == VDSStatus.Maintenance) { - addTextAlert(view, messages.hostInMaintenanceHasUpgradeAlert()); - } - else { - addTextAlert(view, messages.hostHasUpgradeAlert()); + addTextAlert(view, messages.hostInMaintenanceHasUpgradeAlert(), AlertType.UPDATE_AVAILABLE); + } else { + addTextAlert(view, messages.hostHasUpgradeAlert(), AlertType.UPDATE_AVAILABLE); } } + if (model.getHasReinstallAlertNonResponsive()) { addTextAlert(view, messages.hostHasReinstallAlertNonResponsive()); } @@ -138,6 +150,11 @@ } } + private void addTextAlert(final ViewDef view, final String text, AlertType type) { + final Label label = new Label(text); + view.addAlert(label, type); + } + /** * Create a widget containing text and add it to the alerts panel of the host. * @@ -147,8 +164,7 @@ * the text content of the alert */ private void addTextAlert(final ViewDef view, final String text) { - final Label label = new Label(text); - view.addAlert(label); + addTextAlert(view, text, AlertType.ALERT); } /** diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralInfoView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralInfoView.java index 0b28646..49c8be0 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralInfoView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralInfoView.java @@ -28,6 +28,7 @@ import org.ovirt.engine.ui.webadmin.gin.AssetProvider; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host.SubTabHostGeneralInfoPresenter; import org.ovirt.engine.ui.webadmin.widget.alert.InLineAlertWidget; +import org.ovirt.engine.ui.webadmin.widget.alert.InLineAlertWidget.AlertType; import org.ovirt.engine.ui.webadmin.widget.label.DetailsTextBoxLabel; import org.ovirt.engine.ui.webadmin.widget.label.FullDateTimeLabel; import org.ovirt.engine.ui.webadmin.widget.label.NullableNumberTextBoxLabel; @@ -195,8 +196,13 @@ @Override public void addAlert(Widget alertWidget) { + addAlert(alertWidget, AlertType.ALERT); + } + + @Override + public void addAlert(Widget alertWidget, AlertType type) { // Add the composite panel to the alerts panel: - alertsList.add(new InLineAlertWidget(alertWidget)); + alertsList.add(new InLineAlertWidget(alertWidget, type)); // Make the panel visible if it wasn't: if (!alertsPanel.isVisible()) { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/alert/InLineAlertWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/alert/InLineAlertWidget.java index 0fc675b..af9787d 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/alert/InLineAlertWidget.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/alert/InLineAlertWidget.java @@ -3,6 +3,7 @@ import org.ovirt.engine.ui.webadmin.ApplicationResources; import org.ovirt.engine.ui.webadmin.gin.AssetProvider; +import com.google.gwt.resources.client.ImageResource; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Widget; @@ -12,15 +13,32 @@ * by the caller, both rendered horizontally */ public class InLineAlertWidget extends FlowPanel { - private final static ApplicationResources resources = AssetProvider.getResources(); + public static enum AlertType { + ALERT(resources.alertImage()), + UPDATE_AVAILABLE(resources.updateAvailableImage()); + + private ImageResource imageResource; + + private AlertType(ImageResource imageResource) { + this.imageResource = imageResource; + } + + public ImageResource getImageResource() { + return imageResource; + } + } + public InLineAlertWidget(Widget fromWidget) { - Image alertIcon = new Image(resources.alertImage()); + this(fromWidget, AlertType.ALERT); + } + + public InLineAlertWidget(Widget fromWidget, AlertType type) { + Image alertIcon = new Image(type.getImageResource()); alertIcon.getElement().getStyle().setProperty("display", "inline"); //$NON-NLS-1$ //$NON-NLS-2$ fromWidget.getElement().getStyle().setProperty("display", "inline"); //$NON-NLS-1$ //$NON-NLS-2$ add(alertIcon); add(fromWidget); } - } diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/webadmin/images/update_available.png b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/webadmin/images/update_available.png new file mode 100644 index 0000000..e9e386a --- /dev/null +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/webadmin/images/update_available.png Binary files differ -- To view, visit https://gerrit.ovirt.org/40631 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2223e928901cdbc40c4fb420851400e7ee1fb216 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches