diff --git a/dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/result/actions/ActionScope.java b/dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/result/actions/ActionScope.java index 132d2e91c1242edfb91c03614790aafd64340dfb..2a529ed1352d704ee095196af661512d767c4cc3 100644 --- a/dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/result/actions/ActionScope.java +++ b/dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/result/actions/ActionScope.java @@ -7,6 +7,5 @@ public enum ActionScope { INPUT_DATA, INPUT_COLUMN, OUTPUT_COLUMN, - DECISION_TABLE, DECISION } diff --git a/dmnverifierfrontend/src/main/resources/META-INF/resources/actions.html b/dmnverifierfrontend/src/main/resources/META-INF/resources/actions.html index f441d8a4af5a2bd3af7a308bed0b3fc9c3981abb..8da237aa20fe0f39d3d9e3cdfacc601c599bd432 100644 --- a/dmnverifierfrontend/src/main/resources/META-INF/resources/actions.html +++ b/dmnverifierfrontend/src/main/resources/META-INF/resources/actions.html @@ -7,12 +7,34 @@ body { font-family: 'Open Sans', sans-serif; } + + label { + margin: 5px; + } + + #globalSettings { + margin-bottom: 15px; + } + + .row { + margin-bottom: 10px; + } + + .cell { + display: table-cell; + width: 200px; + + } </style> </head> <body> <div id="metricContainer"> <h1>Actions - Configuration</h1> - <div id="configContent"></div> + <div id="configContent"> + <div id="globalSettings"></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> @@ -22,13 +44,13 @@ loadData(); }); - const $checkbox = $(`<input type="checkbox" onchange="update()"/>"`); + const $globalCheckbox = $(`<input type="checkbox" onchange="updateGlobal()"/>"`); const rootUrl = 'http://' + window.location.hostname + ':8080/'; const dmnApi = rootUrl + 'api/dmn/'; function loadData() { - let $root = $('#configContent'); - $root.empty(); + let $globalSettings = $('#globalSettings'); + $globalSettings.empty(); $.ajax({ timeout: 1000, url: dmnApi + 'verification/actions/global', @@ -37,17 +59,59 @@ alert("No connection."); }, success: function (active) { - $root.append("<label>Active:</label>"); - $root.append($checkbox); - $checkbox[0].checked = (active === 'true'); + $globalSettings.append("<label>Global active:</label>"); + $globalSettings.append($globalCheckbox); + $globalCheckbox[0].checked = (active === 'true'); + } + }); + + let $allowedActions = $('#allowedActions'); + $.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)) { + let $row = $(`<div class="row"><label>${actionScope}:</label></div>`); + $allowedActions.append($row); + for (const [actionType, value] of Object.entries(typeBol)) { + let $checkbox = $( + `<input type="checkbox" data-actionscope="${actionScope}" data-actiontype="${actionType}" onchange="updateAllowedAction(this)"/>"`); + $checkbox[0].checked = value; + let $cell = $(`<div class="cell"><label>${actionType}</label></div>`); + $cell.append($checkbox); + $row.append($cell); + } + } + } + }); + } + + function updateGlobal() { + $.ajax({ + timeout: 1000, + url: dmnApi + 'verification/actions/global/' + $globalCheckbox[0].checked, + type: 'POST', + error: function (err) { + alert("No connection."); + }, + success: function (active) { + $('#allowedActions').css('display', $globalCheckbox[0].checked ? '' : 'none') } }); } - function update() { + function updateAllowedAction(checkbox) { + console.log(checkbox.checked); + console.log(checkbox.dataset.actionscope); + console.log(checkbox.dataset.actiontype); $.ajax({ timeout: 1000, - url: dmnApi + 'verification/actions/global/' + $checkbox[0].checked, + url: dmnApi + 'verification/actions/allowedActions/' + checkbox.dataset.actionscope + "/" + + checkbox.dataset.actiontype + "/" + checkbox.checked, type: 'POST', error: function (err) { alert("No connection."); diff --git a/dmnverifierfrontend/src/main/resources/META-INF/resources/css/stylesheets.css b/dmnverifierfrontend/src/main/resources/META-INF/resources/css/stylesheets.css index 1b6990e0e7cdcc2b34dfb7e42076daefb3458539..c2518f6a3604fc9184745179dbeb046314cdc3a5 100644 --- a/dmnverifierfrontend/src/main/resources/META-INF/resources/css/stylesheets.css +++ b/dmnverifierfrontend/src/main/resources/META-INF/resources/css/stylesheets.css @@ -260,16 +260,18 @@ span.select2 { display: flex; flex-direction: row; justify-content: stretch; - margin: 10px; + margin: 4px; + min-height: 35px; border-top: #0d82b7 2px; border-top-style: ridge; border-radius: 3px; + align-items: center; } .dmn-verification-icon { - width: 32px; height: 30px; display: inline-block; + flex: 0 0 24px; background-repeat: no-repeat; background-size: contain; background-position: center center; @@ -292,7 +294,6 @@ span.select2 { } .verification-message { - padding-top: 8px; padding-left: 8px; width: 100%; flex-shrink: 1; @@ -301,18 +302,20 @@ span.select2 { .verification-container-fix-buttons { float: right; - padding-top: 8px; display: flex; flex-direction: row; flex-grow: 1; - justify-content: space-between; + justify-content: flex-end; flex-wrap: wrap; + align-items: center; } .verification-fix-button { - height: 25px; + height: 28px; min-width: 100px; - margin: 2px 2px 5px 10px; + margin-right: 4px; + margin-top: 4px; + margin-bottom: 4px; } .highlight { diff --git a/dmnverifierfrontend/src/main/resources/META-INF/resources/js/dmnVerifierActions.js b/dmnverifierfrontend/src/main/resources/META-INF/resources/js/dmnVerifierActions.js index c3c220f2c1e76933bee8db1cd05222e28947c9dd..552285f8589929820cb2c8637acb07f87d4a1c32 100644 --- a/dmnverifierfrontend/src/main/resources/META-INF/resources/js/dmnVerifierActions.js +++ b/dmnverifierfrontend/src/main/resources/META-INF/resources/js/dmnVerifierActions.js @@ -106,9 +106,6 @@ function performVerificationFixSHOW(verificationEntry, fixAction) { case 'OUTPUT_COLUMN': fixSHOW_OUTPUT_COLUMN(verificationEntry, fixAction); break; - case 'DECISION_TABLE': - fixSHOW_DECISION_TABLE(verificationEntry, fixAction); - break; case 'DECISION': fixSHOW_DECISION(verificationEntry, fixAction); break; @@ -172,15 +169,6 @@ function fixSHOW_OUTPUT_COLUMN(verificationEntry, fixAction) { highlightColumns(verificationEntry.elements, 'outputId'); } -/** - * - * @param {VerificationEntry} verificationEntry - * @param {Action} fixAction - */ -function fixSHOW_DECISION_TABLE(verificationEntry, fixAction) { - highlightDecision(verificationEntry.elements); -} - /** * * @param {VerificationEntry} verificationEntry @@ -291,7 +279,6 @@ function performVerificationFixDELETE(verificationEntry, fixAction) { break; case 'INPUT_ENTRY': case 'OUTPUT_ENTRY': - case 'DECISION_TABLE': case 'DECISION': default: alert("ACTION undefined: " + fixAction.actionType + ' -> ' @@ -361,7 +348,6 @@ function performVerificationFixUPDATE(verificationEntry, fixAction) { case 'OUTPUT_COLUMN': case 'INPUT_ENTRY': case 'OUTPUT_ENTRY': - case 'DECISION_TABLE': default: alert("ACTION undefined: " + fixAction.actionType + ' -> ' + fixAction.actionScope);