Skip to content

Commit

Permalink
[GITFLOW]merging 'hotfix-1.67.1' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MateStrysewske committed Feb 3, 2022
2 parents b4bf498 + 7f5fe70 commit 9788fd0
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 63 deletions.
2 changes: 1 addition & 1 deletion sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public enum FeatureType {
IMMUNIZATION_MANAGEMENT(true, true, null, ImmutableMap.of(FeatureTypeProperty.REDUCED, Boolean.FALSE)),
TRAVEL_ENTRIES(true, false, null, null),

DASHBOARD(true, true, null, null),

// FEATURE EXTENSIONS
ASSIGN_TASKS_TO_HIGHER_LEVEL(true,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@
import android.content.Context;
import android.util.Log;
import android.view.View;

import androidx.databinding.ViewDataBinding;
import androidx.databinding.library.baseAdapters.BR;
import androidx.fragment.app.FragmentActivity;

import de.symeda.sormas.api.CountryHelper;
import de.symeda.sormas.api.infrastructure.facility.FacilityType;
import de.symeda.sormas.api.infrastructure.facility.FacilityTypeGroup;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.i18n.Strings;
import de.symeda.sormas.api.infrastructure.area.AreaType;
import de.symeda.sormas.api.infrastructure.facility.FacilityType;
import de.symeda.sormas.api.infrastructure.facility.FacilityTypeGroup;
import de.symeda.sormas.api.location.LocationDto;
import de.symeda.sormas.api.person.PersonAddressType;
import de.symeda.sormas.api.utils.ValidationException;
Expand All @@ -49,6 +51,7 @@
import de.symeda.sormas.app.component.Item;
import de.symeda.sormas.app.component.controls.ControlButtonType;
import de.symeda.sormas.app.component.validation.FragmentValidator;
import de.symeda.sormas.app.component.validation.ValidationHelper;
import de.symeda.sormas.app.core.notification.NotificationHelper;
import de.symeda.sormas.app.core.notification.NotificationType;
import de.symeda.sormas.app.databinding.DialogLocationLayoutBinding;
Expand Down Expand Up @@ -266,6 +269,9 @@ protected void initializeContentView(ViewDataBinding rootBinding, ViewDataBindin
}
}
});

ValidationHelper.initEmailValidator(contentBinding.locationContactPersonEmail);
ValidationHelper.initPhoneNumberValidator(contentBinding.locationContactPersonPhone);
}

