-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JBPM-6894 - User should be able to define case, process, activity lev…
…el SLA (#990)
- Loading branch information
1 parent
f8a4491
commit aad4b2b
Showing
18 changed files
with
258 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...-common-client/src/main/java/org/jbpm/workbench/common/client/util/SLAComplianceCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Integer> { | ||
|
||
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<String> descriptions; | ||
|
||
public SLAComplianceCell(final List<String> descriptions) { | ||
this.descriptions = descriptions; | ||
} | ||
|
||
@Override | ||
public void render(Context context, | ||
Integer value, | ||
SafeHtmlBuilder sb) { | ||
|
||
List<String> 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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.