Skip to content

Commit 1f2e107

Browse files
authored
Merge pull request #13737 from SORMAS-Foundation/bugfixes-13470-13723
fixes problem showing event info and resolves show case samples also shows environment samples on gis dashboard
2 parents 3967ba0 + b711b1b commit 1f2e107

File tree

5 files changed

+25
-44
lines changed

5 files changed

+25
-44
lines changed

sormas-api/src/main/resources/enum.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,7 @@ UserRight.CONTACT_ARCHIVE = Archive contacts
16721672
UserRight.DASHBOARD_CONTACT_VIEW = Access the contact supervisor dashboard
16731673
UserRight.DASHBOARD_SURVEILLANCE_VIEW = Access the surveillance supervisor dashboard
16741674
UserRight.DASHBOARD_SAMPLES_VIEW = Access the samples dashboard
1675+
UserRight.DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW = Access the adverse events dashboard
16751676
UserRight.DATABASE_EXPORT_ACCESS = Export the whole database
16761677
UserRight.EVENT_ARCHIVE = Archive events
16771678
UserRight.EVENT_CREATE = Create new events

sormas-backend/src/main/resources/sql/sormas_schema.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14893,4 +14893,8 @@ alter table community_history add nutscode varchar(10);
1489314893

1489414894
INSERT INTO schema_version (version_number, comment) VALUES (597, 'Epipulse export module #13631');
1489514895

14896+
INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'EVENT_VIEW_ARCHIVED' FROM public.userroles WHERE userroles.linkeddefaultuserrole in ('ADMIN','NATIONAL_USER') ON CONFLICT (userrole_id, userright) DO NOTHING;
14897+
14898+
INSERT INTO schema_version (version_number, comment) VALUES (598, 'Add view archived events to default ADMIN and NATIONAL_USER roles #13470');
14899+
1489614900
-- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. ***

sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/gis/GisDashboardDataProvider.java

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@
1515

1616
package de.symeda.sormas.ui.dashboard.gis;
1717

18-
import java.util.ArrayList;
19-
import java.util.List;
20-
import java.util.Map;
21-
22-
import de.symeda.sormas.api.FacadeProvider;
2318
import de.symeda.sormas.api.adverseeventsfollowingimmunization.AefiDashboardFilterDateType;
2419
import de.symeda.sormas.api.caze.NewCaseDateType;
2520
import de.symeda.sormas.api.dashboard.AefiDashboardCriteria;
2621
import de.symeda.sormas.api.dashboard.DashboardCriteria;
27-
import de.symeda.sormas.api.dashboard.DashboardEventDto;
2822
import de.symeda.sormas.api.dashboard.GisDashboardCriteria;
2923
import de.symeda.sormas.api.dashboard.SampleDashboardCriteria;
30-
import de.symeda.sormas.api.event.EventStatus;
3124
import de.symeda.sormas.api.person.Sex;
3225
import de.symeda.sormas.api.sample.SampleDashboardFilterDateType;
3326
import de.symeda.sormas.api.sample.SampleMaterial;
@@ -43,12 +36,9 @@ public class GisDashboardDataProvider extends AbstractDashboardDataProvider<GisD
4336
private Sex sex;
4437

4538
//disease specific
46-
private List<DashboardEventDto> events = new ArrayList<>();
47-
private Map<EventStatus, Long> eventCountByStatus;
4839

4940
@Override
5041
public void refreshData() {
51-
refreshDataForSelectedDisease();
5242
}
5343

5444
@Override
@@ -76,6 +66,10 @@ public AefiDashboardCriteria buildAefiDashboardCriteria() {
7666
return newAefiDashboardCriteria().aefiDashboardDateType(aefiDateType).dateBetween(fromDate, toDate);
7767
}
7868

69+
public DashboardCriteria buildEventDashboardCriteria() {
70+
return newEventDashboardCriteria().disease(disease).dateBetween(fromDate, toDate);
71+
}
72+
7973
private DashboardCriteria newCaseDashboardCriteria() {
8074
return new DashboardCriteria();
8175
}
@@ -88,17 +82,8 @@ private AefiDashboardCriteria newAefiDashboardCriteria() {
8882
return new AefiDashboardCriteria();
8983
}
9084

