use of io.imunity.furms.ui.charts.ResourceAllocationChart in project furms by unity-idm.
the class ProjectAllocationsDetailsView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
Optional<String> projectId = event.getLocation().getQueryParameters().getParameters().getOrDefault("projectId", List.of()).stream().findAny();
Optional<ProjectAllocation> projectAllocation = ofNullable(parameter).filter(id -> projectId.isPresent()).flatMap(id -> handleExceptions(() -> projectAllocationService.findByProjectIdAndId(projectId.get(), id))).flatMap(Function.identity());
if (projectAllocation.isPresent()) {
getContent().removeAll();
breadCrumbParameter = new BreadCrumbParameter(parameter, projectAllocation.get().name, getTranslation("view.user-settings.projects.page.details.bread-crumb"));
ResourceAllocationChart resourceAllocationChart = new ResourceAllocationChart(chartPowerService.getChartDataForProjectAlloc(projectAllocation.get().projectId, projectAllocation.get().id), jsonExporter.getJsonForProjectAllocation(projectAllocation.get().projectId, projectAllocation.get().id), csvExporter.getCsvForProjectAllocation(projectAllocation.get().projectId, projectAllocation.get().id), true);
getContent().add(resourceAllocationChart);
}
}
use of io.imunity.furms.ui.charts.ResourceAllocationChart in project furms by unity-idm.
the class ProjectResourceAllocationsDetailsView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
Optional<String> projectId = event.getLocation().getQueryParameters().getParameters().getOrDefault("projectId", List.of()).stream().findAny();
Optional<ProjectAllocation> projectAllocation = ofNullable(parameter).filter(id -> projectId.isPresent()).flatMap(id -> handleExceptions(() -> projectAllocationService.findByProjectIdAndId(projectId.get(), id))).flatMap(Function.identity());
if (projectAllocation.isPresent()) {
getContent().removeAll();
breadCrumbParameter = new BreadCrumbParameter(parameter, projectAllocation.get().name, getTranslation("view.user-settings.projects.page.details.bread-crumb"));
ResourceAllocationChart resourceAllocationChart = new ResourceAllocationChart(chartPowerService.getChartDataForProjectAlloc(projectAllocation.get().projectId, projectAllocation.get().id), jsonExporter.getJsonForProjectAllocation(projectAllocation.get().projectId, projectAllocation.get().id), csvExporter.getCsvForProjectAllocation(projectAllocation.get().projectId, projectAllocation.get().id));
getContent().add(resourceAllocationChart);
}
}
use of io.imunity.furms.ui.charts.ResourceAllocationChart in project furms by unity-idm.
the class CommunityAllocationsDetailsView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
Optional<CommunityAllocation> communityAllocation = ofNullable(parameter).flatMap(id -> handleExceptions(() -> communityAllocationService.findById(id))).flatMap(Function.identity());
if (communityAllocation.isPresent()) {
getContent().removeAll();
breadCrumbParameter = new BreadCrumbParameter(parameter, communityAllocation.get().name, getTranslation("view.fenix-admin.community.resource-allocations.details.page.bread-crumb"));
ResourceAllocationChart resourceAllocationChart = new ResourceAllocationChart(chartPowerService.getChartDataForCommunityAlloc(communityAllocation.get().communityId, communityAllocation.get().id), jsonExporter.getJsonForCommunityAllocation(communityAllocation.get().communityId, communityAllocation.get().id), csvExporter.getCsvForCommunityAllocation(communityAllocation.get().communityId, communityAllocation.get().id), true);
getContent().add(resourceAllocationChart);
}
}
Aggregations