log download

This commit is contained in:
jb-alvarado 2024-04-29 10:48:51 +02:00
parent c62607023b
commit d2ce326386
4 changed files with 39 additions and 2 deletions

View File

@ -126,6 +126,9 @@ export default {
send: 'Senden',
name: 'Name',
},
log: {
download: 'Protokoll herunterladen',
},
config: {
channel: 'Kanal',
user: 'Benutzer',

View File

@ -126,6 +126,9 @@ export default {
send: 'Send',
name: 'Name',
},
log: {
download: 'Download log file',
},
config: {
channel: 'Channel',
user: 'User',

View File

@ -126,6 +126,9 @@ export default {
send: 'Enviar',
name: 'Nome',
},
log: {
download: 'Baixar arquivo de registro',
},
config: {
channel: 'Canal',
user: 'Usuários',

View File

@ -1,7 +1,7 @@
<template>
<div class="w-full flex flex-col">
<div class="flex justify-end p-3 h-14">
<div>
<div class="join">
<VueDatePicker
v-model="listDate"
:clearable="false"
@ -12,9 +12,16 @@
auto-apply
:locale="locale"
:dark="colorMode.value === 'dark'"
input-class-name="input input-sm !input-bordered !w-[300px] text-right !pe-3"
input-class-name="join-item input input-sm !input-bordered !w-[300px] text-right !pe-3"
required
/>
<button
class="btn btn-sm btn-primary join-item"
:title="$t('log.download')"
@click="downloadLog"
>
<i class="bi-download" />
</button>
</div>
</div>
<div class="px-3 inline-block h-[calc(100vh-140px)] text-[13px]">
@ -73,6 +80,27 @@ async function getLog() {
currentLog.value = ''
})
}
function downloadLog() {
const file = new File(
[formatLog(currentLog.value).replace(/<\/?[^>]+(>|$)/g, '')],
`playout_${listDate.value}.log`,
{
type: 'text/plain',
}
)
const link = document.createElement('a')
const url = URL.createObjectURL(file)
link.href = url
link.download = file.name
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
}
</script>
<style>