Moti Asayag has uploaded a new change for review. Change subject: webadmin: Available updates alert for hosts ......................................................................
webadmin: Available updates alert for hosts When an update is available for ovirt-node, a proper message should be displayed, i.e. "An upgrade is available.". This will eliminate the former instructive message, along with the links to the actions. Instead the user will use either the buttons on the menu-bar or from context menu of the host. Change-Id: I50cc10e38897c2a47752ab7f5b808be6bb63bce1 Bug-Url: https://bugzilla.redhat.com/1186196 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, 51 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/40470/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..00f8e9b 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 @@ -5,11 +5,8 @@ public interface ApplicationMessages extends CommonApplicationMessages { - @DefaultMessage("A new version is available; an upgrade option will appear once the Host is moved to maintenance mode.") + @DefaultMessage("An upgrade is available.") String hostHasUpgradeAlert(); - - @DefaultMessage("If you wish to upgrade or reinstall the host click here.") - 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.") String hostHasReinstallAlertNonResponsive(); 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..129b16f 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 @@ -1,7 +1,6 @@ package org.ovirt.engine.ui.webadmin.section.main.presenter.tab.host; import org.ovirt.engine.core.common.businessentities.VDS; -import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.mode.ApplicationMode; import org.ovirt.engine.ui.common.place.PlaceRequestFactory; import org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter; @@ -20,6 +19,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 +63,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); } @@ -114,12 +125,7 @@ // 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.hostHasUpgradeAlert(), AlertType.UPDATE_AVAILABLE); } if (model.getHasReinstallAlertNonResponsive()) { addTextAlert(view, messages.hostHasReinstallAlertNonResponsive()); @@ -138,6 +144,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 +158,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/40470 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I50cc10e38897c2a47752ab7f5b808be6bb63bce1 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