use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class ClusterServiceModel method filterServices.
private void filterServices() {
VDS selectedVds = hostList.getSelectedItem();
ServiceType serviceType = serviceTypeList.getSelectedItem();
ArrayList<EntityModel<GlusterServerService>> list = new ArrayList<>();
List<GlusterServerService> serviceList = new ArrayList<>(getActualServiceList());
Collections.sort(serviceList, Comparator.comparing(GlusterServerService::getHostName).thenComparing(g -> g.getServiceType().toString()));
for (GlusterServerService service : serviceList) {
if ((selectedVds == null || service.getHostName().equals(selectedVds.getHostName())) && (serviceType == null || service.getServiceType() == serviceType)) {
list.add(new EntityModel<>(service));
}
}
getServiceList().setItems(list);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class ManageGlusterSwiftPopupView method initEditors.
private void initEditors() {
swiftStatusEditor = new EntityModelLabelEditor<>(new EnumRenderer<GlusterServiceStatus>());
// $NON-NLS-1$
startSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
// $NON-NLS-1$
stopSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
// $NON-NLS-1$
restartSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
manageSwiftServerLevel = new EntityModelCheckBoxEditor(Align.RIGHT);
hostServicesTable = new EntityModelCellTable<>(false, true);
hostServicesTable.addColumn(new AbstractEntityModelTextColumn<GlusterServerService>() {
@Override
public String getText(GlusterServerService entity) {
return entity.getHostName();
}
}, constants.hostGlusterSwift());
hostServicesTable.addColumn(new AbstractEnumColumn<EntityModel, ServiceType>() {
@Override
protected ServiceType getRawValue(EntityModel object) {
return ((GlusterSwiftServiceModel) object).getEntity().getServiceType();
}
}, constants.serviceNameGlusterSwift());
hostServicesTable.addColumn(new AbstractEnumColumn<EntityModel, GlusterServiceStatus>() {
@Override
protected GlusterServiceStatus getRawValue(EntityModel object) {
return ((GlusterSwiftServiceModel) object).getEntity().getStatus();
}
}, constants.serviceStatusGlusterSwift());
Column<EntityModel, Boolean> startSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getStartSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getStartSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
startSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
swiftModel.getStartSwift().setEntity(value);
if (value) {
swiftModel.getStopSwift().setEntity(false);
swiftModel.getRestartSwift().setEntity(false);
hostServicesTable.redraw();
}
});
hostServicesTable.addColumn(startSwiftColumn, constants.startGlusterSwift());
Column<EntityModel, Boolean> stopSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getStopSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getStopSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
stopSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
if (swiftModel.getStopSwift().getIsChangable()) {
swiftModel.getStopSwift().setEntity(value);
if (value) {
swiftModel.getStartSwift().setEntity(false);
swiftModel.getRestartSwift().setEntity(false);
hostServicesTable.redraw();
}
}
});
hostServicesTable.addColumn(stopSwiftColumn, constants.stopGlusterSwift());
Column<EntityModel, Boolean> restartSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getRestartSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getRestartSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
restartSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
swiftModel.getRestartSwift().setEntity(value);
if (value) {
swiftModel.getStartSwift().setEntity(false);
swiftModel.getStopSwift().setEntity(false);
hostServicesTable.redraw();
}
});
hostServicesTable.addColumn(restartSwiftColumn, constants.restartGlusterSwift());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterServicesReturn method getService.
private GlusterServerService getService(Map<String, Object> serviceMap) {
GlusterServerService serverService = new GlusterServerService();
serverService.setServiceName((String) serviceMap.get(NAME));
String pid = (String) serviceMap.get(PID);
serverService.setPid(StringUtils.isEmpty(pid) ? null : Integer.parseInt(pid));
serverService.setStatus(GlusterServiceStatus.valueOf((String) serviceMap.get(STATUS)));
serverService.setMessage((String) serviceMap.get(MESSAGE));
serverService.setServerId(serverId);
GlusterService service = servicesMap.get(serverService.getServiceName());
if (service != null) {
serverService.setServiceId(service.getId());
serverService.setServiceType(service.getServiceType());
}
return serverService;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterVolumeStatusReturn method prepareServiceInfo.
private void prepareServiceInfo(Map<String, Object> statusInfo, List<GlusterServerService> serviceInfoList, String service) {
if (statusInfo.containsKey(service)) {
Object[] serviceInfo = (Object[]) statusInfo.get(service);
for (Object serviceObj : serviceInfo) {
Map<String, Object> serviceMap = (Map<String, Object>) serviceObj;
GlusterServerService parsedServiceInfo = parseServiceInfo(serviceMap);
parsedServiceInfo.setServiceType(service.equals(NFS_KEY) ? ServiceType.NFS : ServiceType.SHD);
serviceInfoList.add(parsedServiceInfo);
}
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class HostGlusterSwiftListModel method updateActionAvailability.
private void updateActionAvailability() {
boolean enableStart = false;
boolean enableStop = false;
boolean enableRestart = false;
List<GlusterServerService> serviceList = (List<GlusterServerService>) getItems();
if (serviceList == null || serviceList.isEmpty()) {
enableStart = false;
enableStop = false;
enableRestart = false;
} else {
for (GlusterServerService service : serviceList) {
if (service.getStatus() != GlusterServiceStatus.NOT_AVAILABLE) {
if (service.getStatus() != GlusterServiceStatus.RUNNING) {
enableStart = true;
}
if (service.getStatus() != GlusterServiceStatus.STOPPED) {
enableStop = true;
}
enableRestart = true;
}
if (enableStart && enableStop && enableStart) {
break;
}
}
}
getStartSwiftCommand().setIsExecutionAllowed(enableStart);
getStopSwiftCommand().setIsExecutionAllowed(enableStop);
getRestartSwiftCommand().setIsExecutionAllowed(enableRestart);
}
Aggregations