use of org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel in project ovirt-engine by oVirt.
the class VolumeListModel method onConfigureClusterSnapshotOptions.
public void onConfigureClusterSnapshotOptions() {
GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow();
Guid clusterId = clusterSnapshotConfigModel.getClusters().getSelectedItem().getId();
List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<>();
for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : clusterSnapshotConfigModel.getClusterConfigOptions().getItems()) {
vdsParams.add(new GlusterVolumeSnapshotConfig(clusterId, null, clusterCfg.getEntity().getParamName(), clusterCfg.getEntity().getParamValue()));
}
Frontend.getInstance().runAction(ActionType.UpdateGlusterVolumeSnapshotConfig, new UpdateGlusterVolumeSnapshotConfigParameters(clusterId, null, 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.GlusterClusterSnapshotConfigModel in project ovirt-engine by oVirt.
the class VolumeListModel method configureClusterSnapshotOptions.
/**
* This action is handled here in VolumeLisModel only, because there is a use case where no volume would be selected
* for setting the configuration. And in this scenario the GlusrerVolumeSnapshotListModel would not be initialized.
*/
public void configureClusterSnapshotOptions() {
if (getWindow() != null) {
return;
}
final UIConstants constants = ConstantsManager.getInstance().getConstants();
final GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = new GlusterClusterSnapshotConfigModel();
clusterSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot);
// $NON-NLS-1$
clusterSnapshotConfigModel.setHashName("configure_volume_snapshot");
clusterSnapshotConfigModel.setTitle(ConstantsManager.getInstance().getConstants().configureClusterSnapshotOptionsTitle());
setWindow(clusterSnapshotConfigModel);
AsyncDataProvider.getInstance().getClustersHavingHosts(new AsyncQuery<>(returnValue -> {
if (getSelectedItems() != null) {
GlusterVolumeEntity volumeEntity = getSelectedItems().get(0);
if (volumeEntity != null) {
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> clusterSnapshotConfigModel.getClusters().setItems(returnValue, cluster)), volumeEntity.getClusterId());
}
} else {
clusterSnapshotConfigModel.getClusters().setItems(returnValue);
}
}));
clusterSnapshotConfigModel.getClusterConfigOptions().setTitle(ConstantsManager.getInstance().getConstants().configureClusterSnapshotOptionsTitle());
// $NON-NLS-1$
UICommand updateCommand = new UICommand("confirmConfigureClusterSnapshotOptions", this);
updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel());
updateCommand.setIsDefault(true);
clusterSnapshotConfigModel.getCommands().add(updateCommand);
// $NON-NLS-1$
UICommand cancelCommand = new UICommand("Cancel", this);
cancelCommand.setTitle(constants.cancel());
cancelCommand.setIsCancel(true);
clusterSnapshotConfigModel.getCommands().add(cancelCommand);
}
use of org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel in project ovirt-engine by oVirt.
the class VolumeListModel method confirmConfigureClusterSnapshotOptions.
public void confirmConfigureClusterSnapshotOptions() {
boolean cfgChanged = false;
GlusterClusterSnapshotConfigModel snapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow();
if (!snapshotConfigModel.validate()) {
return;
}
for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : snapshotConfigModel.getClusterConfigOptions().getItems()) {
if (!clusterCfg.getEntity().getParamValue().equals(snapshotConfigModel.getExistingClusterConfigValue(clusterCfg.getEntity().getParamName()))) {
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("onConfigureClusterSnapshotOptions", 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 {
onConfigureClusterSnapshotOptions();
}
}
Aggregations