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', send: 'Senden',
name: 'Name', name: 'Name',
}, },
log: {
download: 'Protokoll herunterladen',
},
config: { config: {
channel: 'Kanal', channel: 'Kanal',
user: 'Benutzer', user: 'Benutzer',

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="w-full flex flex-col"> <div class="w-full flex flex-col">
<div class="flex justify-end p-3 h-14"> <div class="flex justify-end p-3 h-14">
<div> <div class="join">
<VueDatePicker <VueDatePicker
v-model="listDate" v-model="listDate"
:clearable="false" :clearable="false"
@ -12,9 +12,16 @@
auto-apply auto-apply
:locale="locale" :locale="locale"
:dark="colorMode.value === 'dark'" :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 required
/> />
<button
class="btn btn-sm btn-primary join-item"
:title="$t('log.download')"
@click="downloadLog"
>
<i class="bi-download" />
</button>
</div> </div>
</div> </div>
<div class="px-3 inline-block h-[calc(100vh-140px)] text-[13px]"> <div class="px-3 inline-block h-[calc(100vh-140px)] text-[13px]">
@ -73,6 +80,27 @@ async function getLog() {
currentLog.value = '' 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> </script>
<style> <style>