2020-04-17 15:02:21 +02:00
|
|
|
<template>
|
2024-04-08 09:35:31 +02:00
|
|
|
<div class="flex justify-end p-3 h-14">
|
2024-04-06 23:12:06 +02:00
|
|
|
<div>
|
2024-04-09 15:45:17 +02:00
|
|
|
<VueDatePicker
|
|
|
|
v-model="listDate"
|
|
|
|
:clearable="false"
|
|
|
|
:hide-navigation="['time']"
|
|
|
|
:action-row="{ showCancel: false, showSelect: false, showPreview: false }"
|
|
|
|
:format="calendarFormat"
|
|
|
|
model-type="yyyy-MM-dd"
|
|
|
|
auto-apply
|
2024-04-14 00:01:45 +02:00
|
|
|
:locale="locale"
|
2024-04-09 17:21:13 +02:00
|
|
|
:dark="colorMode.value === 'dark'"
|
2024-04-14 00:01:45 +02:00
|
|
|
input-class-name="input input-sm !input-bordered !w-[250px] text-right !pe-3"
|
2024-04-09 15:45:17 +02:00
|
|
|
required
|
|
|
|
/>
|
2023-01-11 10:54:25 +01:00
|
|
|
</div>
|
2020-04-17 15:02:21 +02:00
|
|
|
</div>
|
2024-04-08 09:35:31 +02:00
|
|
|
<div class="px-3 inline-block h-[calc(100vh-140px)] text-[13px]">
|
2024-04-06 23:12:06 +02:00
|
|
|
<div class="bg-base-300 whitespace-pre h-full font-mono overflow-auto p-3" v-html="formatLog(currentLog)" />
|
2024-04-05 18:51:50 +02:00
|
|
|
</div>
|
2020-04-17 15:02:21 +02:00
|
|
|
</template>
|
|
|
|
|
2023-01-11 10:54:25 +01:00
|
|
|
<script setup lang="ts">
|
2023-03-22 16:01:58 +01:00
|
|
|
import { storeToRefs } from 'pinia'
|
2023-01-11 10:54:25 +01:00
|
|
|
|
2024-04-09 15:45:17 +02:00
|
|
|
const colorMode = useColorMode()
|
2024-04-14 00:01:45 +02:00
|
|
|
const { locale } = useI18n()
|
2024-04-09 15:45:17 +02:00
|
|
|
|
2023-01-11 10:54:25 +01:00
|
|
|
useHead({
|
2024-04-06 23:12:06 +02:00
|
|
|
title: 'Logging | ffplayout',
|
2023-01-11 10:54:25 +01:00
|
|
|
})
|
|
|
|
|
2023-03-22 16:01:58 +01:00
|
|
|
const { configID } = storeToRefs(useConfig())
|
2023-01-11 13:41:22 +01:00
|
|
|
|
2023-01-11 10:54:25 +01:00
|
|
|
const { $dayjs } = useNuxtApp()
|
|
|
|
const authStore = useAuth()
|
|
|
|
const configStore = useConfig()
|
|
|
|
const currentLog = ref('')
|
|
|
|
const listDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
|
|
|
const { formatLog } = stringFormatter()
|
|
|
|
|
2023-03-22 16:01:58 +01:00
|
|
|
onMounted(() => {
|
|
|
|
getLog()
|
|
|
|
})
|
|
|
|
|
|
|
|
watch([listDate, configID], () => {
|
2023-01-11 13:41:22 +01:00
|
|
|
getLog()
|
|
|
|
})
|
|
|
|
|
2024-04-09 15:45:17 +02:00
|
|
|
const calendarFormat = (date: Date) => {
|
2024-04-15 17:39:41 +02:00
|
|
|
return $dayjs(date).locale(locale.value).format('dddd - LL')
|
2024-04-09 15:45:17 +02:00
|
|
|
}
|
|
|
|
|
2023-01-11 10:54:25 +01:00
|
|
|
async function getLog() {
|
|
|
|
let date = listDate.value
|
|
|
|
|
|
|
|
if (date === $dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD')) {
|
|
|
|
date = ''
|
2020-04-17 15:02:21 +02:00
|
|
|
}
|
2023-01-11 10:54:25 +01:00
|
|
|
|
2023-01-11 13:41:22 +01:00
|
|
|
await fetch(`/api/log/${configStore.configGui[configStore.configID].id}?date=${date}`, {
|
2023-01-11 10:54:25 +01:00
|
|
|
method: 'GET',
|
|
|
|
headers: authStore.authHeader,
|
|
|
|
})
|
|
|
|
.then((response) => response.text())
|
|
|
|
.then((data) => {
|
|
|
|
currentLog.value = data
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
currentLog.value = ''
|
|
|
|
})
|
2020-04-17 15:02:21 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2024-04-09 15:45:17 +02:00
|
|
|
<style>
|
2022-05-15 21:53:02 +02:00
|
|
|
.log-time {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #666864;
|
2022-05-15 21:53:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-number {
|
2024-04-15 17:39:41 +02:00
|
|
|
color: var(--my-yellow);
|
2022-05-15 21:53:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-addr {
|
2024-04-15 17:39:41 +02:00
|
|
|
color: var(--my-purple);
|
2022-05-15 21:53:02 +02:00
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
.log-cmd {
|
2024-04-15 17:39:41 +02:00
|
|
|
color: var(--my-blue);
|
2022-05-15 21:53:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-27 16:07:28 +02:00
|
|
|
.log-info {
|
2024-04-15 17:39:41 +02:00
|
|
|
color: var(--my-green);
|
2020-04-27 16:07:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-warning {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #ff8700;
|
2020-04-27 16:07:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-error {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #d32828;
|
2020-04-27 16:07:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-debug {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #6e99c7;
|
2020-04-27 16:07:28 +02:00
|
|
|
}
|
|
|
|
|
2022-01-25 10:32:29 +01:00
|
|
|
.log-decoder {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #56efff;
|
2022-01-25 10:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-encoder {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #45ccee;
|
2022-01-25 10:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-server {
|
2024-04-09 15:45:17 +02:00
|
|
|
color: #23cbdd;
|
2022-01-25 10:32:29 +01:00
|
|
|
}
|
2020-04-17 15:02:21 +02:00
|
|
|
</style>
|