Alexey Chub has uploaded a new change for review. Change subject: webadmin: "Fully configured" message for guide me dialogs (#850439) ......................................................................
webadmin: "Fully configured" message for guide me dialogs (#850439) http://bugzilla.redhat.com/850439 Also fix a bug relating to use of IsExecutableAllowed and ExecutionProhibitionReasons in UICommand model. Change-Id: I16d72904dfebe8fa0a29065e587c829998da782f Signed-off-by: Alexey Chub <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractUiCommandButton.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UICommand.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java 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 M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.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/guide/GuidePopupView.java 10 files changed, 118 insertions(+), 75 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/8435/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractUiCommandButton.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractUiCommandButton.java index f1d9401..5ba9945 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractUiCommandButton.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractUiCommandButton.java @@ -54,7 +54,17 @@ void updateButton() { getButtonWidget().setVisible(command.getIsAvailable() && command.getIsVisible()); getButtonWidget().setEnabled(command.getIsExecutionAllowed()); - getButtonWidget().setTitle(command.getTitle()); + + // Use prohibition reasons for tooltip if exist. + getButtonWidget().setTitle(!command.getExecuteProhibitionReasons().isEmpty() + ? command.getExecuteProhibitionReasons().isEmpty() + ? null + : command.getExecuteProhibitionReasons().get(0) + : command.getTitle()); + + if (command.getTitle() != null) { + getButtonWidget().setText(command.getTitle()); + } } protected abstract ButtonBase getButtonWidget(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UICommand.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UICommand.java index 2bc52ee..6259b9f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UICommand.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UICommand.java @@ -24,17 +24,20 @@ return isExecutionAllowed; } + /* + * Call this method after adding execute prohibition reasons. + */ public void setIsExecutionAllowed(boolean value) { if (isExecutionAllowed != value) { isExecutionAllowed = value; - OnPropertyChanged(new PropertyChangedEventArgs("IsExecutionAllowed")); //$NON-NLS-1$ - - if (getIsExecutionAllowed()) + if (value) { getExecuteProhibitionReasons().clear(); } + + OnPropertyChanged(new PropertyChangedEventArgs("IsExecutionAllowed")); //$NON-NLS-1$ } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java index c1527b1..5c3dadc 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java @@ -134,10 +134,10 @@ } if (getEntity().getstorage_pool_id() == null) { - addHostAction.setIsExecutionAllowed(false); addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .theClusterIsntAttachedToADcClusterGuide()); + addHostAction.setIsExecutionAllowed(false); return; } @@ -172,23 +172,23 @@ } private void UpdateOptionsLocalFS() { - UICommand tempVar = new UICommand("AddHost", this); //$NON-NLS-1$ - tempVar.setTitle(ClusterAddAnotherHostAction); - UICommand addHostAction = tempVar; - UICommand tempVar2 = new UICommand("SelectHost", this); //$NON-NLS-1$ - tempVar2.setTitle(SelectHostsAction); - UICommand selectHost = tempVar2; + + UICommand addHostAction = new UICommand("AddHost", this); //$NON-NLS-1$ + addHostAction.setTitle(ClusterAddAnotherHostAction); + UICommand selectHost = new UICommand("SelectHost", this); //$NON-NLS-1$ + selectHost.setTitle(SelectHostsAction); if (localStorageHost != null) { - addHostAction.setIsExecutionAllowed(false); - selectHost.setIsExecutionAllowed(false); String hasHostReason = - ConstantsManager.getInstance() - .getConstants() - .thisClusterBelongsToALocalDcWhichAlreadyContainHostClusterGuide(); + ConstantsManager.getInstance() + .getConstants() + .thisClusterBelongsToALocalDcWhichAlreadyContainHostClusterGuide(); + addHostAction.getExecuteProhibitionReasons().add(hasHostReason); + addHostAction.setIsExecutionAllowed(false); selectHost.getExecuteProhibitionReasons().add(hasHostReason); + selectHost.setIsExecutionAllowed(false); } getCompulsoryActions().add(addHostAction); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java index 7ea7766..0f6f59d 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java @@ -362,10 +362,9 @@ } } - UICommand tempVar2 = new UICommand("AddDataStorage", this); //$NON-NLS-1$ - tempVar2.setIsExecutionAllowed(upHosts.size() > 0); - UICommand addDataStorageAction = tempVar2; + UICommand addDataStorageAction = new UICommand("AddDataStorage", this); //$NON-NLS-1$ addDataStorageAction.getExecuteProhibitionReasons().add(NoUpHostReason); + addDataStorageAction.setIsExecutionAllowed(upHosts.size() > 0); if (unattachedStorage.isEmpty() && attachedDataStorages.isEmpty()) { @@ -379,13 +378,13 @@ } // Attach data storage action. - UICommand tempVar3 = new UICommand("AttachDataStorage", this); //$NON-NLS-1$ - tempVar3.setIsExecutionAllowed(unattachedStorage.size() > 0 && upHosts.size() > 0); - UICommand attachDataStorageAction = tempVar3; + UICommand attachDataStorageAction = new UICommand("AttachDataStorage", this); //$NON-NLS-1$ if (upHosts.isEmpty()) { attachDataStorageAction.getExecuteProhibitionReasons().add(NoUpHostReason); } + attachDataStorageAction.setIsExecutionAllowed(unattachedStorage.size() > 0 && upHosts.size() > 0); + if (attachedDataStorages.isEmpty()) { attachDataStorageAction.setTitle(DataCenterAttachStorageAction); @@ -397,10 +396,9 @@ getOptionalActions().add(attachDataStorageAction); } - UICommand tempVar4 = new UICommand("AddIsoStorage", this); //$NON-NLS-1$ - tempVar4.setIsExecutionAllowed(getEntity().getstatus() == StoragePoolStatus.Up); - UICommand addIsoStorageAction = tempVar4; + UICommand addIsoStorageAction = new UICommand("AddIsoStorage", this); //$NON-NLS-1$ addIsoStorageAction.getExecuteProhibitionReasons().add(NoDataDomainAttachedReason); + addIsoStorageAction.setIsExecutionAllowed(getEntity().getstatus() == StoragePoolStatus.Up); if (isoStorageDomains.isEmpty()) { @@ -429,14 +427,13 @@ // Data Center. It will not always be allowed. boolean attachIsoAvailable = attachedIsoStorages.isEmpty(); - UICommand tempVar5 = new UICommand("AttachIsoStorage", this); //$NON-NLS-1$ - tempVar5.setIsExecutionAllowed(attachIsoAllowed); - tempVar5.setIsAvailable(attachIsoAvailable); - UICommand attachIsoStorageAction = tempVar5; + UICommand attachIsoStorageAction = new UICommand("AttachIsoStorage", this); //$NON-NLS-1$ + attachIsoStorageAction.setIsAvailable(attachIsoAvailable); if (upHosts.isEmpty()) { attachIsoStorageAction.getExecuteProhibitionReasons().add(NoUpHostReason); } + attachIsoStorageAction.setIsExecutionAllowed(attachIsoAllowed); if (attachIsoAvailable) { @@ -497,12 +494,12 @@ if (localStorageHost != null) { - addHostAction.setIsExecutionAllowed(false); - selectHost.setIsExecutionAllowed(false); String hasHostReason = ConstantsManager.getInstance().getConstants().localDataCenterAlreadyContainsAHostDcGuide(); addHostAction.getExecuteProhibitionReasons().add(hasHostReason); + addHostAction.setIsExecutionAllowed(false); selectHost.getExecuteProhibitionReasons().add(hasHostReason); + selectHost.setIsExecutionAllowed(false); if (localStorageHost.getstatus() == VDSStatus.Up) { UICommand tempVar8 = new UICommand("AddLocalStorage", this); //$NON-NLS-1$ @@ -513,12 +510,12 @@ } else if (getEntity().getstatus() != StoragePoolStatus.Uninitialized) { - addHostAction.setIsExecutionAllowed(false); - selectHost.setIsExecutionAllowed(false); String dataCenterInitializeReason = ConstantsManager.getInstance().getConstants().dataCenterWasAlreadyInitializedDcGuide(); addHostAction.getExecuteProhibitionReasons().add(dataCenterInitializeReason); + addHostAction.setIsExecutionAllowed(false); selectHost.getExecuteProhibitionReasons().add(dataCenterInitializeReason); + selectHost.setIsExecutionAllowed(false); } if (hasMaintenance3_0Host) 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 eafb3c5..fd7b2d7 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 @@ -904,13 +904,14 @@ { VDS vds = hostGeneralModel.getEntity(); hostGeneralModel.setHasUpgradeAlert(true); - hostGeneralModel.getInstallCommand() - .setIsExecutionAllowed(vds.getstatus() != VDSStatus.Up - && vds.getstatus() != VDSStatus.Installing - && vds.getstatus() != VDSStatus.PreparingForMaintenance - && vds.getstatus() != VDSStatus.Reboot - && vds.getstatus() != VDSStatus.PendingApproval); - if (!hostGeneralModel.getInstallCommand().getIsExecutionAllowed()) + + boolean executionAllowed = vds.getstatus() != VDSStatus.Up + && vds.getstatus() != VDSStatus.Installing + && vds.getstatus() != VDSStatus.PreparingForMaintenance + && vds.getstatus() != VDSStatus.Reboot + && vds.getstatus() != VDSStatus.PendingApproval; + + if (!executionAllowed) { hostGeneralModel.getInstallCommand() .getExecuteProhibitionReasons() @@ -918,6 +919,7 @@ .getConstants() .switchToMaintenanceModeToEnableUpgradeReason()); } + hostGeneralModel.getInstallCommand().setIsExecutionAllowed(executionAllowed); } } 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 30e827f..c932477 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 @@ -1653,10 +1653,10 @@ if (!hasAdminSystemPermission && getConfigureLocalStorageCommand().getIsExecutionAllowed()) { - getConfigureLocalStorageCommand().setIsExecutionAllowed(false); getConfigureLocalStorageCommand().getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .configuringLocalStoragePermittedOnlyAdministratorsWithSystemLevelPermissionsReason()); + getConfigureLocalStorageCommand().setIsExecutionAllowed(false); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java index 787552d..85b25a9 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java @@ -755,11 +755,10 @@ // check if management network is attached LogicalNetworkModel mgmtNetwork = networkMap.get(HostInterfaceListModel.ENGINE_NETWORK_NAME); if (!mgmtNetwork.isAttached()) { + okCommand.getExecuteProhibitionReasons().add(ConstantsManager.getInstance().getConstants().mgmtNotAttachedToolTip()); okCommand.setIsExecutionAllowed(false); - okCommand.setTitle(ConstantsManager.getInstance().getConstants().mgmtNotAttachedToolTip()); } else { okCommand.setIsExecutionAllowed(true); - okCommand.setTitle(null); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java index 380b985..0434e3e 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java @@ -646,20 +646,20 @@ && item.getstatus() != VmTemplateStatus.Locked); if (getEditCommand().getIsExecutionAllowed() && blankSelected) { - getEditCommand().setIsExecutionAllowed(false); getEditCommand().getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .blankTemplateCannotBeEdited()); + getEditCommand().setIsExecutionAllowed(false); } getRemoveCommand().setIsExecutionAllowed(items.size() > 0 && VdcActionUtils.CanExecute(items, VmTemplate.class, VdcActionType.RemoveVmTemplate)); if (getRemoveCommand().getIsExecutionAllowed() && blankSelected) { - getRemoveCommand().setIsExecutionAllowed(false); getRemoveCommand().getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .blankTemplateCannotBeRemoved()); + getRemoveCommand().setIsExecutionAllowed(false); } getExportCommand().setIsExecutionAllowed(items.size() > 0 @@ -667,10 +667,10 @@ if (getExportCommand().getIsExecutionAllowed() && blankSelected) { - getExportCommand().setIsExecutionAllowed(false); getExportCommand().getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .blankTemplateCannotBeExported()); + getExportCommand().setIsExecutionAllowed(false); } getCopyCommand().setIsExecutionAllowed(items.size() == 1 && item != null @@ -678,10 +678,10 @@ if (getCopyCommand().getIsExecutionAllowed() && blankSelected) { - getCopyCommand().setIsExecutionAllowed(false); getCopyCommand().getExecuteProhibitionReasons().add(ConstantsManager.getInstance() .getConstants() .blankTemplateCannotBeCopied()); + getCopyCommand().setIsExecutionAllowed(false); } } 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 ba52f40..e01e364 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 @@ -752,12 +752,21 @@ @DefaultStringValue("Data Center created.") String guidePopupDataCenterCreatedLabel(); + @DefaultStringValue("The Data Center is fully configured and ready for use.") + String guidePopupConfiguredDataCenterLabel(); + @DefaultStringValue("Cluster created.") String guidePopupClusterCreatedLabel(); + @DefaultStringValue("The Cluster is fully configured and ready for use.") + String guidePopupConfiguredClusterLabel(); + @DefaultStringValue("Virtual Machine created.") String guidePopupVMCreatedLabel(); + @DefaultStringValue("The Virtual Machine is fully configured and ready for use.") + String guidePopupConfiguredVmLabel(); + @DefaultStringValue("Cluster:") String moveHostPopupClusterLabel(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/guide/GuidePopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/guide/GuidePopupView.java index 41854ca..d762801 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/guide/GuidePopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/guide/GuidePopupView.java @@ -1,22 +1,5 @@ package org.ovirt.engine.ui.webadmin.section.main.view.popup.guide; -import org.ovirt.engine.core.compat.Event; -import org.ovirt.engine.core.compat.EventArgs; -import org.ovirt.engine.core.compat.IEventListener; -import org.ovirt.engine.core.compat.PropertyChangedEventArgs; -import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; -import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView; -import org.ovirt.engine.ui.common.widget.UiCommandButton; -import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel; -import org.ovirt.engine.ui.uicommonweb.UICommand; -import org.ovirt.engine.ui.uicommonweb.models.GuideModel; -import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGuideModel; -import org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterGuideModel; -import org.ovirt.engine.ui.uicommonweb.models.vms.VmGuideModel; -import org.ovirt.engine.ui.webadmin.ApplicationConstants; -import org.ovirt.engine.ui.webadmin.ApplicationResources; -import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.guide.GuidePopupPresenterWidget; - import com.google.gwt.core.client.GWT; import com.google.gwt.editor.client.SimpleBeanEditorDriver; import com.google.gwt.event.dom.client.ClickEvent; @@ -29,6 +12,24 @@ import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.inject.Inject; +import org.ovirt.engine.core.compat.Event; +import org.ovirt.engine.core.compat.EventArgs; +import org.ovirt.engine.core.compat.IEventListener; +import org.ovirt.engine.core.compat.PropertyChangedEventArgs; +import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; +import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView; +import org.ovirt.engine.ui.common.widget.UiCommandButton; +import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel; +import org.ovirt.engine.ui.uicommonweb.Linq; +import org.ovirt.engine.ui.uicommonweb.UICommand; +import org.ovirt.engine.ui.uicommonweb.models.GuideModel; +import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGuideModel; +import org.ovirt.engine.ui.uicommonweb.models.datacenters.DataCenterGuideModel; +import org.ovirt.engine.ui.uicommonweb.models.vms.VmGuideModel; +import org.ovirt.engine.ui.uicompat.ConstantsManager; +import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.ApplicationResources; +import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.guide.GuidePopupPresenterWidget; public class GuidePopupView extends AbstractModelBoundPopupView<GuideModel> implements GuidePopupPresenterWidget.ViewDef { @@ -78,6 +79,7 @@ Style style; private final ApplicationResources resources; + private final ApplicationConstants constants; @Inject public GuidePopupView(EventBus eventBus, @@ -85,6 +87,7 @@ ApplicationConstants constants) { super(eventBus, resources); this.resources = resources; + this.constants = constants; initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); localize(constants); @@ -113,18 +116,43 @@ if ("Progress".equals(propertyName)) { //$NON-NLS-1$ if (guideModel.getProgress() == null) { - if (guideModel.getCompulsoryActions().isEmpty()) { + + // Check whether there any available actions. + boolean hasAllowedActions = false; + for (Object item : Linq.Concat(guideModel.getCompulsoryActions(), guideModel.getOptionalActions())) { + UICommand command = (UICommand) item; + if (command.getIsExecutionAllowed()) { + hasAllowedActions = true; + break; + } + } + + // Choose an appropriate message matching the entity type (DC, Cluster or VM). + String message = null; + if (guideModel instanceof DataCenterGuideModel) { + message = constants.guidePopupConfiguredDataCenterLabel(); + } else if (guideModel instanceof ClusterGuideModel) { + message = constants.guidePopupConfiguredClusterLabel(); + } else if (guideModel instanceof VmGuideModel) { + message = constants.guidePopupConfiguredVmLabel(); + } + + if (!hasAllowedActions) { + infoLabel.setText(message); + compulsorySection.setVisible(false); + optionalSection.setVisible(false); + // Rename dialog button. + guideModel.getCommands().get(0).setTitle(ConstantsManager.getInstance().getConstants().ok()); + } else if (guideModel.getCompulsoryActions().isEmpty()) { infoLabel.setText(configurationCompleted); optionalSection.setVisible(true); compulsorySection.setVisible(false); - } - else if (guideModel.getOptionalActions().isEmpty()) { + } else if (guideModel.getOptionalActions().isEmpty()) { updateCreatedLabel(guideModel); optionalSection.setVisible(false); compulsorySection.setVisible(true); compulsoryActionsLabel.setVisible(true); - } - else { + } else { infoLabel.setText(unconfigured); optionalSection.setVisible(true); compulsorySection.setVisible(true); @@ -133,8 +161,7 @@ } updateActionsPanels(guideModel); - } - else if ("Window".equals(propertyName)) { //$NON-NLS-1$ + } else if ("Window".equals(propertyName)) { //$NON-NLS-1$ if (guideModel.getLastExecutedCommand().getName().equals("Cancel")) { //$NON-NLS-1$ redrawActionsPanels(); } @@ -176,10 +203,6 @@ command.Execute(); } }); - - if (!command.getExecuteProhibitionReasons().isEmpty()) { - guideButton.setTitle(command.getExecuteProhibitionReasons().get(0)); - } VerticalPanel buttonContainer = new VerticalPanel(); buttonContainer.add(guideButton); -- To view, visit http://gerrit.ovirt.org/8435 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16d72904dfebe8fa0a29065e587c829998da782f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alexey Chub <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
