use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel 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();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeListModel method onStopRebalance.
private void onStopRebalance() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
if (getSelectedItems() == null) {
return;
}
model.startProgress();
final GlusterVolumeEntity volumeEntity = getSelectedItem();
GlusterVolumeRebalanceParameters param = new GlusterVolumeRebalanceParameters(volumeEntity.getId(), false, false);
Frontend.getInstance().runAction(ActionType.StopRebalanceGlusterVolume, param, result -> {
ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow();
localModel.stopProgress();
setConfirmWindow(null);
if (result.getReturnValue().getSucceeded()) {
showRebalanceStatus();
}
});
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeListModel method stop.
private void stop() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().confirmStopVolume());
model.setHelpTag(HelpTag.volume_stop);
// $NON-NLS-1$
model.setHashName("volume_stop");
model.setMessage(ConstantsManager.getInstance().getConstants().stopVolumeMessage());
if (isMetaVolumeInList(getSelectedItems())) {
model.setNote(ConstantsManager.getInstance().getConstants().stopMetaVolumeWarning());
} else {
model.setNote(ConstantsManager.getInstance().getConstants().stopVolumeWarning());
}
if (getSelectedItems() == null) {
return;
}
ArrayList<String> list = new ArrayList<>();
for (GlusterVolumeEntity item : getSelectedItems()) {
list.add(item.getName());
}
model.setItems(list);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("onStop", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VmHostDeviceListModel method removeDevices.
private void removeDevices() {
if (getWindow() != null) {
return;
}
ConfirmationModel window = new ConfirmationModel();
setConfirmWindow(window);
window.setTitle(constants.removeHostDevices());
window.setHelpTag(HelpTag.remove_host_device);
// $NON-NLS-1$
window.setHashName("remove_host_device");
window.setItems(getSelectedPrimaryDeviceNames());
// $NON-NLS-1$
window.getCommands().add(UICommand.createDefaultOkUiCommand("OnRemove", this));
// $NON-NLS-1$
window.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class HostListModel method onSshStop.
public void onSshStop() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
VdsPowerDownParameters param = new VdsPowerDownParameters(vds.getId());
param.setFallbackToPowerManagement(false);
param.setKeepPolicyPMEnabled(true);
list.add(param);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.VdsPowerDown, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancelConfirm();
}, model);
}
Aggregations