use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGuideModel method updateOptionsNonLocalFS.
private void updateOptionsNonLocalFS() {
if (hosts == null || allHosts == null || !isUpHostCheckCompleted()) {
return;
}
if (getEntity() == null) {
stopProgress();
setWindow(null);
return;
}
// Add host action.
UICommand addHostAction = new UICommand(ADD_HOST, this);
if (hosts.size() > 1) {
hosts.remove(0);
}
if (hosts.isEmpty()) {
addHostAction.setTitle(clusterConfigureHostsActionTitle);
getCompulsoryActions().add(addHostAction);
} else if (isAnyUpHostInCluster()) {
addHostAction.setTitle(clusterAddAnotherHostActionTitle);
getOptionalActions().add(addHostAction);
}
if (getEntity().getStoragePoolId() == null) {
addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance().getConstants().theClusterIsntAttachedToADcClusterGuide());
addHostAction.setIsExecutionAllowed(false);
return;
}
ArrayList<VDS> availableHosts = new ArrayList<>();
for (VDS vds : allHosts) {
if (!getEntity().getId().equals(vds.getClusterId()) && (vds.getStatus() == VDSStatus.Maintenance || vds.getStatus() == VDSStatus.PendingApproval) && vds.getSupportedClusterVersionsSet() != null && vds.getSupportedClusterVersionsSet().contains(getEntity().getCompatibilityVersion())) {
availableHosts.add(vds);
}
}
// Select host action.
UICommand selectHostAction = new UICommand(SELECT_HOST, this);
if (availableHosts.size() > 0) {
if (hosts.isEmpty()) {
selectHostAction.setTitle(selectHostsActionTitle);
getCompulsoryActions().add(selectHostAction);
} else if (isAnyUpHostInCluster()) {
selectHostAction.setTitle(selectHostsActionTitle);
getOptionalActions().add(selectHostAction);
}
}
stopProgress();
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGuideModel method onConfirmPMHost.
public void onConfirmPMHost() {
HostModel model = (HostModel) getWindow();
if (!model.validate()) {
return;
}
if (!model.getIsPm().getEntity() && ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().powerManagementConfigurationTitle());
confirmModel.setHelpTag(HelpTag.power_management_configuration);
// $NON-NLS-1$
confirmModel.setHashName("power_management_configuration");
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youHavntConfigPmMsg());
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnAddHost", this);
confirmModel.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmWithFocus", this);
confirmModel.getCommands().add(tempVar2);
} else {
onAddHost();
}
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGuideModel method updateOptionsLocalFS.
private void updateOptionsLocalFS() {
UICommand addHostAction = new UICommand(ADD_HOST, this);
addHostAction.setTitle(clusterAddAnotherHostActionTitle);
UICommand selectHost = new UICommand(SELECT_HOST, this);
selectHost.setTitle(selectHostsActionTitle);
if (localStorageHost != null) {
String hasHostReason = ConstantsManager.getInstance().getConstants().thisClusterBelongsToALocalDcWhichAlreadyContainHostClusterGuide();
addHostAction.getExecuteProhibitionReasons().add(hasHostReason);
addHostAction.setIsExecutionAllowed(false);
selectHost.getExecuteProhibitionReasons().add(hasHostReason);
selectHost.setIsExecutionAllowed(false);
getNote().setIsAvailable(true);
getNote().setEntity(ConstantsManager.getInstance().getConstants().attachLocalStorageDomainToFullyConfigure());
}
getCompulsoryActions().add(addHostAction);
getOptionalActions().add(selectHost);
stopProgress();
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeClusterTitle());
model.setHelpTag(HelpTag.remove_cluster);
// $NON-NLS-1$
model.setHashName("remove_cluster");
ArrayList<String> list = new ArrayList<>();
for (Cluster a : getSelectedItems()) {
list.add(a.getName());
}
model.setItems(list);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterListModel method onSaveConfirmCV.
private void onSaveConfirmCV(ClusterModel model) {
if (!model.getVersion().getSelectedItem().equals(getSelectedItem().getCompatibilityVersion())) {
final ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(constants.changeClusterCompatibilityVersionTitle());
confirmModel.setHelpTag(HelpTag.change_cluster_compatibility_version);
// $NON-NLS-1$
confirmModel.setHashName("change_cluster_compatibility_version");
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSaveConfirmCpuThreads", this);
getConfirmWindow().getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
getConfirmWindow().getCommands().add(tempVar2);
checkForActiveVms(model, confirmModel);
} else {
onSaveConfirmCpuThreads();
}
}
Aggregations