Skip to content

Commit

Permalink
refactoring and fixing #124
Browse files Browse the repository at this point in the history
  • Loading branch information
AbahSuccess committed Mar 8, 2022
1 parent 6b0f83e commit 196cbdd
Show file tree
Hide file tree
Showing 29 changed files with 368 additions and 65 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.65.0-SNAPSHOT</version>
<version>1.0.11</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 @@ -840,6 +840,7 @@ public interface Strings {
String messageCampaignDearchived = "messageCampaignDearchived";
String messageCampaignDeleted = "messageCampaignDeleted";
String messageCampaignFormSaved = "messageCampaignFormSaved";
String messageCampaignFormSavedandContinue = "messageCampaignFormSavednContinue";
String messageCampaignSaved = "messageCampaignSaved";
String messageCaseArchived = "messageCaseArchived";
String messageCaseCreated = "messageCaseCreated";
Expand Down
1 change: 1 addition & 0 deletions sormas-api/src/main/resources/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ messageCampaignDearchived = Campaign has been de-archived
messageCampaignDeleted = Campaign deleted
messageCampaignSaved = Campaign saved
messageCampaignFormSaved = %s saved
messageCampaignFormSavednContinue = %s saved and ready for new input
messageCaseArchived = Case has been archived
messageCaseCreated = New case created
messageCaseDearchived = Case has been de-archived
Expand Down
1 change: 1 addition & 0 deletions sormas-api/src/main/resources/strings_en-AF.properties
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ messageCampaignDearchived = Campaign has been de-archived
messageCampaignDeleted = Campaign deleted
messageCampaignSaved = Campaign saved
messageCampaignFormSaved = %s saved
messageCampaignFormSavednContinue = %s saved and ready for new input
messageCaseArchived = Case has been archived
messageCaseCreated = New case created
messageCaseDearchived = Case has been de-archived
Expand Down
1 change: 1 addition & 0 deletions sormas-api/src/main/resources/strings_fa-AF.properties
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ messageCampaignDearchived = Campaign has been de-archived
messageCampaignDeleted = Campaign deleted
messageCampaignSaved = Campaign saved
messageCampaignFormSaved = %s saved
messageCampaignFormSavednContinue = %s saved and ready for new input
messageCaseArchived = Case has been archived
messageCaseCreated = New case created
messageCaseDearchived = Case has been de-archived
Expand Down
1 change: 1 addition & 0 deletions sormas-api/src/main/resources/strings_ps-AF.properties
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ messageCampaignDearchived = Campaign has been de-archived
messageCampaignDeleted = Campaign deleted
messageCampaignSaved = Campaign saved
messageCampaignFormSaved = %s saved
messageCampaignFormSavednContinue = %s saved and ready for new input
messageCaseArchived = Case has been archived
messageCaseCreated = New case created
messageCaseDearchived = Case has been de-archived
Expand Down
2 changes: 1 addition & 1 deletion sormas-api/src/main/resources/version_apmis.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.11
1.0.12
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.65.0-SNAPSHOT</version>
<version>1.0.11</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
6 changes: 3 additions & 3 deletions sormas-base/build-artifact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<fail unless="copy.path">deploy.path is not set!</fail>

<property name="target.dir" value="./target" />
<copy todir="${copy.path}" preservelastmodified="true" verbose="true">
<!--copy todir="${copy.path}" preservelastmodified="true" verbose="true">
<fileset dir="${target.dir}">
<include name="**/*.${file.suffix}" />
</fileset>
<!-- This mapper strips off all leading directory information and versions from the jars -->
<mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper" from="${dependency.versions}"
to="flatten" />
</copy>
</copy-->
</target>

<path id="maven-ant-tasks.classpath" path="../sormas-base/antlib/maven-ant-tasks-2.1.4-SNAPSHOT_PATCHED.jar" />
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.65.0-SNAPSHOT</version>
<version>1.0.11</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.65.0-SNAPSHOT</version>
<version>1.0.11</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.login-pf body {
background-size: cover;
background: #FFFFFF url(../img/world.png) center;
background: #FFFFFF url(../img/afghanistan-map.svg) center;
box-shadow: inset 2000px 0 0 0 rgba(27, 84, 154, 0.9);
display: flex;
}
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.65.0-SNAPSHOT</version>
<version>1.0.11</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.65.0-SNAPSHOT</version>
<version>1.0.11</version>
<relativePath>../sormas-base</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-keycloak-service-provider/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.65.0-SNAPSHOT</version>
<version>1.0.11</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
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.65.0-SNAPSHOT</version>
<version>1.0.11</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 @@ -5,7 +5,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.65.0-SNAPSHOT</version>
<version>1.0.11</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var url = window.location.toString();
window.location = url.replace(/dashboard_logout/, 'dashboard');
20 changes: 11 additions & 9 deletions sormas-ui/src/main/java/de/symeda/sormas/ui/AboutView.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,26 @@ private VerticalLayout createInfoSection() {

Label aboutLabel = new Label(I18nProperties.getCaption(Captions.about), ContentMode.HTML);
aboutLabel.addStyleName(CssStyles.H1);
//setComponentAlignment(aboutLabel, Alignment.MIDDLE_CENTER);
infoLayout.addComponent(aboutLabel);

ConfigFacade configFacade = FacadeProvider.getConfigFacade();
String infoLabelStr = configFacade.isCustomBranding()
? String.format(I18nProperties.getCaption(Captions.aboutBrandedSormasVersion), configFacade.getCustomBrandingName())
: "SORMAS";
Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " " + infoLabelStr, ContentMode.HTML);
: "";
Label infoLabel = new Label(I18nProperties.getCaption(Captions.aboutApmisVersion) + ": " + InfoProvider.InfoProvider_apmis(), ContentMode.HTML);
// setComponentAlignment(infoLayout, Alignment.MIDDLE_CENTER);
infoLayout.addComponent(infoLabel);

Label versionLabel =
new Label(I18nProperties.getCaption(Captions.aboutSormasVersion) + ": " + InfoProvider.get().getVersion(), ContentMode.HTML);
//Label versionLabel =
//new Label(I18nProperties.getCaption(Captions.aboutSormasVersion) + ": " + InfoProvider.get().getVersion(), ContentMode.HTML);
//CssStyles.style(versionLabel, CssStyles.VSPACE_3);
infoLayout.addComponent(versionLabel);
// infoLayout.addComponent(versionLabel);

Label versionApmisLabel =
new Label(I18nProperties.getCaption(Captions.aboutApmisVersion) + ": " + InfoProvider.InfoProvider_apmis(), ContentMode.HTML);
CssStyles.style(versionApmisLabel, CssStyles.VSPACE_3);
infoLayout.addComponent(versionApmisLabel);
// Label versionApmisLabel =
// new Label(I18nProperties.getCaption(Captions.aboutApmisVersion) + ": " + InfoProvider.InfoProvider_apmis(), ContentMode.HTML);
// CssStyles.style(versionApmisLabel, CssStyles.VSPACE_3);
// infoLayout.addComponent(versionApmisLabel);
/*
Link whatsNewLink = new Link(
I18nProperties.getCaption(Captions.aboutWhatsNew),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.user.UserDto;
import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.ui.ControllerProvider;
import de.symeda.sormas.ui.SormasUI;
import de.symeda.sormas.ui.UserProvider;
import de.symeda.sormas.ui.campaign.campaigndata.CampaignDataView;
Expand Down Expand Up @@ -111,7 +112,12 @@ public void createCampaignDataForm(CampaignReferenceDto campaign, CampaignFormMe
SormasUI.refreshView(); //Strings.messageCampaignFormSaved
Notification
.show(String.format(I18nProperties.getString(Strings.messageCampaignFormSaved), campaignForm.toString()), Type.TRAY_NOTIFICATION);
}, window::close);
}, window::close, () -> {
SormasUI.refreshView(); //Strings.messageCampaignFormSaved
Notification
.show(String.format(I18nProperties.getString(Strings.messageCampaignFormSavedandContinue), campaignForm.toString()), Type.TRAY_NOTIFICATION);

},true);

window.setCaption(String.format(I18nProperties.getString(Strings.headingCreateCampaignDataForm), campaignForm.toString()));
window.setContent(component);
Expand Down Expand Up @@ -237,6 +243,8 @@ public CommitDiscardWrapperComponent<CampaignFormDataEditForm> getCampaignFormDa
boolean showDeleteButton,
Runnable commitCallback,
Runnable discardCallback) {



CampaignFormDataEditForm form = new CampaignFormDataEditForm(campaignFormData == null);
if (campaignFormData == null) {
Expand Down Expand Up @@ -302,6 +310,7 @@ public CommitDiscardWrapperComponent<CampaignFormDataEditForm> getCampaignFormDa
boolean showDeleteButton,
Runnable commitCallback,
Runnable discardCallback,
Runnable saveandcontdCallback,
boolean showCloneButton) {

CampaignFormDataEditForm form = new CampaignFormDataEditForm(campaignFormData == null);
Expand All @@ -312,19 +321,22 @@ public CommitDiscardWrapperComponent<CampaignFormDataEditForm> getCampaignFormDa
CampaignFormDataDto.build(campaign, campaignForm, currentUser.getArea(), currentUser.getRegion(), currentUser.getDistrict(), currentUser.getCommunity());
campaignFormData.setCreatingUser(UserProvider.getCurrent().getUserReference());
}
final UserDto currentUsex = UserProvider.getCurrent().getUser();
form.setValue(campaignFormData);

final CommitDiscardWrapperComponent<CampaignFormDataEditForm> component = new CommitDiscardWrapperComponent<>(form, form.getFieldGroup());

component.addCommitListener(() -> {
if (!form.getFieldGroup().isModified()) {

try {
form.validate();
} catch (InvalidValueException e) {
Notification.show(I18nProperties.getValidationError(Validations.errorsInForm), Type.ERROR_MESSAGE);
return;
}



CampaignFormDataDto formData = form.getValue();
FacadeProvider.getCampaignFormDataFacade().saveCampaignFormData(formData);
if (commitCallback != null) {
Expand All @@ -333,6 +345,42 @@ public CommitDiscardWrapperComponent<CampaignFormDataEditForm> getCampaignFormDa
}
}
});



// TODO duplicate form
component.addCommitandContListener(() -> {

if (!form.getFieldGroup().isModified()) {
try {
form.validate();
} catch (InvalidValueException e) {
Notification.show(I18nProperties.getValidationError(Validations.errorsInForm), Type.ERROR_MESSAGE);
return;
}

CampaignFormDataDto formData = form.getValue();
FacadeProvider.getCampaignFormDataFacade().saveCampaignFormData(formData);
if (saveandcontdCallback != null) {
saveandcontdCallback.run();
form.resetFormValues();

discardCallback.run();
ControllerProvider.getCampaignController().createCampaignDataForm(campaign, campaignForm);



//UI.getCurrent().getNavigator().navigateTo(CampaignDataView.VIEW_NAME + "/?" + CAMPAIGN + "=" + campaign.getUuid());
}
}

}, I18nProperties.getString(Strings.entityCampaignDataForm));







component.addDiscardListener(
() -> UI.getCurrent().getNavigator().navigateTo(CampaignDataView.VIEW_NAME + "/?" + CAMPAIGN + "=" + campaign.getUuid()));
Expand All @@ -353,16 +401,9 @@ public CommitDiscardWrapperComponent<CampaignFormDataEditForm> getCampaignFormDa
UI.getCurrent().getNavigator().navigateTo(CampaignFormDataView.VIEW_NAME);
}, I18nProperties.getString(Strings.entityCampaignDataForm));
}
/*
* TODO duplicate form
if (showCloneButton && UserProvider.getCurrent().hasUserRight(UserRight.CAMPAIGN_DELETE)) {
String campaignFormDataUuid = campaignFormData.getUuid();
component.addCloneListener(() -> {
FacadeProvider.getCampaignFormDataFacade().cloneCampaignFormData(campaignFormDataUuid);
UI.getCurrent().getNavigator().navigateTo(CampaignFormDataView.VIEW_NAME);
}, I18nProperties.getString(Strings.entityCampaignDataForm));
}*/




return component;
}
Expand Down
Loading

0 comments on commit 196cbdd

Please sign in to comment.