Merge pull request 'bema/func/formatter' (#48) from bema/func/formatter into dev

Reviewed-on: R11/release11-tools-web#48
This commit is contained in:
2023-02-21 10:48:16 +01:00
15 changed files with 383 additions and 24 deletions

View File

@@ -287,6 +287,10 @@
width: 100%;
}
.half-width {
width: 50%;
}
.max-width.with-padding {
width: 94%;
}

View File

@@ -91,7 +91,7 @@ function refreshTooltip() {
document.getElementById("xsltelementsheader").innerText = XSLTheader;
}
function performRequest(text, checkXML, checkTransform){
function performRequest(endpoint, checkXML, checkTransform){
var xmlData = document.getElementById("xmlArea").value.trim();
var transformData = document.getElementById("transformArea").value.trim();
@@ -106,7 +106,7 @@ function performRequest(text, checkXML, checkTransform){
empty = true;
}
if (!empty) {
restRequest(text);
restRequest(endpoint, xmlData, transformData);
}else{
document.getElementById("resultArea").value = "No data provided!";
return false;
@@ -114,17 +114,33 @@ function performRequest(text, checkXML, checkTransform){
}
function performFormatRequest(endpoint, checkXML){
var xmlData = document.getElementById("xmlArea").value.trim();
var empty = false;
if (defaultStrings.includes(xmlData) && checkXML) {
document.getElementById("xmlArea").style.backgroundColor = color_red;
xmlData = "";
empty = true;
}
if (!empty) {
restRequest(endpoint, xmlData, null);
}else{
document.getElementById("resultArea").value = "No data provided!";
return false;
}
}
//Form REST request, send, receive and display in resultArea
async function restRequest(text) {
async function restRequest(endpoint, xmlData, transformData) {
const escapeChar = "specialEscapeChar";
var port = ":8081/"
if (getProcessor() == "libxml") {
port = ":8082/"
}
const addr = window.location.protocol + "//" + window.location.hostname + port + text;
var xmlData = document.getElementById("xmlArea").value.trim();
var transformData = document.getElementById("transformArea").value.trim();
const addr = window.location.protocol + "//" + window.location.hostname + port + endpoint;
if(defaultStrings.includes(xmlData)){
xmlData = "<empty/>";