use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class StorageListModel method savePosixStorage.
private void savePosixStorage(TaskContext context) {
this.context = context;
StorageDomain selectedItem = getSelectedItem();
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
final PosixStorageModel posixModel = (PosixStorageModel) storageModel;
path = posixModel.getPath().getEntity();
storageDomain = isNew ? new StorageDomainStatic() : (StorageDomainStatic) Cloner.clone(selectedItem.getStorageStaticData());
saveBaseStorageProperties(model);
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
if (isNew) {
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
posixModel.getPath().setIsValid(false);
handleDomainAlreadyExists(storages);
} else {
saveNewPosixStorage();
}
}), null, path);
} else {
StorageDomain storageDomain = getSelectedItem();
if (isPathEditable(storageDomain)) {
updatePath();
}
updateStorageDomain();
}
}
use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class StorageListModel method saveNfsStorage.
private void saveNfsStorage(TaskContext context) {
this.context = context;
StorageDomain selectedItem = getSelectedItem();
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
final NfsStorageModel nfsModel = (NfsStorageModel) storageModel;
path = nfsModel.getPath().getEntity();
storageDomain = isNew ? new StorageDomainStatic() : (StorageDomainStatic) Cloner.clone(selectedItem.getStorageStaticData());
saveBaseStorageProperties(model);
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
if (isNew) {
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
nfsModel.getPath().setIsValid(false);
handleDomainAlreadyExists(storages);
} else {
saveNewNfsStorage();
}
}), null, path);
} else {
StorageDomain storageDomain = getSelectedItem();
if (isPathEditable(storageDomain)) {
updatePath();
}
updateStorageDomain();
}
}
use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class StorageListModel method saveLocalStorage.
private void saveLocalStorage(TaskContext context) {
this.context = context;
StorageDomain selectedItem = getSelectedItem();
StorageModel model = (StorageModel) getWindow();
VDS host = model.getHost().getSelectedItem();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
LocalStorageModel localModel = (LocalStorageModel) storageModel;
path = localModel.getPath().getEntity();
storageDomain = isNew ? new StorageDomainStatic() : (StorageDomainStatic) Cloner.clone(selectedItem.getStorageStaticData());
saveBaseStorageProperties(model);
if (isNew) {
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
handleDomainAlreadyExists(storages);
} else {
saveNewLocalStorage();
}
}), host.getStoragePoolId(), path);
} else {
StorageDomain storageDomain = getSelectedItem();
if (isPathEditable(storageDomain)) {
updatePath();
}
updateStorageDomain();
}
}
use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveSanStorage.
private void saveSanStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(sanModel.getType());
storageDomain.setStorageDomainType(sanModel.getRole());
storageDomain.setStorageFormat(sanModel.getContainer().getFormat().getSelectedItem());
storageDomain.setStorageName(model.getName().getEntity());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewSanStorage();
}
getWindow().stopProgress();
}), null, path);
}
use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class DataCenterGuideModel method savePosixStorage.
private void savePosixStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
PosixStorageModel posixModel = (PosixStorageModel) storageModel;
path = posixModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewPosixStorage();
}
}), null, path);
}
Aggregations