Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions demo/predictions/css/demo.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
:root {
--color-default-fill: white;
--color-path-executed: #aea3a3;
--color-path-predicted-late: orange;
--color-state-predicted-late: orange;
--color-path-predicted-on-time: #67d567;
--color-state-predicted-on-time: #a7f0a7;
--color-state-running: #9c9cef;
--stroke-path-predicted: 0.18rem;
--color-already-executed: #aea3a3;
--color-predicted-late: orange;
--color-predicted-on-time: #67d567;
--color-running: #9c9cef;
--stroke-predicted: 0.18rem;
}

/* ================================================================================================================== */
Expand All @@ -19,13 +17,13 @@
.bpmn-message-flow.state-already-executed > path:nth-child(4),
/* sequence flow arrow */
.bpmn-sequence-flow.state-already-executed > path:nth-child(3) {
fill: var(--color-path-executed);
fill: var(--color-already-executed);
}

/* message flow start marker */
.bpmn-message-flow.state-already-executed > ellipse,
/* message flow icon */
.bpmn-message-flow-icon.state-already-executed > * ,
.bpmn-message-flow-icon.state-already-executed > *,
/* sequence/message flow line and arrow (end marker) */
.bpmn-type-flow.state-already-executed > path,
/* task */
Expand All @@ -38,18 +36,18 @@
/* event */
.bpmn-type-event.state-already-executed > * {
filter: blur(0.125rem);
stroke: var(--color-path-executed);
stroke: var(--color-already-executed);
}

