Search in sources :

Example 1 with GlusterVolumeSnapshotConfigModel

use of org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel in project ovirt-engine by oVirt.

the class VolumeListModel method onConfigureVolumeSnapshotOptions.

public void onConfigureVolumeSnapshotOptions() {
    GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = (GlusterVolumeSnapshotConfigModel) getWindow();
    GlusterVolumeEntity volumeEntity = volumeSnapshotConfigModel.getSelectedVolumeEntity();
    List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<>();
    for (EntityModel<VolumeSnapshotOptionModel> volumeCfg : volumeSnapshotConfigModel.getConfigOptions().getItems()) {
        vdsParams.add(new GlusterVolumeSnapshotConfig(volumeEntity.getClusterId(), volumeEntity.getId(), volumeCfg.getEntity().getOptionName(), volumeCfg.getEntity().getOptionValue()));
    }
    Frontend.getInstance().runAction(ActionType.UpdateGlusterVolumeSnapshotConfig, new UpdateGlusterVolumeSnapshotConfigParameters(volumeEntity.getClusterId(), volumeEntity.getId(), vdsParams), result -> {
        if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
            cancel();
        }
        if (getConfirmWindow() != null) {
            setConfirmWindow(null);
        }
    }, this);
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) ArrayList(java.util.ArrayList) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)

Example 2 with GlusterVolumeSnapshotConfigModel

use of org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel in project ovirt-engine by oVirt.

the class VolumeListModel method configureVolumeSnapshotOptions.

public void configureVolumeSnapshotOptions() {
    if (getWindow() != null) {
        return;
    }
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    GlusterVolumeEntity volumeEntity = getSelectedItems().get(0);
    final GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = new GlusterVolumeSnapshotConfigModel(volumeEntity);
    volumeSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot);
    // $NON-NLS-1$
    volumeSnapshotConfigModel.setHashName("configure_volume_snapshot");
    volumeSnapshotConfigModel.setTitle(ConstantsManager.getInstance().getConstants().configureVolumeSnapshotOptionsTitle());
    setWindow(volumeSnapshotConfigModel);
    AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> volumeSnapshotConfigModel.getClusterName().setEntity(cluster.getName())), volumeEntity.getClusterId());
    volumeSnapshotConfigModel.getVolumeName().setEntity(volumeEntity.getName());
    // $NON-NLS-1$
    UICommand updateCommand = new UICommand("confirmConfigureVolumeSnapshotOptions", this);
    updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel());
    updateCommand.setIsDefault(true);
    volumeSnapshotConfigModel.getCommands().add(updateCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = new UICommand("Cancel", this);
    cancelCommand.setTitle(constants.cancel());
    cancelCommand.setIsCancel(true);
    volumeSnapshotConfigModel.getCommands().add(cancelCommand);
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) VolumeBrickListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterVolumeUtils(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterClusterSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) VolumeGeneralModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel) VolumeGeoRepListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel) GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterVolumeSnapshotListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) VolumeEventListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel) VolumeParameterListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel) VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 3 with GlusterVolumeSnapshotConfigModel

use of org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel in project ovirt-engine by oVirt.

the class VolumeListModel method confirmConfigureVolumeSnapshotOptions.

public void confirmConfigureVolumeSnapshotOptions() {
    boolean cfgChanged = false;
    GlusterVolumeSnapshotConfigModel snapshotConfigModel = (GlusterVolumeSnapshotConfigModel) getWindow();
    if (!snapshotConfigModel.validate()) {
        return;
    }
    for (EntityModel<VolumeSnapshotOptionModel> volumeCfg : snapshotConfigModel.getConfigOptions().getItems()) {
        if (!volumeCfg.getEntity().getOptionValue().equals(snapshotConfigModel.getExistingVolumeConfigValue(volumeCfg.getEntity().getOptionName()))) {
            cfgChanged = true;
            break;
        }
    }
    if (cfgChanged) {
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().updateSnapshotConfigurationConfirmationTitle());
        confirmModel.setHelpTag(HelpTag.configure_volume_snapshot_confirmation);
        // $NON-NLS-1$
        confirmModel.setHashName("configure_volume_snapshot_confirmation");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutChangeSnapshotConfigurationMsg());
        // $NON-NLS-1$
        UICommand tempVar = new UICommand("onConfigureVolumeSnapshotOptions", this);
        tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
        tempVar.setIsDefault(true);
        getConfirmWindow().getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = new UICommand("CancelConfirmation", this);
        tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
        tempVar2.setIsCancel(true);
        getConfirmWindow().getCommands().add(tempVar2);
    } else {
        onConfigureVolumeSnapshotOptions();
    }
}
Also used : GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Aggregations

GlusterVolumeSnapshotConfigModel (org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel)3 VolumeSnapshotOptionModel (org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel)3 ArrayList (java.util.ArrayList)2 UpdateGlusterVolumeSnapshotConfigParameters (org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 GlusterVolumeSnapshotConfig (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 Inject (com.google.inject.Inject)1 Arrays (java.util.Arrays)1 List (java.util.List)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)1 GlusterVolumeActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)1 GlusterVolumeOptionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters)1 GlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters)1 GlusterVolumeRebalanceParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters)1 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)1 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)1