use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class ClusterListModel method checkForNonResponsiveHosts.
/**
* Checks if in selected cluster are some non responsive hosts. If so, it adds warning about upgrading cluster level
* when some hosts are non responsive
*/
@SuppressWarnings("unchecked")
private void checkForNonResponsiveHosts(final ConfirmationModel confirmModel) {
startProgress();
Frontend.getInstance().runQuery(QueryType.GetHostsByClusterId, new IdQueryParameters(getSelectedItem().getId()), new AsyncQuery<>(returnValue -> {
List<VDS> hosts = null;
if (returnValue instanceof List) {
hosts = (List<VDS>) returnValue;
} else if (returnValue instanceof QueryReturnValue && ((QueryReturnValue) returnValue).getReturnValue() instanceof List) {
hosts = ((QueryReturnValue) returnValue).getReturnValue();
}
boolean foundNRHosts = false;
if (hosts != null) {
for (VDS host : hosts) {
if (VDSStatus.NonResponsive == host.getStatus()) {
foundNRHosts = true;
break;
}
}
}
String existingMsg = confirmModel.getMessage() == null ? "" : confirmModel.getMessage();
if (foundNRHosts) {
confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionNonResponsiveHostsMsg());
} else {
confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionMsg());
}
stopProgress();
}));
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class BookmarkListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeBookmarksTitle());
model.setHelpTag(HelpTag.remove_bookmark);
// $NON-NLS-1$
model.setHashName("remove_bookmark");
ArrayList<String> list = new ArrayList<>();
list.add(((Bookmark) getSelectedItem()).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 PermissionListModel method onRemove.
private void onRemove() {
if (getSelectedItems() != null && getSelectedItems().size() > 0) {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object perm : getSelectedItems()) {
PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
tempVar.setPermission((Permission) perm);
list.add(tempVar);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemovePermission, 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 SystemPermissionListModel method onRemove.
private void onRemove() {
if (getSelectedItems() != null && getSelectedItems().size() > 0) {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object perm : getSelectedItems()) {
PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
tempVar.setPermission((Permission) perm);
list.add(tempVar);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveSystemPermission, 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 SystemPermissionListModel method remove.
private void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeSystemPermissionsTitle());
model.setHelpTag(HelpTag.remove_system_permission);
// $NON-NLS-1$
model.setHashName("remove_system_permission");
model.setItems(getSelectedItems());
// $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);
}
Aggregations