Removed logs directory from .gitignore

This commit is contained in:
Abdulmhsen B. A. A
2024-05-02 18:06:47 +03:00
parent e6b4c3fbb3
commit 63d760127c
3 changed files with 82 additions and 1 deletions

1
frontend/.gitignore vendored
View File

@@ -10,7 +10,6 @@ dist
node_modules
# Logs
logs
*.log
# Misc

View File

@@ -0,0 +1,75 @@
<template>
<div class="columns is-multiline">
<div class="column is-12">
<span class="title is-4">View Log file</span>
<div class="is-pulled-right" v-if="!error">
<div class="field is-grouped">
<p class="control">
<button class="button is-info" v-tooltip="'Watch log'">
<span class="icon is-small">
<i class="fas fa-stream"></i>
</span>
</button>
</p>
<p class="control">
<button class="button is-primary" @click.prevent="loadContent">
<span class="icon is-small">
<i class="fas fa-sync"></i>
</span>
</button>
</p>
</div>
</div>
</div>
<div class="column is-12">
<code class="box logs-container" v-if="!error">
<div v-for="(item, index) in data" :key="'log_line-'+index">
{{ item }}
</div>
</code>
<template v-else>
<Message title="Request Error" message_class="is-danger" :message="error"/>
</template>
</div>
</div>
</template>
<style scoped>
.logs-container {
min-height: 60vh;
max-height: 70vh;
overflow-y: auto;
white-space: pre;
}
</style>
<script setup>
import Message from "~/components/Message.vue";
const filename = useRoute().params.filename
const data = ref([])
const error = ref(null)
const loadContent = async () => {
try {
const response = await request(`/logs/${filename}`)
if (response.ok) {
const text = await response.text()
data.value = text.split('\n')
} else {
error.value = `${response.status}: ${response.statusText}`
}
} catch (e) {
error.value = e
}
}
onMounted(() => {
loadContent()
})
</script>

View File

@@ -0,0 +1,7 @@
<template>
<div class="columns is-multiline">
<div class="column is-12">
<h1 class="title is-4">Logs</h1>
</div>
</div>
</template>