Added green highlight to parsers

This commit is contained in:
2023-11-16 08:40:28 +01:00
parent 00786bf157
commit f411797041
2 changed files with 19 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ const engine = ref('');
const version = ref(''); const version = ref('');
const errorOccurred = ref(false); const errorOccurred = ref(false);
const successOccurred = ref(false);
onMounted(() => { onMounted(() => {
@@ -119,12 +120,14 @@ async function fetchRequest(request: Request):Promise<JSON> {
function updateOutputField(data: any) { function updateOutputField(data: any) {
result.value = data.result result.value = data.result
errorOccurred.value = data.status == "ERR" errorOccurred.value = data.status != "OK"
successOccurred.value = data.status == "OK"
} }
function clear() { function clear() {
result.value = "" result.value = ""
errorOccurred.value = false errorOccurred.value = false
successOccurred.value = false
} }
function emitVersionChange() { function emitVersionChange() {
@@ -135,6 +138,16 @@ function isVersionSelectionAvailable() {
return !(props.tool == "xsd"); return !(props.tool == "xsd");
} }
function highlightField() {
if (errorOccurred.value) {
return "text-field-error";
}
if (successOccurred.value) {
return "text-field-success";
}
return "";
}
</script> </script>
<template> <template>
@@ -152,7 +165,7 @@ function isVersionSelectionAvailable() {
<button class="tool-button" @click="process">Process</button> <button class="tool-button" @click="process">Process</button>
</div> </div>
</div> </div>
<div class="overflow-auto h-full w-full rounded-2xl" :class="{'text-field-error' : errorOccurred}"> <div class="overflow-auto h-full w-full rounded-2xl" :class="highlightField()">
<CodeEditor :code="result" :config="{disabled:true,language:tool}"></CodeEditor> <CodeEditor :code="result" :config="{disabled:true,language:tool}"></CodeEditor>
</div> </div>

View File

@@ -31,3 +31,7 @@
.text-field-error { .text-field-error {
@apply shadow-[0px_0px_10px_0px_rgba(255,0,0,1)]; @apply shadow-[0px_0px_10px_0px_rgba(255,0,0,1)];
} }
.text-field-success {
@apply shadow-[0px_0px_10px_0px_rgba(0,255,0,1)];
}