Skip to content

Commit

Permalink
JBPM-6877 - Fix screen id for navigating to task and process instance…
Browse files Browse the repository at this point in the history
… details screens (#16)
  • Loading branch information
cristianonicolai committed Feb 23, 2018
1 parent 5167156 commit 4fa1a17
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@
import org.uberfire.client.mvp.PlaceStatus;

import static org.jbpm.dashboard.renderer.model.DashboardData.*;
import static org.jbpm.workbench.common.client.PerspectiveIds.PROCESS_INSTANCE_DETAILS_SCREEN;


@Dependent
public class ProcessDashboard extends AbstractDashboard implements IsWidget {

public static final String PROCESS_DETAILS_SCREEN_ID = "Process Instance Details Multi";
protected View view;
protected Event<ProcessInstanceSelectionEvent> instanceSelectionEvent;
protected Event<ProcessDashboardFocusEvent> processDashboardFocusEvent;
Expand Down Expand Up @@ -327,16 +328,16 @@ public void showDashboard() {

public void openProcessDetailsScreen() {
processDashboardFocusEvent.fire(new ProcessDashboardFocusEvent());
PlaceStatus status = placeManager.getStatus(PROCESS_DETAILS_SCREEN_ID);
PlaceStatus status = placeManager.getStatus(PROCESS_INSTANCE_DETAILS_SCREEN);
if (status == PlaceStatus.CLOSE) {
placeManager.goTo(PROCESS_DETAILS_SCREEN_ID);
placeManager.goTo(PROCESS_INSTANCE_DETAILS_SCREEN);
}
}

public void closeProcessDetailsScreen() {
PlaceStatus status = placeManager.getStatus(PROCESS_DETAILS_SCREEN_ID);
PlaceStatus status = placeManager.getStatus(PROCESS_INSTANCE_DETAILS_SCREEN);
if (status == PlaceStatus.OPEN) {
placeManager.closePlace(PROCESS_DETAILS_SCREEN_ID);
placeManager.closePlace(PROCESS_INSTANCE_DETAILS_SCREEN);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
import org.uberfire.workbench.events.NotificationEvent;

import static org.jbpm.dashboard.renderer.model.DashboardData.*;
import static org.jbpm.workbench.common.client.PerspectiveIds.TASK_DETAILS_SCREEN;

@Dependent
public class TaskDashboard extends AbstractDashboard implements IsWidget {

public static final String TASK_DETAILS_SCREEN_ID = "Task Details Multi";
protected View view;
protected Event<TaskSelectionEvent> taskSelectionEvent;
protected Event<TaskDashboardFocusEvent> taskDashboardFocusEvent;
Expand Down Expand Up @@ -406,16 +406,16 @@ public void showTasksTable() {

public void openTaskDetailsScreen() {
taskDashboardFocusEvent.fire(new TaskDashboardFocusEvent());
PlaceStatus status = placeManager.getStatus(TASK_DETAILS_SCREEN_ID);
PlaceStatus status = placeManager.getStatus(TASK_DETAILS_SCREEN);
if (status == PlaceStatus.CLOSE) {
placeManager.goTo(TASK_DETAILS_SCREEN_ID);
placeManager.goTo(TASK_DETAILS_SCREEN);
}
}

public void closeTaskDetailsScreen() {
PlaceStatus status = placeManager.getStatus(TASK_DETAILS_SCREEN_ID);
PlaceStatus status = placeManager.getStatus(TASK_DETAILS_SCREEN);
if (status == PlaceStatus.OPEN) {
placeManager.closePlace(TASK_DETAILS_SCREEN_ID);
placeManager.closePlace(TASK_DETAILS_SCREEN);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import static org.jbpm.dashboard.renderer.model.DashboardData.*;
import static org.jbpm.workbench.common.client.PerspectiveIds.PROCESS_INSTANCE_DETAILS_SCREEN;

@RunWith(MockitoJUnitRunner.class)
public class ProcessDashboardTest extends AbstractDashboardTest {
Expand Down Expand Up @@ -469,12 +470,12 @@ public void testSwitchMetric() {

@Test
public void testOpenInstanceDetails() {
when(placeManager.getStatus(ProcessDashboard.PROCESS_DETAILS_SCREEN_ID)).thenReturn(PlaceStatus.CLOSE);
when(placeManager.getStatus(PROCESS_INSTANCE_DETAILS_SCREEN)).thenReturn(PlaceStatus.CLOSE);
presenter.tableCellSelected(COLUMN_PROCESS_INSTANCE_ID,
3);
verify(instanceSelectionEvent).fire(any(ProcessInstanceSelectionEvent.class));
verify(processDashboardFocusEvent).fire(any(ProcessDashboardFocusEvent.class));
verify(placeManager).goTo(ProcessDashboard.PROCESS_DETAILS_SCREEN_ID);
verify(placeManager).goTo(PROCESS_INSTANCE_DETAILS_SCREEN);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
import org.jbpm.dashboard.renderer.client.panel.DashboardKpis;
import org.jbpm.workbench.ht.model.TaskSummary;
import org.jbpm.workbench.ht.service.TaskService;
import org.jbpm.workbench.pr.model.ProcessInstanceKey;
import org.jbpm.workbench.pr.model.ProcessInstanceSummary;
import org.jbpm.workbench.ht.model.events.TaskSelectionEvent;
import org.jbpm.workbench.pr.service.ProcessRuntimeDataService;
import org.jbpm.dashboard.renderer.client.panel.AbstractDashboard;
import org.jbpm.dashboard.renderer.client.panel.TaskDashboard;
import org.jbpm.dashboard.renderer.client.panel.events.TaskDashboardFocusEvent;
Expand All @@ -52,6 +49,7 @@
import static org.jbpm.dashboard.renderer.model.DashboardData.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.jbpm.workbench.common.client.PerspectiveIds.TASK_DETAILS_SCREEN;

@RunWith(MockitoJUnitRunner.class)
public class TaskDashboardTest extends AbstractDashboardTest {
Expand Down Expand Up @@ -508,7 +506,7 @@ public void testTaskInstanceNoDetailsStatusExited() {
when(taskService.getTask(anyString(),
anyString(),
anyLong())).thenReturn(mock(TaskSummary.class));
when(placeManager.getStatus(TaskDashboard.TASK_DETAILS_SCREEN_ID)).thenReturn(PlaceStatus.CLOSE);
when(placeManager.getStatus(TASK_DETAILS_SCREEN)).thenReturn(PlaceStatus.CLOSE);
TableDisplayer tableDisplayer = presenter.getTasksTable();
tableDisplayer.selectCell(COLUMN_TASK_ID,
3);
Expand All @@ -523,15 +521,15 @@ public void testTaskInstanceNoDetailsStatusExited() {
verify(taskDashboardFocusEvent,
never()).fire(any(TaskDashboardFocusEvent.class));
verify(placeManager,
never()).goTo(TaskDashboard.TASK_DETAILS_SCREEN_ID);
never()).goTo(TASK_DETAILS_SCREEN);
}

@Test
public void testTaskInstanceNoDetailsStatusComplete() {
when(taskService.getTask(anyString(),
anyString(),
anyLong())).thenReturn(mock(TaskSummary.class));
when(placeManager.getStatus(TaskDashboard.TASK_DETAILS_SCREEN_ID)).thenReturn(PlaceStatus.CLOSE);
when(placeManager.getStatus(TASK_DETAILS_SCREEN)).thenReturn(PlaceStatus.CLOSE);
TableDisplayer tableDisplayer = presenter.getTasksTable();
tableDisplayer.selectCell(COLUMN_TASK_ID,
2);
Expand All @@ -546,22 +544,22 @@ public void testTaskInstanceNoDetailsStatusComplete() {
verify(taskDashboardFocusEvent,
never()).fire(any(TaskDashboardFocusEvent.class));
verify(placeManager,
never()).goTo(TaskDashboard.TASK_DETAILS_SCREEN_ID);
never()).goTo(TASK_DETAILS_SCREEN);
}

@Test
public void testOpenInstanceDetails() {
when(taskService.getTask(anyString(),
anyString(),
anyLong())).thenReturn(mock(TaskSummary.class));
when(placeManager.getStatus(TaskDashboard.TASK_DETAILS_SCREEN_ID)).thenReturn(PlaceStatus.CLOSE);
when(placeManager.getStatus(TASK_DETAILS_SCREEN)).thenReturn(PlaceStatus.CLOSE);
TableDisplayer tableDisplayer = presenter.getTasksTable();
tableDisplayer.selectCell(COLUMN_TASK_ID,
0);

verify(taskSelectionEvent).fire(any(TaskSelectionEvent.class));
verify(taskDashboardFocusEvent).fire(any(TaskDashboardFocusEvent.class));
verify(placeManager).goTo(TaskDashboard.TASK_DETAILS_SCREEN_ID);
verify(placeManager).goTo(TASK_DETAILS_SCREEN);
}

@Test
Expand Down

0 comments on commit 4fa1a17

Please sign in to comment.