Skip to content

Commit

Permalink
- Added a new method to reset filters after commit
Browse files Browse the repository at this point in the history
- Modified FacadeProvider to resolve conflit during merge
  • Loading branch information
douglasderrick committed Nov 21, 2023
1 parent b45515e commit 36c819e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static DiseaseConfigurationFacade getDiseaseConfigurationFacade() {
return get().lookupEjbRemote(DiseaseConfigurationFacade.class);
}

public static DiseaseConFacade getDiseaseFacade() {
public static DiseaseConFacade getDiseaseConFacade() {
return get().lookupEjbRemote(DiseaseConFacade.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto;
import de.symeda.sormas.api.infrastructure.facility.*;
import de.symeda.sormas.api.infrastructure.region.RegionReferenceDto;
import de.symeda.sormas.ui.ControllerProvider;
import de.symeda.sormas.ui.ViewModelProviders;
import de.symeda.sormas.ui.configuration.infrastructure.components.SearchField;
import de.symeda.sormas.ui.utils.*;
Expand Down Expand Up @@ -181,9 +182,6 @@ public String apply(FacilityIndexDto facilityIndexDto) {
return facilityIndexDto.getName() + " (" + district + ", " + community + ")";
}
});



}


Expand Down Expand Up @@ -228,4 +226,11 @@ public void updateDataProvider() {
selectDiseaseFacilities.setRightColumnCaption(I18nProperties.getCaption(Captions.facilitiesSelected) + " (" + selectedFacilityIndexDtos.size() + ")");
}

//reset filters
public void resetFilters() {
searchField.setValue("");
regionFilter.setValue(null);
districtFilter.setValue(null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public DiseasesGrid(DiseaseConCriteria criteria) {

public void setLazyDataProvider() {
DataProvider<DiseaseConIndexDto, DiseaseConCriteria> dataProvider = DataProvider.fromFilteringCallbacks(
query -> FacadeProvider.getDiseaseFacade()
query -> FacadeProvider.getDiseaseConFacade()
.getIndexList(
query.getFilter().orElse(null),
query.getOffset(),
Expand All @@ -72,15 +72,15 @@ public void setLazyDataProvider() {
.map(sortOrder -> new SortProperty(sortOrder.getSorted(), sortOrder.getDirection() == SortDirection.ASCENDING))
.collect(Collectors.toList()))
.stream(),
query -> (int) FacadeProvider.getDiseaseFacade().count(query.getFilter().orElse(null)));
query -> (int) FacadeProvider.getDiseaseConFacade().count(query.getFilter().orElse(null)));
setDataProvider(dataProvider);
setSelectionMode(SelectionMode.NONE);
}

public void setEagerDataProvider() {

ListDataProvider<DiseaseConIndexDto> dataProvider =
DataProvider.fromStream(FacadeProvider.getDiseaseFacade().getIndexList(getCriteria(), null, null, null).stream());
DataProvider.fromStream(FacadeProvider.getDiseaseConFacade().getIndexList(getCriteria(), null, null, null).stream());
setDataProvider(dataProvider);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void editFacility(String uuid) {
}

public void editDisease(String uuid) {
DiseaseConDto diseaseConDto = FacadeProvider.getDiseaseFacade().getByUuid(uuid);
DiseaseConDto diseaseConDto = FacadeProvider.getDiseaseConFacade().getByUuid(uuid);
CommitDiscardWrapperComponent<DiseaseEditForm> editComponent = getEditDiseaseComponent(diseaseConDto);
String caption = I18nProperties.getString(Strings.edit) + " " + I18nProperties.getCaption(diseaseConDto.getDisease().toShortString());
VaadinUiUtil.showModalPopupWindow(editComponent, caption);
Expand Down Expand Up @@ -944,7 +944,8 @@ private CommitDiscardWrapperComponent<DiseaseEditForm> getEditDiseaseComponent(D

@Override
public void onCommit() {
FacadeProvider.getDiseaseFacade().save(editForm.getValue());
FacadeProvider.getDiseaseConFacade().save(editForm.getValue());
editForm.resetFilters();
Notification.show(I18nProperties.getString(Strings.messageEntryCreated), Type.ASSISTIVE_NOTIFICATION);
SormasUI.get().getNavigator().navigateTo(DiseasesView.VIEW_NAME);
}
Expand Down

0 comments on commit 36c819e

Please sign in to comment.