Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Додано кольорове кодування для попереджень та помилок #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/pages/modules/CombinedLogOutputComponent.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
<template>
<q-scroll-area ref="scroll" outlined style="height: 200px; max-height: 300px;" class="row q-mt-sm">
<pre>{{ log }}</pre>
</q-scroll-area>
<q-scroll-area ref="scroll" outlined style="height: 200px; max-height: 300px;" class="row q-mt-sm">
<pre v-html="formattedLog"></pre>
</q-scroll-area>
</template>

<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'
import { onMounted, onUnmounted, ref, computed } from 'vue'
import { IpcRendererEvent } from 'electron';
import { QScrollArea } from 'quasar';

const log = ref("")
const scroll = ref<QScrollArea>()

const formattedLog = computed(() => {
return log.value.split('\n').map((entry) => {
if (entry.includes('error')) {
return `<span style="color: red;">${entry}</span>`;
} else if (entry.includes('warning')) {
return `<span style="color: yellow;">${entry}</span>`;
}
return entry;
}).join('\n');
});

async function loadState() {
const executionEngineState = await window.executionEngineAPI.getState()
log.value = executionEngineState.executionLog.map((e) => JSON.stringify(e) + "\n").join("")
Expand Down Expand Up @@ -62,4 +73,4 @@ onUnmounted(() => {
window.executionEngineAPI.stopListeningForStdErr(onStdErr)
})

</script>
</script>