Search in sources :

Example 11 with TransferImageStatusParameters

use of org.ovirt.engine.core.common.action.TransferImageStatusParameters in project ovirt-engine by oVirt.

the class UploadImageModel method onCancelUpload.

public static void onCancelUpload(ConfirmationModel model, List<? extends Disk> disks) {
    if (model.getProgress() != null) {
        return;
    }
    model.startProgress(null);
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Disk disk : disks) {
        ImageTransfer updates = new ImageTransfer();
        updates.setPhase(ImageTransferPhase.CANCELLED);
        TransferImageStatusParameters parameters = new TransferImageStatusParameters();
        parameters.setUpdates(updates);
        parameters.setDiskId(disk.getId());
        list.add(parameters);
    }
    Frontend.getInstance().runMultipleAction(ActionType.TransferImageStatus, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        // parent.cancel();
        localModel.getCancelCommand().execute();
    }, model);
}
Also used : ImageTransfer(org.ovirt.engine.core.common.businessentities.storage.ImageTransfer) ArrayList(java.util.ArrayList) TransferImageStatusParameters(org.ovirt.engine.core.common.action.TransferImageStatusParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

TransferImageStatusParameters (org.ovirt.engine.core.common.action.TransferImageStatusParameters)11 ImageTransfer (org.ovirt.engine.core.common.businessentities.storage.ImageTransfer)10 ArrayList (java.util.ArrayList)4 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)4 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)4 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)3 Element (com.google.gwt.dom.client.Element)2 Request (com.google.gwt.http.client.Request)2 RequestBuilder (com.google.gwt.http.client.RequestBuilder)2 RequestCallback (com.google.gwt.http.client.RequestCallback)2 RequestException (com.google.gwt.http.client.RequestException)2 Response (com.google.gwt.http.client.Response)2 List (java.util.List)2 Logger (java.util.logging.Logger)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 AddDiskParameters (org.ovirt.engine.core.common.action.AddDiskParameters)2 TransferDiskImageParameters (org.ovirt.engine.core.common.action.TransferDiskImageParameters)2 StorageFormatType (org.ovirt.engine.core.common.businessentities.StorageFormatType)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2