use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class StorageListModel method forceCreationWarning.
private void forceCreationWarning(ArrayList<String> usedLunsMessages) {
StorageModel storageModel = (StorageModel) getWindow();
SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
sanStorageModelBase.setForce(true);
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().forceStorageDomainCreation());
model.setMessage(ConstantsManager.getInstance().getConstants().lunsAlreadyInUse());
model.setHelpTag(HelpTag.force_storage_domain_creation);
// $NON-NLS-1$
model.setHashName("force_storage_domain_creation");
model.setItems(usedLunsMessages);
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("OnSaveSanStorage", this);
model.getCommands().add(command);
// $NON-NLS-1$
command = createCancelCommand("CancelConfirm");
model.getCommands().add(command);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class TemplateListModel method onSave.
private void onSave() {
final UnitVmModel model = (UnitVmModel) getWindow();
if (!model.validate()) {
return;
}
final String name = model.getName().getEntity();
boolean isBaseTemplate = false;
if (model.getBehavior().isExistingTemplateBehavior()) {
isBaseTemplate = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate().isBaseTemplate();
} else if (model.getBehavior().isBlankTemplateBehavior()) {
isBaseTemplate = true;
}
if (isBaseTemplate) {
AsyncDataProvider.getInstance().isTemplateNameUnique(new AsyncQuery<>(isNameUnique -> {
if (model.getBehavior().isExistingTemplateBehavior()) {
selectedItem = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate();
} else {
selectedItem = ((ExistingBlankTemplateModelBehavior) model.getBehavior()).getVmTemplate();
}
if (!isNameUnique && name.compareToIgnoreCase(selectedItem.getName()) != 0) {
model.getName().getInvalidityReasons().add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
model.getName().setIsValid(false);
model.setValidTab(TabName.GENERAL_TAB, false);
model.fireValidationCompleteEvent();
return;
}
String selectedCpu = model.getCustomCpu().getSelectedItem();
if (selectedCpu != null && !selectedCpu.isEmpty() && !model.getCustomCpu().getItems().contains(selectedCpu)) {
ConfirmationModel confirmModel = new ConfirmationModel();
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuTitle());
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuMessage());
confirmModel.setHelpTag(HelpTag.edit_unsupported_cpu);
// $NON-NLS-1$
confirmModel.setHashName("edit_unsupported_cpu");
confirmModel.getCommands().add(// $NON-NLS-1$
new UICommand("postNameUniqueCheck", TemplateListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
confirmModel.getCommands().add(// $NON-NLS-1$
UICommand.createCancelUiCommand("CancelConfirmation", TemplateListModel.this));
setConfirmWindow(confirmModel);
} else {
postNameUniqueCheck();
}
}), name, model.getSelectedDataCenter() == null ? null : model.getSelectedDataCenter().getId());
} else {
postNameUniqueCheck();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method onDetach.
private void onDetach() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
if (!model.validate()) {
return;
}
setdetachPrms(new ArrayList<ActionParametersBase>());
setremovePrms(new ArrayList<ActionParametersBase>());
for (Object item : getSelectedItems()) {
StorageDomain storageDomain = (StorageDomain) item;
if (storageDomain.getStorageType() != StorageType.LOCALFS) {
DetachStorageDomainFromPoolParameters param = new DetachStorageDomainFromPoolParameters();
param.setStorageDomainId(getEntity().getId());
if (storageDomain.getStoragePoolId() != null) {
param.setStoragePoolId(storageDomain.getStoragePoolId());
}
getdetachPrms().add(param);
} else {
AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
StorageDomain storage = getEntity();
RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storage.getId());
tempVar.setVdsId(locaVds != null ? locaVds.getId() : null);
tempVar.setDoFormat(model.getForce().getEntity());
RemoveStorageDomainParameters removeStorageDomainParameters = tempVar;
getremovePrms().add(removeStorageDomainParameters);
if (getremovePrms().size() + getdetachPrms().size() == getSelectedItems().size()) {
Frontend.getInstance().runMultipleAction(ActionType.RemoveStorageDomain, getremovePrms());
}
}), storageDomain.getStoragePoolName());
}
if (getdetachPrms().size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.DetachStorageDomainFromPool, getdetachPrms());
}
}
cancel();
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method detach.
private void detach() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle());
model.setHelpTag(HelpTag.detach_storage);
// $NON-NLS-1$
model.setHashName("detach_storage");
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg());
ArrayList<String> items = new ArrayList<>();
boolean shouldAddressWarnning = false;
for (Object item : getSelectedItems()) {
StorageDomain a = (StorageDomain) item;
items.add(a.getStoragePoolName());
if (a.getStorageDomainType().isDataDomain()) {
shouldAddressWarnning = true;
break;
}
}
model.setItems(items);
if (containsLocalStorage(model)) {
model.getForce().setIsAvailable(true);
model.getForce().setIsChangeable(true);
model.setForceLabel(ConstantsManager.getInstance().getConstants().storageRemovePopupFormatLabel());
shouldAddressWarnning = false;
model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString()));
}
if (shouldAddressWarnning) {
model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote());
}
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnDetach", 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 VmBackupModel method onRemove.
private void onRemove() {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
model.startProgress();
AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(pools -> {
if (pools != null && pools.size() > 0) {
StoragePool pool = pools.get(0);
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (VM vm : getSelectedItems()) {
list.add(new RemoveVmFromImportExportParameters(vm.getId(), getEntity().getId(), pool.getId()));
}
Frontend.getInstance().runMultipleAction(ActionType.RemoveVmFromImportExport, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
onEntityChanged();
}, getWindow());
}
}), getEntity().getId());
}
Aggregations