Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 712ad16

Browse files
author
barnabartha
committed
SORMAS-Foundation#2923 - do not show info of case update when task is opened from task grid / contact or event views
1 parent 72d0c6d commit 712ad16

4 files changed

Lines changed: 22 additions & 16 deletions

File tree

sormas-ui/src/main/java/de/symeda/sormas/ui/task/TaskController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public TaskController() {
5050

5151
public void create(TaskContext context, ReferenceDto entityRef, Runnable callback) {
5252

53-
TaskEditForm createForm = new TaskEditForm(true);
53+
TaskEditForm createForm = new TaskEditForm(true, false);
5454
createForm.setValue(createNewTask(context, entityRef));
5555
final CommitDiscardWrapperComponent<TaskEditForm> editView = new CommitDiscardWrapperComponent<TaskEditForm>(
5656
createForm,
@@ -74,7 +74,7 @@ public void onCommit() {
7474

7575
public void createSampleCollectionTask(TaskContext context, ReferenceDto entityRef, SampleDto sample) {
7676

77-
TaskEditForm createForm = new TaskEditForm(true);
77+
TaskEditForm createForm = new TaskEditForm(true, false);
7878
TaskDto taskDto = createNewTask(context, entityRef);
7979
taskDto.setTaskType(TaskType.SAMPLE_COLLECTION);
8080
taskDto.setCreatorComment(sample.getNoTestPossibleReason());
@@ -99,12 +99,12 @@ public void onCommit() {
9999
VaadinUiUtil.showModalPopupWindow(createView, I18nProperties.getString(Strings.headingCreateNewTask));
100100
}
101101

102-
public void edit(TaskIndexDto dto, Runnable callback, boolean fromCase) {
102+
public void edit(TaskIndexDto dto, Runnable callback, boolean editedFromTaskGrid) {
103103

104104
// get fresh data
105105
TaskDto newDto = FacadeProvider.getTaskFacade().getByUuid(dto.getUuid());
106106

107-
TaskEditForm form = new TaskEditForm(false);
107+
TaskEditForm form = new TaskEditForm(false, editedFromTaskGrid);
108108
form.setValue(newDto);
109109
final CommitDiscardWrapperComponent<TaskEditForm> editView =
110110
new CommitDiscardWrapperComponent<TaskEditForm>(form, UserProvider.getCurrent().hasUserRight(UserRight.TASK_EDIT), form.getFieldGroup());
@@ -119,7 +119,7 @@ public void onCommit() {
119119
TaskDto dto = form.getValue();
120120
FacadeProvider.getTaskFacade().saveTask(dto);
121121

122-
if (fromCase && dto.getCaze() != null) {
122+
if (!editedFromTaskGrid && dto.getCaze() != null) {
123123
ControllerProvider.getCaseController().navigateToCase(dto.getCaze().getUuid());
124124
}
125125

sormas-ui/src/main/java/de/symeda/sormas/ui/task/TaskEditForm.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,15 @@ public class TaskEditForm extends AbstractEditForm<TaskDto> {
8282
//@formatter:off
8383

8484
private UserRight editOrCreateUserRight;
85+
private boolean editedFromTaskGrid;
8586

86-
public TaskEditForm(boolean create) {
87+
public TaskEditForm(boolean create, boolean editedFromTaskGrid) {
8788

8889
super(TaskDto.class, TaskDto.I18N_PREFIX);
90+
91+
this.editedFromTaskGrid = editedFromTaskGrid;
8992
this.editOrCreateUserRight = editOrCreateUserRight;
93+
9094
addValueChangeListener(e -> {
9195
updateByTaskContext();
9296
updateByCreatingAndAssignee();
@@ -114,14 +118,6 @@ protected void addFields() {
114118
taskContext.setImmediate(true);
115119
taskContext.addValueChangeListener(event -> updateByTaskContext());
116120

117-
final HorizontalLayout saveInfoLayout = new HorizontalLayout(
118-
new Label(
119-
VaadinIcons.INFO_CIRCLE.getHtml() + " " + I18nProperties.getString(Strings.infoSaveOfTask),
120-
ContentMode.HTML));
121-
saveInfoLayout.setSpacing(true);
122-
saveInfoLayout.setMargin(new MarginInfo(true, false, true, false));
123-
getContent().addComponent(saveInfoLayout, SAVE_INFO);
124-
125121
ComboBox taskTypeField = addField(TaskDto.TASK_TYPE, ComboBox.class);
126122
taskTypeField.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING);
127123
taskTypeField.setImmediate(true);
@@ -152,6 +148,16 @@ protected void addFields() {
152148
new TaskStatusValidator(
153149
taskDto.getCaze().getUuid(),
154150
I18nProperties.getValidationError(Validations.investigationStatusUnclassifiedCase)));
151+
152+
if (!editedFromTaskGrid) {
153+
final HorizontalLayout saveInfoLayout = new HorizontalLayout(
154+
new Label(
155+
VaadinIcons.INFO_CIRCLE.getHtml() + " " + I18nProperties.getString(Strings.infoSaveOfTask),
156+
ContentMode.HTML));
157+
saveInfoLayout.setSpacing(true);
158+
saveInfoLayout.setMargin(new MarginInfo(true, false, true, false));
159+
getContent().addComponent(saveInfoLayout, SAVE_INFO);
160+
}
155161
}
156162

157163
DistrictReferenceDto district = null;

sormas-ui/src/main/java/de/symeda/sormas/ui/task/TaskGrid.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public TaskGrid(TaskCriteria criteria) {
7272
setCriteria(criteria);
7373
}
7474

75-
addEditColumn(e -> ControllerProvider.getTaskController().edit(e, this::reload, false));
75+
addEditColumn(e -> ControllerProvider.getTaskController().edit(e, this::reload, true));
7676

7777
setStyleGenerator(item -> {
7878
if (item != null && item.getTaskStatus() != null) {

sormas-ui/src/main/java/de/symeda/sormas/ui/task/TaskList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected void drawDisplayedEntries() {
8787
if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_EDIT)) {
8888
listEntry.addEditListener(
8989
i,
90-
(ClickListener) event -> ControllerProvider.getTaskController().edit(listEntry.getTask(), TaskList.this::reload, true));
90+
(ClickListener) event -> ControllerProvider.getTaskController().edit(listEntry.getTask(), TaskList.this::reload, false));
9191
}
9292
listLayout.addComponent(listEntry);
9393
}

0 commit comments

Comments
 (0)