Moti Asayag has uploaded a new change for review. Change subject: webadmin: Cleanup for host upgrade related methods ......................................................................
webadmin: Cleanup for host upgrade related methods Change-Id: I645a981a113dbd74983f52d9c5846395607c470c Signed-off-by: Moti Asayag <masa...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java 2 files changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/40632/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java index e71d320..101fcd3 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.List; import org.ovirt.engine.core.common.VdcActionUtils; import org.ovirt.engine.core.common.action.VdcActionParametersBase; @@ -639,7 +640,11 @@ } } - protected static boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String[] hostOs) + protected void setHasUpgradeAlert(List<RpmVersion> isos, String[] hostOs) { + setHasUpgradeAlert(shouldAlertUpgrade(isos, hostOs)); + } + + private boolean shouldAlertUpgrade(List<RpmVersion> isos, String[] hostOs) { // HhostOs holds the following components: // hostOs[0] holds prefix diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java index 5a1d7e7..5bd532b 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java @@ -1963,18 +1963,15 @@ @Override public void onSuccess(Object target, Object returnValue) { - ArrayList<RpmVersion> isos = (ArrayList<RpmVersion>) returnValue; - if (isos.size() > 0) { + @SuppressWarnings("unchecked") + List<RpmVersion> isos = (ArrayList<RpmVersion>) returnValue; + if (!isos.isEmpty()) { String [] hostOsInfo = vds.getHostOs().split("-"); //$NON-NLS-1$ for (int counter = 0; counter < hostOsInfo.length; counter++) { hostOsInfo[counter] = hostOsInfo[counter].trim(); } - generalModel.setHasUpgradeAlert( - generalModel.shouldAlertUpgrade( - isos, - hostOsInfo - ) - ); + + generalModel.setHasUpgradeAlert(isos, hostOsInfo); boolean executionAllowed = vds.getStatus() != VDSStatus.Up && vds.getStatus() != VDSStatus.Installing && vds.getStatus() != VDSStatus.PreparingForMaintenance @@ -1982,10 +1979,8 @@ && vds.getStatus() != VDSStatus.PendingApproval; if (!executionAllowed) { - getUpgradeCommand() - .getExecuteProhibitionReasons() - .add(constants - .switchToMaintenanceModeToEnableUpgradeReason()); + getUpgradeCommand().getExecuteProhibitionReasons() + .add(constants.switchToMaintenanceModeToEnableUpgradeReason()); } getUpgradeCommand().setIsExecutionAllowed(executionAllowed); } -- To view, visit https://gerrit.ovirt.org/40632 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I645a981a113dbd74983f52d9c5846395607c470c 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