use of io.imunity.furms.ui.components.layout.BreadCrumbParameter in project furms by unity-idm.
the class ProjectView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String projectId) {
getContent().removeAll();
Project project = handleExceptions(() -> projectService.findById(projectId)).flatMap(identity()).orElseThrow(IllegalStateException::new);
String param = event.getLocation().getQueryParameters().getParameters().getOrDefault(PARAM_NAME, List.of(ALLOCATIONS_PARAM)).iterator().next();
loadTabs(projectId);
Tab tab = paramToTab.getOrDefault(param, defaultTab);
tabs.setSelectedTab(tab);
links.forEach(x -> x.setRoute(getClass(), projectId));
breadCrumbParameter = new BreadCrumbParameter(project.getId(), project.getName(), param);
loadPage1Content(project);
}
use of io.imunity.furms.ui.components.layout.BreadCrumbParameter in project furms by unity-idm.
the class ProjectAllocationFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
ProjectAllocationViewModel projectAllocationModel = ofNullable(parameter).flatMap(id -> handleExceptions(() -> projectAllocationService.findByIdWithRelatedObjects(communityId, id))).flatMap(Function.identity()).map(ProjectAllocationModelsMapper::map).orElseGet(() -> {
String projectId = event.getLocation().getQueryParameters().getParameters().get("projectId").iterator().next();
Project project = projectService.findById(projectId).get();
return new ProjectAllocationViewModel(projectId, project.getName());
});
this.projectId = projectAllocationModel.getProjectId();
String trans = parameter == null ? "view.community-admin.project-allocation.form.parameter.new" : "view.community-admin.project-allocation.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
projectAllocationFormComponent.setFormPools(projectAllocationModel, () -> projectAllocationService.getOccupiedNames(communityId, projectId));
}
use of io.imunity.furms.ui.components.layout.BreadCrumbParameter in project furms by unity-idm.
the class AlarmFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
AlarmFormModel alarm = ofNullable(parameter).map(UUID::fromString).flatMap(id -> handleExceptions(() -> alarmService.find(projectId, new AlarmId(id)))).flatMap(Function.identity()).map(AlarmFormModelMapper::map).orElseGet(AlarmFormModel::new);
String trans = parameter == null ? "view.project-admin.alarms.form.parameter.new" : "view.project-admin.alarms.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
binder.setBean(alarm);
addCreateButtons();
if (alarm.id != null) {
setComboBoxInReadOnlyMode(alarm);
}
}
use of io.imunity.furms.ui.components.layout.BreadCrumbParameter in project furms by unity-idm.
the class CommunityAllocationFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
CommunityAllocationViewModel serviceViewModel = ofNullable(parameter).flatMap(id -> handleExceptions(() -> communityAllocationService.findByIdWithRelatedObjects(id))).flatMap(Function.identity()).map(CommunityAllocationModelsMapper::map).orElseGet(() -> {
String communityId = event.getLocation().getQueryParameters().getParameters().get("communityId").iterator().next();
return new CommunityAllocationViewModel(communityId, communityService.findById(communityId).get().getName());
});
this.communityId = serviceViewModel.getCommunityId();
String trans = parameter == null ? "view.fenix-admin.resource-credits-allocation.form.parameter.new" : "view.fenix-admin.resource-credits-allocation.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
communityAllocationFormComponent.setModelObject(serviceViewModel, () -> communityAllocationService.getOccupiedNames(communityId));
}
use of io.imunity.furms.ui.components.layout.BreadCrumbParameter 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);
}
}
Aggregations