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 Apr 3, 2023
1 parent ed7cffa commit cc2a12e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 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 @@ -131,6 +131,11 @@
background: rgba(0, 125, 255, 0.2);
}

#decision-evaluation-message .alert-info {
background: #d4e5ff;
border-color: #7fb4bf;
}

.breadcrumb {
font-size: 13px;
margin-bottom: 8px;
Expand Down
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 @@ -44,7 +44,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 @@ -74,6 +74,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 @@ -94,14 +94,14 @@
</button>
<div class="detail-info hidden">
<div class="detail-entry">
<b>Output</b>
<b>Decision Output</b>
<span id="decision-output"></span>
</div>
</div>
</div>
</div>
<div class="decision-canvas-container">
<div id="decision-evaluation-failure-message"></div>
<div id="decision-evaluation-message"></div>
<div id="canvas"></div>
</div>
</div>
Expand Down

0 comments on commit cc2a12e

Please sign in to comment.