Ravi Nori has uploaded a new change for review. Change subject: webadmin: host right click menu is missing 'reinstall' option ......................................................................
webadmin: host right click menu is missing 'reinstall' option Host's right click menu is missing "reinstall" option. Even when it's in maintenance, there is no such option. Instead, there's a link at the bottom left part of host's General sub tab - which is not likely the place where user will search for this option since the rest of this tab is for info about the host (read only). Change-Id: Ib716a984904d6b299cefa981d6d36d5e257e3f1c Bug-Url: https://bugzilla.redhat.com/1065739 Signed-off-by: Ravi Nori <rn...@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 A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallHostUtil.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/gin/uicommon/HostModule.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabHostView.java 6 files changed, 224 insertions(+), 136 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/25523/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 5705811..cc8231c 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 @@ -2,19 +2,13 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; import org.ovirt.engine.core.common.VdcActionUtils; -import org.ovirt.engine.core.common.action.UpdateVdsActionParameters; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; -import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.action.VdsActionParameters; import org.ovirt.engine.core.common.businessentities.NonOperationalReason; -import org.ovirt.engine.core.common.businessentities.Provider; import org.ovirt.engine.core.common.businessentities.VDS; -import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VDSType; import org.ovirt.engine.core.common.businessentities.VdsSpmStatus; @@ -25,7 +19,6 @@ import org.ovirt.engine.ui.frontend.AsyncQuery; import org.ovirt.engine.ui.frontend.Frontend; import org.ovirt.engine.ui.frontend.INewAsyncCallback; -import org.ovirt.engine.ui.uicommonweb.Linq; import org.ovirt.engine.ui.uicommonweb.UICommand; import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.help.HelpTag; @@ -34,9 +27,7 @@ import org.ovirt.engine.ui.uicompat.Event; import org.ovirt.engine.ui.uicompat.EventArgs; import org.ovirt.engine.ui.uicompat.EventDefinition; -import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult; import org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult; -import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback; import org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback; import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; import org.ovirt.engine.ui.uicompat.UIConstants; @@ -915,83 +906,8 @@ return; } - InstallModel model = new InstallModel(); - model.setVds(getEntity()); - setWindow(model); - model.setTitle(constants.installHostTitle()); - model.setHelpTag(HelpTag.install_host); - model.setHashName("install_host"); //$NON-NLS-1$ - model.getOVirtISO().setIsAvailable(false); + InstallHostUtil.install(this, getEntity()); - model.getOverrideIpTables().setIsAvailable(false); - - model.getHostVersion().setEntity(getEntity().getHostOs()); - model.getHostVersion().setIsAvailable(false); - - getWindow().startProgress(null); - if (getEntity().getVdsType() == VDSType.oVirtNode) { - AsyncDataProvider.getoVirtISOsList(new AsyncQuery(model, - new INewAsyncCallback() { - @Override - public void onSuccess(Object target, Object returnValue) { - - InstallModel model = (InstallModel) target; - - ArrayList<RpmVersion> isos = (ArrayList<RpmVersion>) returnValue; - Collections.sort(isos, new Comparator<RpmVersion>() { - @Override - public int compare(RpmVersion rpmV1, RpmVersion rpmV2) { - return RpmVersionUtils.compareRpmParts(rpmV2.getRpmName(), rpmV1.getRpmName()); - } - }); - model.getOVirtISO().setItems(isos); - model.getOVirtISO().setSelectedItem(Linq.firstOrDefault(isos)); - model.getOVirtISO().setIsAvailable(true); - model.getOVirtISO().setIsChangable(!isos.isEmpty()); - model.getHostVersion().setIsAvailable(true); - - if (isos.isEmpty()) { - model.setMessage(constants - .thereAreNoISOversionsVompatibleWithHostCurrentVerMsg()); - } - - addInstallCommands(model, isos.isEmpty()); - getWindow().stopProgress(); - } - }), - getEntity().getId()); - } else { - model.getUserPassword().setIsAvailable(true); - model.getUserPassword().setIsChangable(true); - - Version v3 = new Version(3, 0); - boolean isLessThan3 = getEntity().getVdsGroupCompatibilityVersion().compareTo(v3) < 0; - - if (!isLessThan3) { - model.getOverrideIpTables().setIsAvailable(true); - model.getOverrideIpTables().setEntity(true); - } - - addInstallCommands(model, false); - getWindow().stopProgress(); - } - } - - private void addInstallCommands(InstallModel model, boolean isOnlyClose) { - - if (!isOnlyClose) { - - UICommand command = new UICommand("OnInstall", this); //$NON-NLS-1$ - command.setTitle(constants.ok()); - command.setIsDefault(true); - model.getCommands().add(command); - } - model.getUserName().setEntity(getEntity().getSshUsername()); - UICommand command = new UICommand("Cancel", this); //$NON-NLS-1$ - command.setTitle(isOnlyClose ? constants.close() - : constants.cancel()); - command.setIsCancel(true); - model.getCommands().add(command); } public void editHost() @@ -1002,55 +918,7 @@ public void onInstall() { - InstallModel model = (InstallModel) getWindow(); - final boolean isOVirt = getEntity().getVdsType() == VDSType.oVirtNode; - - if (!model.validate(isOVirt)) - { - return; - } - - UpdateVdsActionParameters param = new UpdateVdsActionParameters(); - param.setvds(getEntity()); - param.setVdsId(getEntity().getId()); - param.setPassword((String) model.getUserPassword().getEntity()); - param.setIsReinstallOrUpgrade(true); - param.setInstallVds(true); - param.setoVirtIsoFile(isOVirt ? ((RpmVersion) model.getOVirtISO().getSelectedItem()).getRpmName() : null); - param.setOverrideFirewall((Boolean) model.getOverrideIpTables().getEntity()); - param.setAuthMethod(model.getAuthenticationMethod()); - - Provider networkProvider = (Provider) model.getNetworkProviders().getSelectedItem(); - if (networkProvider != null) { - param.setProviderId(networkProvider.getId()); - param.setNetworkMappings((String) model.getInterfaceMappings().getEntity()); - } - - AsyncDataProvider.getClusterById(new AsyncQuery(param, new INewAsyncCallback() { - - @Override - public void onSuccess(Object model, Object returnValue) { - VDSGroup cluster = (VDSGroup) returnValue; - UpdateVdsActionParameters internalParam = (UpdateVdsActionParameters) model; - - internalParam.setRebootAfterInstallation(cluster.supportsVirtService()); - Frontend.getInstance().runAction( - VdcActionType.UpdateVds, - internalParam, - new IFrontendActionAsyncCallback() { - @Override - public void executed(FrontendActionAsyncResult result) { - VdcReturnValueBase returnValue = result.getReturnValue(); - if (returnValue != null && returnValue.getSucceeded()) { - cancel(); - } - } - } - ); - } - }), getEntity().getVdsGroupId()); - - + InstallHostUtil.onInstall(this, getEntity()); } public void cancel() 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 b16f023..a381ae6 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 @@ -186,6 +186,18 @@ privateApproveCommand = value; } + private UICommand privateInstallCommand; + + public UICommand getInstallCommand() + { + return privateInstallCommand; + } + + private void setInstallCommand(UICommand value) + { + privateInstallCommand = value; + } + private UICommand privateRestartCommand; public UICommand getRestartCommand() @@ -353,6 +365,7 @@ setActivateCommand(new UICommand("Activate", this, true)); //$NON-NLS-1$ setMaintenanceCommand(new UICommand("Maintenance", this, true)); //$NON-NLS-1$ setApproveCommand(new UICommand("Approve", this)); //$NON-NLS-1$ + setInstallCommand(new UICommand("Install", this)); //$NON-NLS-1$ setRestartCommand(new UICommand("Restart", this, true)); //$NON-NLS-1$ setStartCommand(new UICommand("Start", this, true)); //$NON-NLS-1$ setStopCommand(new UICommand("Stop", this, true)); //$NON-NLS-1$ @@ -1240,6 +1253,16 @@ onSave(true); } + public void install() + { + InstallHostUtil.install(this, (VDS) getSelectedItem()); + } + + public void onInstall() + { + InstallHostUtil.onInstall(this, (VDS) getSelectedItem()); + } + public void restart() { final UIConstants constants = ConstantsManager.getInstance().getConstants(); @@ -1655,6 +1678,16 @@ getApproveCommand().setIsExecutionAllowed(approveAvailability); getApproveCommand().setIsAvailable(approveAvailability); + boolean installAvailability = false; + if (items.size() == 1 && items.get(0) instanceof VDS) { + VDS host = items.get(0); + installAvailability = host.getStatus() == VDSStatus.NonResponsive || + host.getStatus() == VDSStatus.InstallFailed || + host.getStatus() == VDSStatus.Maintenance; + } + getInstallCommand().setIsExecutionAllowed(installAvailability); + getInstallCommand().setIsAvailable(installAvailability); + getMaintenanceCommand().setIsExecutionAllowed(items.size() > 0 && VdcActionUtils.canExecute(items, VDS.class, VdcActionType.MaintenanceVds)); @@ -1789,6 +1822,10 @@ { approve(); } + else if (command == getInstallCommand()) + { + install(); + } else if (command == getRestartCommand()) { restart(); @@ -1861,6 +1898,10 @@ { onApprove(); } + else if ("OnInstall".equals(command.getName())) //$NON-NLS-1$ + { + onInstall(); + } else if ("OnRestart".equals(command.getName())) //$NON-NLS-1$ { onRestart(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallHostUtil.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallHostUtil.java new file mode 100644 index 0000000..4267bc1 --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/InstallHostUtil.java @@ -0,0 +1,166 @@ +package org.ovirt.engine.ui.uicommonweb.models.hosts; + +import org.ovirt.engine.core.common.action.UpdateVdsActionParameters; +import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.action.VdcReturnValueBase; +import org.ovirt.engine.core.common.businessentities.Provider; +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.VDSGroup; +import org.ovirt.engine.core.common.businessentities.VDSType; +import org.ovirt.engine.core.common.utils.RpmVersionUtils; +import org.ovirt.engine.core.compat.RpmVersion; +import org.ovirt.engine.core.compat.Version; +import org.ovirt.engine.ui.frontend.AsyncQuery; +import org.ovirt.engine.ui.frontend.Frontend; +import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.Linq; +import org.ovirt.engine.ui.uicommonweb.UICommand; +import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; +import org.ovirt.engine.ui.uicommonweb.help.HelpTag; +import org.ovirt.engine.ui.uicommonweb.models.Model; +import org.ovirt.engine.ui.uicompat.ConstantsManager; +import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult; +import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; + +public class InstallHostUtil { + + public static void install(final Model hostModel, final VDS host) { + + InstallModel model = new InstallModel(); + model.setVds(host); + hostModel.setWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().installHostTitle()); + model.setHelpTag(HelpTag.install_host); + model.setHashName("install_host"); //$NON-NLS-1$ + model.getOVirtISO().setIsAvailable(false); + + model.getOverrideIpTables().setIsAvailable(false); + + model.getHostVersion().setEntity(host.getHostOs()); + model.getHostVersion().setIsAvailable(false); + + hostModel.getWindow().startProgress(null); + if (host.getVdsType() == VDSType.oVirtNode) { + AsyncDataProvider.getoVirtISOsList(new AsyncQuery(model, + new INewAsyncCallback() { + @Override + public void onSuccess(Object target, Object returnValue) { + + InstallModel model = (InstallModel) target; + + ArrayList<RpmVersion> isos = (ArrayList<RpmVersion>) returnValue; + Collections.sort(isos, new Comparator<RpmVersion>() { + @Override + public int compare(RpmVersion rpmV1, RpmVersion rpmV2) { + return RpmVersionUtils.compareRpmParts(rpmV2.getRpmName(), rpmV1.getRpmName()); + } + }); + model.getOVirtISO().setItems(isos); + model.getOVirtISO().setSelectedItem(Linq.firstOrDefault(isos)); + model.getOVirtISO().setIsAvailable(true); + model.getOVirtISO().setIsChangable(!isos.isEmpty()); + model.getHostVersion().setIsAvailable(true); + + if (isos.isEmpty()) { + model.setMessage(ConstantsManager.getInstance().getConstants() + .thereAreNoISOversionsVompatibleWithHostCurrentVerMsg()); + } + + addInstallCommands(hostModel, model, host, isos.isEmpty()); + hostModel.getWindow().stopProgress(); + } + }), + host.getId()); + } else { + model.getUserPassword().setIsAvailable(true); + model.getUserPassword().setIsChangable(true); + + Version v3 = new Version(3, 0); + boolean isLessThan3 = host.getVdsGroupCompatibilityVersion().compareTo(v3) < 0; + + if (!isLessThan3) { + model.getOverrideIpTables().setIsAvailable(true); + model.getOverrideIpTables().setEntity(true); + } + addInstallCommands(hostModel, model, host, false); + hostModel.getWindow().stopProgress(); + } + } + + private static void addInstallCommands(Model hostModel, InstallModel model, VDS host, boolean isOnlyClose) { + + if (!isOnlyClose) { + + UICommand command = new UICommand("OnInstall", hostModel); //$NON-NLS-1$ + command.setTitle(ConstantsManager.getInstance().getConstants().ok()); + command.setIsDefault(true); + model.getCommands().add(command); + } + model.getUserName().setEntity(host.getSshUsername()); + UICommand command = new UICommand("Cancel", hostModel); //$NON-NLS-1$ + command.setTitle(isOnlyClose ? ConstantsManager.getInstance().getConstants().close() + : ConstantsManager.getInstance().getConstants().cancel()); + command.setIsCancel(true); + model.getCommands().add(command); + } + + public static void onInstall(final Model hostModel, final VDS host) { + InstallModel model = (InstallModel) hostModel.getWindow(); + final boolean isOVirt = host.getVdsType() == VDSType.oVirtNode; + + if (!model.validate(isOVirt)) + { + return; + } + + UpdateVdsActionParameters param = new UpdateVdsActionParameters(); + param.setvds(host); + param.setVdsId(host.getId()); + param.setPassword((String) model.getUserPassword().getEntity()); + param.setIsReinstallOrUpgrade(true); + param.setInstallVds(true); + param.setoVirtIsoFile(isOVirt ? ((RpmVersion) model.getOVirtISO().getSelectedItem()).getRpmName() : null); + param.setOverrideFirewall((Boolean) model.getOverrideIpTables().getEntity()); + param.setAuthMethod(model.getAuthenticationMethod()); + + Provider networkProvider = (Provider) model.getNetworkProviders().getSelectedItem(); + if (networkProvider != null) { + param.setProviderId(networkProvider.getId()); + param.setNetworkMappings((String) model.getInterfaceMappings().getEntity()); + } + + AsyncDataProvider.getClusterById(new AsyncQuery(param, new INewAsyncCallback() { + + @Override + public void onSuccess(Object model, Object returnValue) { + VDSGroup cluster = (VDSGroup) returnValue; + UpdateVdsActionParameters internalParam = (UpdateVdsActionParameters) model; + + internalParam.setRebootAfterInstallation(cluster.supportsVirtService()); + Frontend.getInstance().runAction( + VdcActionType.UpdateVds, + internalParam, + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + VdcReturnValueBase returnValue = result.getReturnValue(); + if (returnValue != null && returnValue.getSucceeded()) { + cancel(hostModel); + } + } + } + ); + } + }), host.getVdsGroupId()); + + + } + + public static void cancel(final Model hostModel) { + hostModel.setWindow(null); + } +} 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 8dfc5bc..b510239 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 @@ -1295,6 +1295,7 @@ @DefaultStringValue("Activate") String activateHost(); + @DefaultStringValue("Maintenance") String maintenanceHost(); @@ -1307,6 +1308,9 @@ @DefaultStringValue("Approve") String approveHost(); + @DefaultStringValue("Install") + String installHost(); + @DefaultStringValue("Configure Local Storage") String configureLocalStorageHost(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java index aef05d6..c1dafad 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java @@ -79,7 +79,8 @@ final Provider<ManualFencePopupPresenterWidget> manualFenceConfirmPopupProvider, final Provider<AssignTagsPopupPresenterWidget> assignTagsPopupProvider, final Provider<ReportPresenterWidget> reportWindowProvider, - final Provider<ConfigureLocalStoragePopupPresenterWidget> configureLocalStoragePopupProvider) { + final Provider<ConfigureLocalStoragePopupPresenterWidget> configureLocalStoragePopupProvider, + final Provider<HostInstallPopupPresenterWidget> installPopupProvider) { return new MainTabModelProvider<VDS, HostListModel>(eventBus, defaultConfirmPopupProvider, HostListModel.class) { @Override public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(HostListModel source, @@ -89,7 +90,9 @@ || lastExecutedCommand == getModel().getEditWithPMemphasisCommand() || lastExecutedCommand == getModel().getApproveCommand()) { return popupProvider.get(); - } else if (lastExecutedCommand == getModel().getAssignTagsCommand()) { + } else if (lastExecutedCommand == getModel().getInstallCommand()) { + return installPopupProvider.get(); + } else if (lastExecutedCommand == getModel().getAssignTagsCommand()) { return assignTagsPopupProvider.get(); } else if (lastExecutedCommand == getModel().getConfigureLocalStorageCommand()) { return configureLocalStoragePopupProvider.get(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabHostView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabHostView.java index 1e3640c..da2f923 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabHostView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabHostView.java @@ -246,6 +246,12 @@ return getMainModel().getApproveCommand(); } }); + getTable().addActionButton(new WebAdminButtonDefinition<VDS>(constants.installHost()) { + @Override + protected UICommand resolveCommand() { + return getMainModel().getInstallCommand(); + } + }); getTable().addActionButton(new WebAdminButtonDefinition<VDS>(constants.configureLocalStorageHost()) { @Override protected UICommand resolveCommand() { -- To view, visit http://gerrit.ovirt.org/25523 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib716a984904d6b299cefa981d6d36d5e257e3f1c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <rn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches