Skip to content
Snippets Groups Projects
Commit 5512a999 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Merge branch 'feat/dmnapp' into 'develop'

Feat/dmnapp

See merge request jonasblatt/ma-jonasblatt-dmn-verifier!13
parents 193dc56b b9a7d29a
No related branches found
No related tags found
No related merge requests found
Showing
with 173 additions and 46 deletions
...@@ -2,6 +2,8 @@ package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl; ...@@ -2,6 +2,8 @@ package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_EQUAL; import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_EQUAL;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.SUBSUMES; import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.SUBSUMES;
import static de.unikoblenz.fgbks.core.dmn.domain.vdmn.utils.VDmnFunctions.getRulesRowsStrings;
import static de.unikoblenz.fgbks.core.dmn.domain.vdmn.utils.VDmnFunctions.templateDecision;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_RULES; import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_RULES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision; import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision;
...@@ -43,25 +45,29 @@ public class SubsumptionVerifier extends AbstractVerifier { ...@@ -43,25 +45,29 @@ public class SubsumptionVerifier extends AbstractVerifier {
private void checkSubsumptions( private void checkSubsumptions(
List<VDmnInputColumn> inColumns, List<VDmnInputColumn> inColumns,
int i, int i,
List<VDmnRule> currentRuleIds, List<VDmnRule> currentRules,
boolean hasSubsumption, boolean hasSubsumption,
List<VDmnRule> currentRootSubsumptionElements) { List<VDmnRule> currentRootSubsumptionElements) {
if (i == inColumns.size()) { if (i == inColumns.size()) {
if (hasSubsumption && currentRuleIds.size() > currentRootSubsumptionElements.size()) { if (hasSubsumption && currentRules.size() > currentRootSubsumptionElements.size()) {
// add to rules to result // add to rules to result
// TODO boolean differentConclusions = VDmnFunctions.differentConclusions(currentRules);
currentRuleIds.forEach( currentRules.forEach(
rule -> rule ->
vreFactory.addElement( vreFactory.addElement(
VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable()) VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable())
.withIdentifier(rule.getRuleId()))); .withIdentifier(rule.getRuleId())));
vreFactory.addVerificationFix(SHOW_RULES); vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(VerificationClassification.WARNING, "subsumption"); vreFactory.addToEntry(
VerificationClassification.WARNING,
templateDecision(inColumns.get(0).getDmnDecision())
+ getMessageText(
currentRules, currentRootSubsumptionElements, differentConclusions));
} }
} else { } else {
// get all input values from the current column, and filter with the prev. iteration // get all input values from the current column, and filter with the prev. iteration
List<VDmnInputValue> selectedBounds = List<VDmnInputValue> selectedBounds =
VDmnFunctions.getColumnValuesInRules(inColumns.get(i), currentRuleIds); VDmnFunctions.getColumnValuesInRules(inColumns.get(i), currentRules);
List<List<VDmnInputValue>> clusters = new ArrayList<>(); // clusters of subsumptions List<List<VDmnInputValue>> clusters = new ArrayList<>(); // clusters of subsumptions
List<Boolean> subsumptions = List<Boolean> subsumptions =
...@@ -69,7 +75,7 @@ public class SubsumptionVerifier extends AbstractVerifier { ...@@ -69,7 +75,7 @@ public class SubsumptionVerifier extends AbstractVerifier {
List<List<VDmnInputValue>> subsumptionValue = List<List<VDmnInputValue>> subsumptionValue =
new ArrayList<>(); // save the subsumption value of the current cluster new ArrayList<>(); // save the subsumption value of the current cluster
// if previously a rule was found, which has a subsumption, than it must be also the element, // if previously a rule was found, which has a subsumption, than it must be also the element,
// which subsume the other elements. // which subsumes the other elements.
// First, build clusters, which contain a subsumption set // First, build clusters, which contain a subsumption set
if (!currentRootSubsumptionElements.isEmpty()) { if (!currentRootSubsumptionElements.isEmpty()) {
// get the value from the subsumption rule // get the value from the subsumption rule
...@@ -85,7 +91,7 @@ public class SubsumptionVerifier extends AbstractVerifier { ...@@ -85,7 +91,7 @@ public class SubsumptionVerifier extends AbstractVerifier {
c1.add(cb2); c1.add(cb2);
} else if (nValue.getBoundary().checkWith(IS_EQUAL, cb2.getBoundary())) { } else if (nValue.getBoundary().checkWith(IS_EQUAL, cb2.getBoundary())) {
c1.add(cb2); c1.add(cb2);
if (currentRootSubsumptionElements.contains(cb2)) { if (currentRootSubsumptionElements.contains(cb2.getDmnRule())) {
subsumptionVals.add(cb2); subsumptionVals.add(cb2);
} }
} }
...@@ -166,4 +172,47 @@ public class SubsumptionVerifier extends AbstractVerifier { ...@@ -166,4 +172,47 @@ public class SubsumptionVerifier extends AbstractVerifier {
} }
} }
} }
private String getMessageText(
List<VDmnRule> currentRules,
List<VDmnRule> currentRootSubsumptionElements,
boolean differentConclusions) {
StringBuilder sb = new StringBuilder();
sb.append(templateDecision(currentRules.get(0).getDmnDecision()));
sb.append("Rule");
if (currentRootSubsumptionElements.size() > 1) {
sb.append("s");
}
sb.append(" ");
sb.append(getRulesRowsStrings(currentRootSubsumptionElements));
if (currentRootSubsumptionElements.size() > 1) {
sb.append("subsume"); // Plural
} else {
sb.append(" subsumes");
}
// subsumed rules:
List<VDmnRule> subsumedRules =
currentRules.stream()
.filter(
r ->
!currentRootSubsumptionElements.stream()
.map(VDmnRule::getRuleId)
.collect(Collectors.toList())
.contains(r.getRuleId()))
.collect(Collectors.toList());
sb.append(" rule");
if (subsumedRules.size() > 1) {
sb.append("s");
}
sb.append(" ");
sb.append(getRulesRowsStrings(subsumedRules));
sb.append(".");
if (differentConclusions) {
sb.append(" The outputs have different conclusions!");
} else {
sb.append(" The output is the same.");
}
return sb.toString();
}
} }
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
Root path: <code>/api</code> Root path: <code>/api</code>
<h3>Verifications</h3> <h3>Verifications</h3>
<h4>Get all verifications from all verifiers with the given dmn table</h4> <h4>Get all verifications from all verifiers with the given dmn table</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
...@@ -130,39 +131,45 @@ ...@@ -130,39 +131,45 @@
</ul> </ul>
<h3>Verification classifications</h3> <h3>Verification classifications</h3>
<h4>Get a list of all verification classifications</h4> <h4>Get a list of all verification classifications</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
<li><code><a href="/api/dmn/verification/classification" target="_blank">/api/dmn/verification/classification</a></code> <li><code><a href="/api/dmn/verification/classifications" target="_blank">/api/dmn/verification/classifications</a></code>
</li> </li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h4>Get all verifications for the given verification classification</h4> <h4>Get all verifications for the given verification classification</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li> <li><code>/api/dmn/verification/classifications/{classificationName}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li> <li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h3>Verification types</h3> <h3>Verification types</h3>
<h4>Get a list of all verification types</h4> <h4>Get a list of all verification types</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
<li> <li>
<code><a href="/api/dmn/verification/type" <code><a href="/api/dmn/verification/types"
target="_blank">/api/dmn/verification/type</a></code> target="_blank">/api/dmn/verification/types</a></code>
</li> </li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h4>Get all verifications for the given verification type</h4>
<h4>Get all verifications for the given verification types a and b</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li> <li><code>/api/dmn/verification/types?typeName={a}&typeName={b}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li> <li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h3>Metrics</h3> <h3>Metrics</h3>
<h4>Get some statistics about execution times</h4> <h4>Get some statistics about execution times</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
...@@ -188,16 +195,8 @@ ...@@ -188,16 +195,8 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="right-section">
<h3>Contribute</h3>
<ul>
<li><a href="https://gitlab.uni-koblenz.de/jonasblatt/ma-jonasblatt-thesis" target="_blank">
GitLab Project </a></li>
</ul>
</div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
...@@ -7,4 +7,9 @@ This project contains all source files of the implementation, created for the ma ...@@ -7,4 +7,9 @@ This project contains all source files of the implementation, created for the ma
- [Backend Project](../dmnverifierapi) - [Backend Project](../dmnverifierapi)
## Frontend ## Frontend
TODO.. - [Running Frontend Instance](http://dmn.fg-bks.uni-koblenz.de)
### Important dependencies
- [dmn-js](https://github.com/bpmn-io/dmn-js)
- [dmn-js-modeler](https://github.com/bpmn-io/dmn-js-examples/tree/master/modeler)
- [jQuery](https://jquery.com/)
package de.unikoblenz.fgbks.dmn.frontend;
import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.StartupEvent;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ApplicationScoped
public class AppLifecycleBean {
private static final Logger LOGGER = LoggerFactory.getLogger("AppLifecycle");
void onStart(@Observes StartupEvent ev) {
LOGGER.info("The dmn verification application (frontend) is starting...");
}
void onStop(@Observes ShutdownEvent ev) {
LOGGER.info("The dmn verification application (frontend) is stopping...");
}
}
package de.unikoblenz.fgbks.dmn.frontend;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.ext.Provider;
@Provider
public class HttpFilter implements ContainerRequestFilter {
@Context
UriInfo info;
@Context
HttpServletRequest request;
@Override
public void filter(ContainerRequestContext context) {
final String method = context.getMethod();
final String path = info.getPath();
final String address = request.getRemoteAddr();
System.out.format("Request %s %s from IP %s %n + x", method, path, address);
}
}
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
...@@ -139,10 +139,15 @@ select:focus::-ms-value { ...@@ -139,10 +139,15 @@ select:focus::-ms-value {
.dmn-verifier-header-item { .dmn-verifier-header-item {
margin: 8px 12px; margin: 8px 12px;
color: #0b3004;
cursor: pointer;
font-family: 'Open Sans', sans-serif;
font-size: 13px;
} }
.dmn-verifier-select { .dmn-verifier-select {
flex-grow: 4; flex-grow: 4;
font-family: 'Open Sans', sans-serif;
} }
#dmn-verifier-types { #dmn-verifier-types {
...@@ -165,3 +170,9 @@ select:focus::-ms-value { ...@@ -165,3 +170,9 @@ select:focus::-ms-value {
.dmn-INFO { .dmn-INFO {
list-style-image: url("img/INFO.png"); list-style-image: url("img/INFO.png");
} }
span.select2 {
display: table;
table-layout: fixed;
width: 25% !important;
}
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
rel="stylesheet"> rel="stylesheet">
<link href="https://unpkg.com/dmn-js@7.0.1/dist/assets/dmn-font/css/dmn.css" rel="stylesheet"> <link href="https://unpkg.com/dmn-js@7.0.1/dist/assets/dmn-font/css/dmn.css" rel="stylesheet">
<link href="assets/css/select2.min.css" rel="stylesheet"/>
<link href="css/stylesheets.css" rel="stylesheet" type="text/css"/> <link href="css/stylesheets.css" rel="stylesheet" type="text/css"/>
<link href="css/dmnEditorTabs.css" rel="stylesheet" type="text/css"/> <link href="css/dmnEditorTabs.css" rel="stylesheet" type="text/css"/>
</head> </head>
...@@ -49,11 +51,11 @@ ...@@ -49,11 +51,11 @@
</div> </div>
<!-- load jquery --> <!-- load jquery -->
<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js" type="text/javascript"></script> <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js" type="text/javascript"></script>
<script src="assets/js/select2.full.min.js"></script>
<!-- load dmn modeler --> <!-- load dmn modeler -->
<script src="https://unpkg.com/dmn-js@7.0.1/dist/dmn-modeler.development.js"></script> <script src="https://unpkg.com/dmn-js@7.0.1/dist/dmn-modeler.development.js"></script>
<script src="js/dmnUpload.js" type="text/javascript"></script> <script src="js/dmnUpDownload.js" type="text/javascript"></script>
<script src="js/dmnDownload.js" type="text/javascript"></script>
<script src="js/dmnViewer.js" type="text/javascript"></script> <script src="js/dmnViewer.js" type="text/javascript"></script>
<script src="js/dmnVerifier.js" type="text/javascript"></script> <script src="js/dmnVerifier.js" type="text/javascript"></script>
</body> </body>
......
document.addEventListener("DOMContentLoaded", function () {
$('#dmn-file-download').on('click', exportDiagram());
});
function download(filename, dmnXml) {
let el = document.createElement('a');
el.setAttribute('href',
'data:text/xml;charset=utf-8,' + encodeURIComponent(dmnXml));
el.setAttribute('download', filename);
el.style.display = 'none';
document.body.appendChild(el);
el.click();
document.body.removeChild(el);
}
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
$('#dmn-file-upload').on('change', loadDmnFromFile); $('#dmn-file-upload').on('change', loadDmnFromFile);
$('#dmn-file-empty').on('click', loadEmptyFile); $('#dmn-file-empty').on('click', loadEmptyFile);
$('#dmn-file-download').on('click', exportDiagram);
}); });
function loadDmnFromFile(evt) { function loadDmnFromFile(evt) {
...@@ -25,4 +26,13 @@ function loadEmptyFile() { ...@@ -25,4 +26,13 @@ function loadEmptyFile() {
}); });
} }
function download(filename, dmnXml) {
let el = document.createElement('a');
el.setAttribute('href',
'data:text/xml;charset=utf-8,' + encodeURIComponent(dmnXml));
el.setAttribute('download', filename);
el.style.display = 'none';
document.body.appendChild(el);
el.click();
document.body.removeChild(el);
}
let rootUrl = 'http://dmn.fg-bks.uni-koblenz.de:8080/'; let rootUrl = 'http://' + window.location.hostname + ':8080/';
let dmnApi = rootUrl + 'api/dmn/'; let dmnApi = rootUrl + 'api/dmn/';
/** /**
...@@ -17,7 +17,7 @@ let $verifierTypes; ...@@ -17,7 +17,7 @@ let $verifierTypes;
// load types // load types
$.ajax({ $.ajax({
url: dmnApi + 'verification/type', url: dmnApi + 'verification/types',
type: 'GET', type: 'GET',
contentType: 'text/xml', contentType: 'text/xml',
success: function (data) { success: function (data) {
...@@ -49,6 +49,14 @@ function cleanDmnVerifierRoot() { ...@@ -49,6 +49,14 @@ function cleanDmnVerifierRoot() {
`); `);
// add types // add types
$header.append($verifierTypes); $header.append($verifierTypes);
$verifierTypes.select2({
containerCssClass: "dmn-verifier-header-item dmn-verifier-select clickable",
placeholder: {
id: -1,
text: "All verifier"
},
allowClear: true
});
// Add Button // Add Button
$header.append($(` $header.append($(`
<button class="clickable dmn-verifier-header-item" id="dmn-button-verify" onClick="checkVerifications()"> <button class="clickable dmn-verifier-header-item" id="dmn-button-verify" onClick="checkVerifications()">
...@@ -75,8 +83,16 @@ function getVerifications() { ...@@ -75,8 +83,16 @@ function getVerifications() {
} }
let apiPath = dmnApi + 'verification'; let apiPath = dmnApi + 'verification';
// check, if a verifier is preselected // check, if a verifier is preselected
if ($verifierTypes[0].selectedOptions[0].value !== 'all') { if ($verifierTypes[0].selectedOptions[0] !== undefined) {
apiPath += "/type/" + $verifierTypes[0].selectedOptions[0].value; apiPath += "/types";
for (let i = 0; i < $verifierTypes[0].selectedOptions.length; i++) {
if (i === 0) {
apiPath += '?';
} else {
apiPath += '&';
}
apiPath += 'typeName=' + $verifierTypes[0].selectedOptions[i].value;
}
} }
$.ajax({ $.ajax({
url: apiPath, url: apiPath,
...@@ -115,10 +131,9 @@ function getVerifications() { ...@@ -115,10 +131,9 @@ function getVerifications() {
function renderTypeOptions() { function renderTypeOptions() {
let $select = $(` let $select = $(`
<select name="verifier" id="dmn-verifier-types" <select name="verifier[]" id="dmn-verifier-types" multiple="multiple"
class="dmn-verifier-header-item dmn-verifier-select clickable"> class="dmn-verifier-header-item dmn-verifier-select clickable">
`); `);
$select.append($(`<option value="all">All verifier</option>`));
let currentOpt = ''; let currentOpt = '';
let $curGroup; let $curGroup;
for (let i = 0; i < types.length; i++) { for (let i = 0; i < types.length; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment