diff --git a/jbpm-wb-common/jbpm-wb-common-client/pom.xml b/jbpm-wb-common/jbpm-wb-common-client/pom.xml index 1ac5da6a3e..72958c7fd7 100644 --- a/jbpm-wb-common/jbpm-wb-common-client/pom.xml +++ b/jbpm-wb-common/jbpm-wb-common-client/pom.xml @@ -167,6 +167,10 @@ gwt-user provided + + com.google.elemental2 + elemental2-dom + diff --git a/jbpm-wb-common/jbpm-wb-common-client/src/main/java/org/jbpm/workbench/common/client/util/SLAComplianceCell.java b/jbpm-wb-common/jbpm-wb-common-client/src/main/java/org/jbpm/workbench/common/client/util/SLAComplianceCell.java new file mode 100644 index 0000000000..3ba0bb685f --- /dev/null +++ b/jbpm-wb-common/jbpm-wb-common-client/src/main/java/org/jbpm/workbench/common/client/util/SLAComplianceCell.java @@ -0,0 +1,90 @@ +/* + * Copyright 2018 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jbpm.workbench.common.client.util; + +import java.util.ArrayList; +import java.util.List; + +import elemental2.dom.DomGlobal; +import elemental2.dom.Element; +import org.kie.api.runtime.process.ProcessInstance; + +import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; + +public class SLAComplianceCell extends AbstractCell { + + private static final String SLA_STYLE = "label"; + private static final String SLA_NA_PRESENT_STYLE = "label-default"; + private static final String SLA_PENDING_PRESENT_STYLE = "label-primary"; + private static final String SLA_MET_PRESENT_STYLE = "label-success"; + private static final String SLA_ABORTED_PRESENT_STYLE = "label-warning"; + private static final String SLA_VIOLATED_PRESENT_STYLE = "label-danger"; + + private List descriptions; + + public SLAComplianceCell(final List descriptions) { + this.descriptions = descriptions; + } + + @Override + public void render(Context context, + Integer value, + SafeHtmlBuilder sb) { + + List tooltipClasses = new ArrayList<>(); + + tooltipClasses.add(SLA_STYLE); + String description = descriptions.get(0); + switch (value) { + case ProcessInstance.SLA_NA: + description = descriptions.get(1); + tooltipClasses.add(SLA_NA_PRESENT_STYLE); + + break; + case ProcessInstance.SLA_PENDING: + description = descriptions.get(2); + tooltipClasses.add(SLA_PENDING_PRESENT_STYLE); + break; + case ProcessInstance.SLA_MET: + description = descriptions.get(3); + tooltipClasses.add(SLA_MET_PRESENT_STYLE); + break; + case ProcessInstance.SLA_ABORTED: + description = descriptions.get(4); + tooltipClasses.add(SLA_ABORTED_PRESENT_STYLE); + break; + case ProcessInstance.SLA_VIOLATED: + description = descriptions.get(5); + tooltipClasses.add(SLA_VIOLATED_PRESENT_STYLE); + break; + default: + description = descriptions.get(0); + tooltipClasses.add(SLA_NA_PRESENT_STYLE); + break; + + } + + Element span = DomGlobal.document.createElement("span"); + span.textContent = description; + tooltipClasses.forEach(c -> span.classList.add(c)); + Element content = DomGlobal.document.createElement("span"); + content.appendChild(span); + sb.appendHtmlConstant(content.innerHTML); + } + +} \ No newline at end of file diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceDataSetConstants.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceDataSetConstants.java index ed3f1e8c95..edb72a09a0 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceDataSetConstants.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceDataSetConstants.java @@ -35,6 +35,8 @@ public final class ProcessInstanceDataSetConstants { public static final String COLUMN_EXTERNAL_ID = "externalId"; public static final String COLUMN_PROCESS_INSTANCE_DESCRIPTION = "processInstanceDescription"; public static final String COLUMN_LAST_MODIFICATION_DATE = "lastModificationDate"; + public static final String COLUMN_SLA_DUE_DATE = "sla_due_date"; + public static final String COLUMN_SLA_COMPLIANCE = "slaCompliance"; public static final String COLUMN_ERROR_COUNT = "errorCount"; public static final String PROCESS_INSTANCES_WITH_VARIABLES_INCLUDED_LIST_PREFIX = "DS_ProcessInstancesWithVariablesIncludedGrid"; public static final String PROCESS_INSTANCE_ID = "processInstanceId"; diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceSummary.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceSummary.java index 1863b113cf..834779c0e1 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceSummary.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-api/src/main/java/org/jbpm/workbench/pr/model/ProcessInstanceSummary.java @@ -42,6 +42,8 @@ public class ProcessInstanceSummary extends GenericErrorSummary { private Map domainData = new HashMap(); private List activeTasks; private Date lastModificationDate; + private Integer slaCompliance; + private Date slaDueDate; public ProcessInstanceSummary(Long processInstanceId, String processId, @@ -56,6 +58,8 @@ public ProcessInstanceSummary(Long processInstanceId, String correlationKey, Long parentId, Date lastModificationDate, + Integer slaCompliance, + Date slaDueDate, Integer errorCount) { super(errorCount, processInstanceId, processName); this.id = processInstanceId; @@ -73,6 +77,8 @@ public ProcessInstanceSummary(Long processInstanceId, this.correlationKey = correlationKey; this.parentId = parentId; this.lastModificationDate = lastModificationDate; + this.slaCompliance = slaCompliance; + this.slaDueDate = slaDueDate; } public ProcessInstanceSummary() { @@ -203,6 +209,22 @@ public Date getLastModificationDate() { public void setLastModificationDate(Date lastModificationDate) { this.lastModificationDate = lastModificationDate; } + + public Integer getSlaCompliance() { + return slaCompliance; + } + + public void setSlaCompliance(Integer slaCompliance) { + this.slaCompliance = slaCompliance; + } + + public Date getSlaDueDate() { + return slaDueDate; + } + + public void setSlaDueDate(Date slaDueDate) { + this.slaDueDate = slaDueDate; + } @Override public String toString() { diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/DataSetDefsBootstrap.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/DataSetDefsBootstrap.java index 260d115a0c..de6782e095 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/DataSetDefsBootstrap.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/DataSetDefsBootstrap.java @@ -61,6 +61,8 @@ protected void registerDataSetDefinitions() { "log.correlationKey, " + "log.externalId, " + "log.processInstanceDescription, " + + "log.sla_due_date, " + + "log.slaCompliance, " + "COALESCE(info.lastModificationDate, log.end_date) as lastModificationDate, " + "(select COUNT(errInfo.id) " + "from " + @@ -90,7 +92,9 @@ protected void registerDataSetDefinitions() { .label(COLUMN_PROCESS_NAME) .label(COLUMN_CORRELATION_KEY) .label(COLUMN_EXTERNAL_ID) - .label(COLUMN_PROCESS_INSTANCE_DESCRIPTION) + .label(COLUMN_PROCESS_INSTANCE_DESCRIPTION) + .date(COLUMN_SLA_DUE_DATE) + .number(COLUMN_SLA_COMPLIANCE) .date(COLUMN_LAST_MODIFICATION_DATE) .number(COLUMN_ERROR_COUNT) .buildDef(); diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImpl.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImpl.java index 65a23fd45f..8934df9a6f 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImpl.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/main/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImpl.java @@ -206,6 +206,8 @@ protected ProcessInstanceSummary build(ProcessInstance processInstance) { processInstance.getCorrelationKey(), processInstance.getParentId(), null, + processInstance.getSlaCompliance(), + processInstance.getSlaDueDate(), 0 ); diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/test/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImplTest.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/test/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImplTest.java index 3e030ec9cf..349ef0bc40 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/test/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImplTest.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-backend/src/test/java/org/jbpm/workbench/pr/backend/server/RemoteProcessRuntimeDataServiceImplTest.java @@ -97,6 +97,8 @@ public void getProcessInstanceDetailsTest() { verify(processInstanceSpy).getProcessVersion(); verify(processInstanceSpy).getCorrelationKey(); verify(processInstanceSpy).getParentId(); + verify(processInstanceSpy).getSlaCompliance(); + verify(processInstanceSpy).getSlaDueDate(); verifyActiveUserTasks(taskSummaryListSpy, taskSummaryMock); verifyCurrentActivities(processInstanceId); diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/pom.xml b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/pom.xml index 5839f09e6d..5998993552 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/pom.xml +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/pom.xml @@ -186,6 +186,10 @@ gwt-user provided + + com.google.elemental2 + elemental2-dom + diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsPresenter.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsPresenter.java index 50e206c9ee..02a1bb5c7c 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsPresenter.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsPresenter.java @@ -118,6 +118,10 @@ public void callback(final ProcessInstanceSummary process) { default: break; } + view.getStateText().setText(statusStr); + + String slaComplianceStr = mapSlaCompliance(process); + view.setSlaComplianceText(slaComplianceStr); if (process.getActiveTasks() != null && !process.getActiveTasks().isEmpty()) { SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); @@ -127,7 +131,7 @@ public void callback(final ProcessInstanceSummary process) { } view.getActiveTasksListBox().setHTML(safeHtmlBuilder.toSafeHtml()); } - view.getStateText().setText(statusStr); + } }).getProcessInstance(serverTemplateId, new ProcessInstanceKey(serverTemplateId, @@ -149,6 +153,30 @@ public void callback(final List details) { Long.parseLong(processId)); } + protected String mapSlaCompliance(ProcessInstanceSummary process) { + String slaComplianceStr = constants.Unknown(); + switch (process.getSlaCompliance()) { + case ProcessInstance.SLA_NA: + slaComplianceStr = constants.SlaNA(); + break; + case ProcessInstance.SLA_PENDING: + slaComplianceStr = constants.SlaPending(); + break; + case ProcessInstance.SLA_MET: + slaComplianceStr = constants.SlaMet(); + break; + case ProcessInstance.SLA_ABORTED: + slaComplianceStr = constants.SlaAborted(); + break; + case ProcessInstance.SLA_VIOLATED: + slaComplianceStr = constants.SlaViolated(); + break; + default: + break; + } + return slaComplianceStr; + } + public interface ProcessInstanceDetailsView extends IsWidget { // TODO Review interface to not expose GWT components @@ -167,5 +195,7 @@ public interface ProcessInstanceDetailsView extends IsWidget { HTML getCorrelationKeyText(); HTML getParentProcessInstanceIdText(); + + void setSlaComplianceText(String value); } } \ No newline at end of file diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.html b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.html index c541b6410d..9d5a6b914b 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.html +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.html @@ -31,6 +31,13 @@

+

+ + +
+

+

+
diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.java index a16b4021a0..88b10147a2 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/details/ProcessInstanceDetailsViewImpl.java @@ -22,6 +22,9 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; + +import elemental2.dom.HTMLParagraphElement; + import org.gwtbootstrap3.client.ui.FormLabel; import org.jboss.errai.ui.shared.api.annotations.DataField; import org.jboss.errai.ui.shared.api.annotations.Templated; @@ -43,6 +46,10 @@ public class ProcessInstanceDetailsViewImpl extends Composite implements @Inject @DataField public HTML processVersionText; + + @Inject + @DataField + public HTMLParagraphElement slaComplianceText; @Inject @DataField @@ -75,6 +82,10 @@ public class ProcessInstanceDetailsViewImpl extends Composite implements @Inject @DataField public FormLabel processVersionLabel; + + @Inject + @DataField + public FormLabel slaComplianceLabel; @Inject @DataField @@ -103,6 +114,7 @@ public void init() { processDefinitionIdLabel.setText(constants.Process_Definition_Id()); processDeploymentLabel.setText(constants.Deployment_Name()); processVersionLabel.setText(constants.Process_Definition_Version()); + slaComplianceLabel.setText(constants.Process_SLA_Compliance()); correlationKeyLabel.setText(constants.Correlation_Key()); stateLabel.setText(constants.Process_Instance_State()); activeTasksListLabel.setText(constants.Active_Tasks()); @@ -149,4 +161,9 @@ public HTML getParentProcessInstanceIdText() { public HTML getProcessVersionText() { return processVersionText; } + + @Override + public void setSlaComplianceText(String value) { + slaComplianceText.textContent = value; + } } \ No newline at end of file diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenter.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenter.java index 8f7b543acf..a7c92c9e23 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenter.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenter.java @@ -305,6 +305,12 @@ protected ProcessInstanceSummary createProcessInstanceSummaryFromDataSet(DataSet getColumnDateValue(dataSet, COLUMN_LAST_MODIFICATION_DATE, i), + getColumnIntValue(dataSet, + COLUMN_SLA_COMPLIANCE, + i), + getColumnDateValue(dataSet, + COLUMN_SLA_DUE_DATE, + i), getColumnIntValue(dataSet, COLUMN_ERROR_COUNT, i) diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImpl.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImpl.java index 62f061954b..52df40db7a 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImpl.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImpl.java @@ -40,6 +40,7 @@ import org.jbpm.workbench.common.client.util.ConditionalButtonActionCell; import org.jbpm.workbench.common.client.util.DateUtils; import org.jbpm.workbench.common.client.util.GenericErrorSummaryCountCell; +import org.jbpm.workbench.common.client.util.SLAComplianceCell; import org.jbpm.workbench.pr.client.resources.i18n.Constants; import org.jbpm.workbench.pr.model.ProcessInstanceSummary; import org.kie.api.runtime.process.ProcessInstance; @@ -64,7 +65,7 @@ public class ProcessInstanceListViewImpl extends AbstractMultiGridView popoverCellInstance; - + @Override public List getInitColumns() { return Arrays.asList(COL_ID_SELECT, @@ -110,6 +111,7 @@ public void initColumns(ExtendedPagedTable extendedPaged Column actionsColumn = initActionsColumn(); Column errorCountColumn = initErrorCountColumn(); + Column slaComplianceColumn = initSlaComplianceColumn(); extendedPagedTable.addSelectionIgnoreColumn(actionsColumn); extendedPagedTable.addSelectionIgnoreColumn(errorCountColumn); @@ -155,6 +157,12 @@ public void initColumns(ExtendedPagedTable extendedPaged columnMetas.add(new ColumnMeta<>(createTextColumn(COLUMN_LAST_MODIFICATION_DATE, process -> DateUtils.getDateTimeStr(process.getLastModificationDate())), constants.Last_Modification_Date())); + + columnMetas.add(new ColumnMeta<>(slaComplianceColumn, + constants.SlaCompliance())); + columnMetas.add(new ColumnMeta<>(createTextColumn(COLUMN_SLA_DUE_DATE, + process -> DateUtils.getDateTimeStr(process.getSlaDueDate())), + constants.SlaDueDate())); columnMetas.add(new ColumnMeta<>(createTextColumn(COLUMN_CORRELATION_KEY, process -> process.getCorrelationKey()), constants.Correlation_Key())); @@ -328,6 +336,30 @@ public ProcessInstanceSummary getValue(ProcessInstanceSummary process) { column.setDataStoreName(COLUMN_ERROR_COUNT); return column; } + + private Column initSlaComplianceColumn() { + + final List slaDescriptions = new ArrayList<>(); + slaDescriptions.add(constants.Unknown()); + slaDescriptions.add(constants.SlaNA()); + slaDescriptions.add(constants.SlaPending()); + slaDescriptions.add(constants.SlaMet()); + slaDescriptions.add(constants.SlaAborted()); + slaDescriptions.add(constants.SlaViolated()); + + Column column = new Column( + new SLAComplianceCell(slaDescriptions)) { + + @Override + public Integer getValue(ProcessInstanceSummary process) { + return process.getSlaCompliance(); + } + }; + + column.setSortable(true); + column.setDataStoreName(COLUMN_SLA_COMPLIANCE); + return column; + } private Column initActionsColumn() { List> cells = new LinkedList>(); diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/resources/i18n/Constants.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/resources/i18n/Constants.java index 3f549ed762..da0977af96 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/resources/i18n/Constants.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/java/org/jbpm/workbench/pr/client/resources/i18n/Constants.java @@ -269,4 +269,19 @@ public interface Constants extends Messages { String WasCompleted(); + String Process_SLA_Compliance(); + + String SlaNA(); + + String SlaPending(); + + String SlaMet(); + + String SlaAborted(); + + String SlaViolated(); + + String SlaCompliance(); + + String SlaDueDate(); } diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/resources/org/jbpm/workbench/pr/client/resources/i18n/Constants.properties b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/resources/org/jbpm/workbench/pr/client/resources/i18n/Constants.properties index 02d9849f1a..071abd223a 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/resources/org/jbpm/workbench/pr/client/resources/i18n/Constants.properties +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/main/resources/org/jbpm/workbench/pr/client/resources/i18n/Constants.properties @@ -119,4 +119,11 @@ Human=Human System=System WasStarted=was started WasCompleted=was completed - +Process_SLA_Compliance=SLA Compliance +SlaNA=N/A +SlaPending=Pending +SlaMet=Met +SlaAborted=Aborted +SlaViolated=Violated +SlaCompliance=SLA Compliance +SlaDueDate=SLA Due Date diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/details/multi/ProcessInstanceDetailsPresenterTest.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/details/multi/ProcessInstanceDetailsPresenterTest.java index 99dea4eb4f..c9bab53845 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/details/multi/ProcessInstanceDetailsPresenterTest.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/details/multi/ProcessInstanceDetailsPresenterTest.java @@ -45,6 +45,7 @@ public class ProcessInstanceDetailsPresenterTest { private static final int ACTIVE_STATE = 1; + private static final int SLA_MET = 2; private static final String PROCESS_VERSION = "1.0"; private static final String PROCESS_ID = "evaluation"; private static final String PROCESS_INSTANCE_ID = "3"; @@ -91,6 +92,7 @@ public void setProcessInstanceDetailsTest() { verify(htmlMock).setText(processInstanceSummary.getProcessVersion()); verify(htmlMock).setText(processInstanceSummary.getCorrelationKey()); verify(htmlMock).setText(Constants.INSTANCE.No_Parent_Process_Instance()); + verify(viewMock).setSlaComplianceText(Constants.INSTANCE.SlaMet()); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(SafeHtml.class); verify(htmlMock, @@ -128,6 +130,7 @@ private ProcessInstanceSummary getProcessInstanceSummary() { processInstanceSummary.setCorrelationKey(PROCESS_INSTANCE_ID); processInstanceSummary.setParentId(0L); processInstanceSummary.setActiveTasks(singletonList(getUserTaskSummary())); + processInstanceSummary.setSlaCompliance(SLA_MET); return processInstanceSummary; } diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenterTest.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenterTest.java index 9d7a698b17..78082c5a12 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenterTest.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListPresenterTest.java @@ -137,6 +137,8 @@ public static ProcessInstanceSummary createProcessInstanceSummary(Long key, "cKey", Long.valueOf(0), new Date(), + 0, + null, 0); } diff --git a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImplTest.java b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImplTest.java index 64af0a743e..3c9edb3b21 100644 --- a/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImplTest.java +++ b/jbpm-wb-process-runtime/jbpm-wb-process-runtime-client/src/test/java/org/jbpm/workbench/pr/client/editors/instance/list/ProcessInstanceListViewImplTest.java @@ -24,6 +24,7 @@ import org.jbpm.workbench.common.client.list.AbstractMultiGridView; import org.jbpm.workbench.common.client.list.AbstractMultiGridViewTest; import org.jbpm.workbench.common.client.util.GenericErrorSummaryCountCell; +import org.jbpm.workbench.common.client.util.SLAComplianceCell; import org.jbpm.workbench.pr.model.ProcessInstanceSummary; import org.junit.Before; import org.junit.runner.RunWith; @@ -45,8 +46,8 @@ public class ProcessInstanceListViewImplTest extends AbstractMultiGridViewTest

cellInstance; - + private ManagedInstance popoverCellInstance; + @InjectMocks @Spy private ProcessInstanceListViewImpl view; @@ -92,7 +93,7 @@ public List getExpectedBannedColumns() { @Override public Integer getExpectedNumberOfColumns() { - return 12; + return 14; } @Before @@ -102,6 +103,6 @@ public void setupMocks() { when(presenter.createActiveTabSettings()).thenReturn(filterSettings); when(presenter.createCompletedTabSettings()).thenReturn(filterSettings); when(presenter.createAbortedTabSettings()).thenReturn(filterSettings); - when(cellInstance.get()).thenReturn(cellMock); + when(popoverCellInstance.get()).thenReturn(cellMock); } }