use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VmListModel method onPowerAction.
private void onPowerAction(ActionType actionType, PowerActionParametersFactory<?> parametersFactory) {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
list.add(parametersFactory.createActionParameters(vm));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(actionType, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeListModel method removeVolume.
private void removeVolume() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeVolumesTitle());
model.setHelpTag(HelpTag.remove_volume);
// $NON-NLS-1$
model.setHashName("remove_volume");
if (isMetaVolumeInList(getSelectedItems())) {
model.setNote(ConstantsManager.getInstance().getConstants().removeMetaVolumeWarning());
} else {
model.setNote(ConstantsManager.getInstance().getConstants().removeVolumesWarning());
}
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("OnRemove", 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 VolumeListModel method onRemoveVolume.
private void onRemoveVolume() {
if (getWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (getSelectedItems() == null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
list.add(new GlusterVolumeActionParameters(volume.getId(), false));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.DeleteGlusterVolume, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeListModel method onStop.
public void onStop() {
if (getWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (getSelectedItems() == null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
list.add(new GlusterVolumeActionParameters(volume.getId(), false));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.StopGlusterVolume, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel 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