/* end event center circle */
.bpmn-type-event.state-already-executed > ellipse:nth-child(2) {
fill: var(--color-path-executed);
.bpmn-type-event.already-executed > ellipse:nth-child(2) {
fill: var(--color-already-executed);
}

/* labels (the selector applies to all div, not the only one that contains text, but this is ok.
Use important to override the color set inline in the style attribute of the label div */
.bpmn-label.state-already-executed > g div {
color: var(--color-path-executed) !important;
.bpmn-label.already-executed > g div {
color: var(--color-already-executed) !important;
/*or use opacity if we want to be able to read labels*/
filter: blur(0.0625rem);
}
Expand All @@ -64,7 +62,7 @@
.bpmn-type-event.state-running > ellipse,
/* envelope of the message event */
.bpmn-event-def-message.state-running > rect {
fill: var(--color-state-running);
fill: var(--color-running);
}

/*apply shadow on hover*/
Expand All @@ -83,7 +81,7 @@

/* task */
.bpmn-task.state-predicted-late > rect {
fill: var(--color-state-predicted-late);
fill: var(--color-predicted-late);
animation: pulse-animation 0.8s infinite alternate;
}

Expand All @@ -102,7 +100,7 @@
.bpmn-message-flow.path-predicted-late > ellipse,
/* sequence flow arrow */
.bpmn-sequence-flow.path-predicted-late > path:nth-child(3) {
fill: var(--color-path-predicted-late);
fill: var(--color-predicted-late);
}

/* sequence/message flow line and arrow (end marker) */
Expand All @@ -112,8 +110,8 @@
.bpmn-type-gateway.path-predicted-late > path:nth-child(1),
.bpmn-type-task.path-predicted-late > rect,
.bpmn-type-event.path-predicted-late > ellipse {
stroke: var(--color-path-predicted-late);
stroke-width: var(--stroke-path-predicted);
stroke: var(--color-predicted-late);
stroke-width: var(--stroke-predicted);
}

.bpmn-type-gateway.path-predicted-late > path:nth-child(1),
Expand All @@ -123,14 +121,14 @@
.bpmn-event-def-message.path-predicted-late > path,
.bpmn-event-def-timer.path-predicted-late > path,
.bpmn-type-event.path-predicted-late > ellipse {
stroke: var(--color-path-predicted-late);
stroke: var(--color-predicted-late);
fill: var(--color-default-fill);
}

/* labels (the selector applies to all div, not the only one that contains text, but this is ok.
Use important to override the color set inline in the style attribute of the label div */
.bpmn-label.path-predicted-late > g div {
color: var(--color-path-predicted-late) !important;
.bpmn-label.predicted-late > g div {
color: var(--color-predicted-late) !important;
font-weight: bold;
}

Expand All @@ -139,7 +137,7 @@
/* ================================================================================================================== */

.bpmn-type-task.state-predicted-on-time > rect {
fill: var(--color-state-predicted-on-time);
fill: var(--color-predicted-on-time);
}

/*apply shadow on hover*/
Expand All @@ -151,12 +149,12 @@
.bpmn-message-flow.path-predicted-on-time > ellipse,
/* sequence flow arrow */
.bpmn-sequence-flow.path-predicted-on-time > path:nth-child(3) {
fill: var(--color-path-predicted-on-time);
fill: var(--color-predicted-on-time);
}

/* message flow icon */
.bpmn-message-flow-icon.path-predicted-on-time > * {
stroke: var(--color-path-predicted-on-time);
stroke: var(--color-predicted-on-time);
}

.bpmn-type-gateway.path-predicted-on-time > path:nth-child(1),
Expand All @@ -166,8 +164,8 @@
.bpmn-message-flow.path-predicted-on-time > ellipse,
.bpmn-type-task.path-predicted-on-time > rect,
.bpmn-type-event.path-predicted-on-time > ellipse {
stroke: var(--color-path-predicted-on-time);
stroke-width: var(--stroke-path-predicted);
stroke: var(--color-predicted-on-time);
stroke-width: var(--stroke-predicted);
}

.bpmn-type-gateway.path-predicted-on-time > path:nth-child(1),
Expand All @@ -177,14 +175,14 @@
.bpmn-event-def-message.path-predicted-on-time > path,
.bpmn-event-def-timer.path-predicted-on-time > path,
.bpmn-type-event.path-predicted-on-time > ellipse {
stroke: var(--color-path-predicted-on-time);
stroke: var(--color-predicted-on-time);
fill: var(--color-default-fill);
}

/* labels (the selector applies to all div, not the only one that contains text, but this is ok.
Use important to override the color set inline in the style attribute of the label div */
.bpmn-label.path-predicted-on-time > g div {
color: var(--color-path-predicted-on-time) !important;
color: var(--color-predicted-on-time) !important;
font-weight: bold;
}

47 changes: 47 additions & 0 deletions demo/predictions/css/legend.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
fieldset {
border: 1px solid#ddd;
padding: 5px 12px;
}

legend {
font-size: 18px;
padding: 0 10px;
margin: auto;
}

.state-predicted-on-time .legend li:first-child::before {
background-color: var(--color-predicted-on-time);
}

.state-predicted-late .legend li:first-child::before {
background-color: var(--color-predicted-late);
}

.legend li:nth-child(2)::before {
background-color: var(--color-running);
}
.legend li:nth-child(3)::before {
background-color: var(--color-already-executed);
}


.legend li::before {
content: "";
display: inline-block;
vertical-align: middle;
margin-inline-end: .5rem;
border-width: 2px;
border-style: solid;
width: 1rem;
height: 1rem;
border-radius: 3px;
border-color: #000;
}

.legend li {
line-height: 1rem;
}
.legend {
list-style: none;
font-size: 0.8rem;
}
13 changes: 12 additions & 1 deletion demo/predictions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<link rel="stylesheet" href="../../examples/static/css/icons.min.css" type="text/css">
<link rel="stylesheet" href="../../examples/static/css/main.css" type="text/css">
<link rel="stylesheet" href="../static/css/style.css" type="text/css">
<link rel="stylesheet" href="./css/legend.css" type="text/css">
<link rel="stylesheet" href="./css/demo.css" type="text/css">
<script defer src="../../examples/static/js/link-to-sources.js"></script>
<!-- load bpmn-visualization -->
Expand Down Expand Up @@ -89,7 +90,17 @@ <h5>Use case</h5>
<h4 id="late-title">Predicted Late</h4>
<h4 id="onTime-title" class="d-hide">Predicted on Time</h4>
</div>
<div class="columns">
<div class="columns" style="padding: 0 1rem">
<div id="legend" class="column col-2 col-mx-auto state-predicted-late" style="margin: auto; padding-right: 0.7rem">
<fieldset>
<legend>Legend</legend>
<ul class="legend">
<li>Running items with prediction</li>
<li>Running items without prediction</li>
<li>Executed items</li>
</ul>
</fieldset>
</div>
<div class="column col-10 col-mx-auto">
<div id="late-bpmn-container" class="col-12 bpmn-container"></div>
<div id="onTime-bpmn-container" class="col-12 bpmn-container d-hide"></div>
Expand Down
6 changes: 6 additions & 0 deletions demo/predictions/js/prediction-use-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ class PredicatedLateUseCase extends UseCase {
super(type, () => pizzaDiagram(), true, {fit: {type: 'Center', margin: 20}});
}

display(dataType) {
super.display(dataType);
this._style.switchLegend();
}

_postLoadDiagram() {
this._initManagers();

Expand Down Expand Up @@ -39,6 +44,7 @@ class PredicatedLateUseCase extends UseCase {


class PredictedOnTimeUseCase extends PredicatedLateUseCase {

_initManagers() {
this._style = new PredictedOnTimeStyle(this._bpmnVisualization.bpmnElementsRegistry);
const pathResolver = new PathResolver(this._bpmnVisualization);
Expand Down
15 changes: 15 additions & 0 deletions demo/predictions/js/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class Style {
*/
highlightRunningElementsWithPrediction(ids) {
}

switchLegend() {
}
}

class PredicatedLateStyle extends Style {
Expand All @@ -59,6 +62,12 @@ class PredicatedLateStyle extends Style {
highlightRunningElementsWithPrediction(ids) {
this._bpmnElementsRegistry.addCssClasses(ids, 'state-predicted-late');
}

switchLegend() {
const element = document.getElementById(`legend`);
element.classList.remove('state-predicted-on-time');
element.classList.add('state-predicted-late');
}
}


Expand All @@ -81,4 +90,10 @@ class PredictedOnTimeStyle extends Style {
highlightRunningElementsWithPrediction(ids) {
this._bpmnElementsRegistry.addCssClasses(ids, 'state-predicted-on-time');
}

switchLegend() {
const element = document.getElementById(`legend`);
element.classList.remove('state-predicted-late');
element.classList.add('state-predicted-on-time');
}
}