Search in sources :

Example 31 with ActionParametersBase

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

the class PoolListModel method onRemove.

public void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VmPool pool = (VmPool) item;
        list.add(new VmPoolParametersBase(pool.getVmPoolId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveVmPool, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : VmPoolParametersBase(org.ovirt.engine.core.common.action.VmPoolParametersBase) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 32 with ActionParametersBase

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

the class QuotaUserListModel method onRemove.

private void onRemove() {
    if (getSelectedItems() != null && getSelectedItems().size() > 0) {
        ConfirmationModel model = (ConfirmationModel) getWindow();
        if (model.getProgress() != null) {
            return;
        }
        ArrayList<ActionParametersBase> list = new ArrayList<>();
        for (Object perm : getSelectedItems()) {
            PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
            tempVar.setPermission((Permission) perm);
            list.add(tempVar);
        }
        model.startProgress();
        Frontend.getInstance().runMultipleAction(ActionType.RemovePermission, list, result -> {
            ConfirmationModel localModel = (ConfirmationModel) result.getState();
            localModel.stopProgress();
            cancel();
        }, model);
    }
    cancel();
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 33 with ActionParametersBase

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

the class MoveOrCopyDiskModel method getParameters.

protected ArrayList<ActionParametersBase> getParameters() {
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (DiskModel diskModel : getDisks()) {
        StorageDomain destStorageDomain = diskModel.getStorageDomain().getSelectedItem();
        StorageDomain sourceStorageDomain = diskModel.getSourceStorageDomain().getSelectedItem();
        Guid sourceStorageDomainGuid = sourceStorageDomain != null ? sourceStorageDomain.getId() : Guid.Empty;
        DiskImage disk = (DiskImage) diskModel.getDisk();
        DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem();
        disk.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null);
        disk.setDiskAlias(diskModel.getAlias().getEntity());
        if (diskModel.getQuota().getSelectedItem() != null) {
            disk.setQuotaId(diskModel.getQuota().getSelectedItem().getId());
        }
        if (destStorageDomain == null || sourceStorageDomain == null) {
            continue;
        }
        Guid destStorageDomainGuid = destStorageDomain.getId();
        addMoveOrCopyParameters(parameters, sourceStorageDomainGuid, destStorageDomainGuid, disk);
    }
    return parameters;
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 34 with ActionParametersBase

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

the class ProviderSecretListModel method onRemoveSecret.

private void onRemoveSecret() {
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (LibvirtSecret libvirtSecret : getSelectedItems()) {
        LibvirtSecretParameters param = new LibvirtSecretParameters(libvirtSecret);
        parameters.add(param);
    }
    Frontend.getInstance().runMultipleAction(ActionType.RemoveLibvirtSecret, parameters, result -> cancel());
}
Also used : LibvirtSecretParameters(org.ovirt.engine.core.common.action.LibvirtSecretParameters) ArrayList(java.util.ArrayList) LibvirtSecret(org.ovirt.engine.core.common.businessentities.storage.LibvirtSecret) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 35 with ActionParametersBase

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

the class RemoveProfileModel method onRemove.

private void onRemove() {
    if (getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> actionParametersBaseList = new ArrayList<>();
    for (P profile : getProfiles()) {
        ActionParametersBase parameters = getRemoveProfileParams(profile);
        actionParametersBaseList.add(parameters);
    }
    startProgress();
    Frontend.getInstance().runMultipleAction(getRemoveActionType(), actionParametersBaseList, result -> {
        stopProgress();
        cancel();
    }, null);
}
Also used : ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)204 ArrayList (java.util.ArrayList)149 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)53 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)52 ActionType (org.ovirt.engine.core.common.action.ActionType)45 Test (org.junit.Test)44 Guid (org.ovirt.engine.core.compat.Guid)35 VDS (org.ovirt.engine.core.common.businessentities.VDS)26 List (java.util.List)23 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)23 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)20 VM (org.ovirt.engine.core.common.businessentities.VM)19 QueryType (org.ovirt.engine.core.common.queries.QueryType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)18 IFrontendActionAsyncCallback (org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback)18 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)16 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)16 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)16 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)15