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);
}
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();
}
}
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));
}
Aggregations