use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel 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 onSaveSanStorageCommand = UICommand.createDefaultOkUiCommand("OnSaveSanStorage", this);
model.getCommands().add(onSaveSanStorageCommand);
// $NON-NLS-1$
UICommand cancelConfirmCommand = UICommand.createCancelUiCommand("CancelConfirm", this);
model.getCommands().add(cancelConfirmCommand);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class DataCenterIscsiBondListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
model.setTitle(ConstantsManager.getInstance().getConstants().removeIscsiBondTitle());
model.setHelpTag(HelpTag.remove_iscsi_bundle);
// $NON-NLS-1$
model.setHashName("remove_iscsi_bundle");
setWindow(model);
model.getLatch().setEntity(false);
ArrayList<String> items = new ArrayList<>();
for (IscsiBond selected : getSelectedItems()) {
items.add(selected.getName());
}
model.setItems(items);
// $NON-NLS-1$
UICommand removeCommand = UICommand.createDefaultOkUiCommand("OnRemove", this);
model.getCommands().add(removeCommand);
model.getCommands().add(createCancelCommand());
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class DataCenterListModel method onRemove.
public void onRemove() {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (StoragePool a : getSelectedItems()) {
parameters.add(new StoragePoolParametersBase(a.getId()));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveStoragePool, parameters, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class DataCenterListModel method onSave.
public void onSave() {
final DataCenterModel dcModel = (DataCenterModel) getWindow();
if (!dcModel.validate()) {
return;
}
if ((dcModel.getIsNew() || dcModel.getEntity() == null) && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
promptNoQuotaInDCMessage();
} else if (!dcModel.getIsNew() && getSelectedItem() != null && !dcModel.getVersion().getSelectedItem().equals(getSelectedItem().getCompatibilityVersion())) {
final ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().changeDataCenterCompatibilityVersionTitle());
confirmModel.setHelpTag(HelpTag.change_data_center_compatibility_version);
// $NON-NLS-1$
confirmModel.setHashName("change_data_center_compatibility_version");
final StoragePool sp = getSelectedItem();
startProgress();
IdQueryParameters params = new IdQueryParameters(sp.getId());
Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
List<StorageDomain> storages = returnValue.getReturnValue();
StorageDomain storage = null;
for (StorageDomain sd : storages) {
if (sd.getStorageDomainType().isDataDomain()) {
storage = sd;
}
}
StorageFormatType newFormat = null;
StorageFormatType oldFormat = null;
if (storage != null) {
newFormat = VersionStorageFormatUtil.getForVersion(dcModel.getVersion().getSelectedItem());
oldFormat = VersionStorageFormatUtil.getForVersion(sp.getCompatibilityVersion());
}
if (newFormat == oldFormat) {
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutChangeDcCompatibilityVersionMsg());
} else {
Version v = VersionStorageFormatUtil.getEarliestVersionSupported(newFormat);
confirmModel.setMessage(ConstantsManager.getInstance().getMessages().youAreAboutChangeDcCompatibilityVersionWithUpgradeMsg(v.getValue()));
}
stopProgress();
}));
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSaveInternal", this);
confirmModel.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
confirmModel.getCommands().add(tempVar2);
} else if (getSelectedItem() != null && getSelectedItem().getQuotaEnforcementType() != QuotaEnforcementTypeEnum.HARD_ENFORCEMENT && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
checkForQuotaInDC(dcModel.getEntity(), this);
} else if (dcModel.getIsNew()) {
// New data center, check for name uniqueness.
validateDataCenterName(dcModel);
} else {
onSaveInternal();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class DataCenterListModel method recoveryStorage.
public void recoveryStorage() {
final ConfirmationModel windowModel = new ConfirmationModel();
setWindow(windowModel);
windowModel.setTitle(ConstantsManager.getInstance().getConstants().dataCenterReInitializeTitle());
windowModel.setHelpTag(HelpTag.data_center_re_initialize);
// $NON-NLS-1$
windowModel.setHashName("data_center_re-initialize");
windowModel.getLatch().setIsAvailable(true);
windowModel.getLatch().setIsChangeable(true);
windowModel.startProgress();
AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomainList -> {
windowModel.stopProgress();
List<EntityModel> models = new ArrayList<>();
for (StorageDomain a : storageDomainList) {
if (a.getStorageDomainType() == StorageDomainType.Data && (a.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Unattached)) {
EntityModel tempVar = new EntityModel();
tempVar.setEntity(a);
models.add(tempVar);
}
}
windowModel.setItems(models);
if (models.size() > 0) {
EntityModel entityModel = models.size() != 0 ? models.get(0) : null;
if (entityModel != null) {
entityModel.setIsSelected(true);
}
}
if (models.isEmpty()) {
windowModel.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoCompatibleStorageDomainsAttachThisDcMsg());
windowModel.getLatch().setIsAvailable(false);
// $NON-NLS-1$
UICommand tempVar2 = new UICommand("Cancel", DataCenterListModel.this);
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar2.setIsDefault(true);
tempVar2.setIsCancel(true);
windowModel.getCommands().add(tempVar2);
} else {
// $NON-NLS-1$
UICommand tempVar3 = UICommand.createDefaultOkUiCommand("OnRecover", DataCenterListModel.this);
windowModel.getCommands().add(tempVar3);
// $NON-NLS-1$
UICommand tempVar4 = UICommand.createCancelUiCommand("Cancel", DataCenterListModel.this);
windowModel.getCommands().add(tempVar4);
}
}));
}
Aggregations