use of org.ovirt.engine.core.common.action.ActionParametersBase 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.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class DataCenterListModel method onSaveInternal.
public void onSaveInternal() {
DataCenterModel model = (DataCenterModel) getWindow();
if (model.getProgress() != null) {
return;
}
StoragePool dataCenter = model.getIsNew() ? new StoragePool() : (StoragePool) Cloner.clone(getSelectedItem());
// cancel confirm window if there is
cancelConfirmation();
// Save changes.
dataCenter.setName(model.getName().getEntity());
dataCenter.setdescription(model.getDescription().getEntity());
dataCenter.setComment(model.getComment().getEntity());
dataCenter.setIsLocal(model.getStoragePoolType().getSelectedItem());
dataCenter.setCompatibilityVersion(model.getVersion().getSelectedItem());
dataCenter.setQuotaEnforcementType(model.getQuotaEnforceTypeListModel().getSelectedItem());
model.startProgress();
if (model.getIsNew()) {
// When adding a data center use sync action to be able present a Guide Me dialog afterwards.
Frontend.getInstance().runAction(ActionType.AddEmptyStoragePool, new StoragePoolManagementParameter(dataCenter), result -> {
DataCenterListModel localModel = (DataCenterListModel) result.getState();
localModel.postOnSaveInternal(result.getReturnValue());
}, this);
} else {
// Use async action in order to close dialog immediately.
Frontend.getInstance().runMultipleAction(ActionType.UpdateStoragePool, new ArrayList<ActionParametersBase>(Arrays.asList(new StoragePoolManagementParameter(dataCenter))), result -> {
DataCenterListModel localModel = (DataCenterListModel) result.getState();
localModel.postOnSaveInternal(result.getReturnValue().get(0));
}, this);
}
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class DataCenterListModel method onForceRemove.
public void onForceRemove() {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (!model.validate()) {
return;
}
StoragePoolParametersBase tempVar = new StoragePoolParametersBase(getSelectedItem().getId());
tempVar.setForceDelete(true);
ActionParametersBase parametersBase = tempVar;
Frontend.getInstance().runAction(ActionType.RemoveStoragePool, parametersBase);
cancel();
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method postDetach.
public void postDetach(Model model) {
Frontend.getInstance().runMultipleAction(ActionType.RemoveStorageDomain, getRemoveParams(), outerResult -> {
Object[] array = (Object[]) outerResult.getState();
ConfirmationModel localModel1 = (ConfirmationModel) array[0];
List<ActionParametersBase> parameters = (List<ActionParametersBase>) array[1];
Frontend.getInstance().runMultipleAction(ActionType.DetachStorageDomainFromPool, parameters, innerResult -> {
ConfirmationModel localModel2 = (ConfirmationModel) innerResult.getState();
localModel2.stopProgress();
cancel();
}, localModel1);
}, new Object[] { model, getDetachParams() });
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method onDetach.
public void onDetach() {
final ConfirmationModel confirmModel = (ConfirmationModel) getWindow();
if (confirmModel.getProgress() != null) {
return;
}
if (!confirmModel.validate()) {
return;
}
// A list of 'detach' action parameters
setDetachParams(new ArrayList<>());
// A list of 'remove' action parameters
setRemoveParams(new ArrayList<>());
String localStorgaeDC = null;
for (StorageDomain a : getSelectedItems()) {
// For local storage - remove; otherwise - detach
if (a.getStorageType() == StorageType.LOCALFS && a.getStorageDomainType() != StorageDomainType.ISO) {
getRemoveParams().add(new RemoveStorageDomainParameters(a.getId()));
localStorgaeDC = a.getStoragePoolName();
} else {
getDetachParams().add(new DetachStorageDomainFromPoolParameters(a.getId(), getEntity().getId()));
}
}
confirmModel.startProgress();
if (getRemoveParams().size() > 0) {
AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
for (ActionParametersBase item : getRemoveParams()) {
((RemoveStorageDomainParameters) item).setVdsId(locaVds != null ? locaVds.getId() : null);
((RemoveStorageDomainParameters) item).setDoFormat(confirmModel.getForce().getEntity());
}
postDetach(getWindow());
}), localStorgaeDC);
} else {
postDetach(confirmModel);
}
}
Aggregations