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

#31 Config Verifier: Frontend config page for verifier types

parent 1940de5f
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
margin: 5px;
}
#globalSettings {
#globalActions {
margin-bottom: 15px;
}
......@@ -29,12 +29,14 @@
</head>
<body>
<div id="metricContainer">
<h1>Actions - Configuration</h1>
<h1>Configuration</h1>
<div id="configContent">
<div id="globalSettings"></div>
<h2>Verifications</h2>
<div id="verificationConfig"></div>
<h2>Actions</h2>
<div id="globalActions"></div>
<div id="allowedActions"></div>
</div>
</div>
<!-- load jquery -->
<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js" type="text/javascript"></script>
......@@ -49,29 +51,55 @@
const dmnApi = rootUrl + 'api/dmn/';
function loadData() {
let $globalSettings = $('#globalSettings');
$globalSettings.empty();
// load verification config
let $verificationConfig = $('#verificationConfig');
$verificationConfig.empty();
$.ajax({
timeout: 1000,
url: dmnApi + 'verification/actions/global',
url: dmnApi + 'verification/config',
type: 'GET',
error: function (err) {
alert("No connection.");
},
success: function (verificationTypes) {
let $ul = $(`<ul>`);
$verificationConfig.append($ul);
for (const [name, value] of Object.entries(verificationTypes)) {
let $li = $(`<li>`);
let $checkbox = $(`<input type="checkbox" data-verificationtypename="${name}"
onchange="updateVerificationType(this)"/>`);
$checkbox[0].checked = value;
$li.append($checkbox);
$li.append($(`<label>${name}</label>`));
$ul.append($li);
}
}
});
// load global action config
let $globalActions = $('#globalActions');
$globalActions.empty();
$.ajax({
timeout: 1000,
url: dmnApi + 'verification/actions/global',
type: 'GET',
error: function (err) {
},
success: function (active) {
$globalSettings.append("<label>Global active:</label>");
$globalSettings.append($globalCheckbox);
$globalActions.append("<label>Global active:</label>");
$globalActions.append($globalCheckbox);
$globalCheckbox[0].checked = (active === 'true');
}
});
// load actions config
let $allowedActions = $('#allowedActions');
$allowedActions.empty();
$.ajax({
timeout: 1000,
url: dmnApi + 'verification/actions/allowedActions',
type: 'GET',
error: function (err) {
alert("No connection.");
},
success: function (allowedActions) {
for (const [actionScope, typeBol] of Object.entries(allowedActions)) {
......@@ -90,6 +118,23 @@
});
}
function updateVerificationType(checkbox) {
console.log(checkbox.checked);
console.log(checkbox.dataset.actionscope);
console.log(checkbox.dataset.actiontype);
$.ajax({
timeout: 1000,
url: dmnApi + 'verification/config/' + checkbox.dataset.verificationtypename
+ "/" + checkbox.checked,
type: 'POST',
error: function (err) {
alert("No connection.");
},
success: function (active) {
}
});
}
function updateGlobal() {
$.ajax({
timeout: 1000,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment