Search in sources :

Example 86 with ActionParametersBase

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);
    });
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) Model(org.ovirt.engine.ui.uicommonweb.models.Model) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) ActionUtils(org.ovirt.engine.core.common.ActionUtils) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) NotifyCollectionChangedEventArgs(org.ovirt.engine.ui.uicompat.NotifyCollectionChangedEventArgs) List(java.util.List) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) DeactivateStorageDomainWithOvfUpdateParameters(org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) DeactivateStorageDomainWithOvfUpdateParameters(org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 87 with ActionParametersBase

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);
}
Also used : ActionType(org.ovirt.engine.core.common.action.ActionType) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterGeoRepSessionConfiguration(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 88 with ActionParametersBase

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);
}
Also used : RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel) ArrayList(java.util.ArrayList) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 89 with ActionParametersBase

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();
}
Also used : QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 90 with ActionParametersBase

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);
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) RemoveNetworkParameters(org.ovirt.engine.core.common.action.RemoveNetworkParameters) 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