Skip to content

Commit

Permalink
feat: Show info if no rule matched
Browse files Browse the repository at this point in the history
  • Loading branch information
saig0 committed Mar 27, 2023
1 parent b6432a7 commit 3318afc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/main/resources/public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@
.dmn-decision-table-container tbody .dmn-row-highlighted td {
background: rgba(0, 125, 255, 0.2);
}

#decision-evaluation-message .alert-info {
background: #d4e5ff;
border-color: #7fb4bf;
}
15 changes: 14 additions & 1 deletion src/main/resources/public/js/view-decision-evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function loadDecisionEvaluationView() {
}

if (decisionEvaluation.evaluationFailureMessage) {
$("#decision-evaluation-failure-message").html(`
$("#decision-evaluation-message").html(`
<div class="alert alert-danger" role="alert">
${decisionEvaluation.evaluationFailureMessage}
</div>`);
Expand Down Expand Up @@ -72,6 +72,9 @@ function onDecisionEvaluationViewChanged(event) {
$(".dmn-row-highlighted").each(function () {
$(this).removeClass("dmn-row-highlighted");
});
if (!decisionEvaluation.failedDecision) {
$("#decision-evaluation-message").html("");
}

// update the diagram based on the active view
let id = event.activeView.id;
Expand Down Expand Up @@ -107,6 +110,16 @@ function onDecisionEvaluationViewChanged(event) {
let ruleIndex = rule.ruleIndex - 1;
$(".tjs-table tbody tr")[ruleIndex].classList.add("dmn-row-highlighted");
});

if (
currentEvaluatedDecision.matchedRules?.length === 0 &&
!decisionEvaluation.failedDecision
) {
$("#decision-evaluation-message").html(`
<div class="alert alert-info" role="alert">
No rule of the decision table matched the given input.
</div>`);
}
}

if (event.activeView.type === "decisionTable") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h6>Decision Output</h6>
</div>
</div>
<div class="col-auto" style="flex: 1">
<div id="decision-evaluation-failure-message"></div>
<div id="decision-evaluation-message"></div>
<div id="canvas" style="height: 80vh"></div>
</div>
</div>
Expand Down

0 comments on commit 3318afc

Please sign in to comment.