use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method onMaintenance.
public void onMaintenance() {
final ConfirmationModel confirmationModel = (ConfirmationModel) getWindow();
List<ActionParametersBase> pb = getSelectedItems().stream().map(sd -> new DeactivateStorageDomainWithOvfUpdateParameters(sd.getId(), getEntity().getId(), confirmationModel.getForce().getEntity())).collect(Collectors.toList());
confirmationModel.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.DeactivateStorageDomainWithOvfUpdate, pb, result -> {
confirmationModel.stopProgress();
setWindow(null);
});
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class VolumeGeoRepListModel method updateConfig.
private void updateConfig() {
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
List<IFrontendActionAsyncCallback> callbacks;
final GlusterVolumeGeoReplicationSessionConfigModel geoRepConfigModel = (GlusterVolumeGeoReplicationSessionConfigModel) getWindow();
LinkedHashMap<String, String> oldConfigs = geoRepConfigModel.getConfigs();
geoRepConfigModel.startProgress();
for (EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> newConfigEntity : geoRepConfigModel.getConfigsModel().getItems()) {
Pair<Boolean, GlusterGeoRepSessionConfiguration> newConfigPair = newConfigEntity.getEntity();
GlusterGeoRepSessionConfiguration newConfig = newConfigPair.getSecond();
boolean isOldConfigNull = oldConfigs.get(newConfig.getKey()) == null;
boolean isNewConfigNull = newConfig.getValue() == null;
if (!isNewConfigNull && !newConfig.getValue().isEmpty() && (isOldConfigNull || !newConfig.getValue().equals(oldConfigs.get(newConfig.getKey())))) {
actionTypes.add(ActionType.SetGeoRepConfig);
parameters.add(geoRepConfigModel.formGeoRepConfigParameters(newConfig));
}
if (newConfigPair.getFirst()) {
actionTypes.add(ActionType.ResetDefaultGeoRepConfig);
parameters.add(geoRepConfigModel.formGeoRepConfigParameters(newConfig));
}
}
int numberOfConfigUpdates = parameters.size();
if (numberOfConfigUpdates == 0) {
geoRepConfigModel.stopProgress();
closeWindow();
return;
}
callbacks = new ArrayList<>(Collections.nCopies(numberOfConfigUpdates, (IFrontendActionAsyncCallback) null));
callbacks.set(numberOfConfigUpdates - 1, result -> {
geoRepConfigModel.stopProgress();
closeWindow();
});
// Failure call back. Update the config list just to reflect any new changes and default error msg
// dialog is thrown.
Frontend.getInstance().runMultipleActions(actionTypes, parameters, callbacks, result -> fetchConfigForSession(geoRepConfigModel.getGeoRepSession()), this);
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class DiskListModel method onRemove.
private void onRemove() {
RemoveDiskModel model = (RemoveDiskModel) getWindow();
ArrayList<ActionParametersBase> parameterList = new ArrayList<>();
for (Object item : getSelectedItems()) {
Disk disk = (Disk) item;
ActionParametersBase parameters = new RemoveDiskParameters(disk.getId());
parameterList.add(parameters);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, parameterList, result -> {
DiskListModel localModel = (DiskListModel) result.getState();
localModel.stopProgress();
cancel();
}, this);
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class RemoveNetworkQoSModel method onRemove.
public void onRemove() {
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (Object networkQoS : sourceListModel.getSelectedItems()) {
QosParametersBase<NetworkQoS> parameter = new QosParametersBase<>();
NetworkQoS tempQos = (NetworkQoS) networkQoS;
parameter.setQos(tempQos);
parameters.add(parameter);
}
Frontend.getInstance().runMultipleAction(ActionType.RemoveNetworkQoS, parameters);
cancel();
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class RemoveNetworksModel method onRemove.
public void onRemove() {
ArrayList<ActionParametersBase> pb = new ArrayList<>();
for (Object a : sourceListModel.getSelectedItems()) {
Network network = (Network) a;
if (network.isExternal()) {
pb.add(new RemoveNetworkParameters(network.getId(), getForce().getEntity()));
} else {
pb.add(new RemoveNetworkParameters(network.getId()));
}
}
Frontend.getInstance().runMultipleAction(ActionType.RemoveNetwork, pb);
sourceListModel.setConfirmWindow(null);
}
Aggregations