use of org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel 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());
}
Aggregations