private void overrideLocationDetailsWithFacilityOnes(Facility facility) {
Expand Down
2 changes: 1 addition & 1 deletion sormas-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion sormas-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,10 @@ public ContactDto saveContact(ContactDto dto, boolean handleChanges, boolean han
final boolean dropped = entity.getContactStatus() == ContactStatus.DROPPED
&& (existingContactDto == null || existingContactDto.getContactStatus() != ContactStatus.DROPPED);
if (dropped || convertedToCase) {
StringBuilder sb = new StringBuilder();
if (entity.getFollowUpComment() != null) {
sb.append(entity.getFollowUpComment()).append(" ");
}
contactService.cancelFollowUp(
entity,
sb.append(
I18nProperties
.getString(convertedToCase ? Strings.messageSystemFollowUpCanceled : Strings.messageSystemFollowUpCanceledByDropping))
.toString());
I18nProperties
.getString(convertedToCase ? Strings.messageSystemFollowUpCanceled : Strings.messageSystemFollowUpCanceledByDropping));
} else {
contactService.updateFollowUpDetails(
entity,
Expand Down
2 changes: 1 addition & 1 deletion sormas-base/dependencies/serverlibs.pom
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<packaging>pom</packaging>
<version>1.67.0</version>
<version>1.67.1</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion sormas-cargoserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-ear/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>

Expand Down
6 changes: 3 additions & 3 deletions sormas-keycloak-service-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>sormas-keycloak-service-provider</artifactId>
<version>1.67.0</version>
<version>1.67.1</version>
<name>sormas-keycloak-service-provider</name>
<packaging>jar</packaging>

Expand All @@ -35,7 +35,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sormas-api</artifactId>
<version>1.67.0</version>
<version>1.67.1</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion sormas-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
66 changes: 36 additions & 30 deletions sormas-ui/src/main/java/de/symeda/sormas/ui/MainScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*******************************************************************************/
package de.symeda.sormas.ui;

import static de.symeda.sormas.ui.UiUtil.enabled;
import static de.symeda.sormas.ui.UiUtil.permitted;

import java.util.Arrays;
Expand Down Expand Up @@ -131,25 +132,27 @@ public View getView(String viewName) {
});

menu = new Menu(navigator);
ControllerProvider.getDashboardController().registerViews(navigator);
if (permitted(FeatureType.CASE_SURVEILANCE, UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) {
menu.addView(
SurveillanceDashboardView.class,
AbstractDashboardView.ROOT_VIEW_NAME,
I18nProperties.getCaption(Captions.mainMenuDashboard),
VaadinIcons.DASHBOARD);
} else if (permitted(FeatureType.CONTACT_TRACING, UserRight.DASHBOARD_CONTACT_ACCESS)) {
menu.addView(
ContactsDashboardView.class,
AbstractDashboardView.ROOT_VIEW_NAME,
I18nProperties.getCaption(Captions.mainMenuDashboard),
VaadinIcons.DASHBOARD);
} else if (permitted(FeatureType.CAMPAIGNS, UserRight.DASHBOARD_CAMPAIGNS_ACCESS)) {
menu.addView(
CampaignDashboardView.class,
AbstractDashboardView.ROOT_VIEW_NAME,
I18nProperties.getCaption(Captions.mainMenuDashboard),
VaadinIcons.DASHBOARD);
if (enabled(FeatureType.DASHBOARD)) {
ControllerProvider.getDashboardController().registerViews(navigator);
if (permitted(FeatureType.CASE_SURVEILANCE, UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) {
menu.addView(
SurveillanceDashboardView.class,
AbstractDashboardView.ROOT_VIEW_NAME,
I18nProperties.getCaption(Captions.mainMenuDashboard),
VaadinIcons.DASHBOARD);
} else if (permitted(FeatureType.CONTACT_TRACING, UserRight.DASHBOARD_CONTACT_ACCESS)) {
menu.addView(
ContactsDashboardView.class,
AbstractDashboardView.ROOT_VIEW_NAME,
I18nProperties.getCaption(Captions.mainMenuDashboard),
VaadinIcons.DASHBOARD);
} else if (permitted(FeatureType.CAMPAIGNS, UserRight.DASHBOARD_CAMPAIGNS_ACCESS)) {
menu.addView(
CampaignDashboardView.class,
AbstractDashboardView.ROOT_VIEW_NAME,
I18nProperties.getCaption(Captions.mainMenuDashboard),
VaadinIcons.DASHBOARD);
}
}

if (permitted(FeatureType.TASK_MANAGEMENT, UserRight.TASK_VIEW)) {
Expand Down Expand Up @@ -336,14 +339,16 @@ private static Set<String> initKnownViews() {
TravelEntriesView.VIEW_NAME,
ImmunizationsView.VIEW_NAME));

if (permitted(FeatureType.CASE_SURVEILANCE, UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) {
views.add(SurveillanceDashboardView.VIEW_NAME);
}
if (permitted(FeatureType.CONTACT_TRACING, UserRight.DASHBOARD_CONTACT_ACCESS)) {
views.add(ContactsDashboardView.VIEW_NAME);
}
if (permitted(FeatureType.CAMPAIGNS, UserRight.DASHBOARD_CAMPAIGNS_ACCESS)) {
views.add(CampaignDashboardView.VIEW_NAME);
if (enabled(FeatureType.DASHBOARD)) {
if (permitted(FeatureType.CASE_SURVEILANCE, UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) {
views.add(SurveillanceDashboardView.VIEW_NAME);
}
if (permitted(FeatureType.CONTACT_TRACING, UserRight.DASHBOARD_CONTACT_ACCESS)) {
views.add(ContactsDashboardView.VIEW_NAME);
}
if (permitted(FeatureType.CAMPAIGNS, UserRight.DASHBOARD_CAMPAIGNS_ACCESS)) {
views.add(CampaignDashboardView.VIEW_NAME);
}
}

return views;
Expand Down Expand Up @@ -386,11 +391,11 @@ public boolean beforeViewChange(ViewChangeEvent event) {
if (event.getViewName().isEmpty()) {
// redirect to default view
String defaultView;
if (permitted(FeatureType.CASE_SURVEILANCE, UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) {
if (enabled(FeatureType.DASHBOARD) && permitted(FeatureType.CASE_SURVEILANCE, UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) {
defaultView = SurveillanceDashboardView.VIEW_NAME;
} else if (permitted(FeatureType.CONTACT_TRACING, UserRight.DASHBOARD_CONTACT_ACCESS)) {
} else if (enabled(FeatureType.DASHBOARD) && permitted(FeatureType.CONTACT_TRACING, UserRight.DASHBOARD_CONTACT_ACCESS)) {
defaultView = ContactsDashboardView.VIEW_NAME;
} else if (permitted(FeatureType.CAMPAIGNS, UserRight.DASHBOARD_CAMPAIGNS_ACCESS)) {
} else if (enabled(FeatureType.DASHBOARD) && permitted(FeatureType.CAMPAIGNS, UserRight.DASHBOARD_CAMPAIGNS_ACCESS)) {
defaultView = CampaignDashboardView.VIEW_NAME;
} else if (UserProvider.getCurrent().hasUserRole(UserRole.EXTERNAL_LAB_USER)) {
defaultView = SamplesView.VIEW_NAME;
Expand All @@ -399,6 +404,7 @@ public boolean beforeViewChange(ViewChangeEvent event) {
} else {
defaultView = AboutView.VIEW_NAME;
}

SormasUI.get().getNavigator().navigateTo(defaultView);
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions sormas-ui/src/main/java/de/symeda/sormas/ui/UiUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ public static boolean permitted(FeatureType feature, UserRight userRight) {
public static boolean permitted(UserRight userRight) {
return permitted(null, userRight);
}

public static boolean enabled(FeatureType featureType) {
return permitted(featureType, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected void addFields() {
}
});

if (sample.getSamplePurpose() != SamplePurpose.INTERNAL) {
if (sample.getSamplePurpose() != SamplePurpose.INTERNAL) { // this only works for already saved samples
setRequired(true, PathogenTestDto.LAB);
}
setRequired(true, PathogenTestDto.TEST_TYPE, PathogenTestDto.TESTED_DISEASE, PathogenTestDto.TEST_RESULT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.vaadin.v7.ui.CheckBox;
import com.vaadin.v7.ui.ComboBox;

import com.vaadin.v7.ui.Field;
import de.symeda.sormas.api.CountryHelper;
import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.FacadeProvider;
Expand Down Expand Up @@ -81,6 +82,7 @@
import de.symeda.sormas.ui.utils.DateComparisonValidator;
import de.symeda.sormas.ui.utils.DateFormatHelper;
import de.symeda.sormas.ui.utils.DateTimeField;
import de.symeda.sormas.ui.utils.NullableOptionGroup;
import de.symeda.sormas.ui.utils.VaadinUiUtil;
import de.symeda.sormas.ui.utils.components.page.title.TitleLayout;

Expand Down Expand Up @@ -185,6 +187,12 @@ public PathogenTestForm addPathogenTestComponent(
testDiseaseField.setValue(FacadeProvider.getDiseaseConfigurationFacade().getDefaultDisease());

}
// setup field updates
Field testLabField = pathogenTestForm.getField(PathogenTestDto.LAB);
NullableOptionGroup samplePurposeField = sampleComponent.getWrappedComponent().getField(SampleDto.SAMPLE_PURPOSE);
Runnable updateTestLabFieldRequired = () -> testLabField.setRequired(!SamplePurpose.INTERNAL.equals(samplePurposeField.getValue()));
updateTestLabFieldRequired.run();
samplePurposeField.addValueChangeListener(e -> updateTestLabFieldRequired.run());
// validate pathogen test create component before saving the sample
sampleComponent.addFieldGroups(pathogenTestForm.getFieldGroup());
CommitDiscardWrapperComponent.CommitListener savePathogenTest = () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,22 +331,22 @@ private void updateByCreatingAndAssignee() {
boolean creating = value.getCreationDate() == null;

UserDto user = UserProvider.getCurrent().getUser();
boolean creator = value.getCreatorUser() == null
? UserRole.getJurisdictionLevel(user.getUserRoles()) == JurisdictionLevel.NATION
: user.equals(value.getCreatorUser());
JurisdictionLevel jurisdictionLevel = UserRole.getJurisdictionLevel(user.getUserRoles());
boolean creator = value.getCreatorUser() != null && user.getUuid().equals(value.getCreatorUser().getUuid());
boolean nationalOrAdmin = jurisdictionLevel == null || jurisdictionLevel == JurisdictionLevel.NATION;
boolean supervisor = UserRole.isSupervisor(user.getUserRoles());
boolean assignee = user.equals(getFieldGroup().getField(TaskDto.ASSIGNEE_USER).getValue());

setVisible(!creating || assignee, TaskDto.ASSIGNEE_REPLY, TaskDto.TASK_STATUS);
if (creating && !assignee) {
setVisible(!creating || assignee || nationalOrAdmin, TaskDto.ASSIGNEE_REPLY, TaskDto.TASK_STATUS);
if (creating && !assignee && !nationalOrAdmin) {
discard(TaskDto.ASSIGNEE_REPLY, TaskDto.TASK_STATUS);
}

if (UserProvider.getCurrent().hasUserRight(editOrCreateUserRight)) {
setReadOnly(!(assignee || creator), TaskDto.TASK_STATUS);
setReadOnly(!assignee, TaskDto.ASSIGNEE_REPLY);
setReadOnly(!(assignee || creator || nationalOrAdmin), TaskDto.TASK_STATUS);
setReadOnly(!(assignee || nationalOrAdmin), TaskDto.ASSIGNEE_REPLY);
setReadOnly(
!creator,
!(creator || nationalOrAdmin),
TaskDto.TASK_TYPE,
TaskDto.PRIORITY,
TaskDto.SUGGESTED_START,
Expand All @@ -355,7 +355,7 @@ private void updateByCreatingAndAssignee() {
TaskDto.CREATOR_COMMENT,
TaskDto.OBSERVER_USERS);
setReadOnly(
!(creator || supervisor),
!(creator || supervisor || nationalOrAdmin),
TaskDto.PRIORITY,
TaskDto.SUGGESTED_START,
TaskDto.DUE_DATE,
Expand Down
2 changes: 1 addition & 1 deletion sormas-widgetset/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.67.0</version>
<version>1.67.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down

0 comments on commit 9788fd0

Please sign in to comment.