use of org.ovirt.engine.ui.uicommonweb.UICommand 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.UICommand 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.UICommand in project ovirt-engine by oVirt.
the class VolumeListModel method showRebalanceStatus.
private void showRebalanceStatus() {
if (getSelectedItem() == null) {
return;
}
final ConfirmationModel cModel = new ConfirmationModel();
final GlusterVolumeEntity volumeEntity = getSelectedItem();
setConfirmWindow(cModel);
cModel.setTitle(ConstantsManager.getInstance().getConstants().rebalanceStatusTitle());
// $NON-NLS-1$
cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
cModel.setHelpTag(HelpTag.volume_rebalance_status);
// $NON-NLS-1$
cModel.setHashName("volume_rebalance_status");
// $NON-NLS-1$
final UICommand rebalanceStatusOk = new UICommand("closeConfirmationWindow", VolumeListModel.this);
rebalanceStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
rebalanceStatusOk.setIsCancel(true);
cModel.getCommands().add(rebalanceStatusOk);
AsyncDataProvider.getInstance().getGlusterRebalanceStatus(new AsyncQuery<>(returnValue -> {
cModel.stopProgress();
GlusterVolumeTaskStatusEntity rebalanceStatusEntity = returnValue.getReturnValue();
if ((rebalanceStatusEntity == null) || !returnValue.getSucceeded()) {
cModel.setMessage(ConstantsManager.getInstance().getMessages().rebalanceStatusFailed(volumeEntity.getName()));
} else {
setConfirmWindow(null);
if (getWindow() == null) {
VolumeRebalanceStatusModel rebalanceStatusModel = new VolumeRebalanceStatusModel(volumeEntity);
rebalanceStatusModel.setTitle(ConstantsManager.getInstance().getConstants().volumeRebalanceStatusTitle());
setWindow(rebalanceStatusModel);
rebalanceStatusModel.setHelpTag(HelpTag.volume_rebalance_status);
// $NON-NLS-1$
rebalanceStatusModel.setHashName("volume_rebalance_status");
rebalanceStatusModel.getVolume().setEntity(volumeEntity.getName());
rebalanceStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
// $NON-NLS-1$
UICommand stopRebalanceFromStatus = new UICommand("stop_rebalance_from_status", VolumeListModel.this);
stopRebalanceFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRebalance());
rebalanceStatusModel.getCommands().add(stopRebalanceFromStatus);
rebalanceStatusModel.setStopReblanceFromStatus(stopRebalanceFromStatus);
// $NON-NLS-1$
UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);
cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close());
cancelRebalance.setIsCancel(true);
rebalanceStatusModel.getCommands().add(cancelRebalance);
rebalanceStatusModel.showStatus(rebalanceStatusEntity);
} else {
VolumeRebalanceStatusModel statusModel = (VolumeRebalanceStatusModel) getWindow();
statusModel.getCommands().get(0).setIsExecutionAllowed(false);
statusModel.showStatus(rebalanceStatusEntity);
}
}
}), volumeEntity.getClusterId(), volumeEntity.getId());
}
use of org.ovirt.engine.ui.uicommonweb.UICommand 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.UICommand 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);
}
Aggregations