mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-13 12:46:41 +00:00
65 lines
1.3 KiB
Vue
65 lines
1.3 KiB
Vue
<template>
|
|
<b-modal
|
|
id="logs_modal"
|
|
ref="$modal"
|
|
:title="$gettext('Log Viewer')"
|
|
>
|
|
<textarea
|
|
class="form-control log-viewer"
|
|
spellcheck="false"
|
|
readonly
|
|
:value="logs"
|
|
/>
|
|
|
|
<template #modal-footer>
|
|
<b-button
|
|
variant="default"
|
|
type="button"
|
|
@click="close"
|
|
>
|
|
{{ $gettext('Close') }}
|
|
</b-button>
|
|
<b-button
|
|
variant="primary"
|
|
class="btn_copy"
|
|
type="button"
|
|
@click.prevent="doCopy"
|
|
>
|
|
{{ $gettext('Copy to Clipboard') }}
|
|
</b-button>
|
|
</template>
|
|
</b-modal>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {ref} from "vue";
|
|
import {useClipboard} from "@vueuse/core";
|
|
|
|
const logs = ref('Loading...');
|
|
const $modal = ref(); // Template Ref
|
|
|
|
const show = (newLogs) => {
|
|
let logDisplay = [];
|
|
newLogs.forEach((log) => {
|
|
logDisplay.push(log.formatted);
|
|
});
|
|
|
|
logs.value = logDisplay.join('');
|
|
$modal.value.show();
|
|
};
|
|
|
|
const clipboard = useClipboard();
|
|
|
|
const doCopy = () => {
|
|
clipboard.copy(logs.value);
|
|
};
|
|
|
|
const close = () => {
|
|
$modal.value.hide();
|
|
}
|
|
|
|
defineExpose({
|
|
show
|
|
});
|
|
</script>
|