mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
rewrite logger to support custom config files (#3104)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
This commit is contained in:
parent
cba076b6a4
commit
6bd5a82b92
19 changed files with 285 additions and 294 deletions
|
@ -203,7 +203,6 @@ export interface MaintenanceStorageDetails {
|
|||
}
|
||||
export interface MaintenanceSummary {
|
||||
dataDirSize: string;
|
||||
logFileSize: string;
|
||||
cleanableImages: number;
|
||||
cleanableDirs: number;
|
||||
}
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
<template #title> {{ $t("admin.maintenance.page-title") }} </template>
|
||||
</BasePageTitle>
|
||||
|
||||
<div class="d-flex justify-end">
|
||||
<ButtonLink to="/admin/maintenance/logs" text="Logs" :icon="$globals.icons.file" />
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<BaseCardSectionTitle class="pb-0" :icon="$globals.icons.wrench" :title="$tc('admin.maintenance.summary-title')">
|
||||
</BaseCardSectionTitle>
|
||||
|
@ -110,7 +106,6 @@ export default defineComponent({
|
|||
|
||||
const infoResults = ref<MaintenanceSummary>({
|
||||
dataDirSize: i18n.tc("about.unknown-version"),
|
||||
logFileSize: i18n.tc("about.unknown-version"),
|
||||
cleanableDirs: 0,
|
||||
cleanableImages: 0,
|
||||
});
|
||||
|
@ -121,7 +116,6 @@ export default defineComponent({
|
|||
|
||||
infoResults.value = data ?? {
|
||||
dataDirSize: i18n.tc("about.unknown-version"),
|
||||
logFileSize: i18n.tc("about.unknown-version"),
|
||||
cleanableDirs: 0,
|
||||
cleanableImages: 0,
|
||||
};
|
||||
|
@ -129,17 +123,12 @@ export default defineComponent({
|
|||
state.fetchingInfo = false;
|
||||
}
|
||||
|
||||
|
||||
const info = computed(() => {
|
||||
return [
|
||||
{
|
||||
name: i18n.t("admin.maintenance.info-description-data-dir-size"),
|
||||
value: infoResults.value.dataDirSize,
|
||||
},
|
||||
{
|
||||
name: i18n.t("admin.maintenance.info-description-log-file-size"),
|
||||
value: infoResults.value.logFileSize,
|
||||
},
|
||||
{
|
||||
name: i18n.t("admin.maintenance.info-description-cleanable-directories"),
|
||||
value: infoResults.value.cleanableDirs,
|
||||
|
@ -184,12 +173,6 @@ export default defineComponent({
|
|||
// ==========================================================================
|
||||
// Actions
|
||||
|
||||
async function handleDeleteLogFile() {
|
||||
state.actionLoading = true;
|
||||
await adminApi.maintenance.cleanLogFile();
|
||||
state.actionLoading = false;
|
||||
}
|
||||
|
||||
async function handleCleanDirectories() {
|
||||
state.actionLoading = true;
|
||||
await adminApi.maintenance.cleanRecipeFolders();
|
||||
|
@ -209,11 +192,6 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
const actions = [
|
||||
{
|
||||
name: i18n.t("admin.maintenance.action-delete-log-files-name"),
|
||||
handler: handleDeleteLogFile,
|
||||
subtitle: i18n.t("admin.maintenance.action-delete-log-files-description"),
|
||||
},
|
||||
{
|
||||
name: i18n.t("admin.maintenance.action-clean-directories-name"),
|
||||
handler: handleCleanDirectories,
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
<template>
|
||||
<v-container fluid>
|
||||
<BaseCardSectionTitle class="pb-0" :icon="$globals.icons.cog" :title="$t('admin.maintenance.summary-title')">
|
||||
</BaseCardSectionTitle>
|
||||
<div class="mb-6 ml-2 d-flex" style="gap: 0.8rem">
|
||||
<BaseButton color="info" :loading="state.loading" @click="refreshLogs">
|
||||
<template #icon> {{ $globals.icons.refreshCircle }} </template>
|
||||
{{ $t("admin.maintenance.logs-action-refresh") }}
|
||||
</BaseButton>
|
||||
<AppButtonCopy :copy-text="copyText" />
|
||||
<div class="ml-auto" style="max-width: 150px">
|
||||
<v-text-field
|
||||
v-model="state.lines"
|
||||
type="number"
|
||||
:label="$t('admin.maintenance.logs-tail-lines-label')"
|
||||
hide-details
|
||||
dense
|
||||
outlined
|
||||
>
|
||||
</v-text-field>
|
||||
</div>
|
||||
</div>
|
||||
<v-card outlined>
|
||||
<v-virtual-scroll
|
||||
v-scroll="scrollOptions"
|
||||
:bench="20"
|
||||
:items="logs.logs"
|
||||
height="800"
|
||||
item-height="20"
|
||||
class="keep-whitespace log-container"
|
||||
>
|
||||
<template #default="{ item }">
|
||||
<p class="log-text">
|
||||
{{ item }}
|
||||
</p>
|
||||
</template>
|
||||
</v-virtual-scroll>
|
||||
</v-card>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, computed, onMounted, reactive } from "@nuxtjs/composition-api";
|
||||
import { useAdminApi } from "~/composables/api";
|
||||
|
||||
export default defineComponent({
|
||||
layout: "admin",
|
||||
setup() {
|
||||
const adminApi = useAdminApi();
|
||||
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
lines: 500,
|
||||
autoRefresh: true,
|
||||
});
|
||||
|
||||
const scrollOptions = reactive({
|
||||
enable: true,
|
||||
always: false,
|
||||
smooth: false,
|
||||
notSmoothOnInit: true,
|
||||
});
|
||||
|
||||
const logs = ref({
|
||||
logs: [] as string[],
|
||||
});
|
||||
|
||||
async function refreshLogs() {
|
||||
state.loading = true;
|
||||
const { data } = await adminApi.maintenance.logs(state.lines);
|
||||
if (data) {
|
||||
logs.value = data;
|
||||
}
|
||||
state.loading = false;
|
||||
}
|
||||
onMounted(() => {
|
||||
refreshLogs();
|
||||
});
|
||||
|
||||
const copyText = computed(() => {
|
||||
return logs.value.logs.join("") || "";
|
||||
});
|
||||
return {
|
||||
copyText,
|
||||
scrollOptions,
|
||||
state,
|
||||
refreshLogs,
|
||||
logs,
|
||||
};
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.$t("admin.maintenance.logs-page-title") as string,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.log-text {
|
||||
font: 0.8rem Inconsolata, monospace;
|
||||
}
|
||||
.log-container {
|
||||
background-color: var(--v-background-base) !important;
|
||||
}
|
||||
.keep-whitespace {
|
||||
white-space: pre;
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue