use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotListModel method deleteAllSnapshots.
private void deleteAllSnapshots() {
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getMessages().confirmRemoveAllSnapshots(getEntity().getName()));
model.setHelpTag(HelpTag.volume_delete_all_snapshot_confirmation);
// $NON-NLS-1$
model.setHashName("volume_delete_all_snapshot_confirmation");
model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotDeleteAllMessage());
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeleteAllSnapshots", 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 onCommitRemoveBricks.
private void onCommitRemoveBricks() {
if (getConfirmWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
GlusterVolumeEntity volumeEntity = getVolumeEntity();
ArrayList<GlusterBrickEntity> list = new ArrayList<>();
for (Object brickName : model.getItems()) {
GlusterBrickEntity brick = volumeEntity.getBrickWithQualifiedName((String) brickName);
if (brick != null) {
list.add(brick);
}
}
GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), list);
model.startProgress();
Frontend.getInstance().runAction(ActionType.CommitRemoveGlusterVolumeBricks, parameter, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
setConfirmWindow(null);
if (result.getReturnValue().getSucceeded()) {
disableRemoveBrickStatusPopUpActions();
}
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method preAddBricks.
private void preAddBricks(final GlusterVolumeEntity volumeEntity) {
if (volumeEntity == null) {
return;
}
final VolumeBrickModel volumeBrickModel = new VolumeBrickModel();
setWindow(volumeBrickModel);
if (volumeEntity.getVolumeType().isReplicatedType()) {
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> {
if (cluster.supportsGlusterService() && cluster.supportsVirtService()) {
// in HC mode, show a warning that add bricks is not recommended
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().hcAddBrickWarning());
model.setHelpTag(HelpTag.cannot_add_bricks);
// $NON-NLS-1$
model.setHashName("cannot_add_bricks");
// $NON-NLS-1$
UICommand yesCommand = new UICommand("AddBricks", VolumeBrickListModel.this);
yesCommand.setTitle(ConstantsManager.getInstance().getConstants().yes());
model.getCommands().add(yesCommand);
// $NON-NLS-1$
UICommand noCommand = new UICommand("CancelAll", VolumeBrickListModel.this);
noCommand.setTitle(ConstantsManager.getInstance().getConstants().no());
noCommand.setIsCancel(true);
noCommand.setIsDefault(true);
model.getCommands().add(noCommand);
return;
} else {
addBricks();
}
}), volumeEntity.getClusterId());
} else {
addBricks();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method checkUpServerAndAddBricks.
private void checkUpServerAndAddBricks() {
if (getWindow() != null) {
return;
}
final GlusterVolumeEntity volumeEntity = getEntity();
cancelConfirmation();
if (volumeEntity == null) {
return;
}
AsyncDataProvider.getInstance().isAnyHostUpInCluster(new AsyncQuery<>(clusterHasUpHost -> {
if (clusterHasUpHost) {
preAddBricks(volumeEntity);
} else {
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().cannotAddBricksNoUpServerFound());
model.setHelpTag(HelpTag.cannot_add_bricks);
// $NON-NLS-1$
model.setHashName("cannot_add_bricks");
// $NON-NLS-1$
UICommand command = new UICommand("Cancel", VolumeBrickListModel.this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
model.getCommands().add(command);
return;
}
}), volumeEntity.getClusterName());
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onStopRemoveBricks.
private void onStopRemoveBricks() {
if (getConfirmWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
GlusterVolumeEntity volumeEntity = getVolumeEntity();
ArrayList<GlusterBrickEntity> list = new ArrayList<>();
for (Object brickName : model.getItems()) {
GlusterBrickEntity brick = volumeEntity.getBrickWithQualifiedName((String) brickName);
if (brick != null) {
list.add(brick);
}
}
GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), list);
model.startProgress();
Frontend.getInstance().runAction(ActionType.StopRemoveGlusterVolumeBricks, parameter, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
setConfirmWindow(null);
if (result.getReturnValue().getSucceeded()) {
showRemoveBricksStatus();
}
}, model);
}
Aggregations