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