Skip to content

Commit

Permalink
Merge pull request #85 from Cinoteck/development
Browse files Browse the repository at this point in the history
Moving to Live server deployment
  • Loading branch information
sundayAdu authored Jan 19, 2022
2 parents 08c66b1 + 3e38179 commit 4d4895c
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum Language {
/**
* Links locale strings to Languages
*/
private static final Map<String, Language> languageLookup; //max
private static final Map<String, Language> languageLookup;
static {
languageLookup = new HashMap<>();
for (Language lang : Language.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CampaignStatisticsDto implements Serializable, Cloneable {
public static final String AREA = "area";
public static final String REGION = "region";
public static final String DISTRICT = "district";
public static final String COMMUNITY = "community";
public static final String COMMUNITY = "community";
public static final String FORM_COUNT = "formCount";

private final CampaignStatisticsGroupingDto campaignStatisticsGroupingDto;
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.1
1.0.5
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ public final class EntityId {

private final Class<?> entityClass;
private final String entityUuid;


public EntityId(Class<?> entityClass, String entityUuid) {
this.entityClass = entityClass;
this.entityUuid = entityUuid;

}

public Class<?> getEntityClass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ public String getName() {
return name;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,18 @@ private String buildStatisticsQuery(CampaignStatisticsCriteria criteria) {
queryBuilder.append(buildJsonWhereExpression());

queryBuilder.append(buildGroupByExpression(criteria)).append(buildJsonGroupByExpression()).append(buildOrderByExpression(criteria));

System.out.println(">>>>>>>>>>>>>>>>>>> xxxxxxxxxxxxxxxxxxxxx"+queryBuilder.toString());

return queryBuilder.toString();
}



private String buildSelectExpression(CampaignStatisticsCriteria criteria) {
StringBuilder selectBuilder = new StringBuilder().append(buildSelectField(Campaign.TABLE_NAME, Campaign.NAME))
.append(", ")
.append(buildSelectField(CampaignFormMeta.TABLE_NAME, CampaignFormMeta.FORM_NAME))
.append(buildSelectField(CampaignFormMeta.TABLE_NAME, CampaignFormMeta.FORM_NAME))
.append(", ")
.append(buildSelectField(Area.TABLE_NAME, Area.NAME));

Expand Down Expand Up @@ -149,6 +153,7 @@ private String buildLeftJoinCondition(String fieldPart, String joinedTableName,
return joinConditionBuilder.toString();
}


private String buildWhereExpression(CampaignStatisticsCriteria criteria) {
StringBuilder whereBuilder = new StringBuilder();
if (criteria.getCampaign() != null) {
Expand Down Expand Up @@ -270,7 +275,8 @@ private boolean shouldIncludeCommunity(CampaignJurisdictionLevel groupingLevel)
}

private String buildJsonSelectExpression() {
System.out.println(">>>>>>>>>>>>>>>>>>> xxxxxxxxxxxxxxxxxxxxx");
String eum_dug = CampaignFormElementType.YES_NO.toString();


StringBuilder jsonQueryExpression = new StringBuilder();
jsonQueryExpression.append(", jsonData->>'")
Expand All @@ -283,15 +289,50 @@ private String buildJsonSelectExpression() {
.append("' THEN sum(cast_to_int(jsonData->>'")
.append(CampaignFormDataEntry.VALUE)
.append("', 0))")

.append(" WHEN (jsonMeta ->> '")
.append(CampaignFormElement.TYPE)
.append("') = '")
.append(eum_dug.toLowerCase().replaceAll("-", "_"))
.append("' THEN sum(CASE WHEN(jsonData->>'")
.append(CampaignFormDataEntry.VALUE)
.append("') = 'true' THEN 1 ELSE 0 END)")

/*
.append(" WHEN (jsonMeta ->> '")
.append(CampaignFormElement.TYPE)
.append("') = '")
.append(CampaignFormElementType.YES_NO.toStringJson())
.append("' THEN sum(CASE WHEN(jsonData->>'")
.append(CampaignFormDataEntry.VALUE)
.append("') = 'true' THEN 1 ELSE 0 END)")
.append(" WHEN (jsonMeta ->> '")
.append(CampaignFormElement.TYPE)
.append("') = '")
.append(CampaignFormElementType.YES_NO.toStringJson())
.append("' THEN sum(CASE WHEN(jsonData->>'")
.append(CampaignFormDataEntry.VALUE)
.append("') = 'true' THEN 1 ELSE 0 END)")
.append(" WHEN (jsonMeta ->> '")
.append(CampaignFormElement.TYPE)
.append("') = '")
.append(CampaignFormElementType.YES_NO.toString())
.append(CampaignFormElementType.YES_NO.toStringJson())
.append("' THEN sum(CASE WHEN(jsonData->>'")
.append(CampaignFormDataEntry.VALUE)
.append("') = 'true' THEN 1 ELSE 0 END) END as sumValue");
.append("') = 'true' THEN 1 ELSE 0 END)")
*/

.append(" END as sumValue");
return jsonQueryExpression.toString();
}



private String buildJsonJoinExpression() {
return new StringBuilder().append(", json_array_elements(")
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion sormas-ui/src/main/java/de/symeda/sormas/ui/ErrorView.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ public ErrorView() {
public void enter(ViewChangeListener.ViewChangeEvent event) {
explanation.setValue(String.format(I18nProperties.getString(Strings.errorViewNotFound), event.getViewName()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void enter(ViewChangeListener.ViewChangeEvent event) {
}

@Override
public void refreshMenu(SubMenu menu, String params) {
public void refreshMenu(SubMenu menu, String params) {
if (!findReferenceByParams(params)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import static de.symeda.sormas.ui.utils.FilteredGrid.EDIT_BTN_ID;

import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
Expand Down Expand Up @@ -238,7 +240,8 @@ private void fillNewFormDropdown(Panel containerPanel) {
if (campaignReferenceDto != null) {
List<CampaignFormMetaReferenceDto> campagaignFormReferences =
FacadeProvider.getCampaignFormMetaFacade().getCampaignFormMetasAsReferencesByCampaign(campaignReferenceDto.getUuid());
System.out.println(campaignReferenceDto.getUuid() + " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>___________"+campaignReferenceDto+"____________>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+campagaignFormReferences);
Collections.sort(campagaignFormReferences);
//System.out.println(campaignReferenceDto.getUuid() + " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>___________"+campaignReferenceDto+"____________>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+ campagaignFormReferences);
for (CampaignFormMetaReferenceDto campaignForm : campagaignFormReferences) {
Button campaignFormButton = ButtonHelper.createButton(campaignForm.toString(), e -> {
ControllerProvider.getCampaignController().createCampaignDataForm(criteria.getCampaign(), campaignForm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class CampaignGrid extends FilteredGrid<CampaignIndexDto, CampaignCriteri
@SuppressWarnings("unchecked")
public CampaignGrid(CampaignCriteria criteria) {

super(CampaignIndexDto.class);
super(CampaignIndexDto.class);

setSizeFull();

Expand All @@ -66,30 +66,34 @@ public CampaignGrid(CampaignCriteria criteria) {
}

final boolean canEditCampaigns = UserProvider.getCurrent().hasUserRight(UserRight.CAMPAIGN_EDIT);
final String navigateToCampaignColumnIcon = canEditCampaigns ? VaadinIcons.EDIT.getHtml() : VaadinIcons.EYE.getHtml();
//final Column<CampaignIndexDto, String> navigateToCampaignColumn = addColumn(entry -> navigateToCampaignColumnIcon, new HtmlRenderer());
final String navigateToCampaignColumnId = canEditCampaigns ? EDIT_BTN_ID : OPEN_BTN_ID;
//navigateToCampaignColumn.setId(navigateToCampaignColumnId);
//navigateToCampaignColumn.setSortable(false);
//navigateToCampaignColumn.setWidth(20);
final String navigateToCampaignColumnIcon = canEditCampaigns ? VaadinIcons.COPY.getHtml() : VaadinIcons.EYE.getHtml();
final Column<CampaignIndexDto, String> navigateToCampaignColumn = addColumn(entry -> navigateToCampaignColumnIcon+"Clone", new HtmlRenderer());
final String navigateToCampaignColumnId = canEditCampaigns ? CLONE_BTN_ID : OPEN_BTN_ID;
navigateToCampaignColumn.setId(navigateToCampaignColumnId);
navigateToCampaignColumn.setSortable(false);
navigateToCampaignColumn.setWidth(20);

//addItemClickListener(new ShowDetailsListener<>(navigateToCampaignColumnId, e -> ControllerProvider.getCampaignController().navigateToCampaign(e.getUuid()))) New Form

if(canEditCampaigns){
addItemClickListener(new ShowDetailsListener<>(navigateToCampaignColumnId, e -> ControllerProvider.getCampaignController().navigateToCampaign(e.getUuid())));
}

//setColumns(navigateToCampaignColumnId, CampaignIndexDto.NAME, CampaignIndexDto.START_DATE, CampaignIndexDto.END_DATE);
setColumns(CampaignIndexDto.NAME, CampaignIndexDto.START_DATE, CampaignIndexDto.END_DATE);
addItemClickListener(new ShowDetailsListener<>(CampaignIndexDto.NAME, e -> ControllerProvider.getCampaignController().navigateToCampaign(e.getUuid())));
addItemClickListener(new ShowDetailsListener<>(CampaignIndexDto.START_DATE, e -> ControllerProvider.getCampaignController().navigateToCampaign(e.getUuid())));
addItemClickListener(new ShowDetailsListener<>(CampaignIndexDto.END_DATE, e -> ControllerProvider.getCampaignController().navigateToCampaign(e.getUuid())));

}

//setColumns(, CampaignIndexDto.NAME, CampaignIndexDto.START_DATE, CampaignIndexDto.END_DATE);
setColumns(CampaignIndexDto.NAME, CampaignIndexDto.START_DATE, CampaignIndexDto.END_DATE, navigateToCampaignColumnId);
Language userLanguage = I18nProperties.getUserLanguage();
((Column<CampaignIndexDto, Date>) getColumn(CampaignIndexDto.START_DATE))
.setRenderer(new DateRenderer(DateHelper.getLocalDateFormat(userLanguage)));
((Column<CampaignIndexDto, Date>) getColumn(CampaignIndexDto.END_DATE))
.setRenderer(new DateRenderer(DateHelper.getLocalDateFormat(userLanguage)));



for (Column<?, ?> column : getColumns()) {
column.setCaption(I18nProperties.getPrefixCaption(CampaignIndexDto.I18N_PREFIX, column.getId(), column.getCaption()));
}
//getColumn(navigateToCampaignColumnId).setWidth(40).setStyleGenerator(item -> CssStyles.GRID_CELL_LINK);
getColumn(navigateToCampaignColumnId).setWidth(100).setStyleGenerator(item -> CssStyles.GRID_CELL_LINK);
}

public void setLazyDataProvider() {
Expand Down Expand Up @@ -121,4 +125,4 @@ public void setEagerDataProvider() {
public void reload() {
getDataProvider().refreshAll();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public CampaignSelector() {
campaignCombo.setEmptySelectionCaption(I18nProperties.getCaption(Captions.campaignAllCampaigns));
final CampaignReferenceDto lastStartedCampaign = FacadeProvider.getCampaignFacade().getLastStartedCampaign();

System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+campaigns);
//System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+campaigns);


if (lastStartedCampaign != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"vaadin://map/leaflet-connector.js" })
@StyleSheet({
"vaadin://map/leaflet.css",
"vaadin://map/leaflet.fullscreen.css",
"vaadin://map/leaflet.fullscreen.css",
"vaadin://map/MarkerCluster.css" })
public class LeafletMap extends AbstractJavaScriptComponent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
public class FilteredGrid<T, C extends BaseCriteria> extends Grid<T> {

public static final String EDIT_BTN_ID = "edit";

public static final String CLONE_BTN_ID = "clone";

private static final long serialVersionUID = 8116377533153377424L;

Expand Down Expand Up @@ -148,6 +150,11 @@ protected void addEditColumn(Consumer<T> handler) {

addItemClickListener(new ShowDetailsListener<>(EDIT_BTN_ID, e -> handler.accept(e)));
}

protected void addCloneColumn(Consumer<T> handler) {


}

protected void removeColumnIfExists(String columnId) {
if (getColumn(columnId) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ $v-grid-cell-focused-border: none !default;

@mixin sormas-grid {
.v-grid-row:hover{
background-color: rgb(253, 228, 208);
background-color: rgb(234, 234, 234);
cursor: pointer;
text-decoration: underline;
font-weight: bolder;

}

Expand Down Expand Up @@ -62,6 +64,7 @@ $v-grid-cell-focused-border: none !default;

&.link {
cursor: pointer;

}

&.priority-high {
Expand Down
Binary file modified sormas-ui/src/main/webapp/VAADIN/themes/sormas/img/sormas-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d4895c

Please sign in to comment.