use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method stopRemoveBricks.
private void stopRemoveBricks() {
if (getConfirmWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().stopRemoveBricksMessage());
model.setHelpTag(HelpTag.volume_remove_bricks_stop);
// $NON-NLS-1$
model.setHashName("volume_remove_bricks_stop");
GlusterVolumeEntity volumeEntity = getVolumeEntity();
GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask();
ArrayList<String> list = new ArrayList<>();
for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.STARTED) {
list.add(brick.getQualifiedName());
}
}
model.setItems(list);
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnStopRemoveBricks", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = new UICommand("CancelConfirmation", this);
cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
cancelCommand.setIsCancel(true);
model.getCommands().add(cancelCommand);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method commitRemoveBricks.
private void commitRemoveBricks() {
if (getConfirmWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().commitRemoveBricksMessage());
model.setHelpTag(HelpTag.volume_remove_bricks_commit);
// $NON-NLS-1$
model.setHashName("volume_remove_bricks_commit");
GlusterVolumeEntity volumeEntity = getVolumeEntity();
GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask();
ArrayList<String> list = new ArrayList<>();
for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.FINISHED) {
list.add(brick.getQualifiedName());
}
}
model.setItems(list);
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnCommitRemoveBricks", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this);
model.getCommands().add(cancelCommand);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method showRemoveBricksStatus.
private void showRemoveBricksStatus() {
final GlusterVolumeEntity volumeEntity = getVolumeEntity();
final ArrayList<GlusterBrickEntity> bricks = new ArrayList<>();
for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null) {
bricks.add(brick);
}
}
final ConfirmationModel cModel = new ConfirmationModel();
cModel.setHelpTag(HelpTag.volume_remove_bricks_status);
// //$NON-NLS-1$
cModel.setHashName("volume_remove_bricks_status");
// $NON-NLS-1$
UICommand removeBrickStatusOk = new UICommand("CancelConfirmation", VolumeBrickListModel.this);
removeBrickStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
removeBrickStatusOk.setIsCancel(true);
cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
cModel.getCommands().add(removeBrickStatusOk);
cModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
setConfirmWindow(cModel);
// $NON-NLS-1$
final UICommand stopRemoveBrickFromStatus = new UICommand("StopRemoveBricksOnStatus", this);
stopRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksButton());
stopRemoveBrickFromStatus.setIsExecutionAllowed(false);
// $NON-NLS-1$
final UICommand commitRemoveBrickFromStatus = new UICommand("CommitRemoveBricksOnStatus", this);
commitRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksButton());
commitRemoveBrickFromStatus.setIsExecutionAllowed(false);
// $NON-NLS-1$
final UICommand retainBricksFromStatus = new UICommand("RetainBricksOnStatus", this);
retainBricksFromStatus.setTitle(ConstantsManager.getInstance().getConstants().retainBricksButton());
retainBricksFromStatus.setIsExecutionAllowed(false);
// $NON-NLS-1$
final UICommand cancelCommand = new UICommand("CancelRemoveBricksStatus", this);
cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
cancelCommand.setIsCancel(true);
AsyncDataProvider.getInstance().getGlusterRemoveBricksStatus(new AsyncQuery<>(returnValue -> {
cModel.stopProgress();
if (returnValue.getSucceeded() && returnValue.getReturnValue() != null) {
cancelConfirmation();
RemoveBrickStatusModel removeBrickStatusModel;
GlusterVolumeTaskStatusEntity removeBrickStatusEntity = returnValue.getReturnValue();
if (getWindow() == null) {
removeBrickStatusModel = new RemoveBrickStatusModel(volumeEntity, bricks);
removeBrickStatusModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
removeBrickStatusModel.setHelpTag(HelpTag.volume_remove_bricks_status);
// //$NON-NLS-1$
removeBrickStatusModel.setHashName("volume_remove_bricks_status");
setWindow(removeBrickStatusModel);
removeBrickStatusModel.getVolume().setEntity(volumeEntity.getName());
removeBrickStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
removeBrickStatusModel.addStopRemoveBricksCommand(stopRemoveBrickFromStatus);
removeBrickStatusModel.addCommitRemoveBricksCommand(commitRemoveBrickFromStatus);
removeBrickStatusModel.addRetainBricksCommand(retainBricksFromStatus);
removeBrickStatusModel.getCommands().add(cancelCommand);
} else {
removeBrickStatusModel = (RemoveBrickStatusModel) getWindow();
}
removeBrickStatusModel.showStatus(removeBrickStatusEntity);
} else {
cModel.setMessage(ConstantsManager.getInstance().getMessages().removeBrickStatusFailed(volumeEntity.getName()));
}
}), volumeEntity.getClusterId(), volumeEntity.getId(), bricks);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotListModel method runAction.
private void runAction(ActionType action, ActionParametersBase param) {
if (getConfirmWindow() == null) {
return;
}
final ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
model.startProgress();
Frontend.getInstance().runAction(action, param, result -> {
model.stopProgress();
setConfirmWindow(null);
});
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotListModel method deleteSnapshot.
private void deleteSnapshot() {
if (getSelectedItems() == null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
List<GlusterVolumeSnapshotEntity> snapshots = getSelectedItems();
StringBuilder snapshotNames = new StringBuilder();
for (GlusterVolumeSnapshotEntity snapshot : snapshots) {
snapshotNames.append(snapshot.getSnapshotName());
// $NON-NLS-1$
snapshotNames.append("\n");
}
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getMessages().confirmRemoveSnapshot(getEntity().getName()));
model.setHelpTag(HelpTag.volume_delete_snapshot_confirmation);
// $NON-NLS-1$
model.setHashName("volume_delete_snapshot_confirmation");
model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDeleteMessage(snapshotNames.toString()));
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeleteSnapshot", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this);
model.getCommands().add(cancelCommand);
}
Aggregations