use of org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel in project ovirt-engine by oVirt.
the class ClusterGeneralModel method onDetachNewGlusterHosts.
public void onDetachNewGlusterHosts() {
if (getWindow() == null) {
return;
}
final DetachGlusterHostsModel hostsModel = (DetachGlusterHostsModel) getWindow();
if (!hostsModel.validate()) {
return;
}
boolean force = hostsModel.getForce().getEntity();
ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
for (Object model : hostsModel.getHosts().getSelectedItems()) {
String host = (String) ((EntityModel) model).getEntity();
parametersList.add(new RemoveGlusterServerParameters(getEntity().getId(), host, force));
}
Frontend.getInstance().runMultipleAction(ActionType.RemoveGlusterServer, parametersList);
cancel();
}
use of org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel in project ovirt-engine by oVirt.
the class ClusterGeneralModel method detachNewGlusterHosts.
public void detachNewGlusterHosts() {
if (getWindow() != null) {
return;
}
final DetachGlusterHostsModel hostsModel = new DetachGlusterHostsModel();
setWindow(hostsModel);
hostsModel.setTitle(ConstantsManager.getInstance().getConstants().detachGlusterHostsTitle());
hostsModel.setHelpTag(HelpTag.detach_gluster_hosts);
// $NON-NLS-1$
hostsModel.setHashName("detach_gluster_hosts");
// $NON-NLS-1$
UICommand command = UICommand.createOkUiCommand("OnDetachGlusterHosts", this);
hostsModel.getCommands().add(command);
hostsModel.getHosts().setItems(new ArrayList<EntityModel<String>>());
// $NON-NLS-1$
hostsModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
hostsModel.startProgress();
AsyncDataProvider.getInstance().getGlusterHostsNewlyAdded(new AsyncQuery<>(hostMap -> {
if (hostMap == null || hostMap.isEmpty()) {
hostsModel.setMessage(ConstantsManager.getInstance().getConstants().emptyNewGlusterHosts());
} else {
ArrayList<EntityModel<String>> hostList = new ArrayList<>();
for (String host : hostMap.keySet()) {
hostList.add(new EntityModel<>(host));
}
hostsModel.getHosts().setItems(hostList);
}
hostsModel.stopProgress();
}), getEntity().getId(), true);
}
Aggregations