91-
public void refreshDataForSelectedDisease() {
92-
93-
// Update the entities lists according to the filters
94-
if (this.disease == null) {
95-
return;
96-
}
97-
98-
// Events
99-
DashboardCriteria eventDashboardCriteria = buildCaseDashboardCriteria();
100-
setEvents(FacadeProvider.getDashboardFacade().getNewEvents(eventDashboardCriteria));
101-
setEventCountByStatus(FacadeProvider.getDashboardFacade().getEventCountByStatus(eventDashboardCriteria));
85+
private DashboardCriteria newEventDashboardCriteria() {
86+
return new DashboardCriteria();
10287
}
10388

10489
public NewCaseDateType getCaseDateType() {
@@ -144,22 +129,6 @@ public void setAefiDateType(AefiDashboardFilterDateType aefiDateType) {
144129
this.aefiDateType = aefiDateType;
145130
}
146131

147-
public List<DashboardEventDto> getEvents() {
148-
return events;
149-
}
150-
151-
public void setEvents(List<DashboardEventDto> events) {
152-
this.events = events;
153-
}
154-
155-
public Map<EventStatus, Long> getEventCountByStatus() {
156-
return eventCountByStatus;
157-
}
158-
159-
public void setEventCountByStatus(Map<EventStatus, Long> eventCountByStatus) {
160-
this.eventCountByStatus = eventCountByStatus;
161-
}
162-
163132
public Sex getSex() {
164133
return sex;
165134
}

sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/gis/GisDashboardMapComponent.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import de.symeda.sormas.api.contact.ContactClassification;
5454
import de.symeda.sormas.api.contact.MapContactDto;
5555
import de.symeda.sormas.api.dashboard.AefiDashboardCriteria;
56+
import de.symeda.sormas.api.dashboard.DashboardCriteria;
5657
import de.symeda.sormas.api.dashboard.DashboardEventDto;
5758
import de.symeda.sormas.api.dashboard.GisDashboardCriteria;
5859
import de.symeda.sormas.api.dashboard.SampleDashboardCriteria;
@@ -159,7 +160,7 @@ public GisDashboardMapComponent(GisDashboardDataProvider dashboardDataProvider)
159160
protected void addComponents() {
160161
displayedHumanSamples = new HashSet<>();
161162
if (UiUtil.permitted(FeatureType.ENVIRONMENT_MANAGEMENT, UserRight.ENVIRONMENT_SAMPLE_VIEW)) {
162-
showEnvironmentalSamples = true;
163+
showEnvironmentalSamples = false;
163164
}
164165

165166
caseClassificationOption = MapCaseClassificationOption.ALL_CASES;
@@ -244,7 +245,9 @@ protected Long getMarkerCount(Date fromDate, Date toDate, int maxCount) {
244245
markerCount += FacadeProvider.getAefiDashboardFacade().countAefiForMap(dashboardDataProvider.buildAefiDashboardCriteria());
245246
} else if (loadEvents) {
246247
if (showEvents) {
247-
markerCount += dashboardDataProvider.getEvents().size();
248+
DashboardCriteria eventDashboardCriteria = dashboardDataProvider.buildEventDashboardCriteria();
249+
List<DashboardEventDto> events = FacadeProvider.getDashboardFacade().getNewEvents(eventDashboardCriteria);
250+
markerCount += events.size();
248251
}
249252
}
250253

@@ -309,7 +312,7 @@ protected void loadMapData(Date fromDate, Date toDate) {
309312
if (loadEvents) {
310313
clearEventMarkers();
311314
if (showEvents) {
312-
showEventMarkers(dashboardDataProvider.getEvents());
315+
showEventMarkers();
313316
}
314317
loadEvents = false;
315318
}
@@ -523,7 +526,7 @@ protected void addLayerOptions(VerticalLayout layersLayout) {
523526
showEnvironmentSamplesCheckBox = new CheckBox();
524527
showEnvironmentSamplesCheckBox.setId(Captions.sampleDashboardShowEnvironmentSamples);
525528
showEnvironmentSamplesCheckBox.setCaption(I18nProperties.getCaption(Captions.sampleDashboardShowEnvironmentSamples));
526-
showEnvironmentSamplesCheckBox.setValue(shouldShowEventParticipantSamples());
529+
showEnvironmentSamplesCheckBox.setValue(showEnvironmentalSamples);
527530
showEnvironmentSamplesCheckBox.addValueChangeListener(e -> {
528531
if ((boolean) e.getProperty().getValue()) {
529532
showEnvironmentalSamples = true;
@@ -585,7 +588,7 @@ protected void addLayerOptions(VerticalLayout layersLayout) {
585588
refreshMap(true);
586589
});
587590
samplesLayers.addComponent(showEventsCheckBox);
588-
showEventsCheckBox.setVisible(false);
591+
showEventsCheckBox.setVisible(true);
589592
}
590593

591594
if (UiUtil.hasNationJurisdictionLevel() && UiUtil.permitted(UserRight.CASE_VIEW)) {
@@ -1341,9 +1344,12 @@ private void clearEventMarkers() {
13411344
markerEvents.clear();
13421345
}
13431346

1344-
private void showEventMarkers(List<DashboardEventDto> events) {
1347+
private void showEventMarkers() {
13451348
clearEventMarkers();
13461349

1350+
DashboardCriteria eventDashboardCriteria = dashboardDataProvider.buildEventDashboardCriteria();
1351+
List<DashboardEventDto> events = FacadeProvider.getDashboardFacade().getNewEvents(eventDashboardCriteria);
1352+
13471353
List<LeafletMarker> eventMarkers = new ArrayList<LeafletMarker>();
13481354

13491355
for (DashboardEventDto event : events) {

sormas-ui/src/main/java/de/symeda/sormas/ui/statistics/AbstractStatisticsView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.vaadin.ui.Link;
2525

2626
import de.symeda.sormas.api.FacadeProvider;
27+
import de.symeda.sormas.api.feature.FeatureType;
2728
import de.symeda.sormas.api.i18n.Captions;
2829
import de.symeda.sormas.api.i18n.I18nProperties;
2930
import de.symeda.sormas.api.user.UserRight;
@@ -49,7 +50,7 @@ public void refreshMenu(SubMenu menu, String params) {
4950
menu.addView(DatabaseExportView.VIEW_NAME, I18nProperties.getCaption(Captions.statisticsDatabaseExport), params);
5051
}
5152

52-
if (UiUtil.permitted(UserRight.EPIPULSE_EXPORT_VIEW)) {
53+
if (UiUtil.permitted(FeatureType.EPIPULSE_EXPORT, UserRight.EPIPULSE_EXPORT_VIEW)) {
5354
menu.addView(EpipulseExportView.VIEW_NAME, I18nProperties.getCaption(Captions.statisticsEpipulseExport), params);
5455
}
5556

0 commit comments

Comments
 (0)