Search in sources :

Example 1 with VolumeSnapshotOptionModel

use of org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel 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 VolumeSnapshotOptionModel

use of org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel 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)

Example 3 with VolumeSnapshotOptionModel

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

the class GlusterVolumeSnapshotConfigureOptionsPopupView method initEditors.

private void initEditors() {
    configsTable = new EntityModelCellTable<>(false, true);
    configsTable.setSelectionModel(new NoSelectionModel());
    configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {

        @Override
        public String getText(VolumeSnapshotOptionModel object) {
            return object.getOptionName();
        }
    }, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
    "150px");
    configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {

        @Override
        public String getText(VolumeSnapshotOptionModel object) {
            return object.getCorrespodingClusterValue();
        }
    }, constants.clusterSnapshotConfigValue(), // $NON-NLS-1$
    "200px");
    Column<EntityModel<VolumeSnapshotOptionModel>, String> valueColumn = new Column<EntityModel<VolumeSnapshotOptionModel>, String>(new TextInputCell()) {

        @Override
        public String getValue(EntityModel<VolumeSnapshotOptionModel> object) {
            return ((VolumeSnapshotOptionModel) object.getEntity()).getOptionValue();
        }
    };
    // $NON-NLS-1$
    configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
    valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setOptionValue(value));
}
Also used : AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel)

Aggregations

VolumeSnapshotOptionModel (org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel)3 GlusterVolumeSnapshotConfigModel (org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel)2 TextInputCell (com.google.gwt.cell.client.TextInputCell)1 Column (com.google.gwt.user.cellview.client.Column)1 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)1 ArrayList (java.util.ArrayList)1 UpdateGlusterVolumeSnapshotConfigParameters (org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1 GlusterVolumeSnapshotConfig (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)1 AbstractEntityModelTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1