use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class HostListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
final ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeHostsTitle());
model.setHelpTag(HelpTag.remove_host);
// $NON-NLS-1$
model.setHashName("remove_host");
Set<Guid> clusters = new HashSet<>();
ArrayList<String> list = new ArrayList<>();
boolean heOnHosts = false;
for (VDS item : getSelectedItems()) {
clusters.add(item.getClusterId());
String name = item.getName();
if (item.isHostedEngineDeployed()) {
// $NON-NLS-1$
name = name + " *";
heOnHosts = true;
}
list.add(name);
}
model.setItems(list);
if (heOnHosts) {
model.setNote(ConstantsManager.getInstance().getConstants().heHostRemovalWarning());
}
// - the cluster should have gluster service enabled
if (clusters.size() == 1) {
model.startProgress();
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> {
if (cluster != null && cluster.supportsGlusterService()) {
model.getForce().setIsAvailable(true);
}
model.stopProgress();
}), clusters.iterator().next());
}
// $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.models.ConfirmationModel in project ovirt-engine by oVirt.
the class FenceAgentModel method confirmRemove.
/**
* Confirm the removal of the model.
*/
public void confirmRemove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(constants.areYouSureTitle());
String confirmMessage = "";
if (concurrentList.isEmpty()) {
confirmMessage = messages.confirmDeleteFenceAgent(getDisplayString());
} else {
StringBuilder builder = new StringBuilder();
builder.append(getDisplayString());
for (FenceAgentModel concurrentModel : concurrentList) {
// $NON-NLS-1$
builder.append("\n");
builder.append(concurrentModel.getDisplayString());
}
confirmMessage = messages.confirmDeleteAgentGroup(builder.toString());
}
model.setMessage(confirmMessage);
model.getLatch().setIsAvailable(true);
model.getLatch().setIsChangeable(true);
UICommand tempVar = UICommand.createDefaultOkUiCommand(ON_REMOVE, this);
model.getCommands().add(tempVar);
UICommand tempVar2 = UICommand.createCancelUiCommand(CANCEL, this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class FenceProxyModel method warnUserOnLimit.
public void warnUserOnLimit() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(constants.unableToRemoveTitle());
model.setMessage(constants.unableToRemove());
model.getLatch().setIsAvailable(true);
model.getLatch().setIsChangeable(true);
model.getCommands().add(UICommand.createCancelUiCommand(CANCEL, this));
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class StorageListModel method onSaveSanStorage.
private void onSaveSanStorage() {
ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
if (confirmationModel != null && !confirmationModel.validate()) {
return;
}
cancelConfirm();
getWindow().startProgress();
// $NON-NLS-1$
Task.create(this, new ArrayList<>(Arrays.asList(new Object[] { "SaveSan" }))).run();
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class StorageListModel method checkDomainAttachedToDc.
private void checkDomainAttachedToDc(String commandName, List<StorageDomain> storageDomains, StorageServerConnections storageServerConnections) {
final StorageModel storageModel = (StorageModel) getWindow();
StoragePool storagePool = storageModel.getDataCenter().getSelectedItem();
final UICommand okCommand = UICommand.createDefaultOkUiCommand(commandName, this);
if (storagePool.getId().equals(Guid.Empty)) {
okCommand.execute();
return;
}
VDS host = storageModel.getHost().getSelectedItem();
AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
if (!attachedStorageDomains.isEmpty()) {
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
model.setHelpTag(HelpTag.import_storage_domain_confirmation);
// $NON-NLS-1$
model.setHashName("import_storage_domain_confirmation");
List<String> stoageDomainNames = new ArrayList<>();
for (StorageDomainStatic domain : attachedStorageDomains) {
stoageDomainNames.add(domain.getStorageName());
}
model.setItems(stoageDomainNames);
// $NON-NLS-1$
UICommand cancelCommand = createCancelCommand("CancelImportConfirm");
model.getCommands().add(okCommand);
model.getCommands().add(cancelCommand);
} else {
okCommand.execute();
}
}), storagePool, storageDomains, storageServerConnections, host.getId());
}
Aggregations