feat(webui): download log file from server settings

Closes: #1599
This commit is contained in:
Gauthier Roebroeck 2024-12-18 16:55:26 +08:00
parent 85cffc73fd
commit eed4f09a06
3 changed files with 32 additions and 4 deletions

View File

@ -881,10 +881,6 @@
"tasks_total_time": "Tasks total time",
"title": "Metrics"
},
"updates": {
"available": "Updates are available",
"latest_installed": "The latest version of Komga is already installed"
},
"navigation": {
"home": "Home",
"libraries": "Libraries",
@ -927,6 +923,7 @@
"button_scan_libraries": "Scan all libraries",
"button_scan_libraries_deep": "Scan all libraries (deep)",
"button_shutdown": "Shut down",
"download_log": "Download log file",
"notification_tasks_cancelled": "No tasks to cancel | One task cancelled | {count} tasks cancelled",
"section_title": "Server Management"
},
@ -996,6 +993,10 @@
"less": "Less titles",
"more": "More titles"
},
"updates": {
"available": "Updates are available",
"latest_installed": "The latest version of Komga is already installed"
},
"user_roles": {
"ADMIN": "Administrator",
"FILE_DOWNLOAD": "File download",

View File

@ -32,4 +32,8 @@ export default class ActuatorService {
throw new Error(msg)
}
}
logfileUrl(): string {
return `${API_ACTUATOR}/logfile`
}
}

View File

@ -3,6 +3,13 @@
<v-row>
<v-col><span class="text-h5">{{ $t('server.server_management.section_title') }}</span></v-col>
</v-row>
<v-row>
<v-col cols="auto">
<v-btn @click="downloadLogFile"
>{{ $t('server.server_management.download_log') }}
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col cols="auto">
<v-btn @click="scanAllLibraries(false)">{{ $t('server.server_management.button_scan_libraries') }}</v-btn>
@ -13,15 +20,21 @@
>{{ $t('server.server_management.button_scan_libraries_deep') }}
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col cols="auto">
<v-btn @click="confirmEmptyTrash = true">{{ $t('server.server_management.button_empty_trash') }}</v-btn>
</v-col>
</v-row>
<v-row>
<v-col cols="auto">
<v-btn @click="cancelAllTasks"
color="warning"
>{{ $t('server.server_management.button_cancel_all_tasks') }}
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col cols="auto">
<v-btn @click="modalStopServer = true"
color="error"
@ -55,6 +68,8 @@ import Vue from 'vue'
import ConfirmationDialog from '@/components/dialogs/ConfirmationDialog.vue'
import {ERROR, ErrorEvent, NOTIFICATION, NotificationEvent} from '@/types/events'
import {LibraryDto} from '@/types/komga-libraries'
import jsFileDownloader from 'js-file-downloader'
import urls from '@/functions/urls'
export default Vue.extend({
name: 'ServerManagement',
@ -92,6 +107,14 @@ export default Vue.extend({
this.$eventHub.$emit(ERROR, {message: e.message} as ErrorEvent)
}
},
downloadLogFile() {
new jsFileDownloader({
url: `${urls.originNoSlash}${this.$actuator.logfileUrl()}`,
filename: 'komga.log',
withCredentials: true,
forceDesktopMode: true,
})
},
},
})
</script>