Skip to content

Commit 5f59ea0

Browse files
committed
Add a new section in setting for logs (fix #375)
1 parent aa868ea commit 5f59ea0

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

src/renderer/views/Config.vue

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,65 @@
537537
></x-switch>
538538
</div>
539539
</x-card>
540+
541+
<!-- Logs -->
542+
<x-card
543+
class="flex flex-row justify-between items-center p-2 py-3 my-0 w-full backdrop-blur-xl backdrop-brightness-150 bg-neutral-800/20"
544+
>
545+
<div>
546+
<div class="flex flex-row gap-2 items-center mb-2">
547+
<Icon class="inline-flex text-violet-400 size-8" icon="lucide:file-code"></Icon>
548+
<h1 class="my-0 text-lg font-semibold">Logs</h1>
549+
</div>
550+
<p class="text-neutral-400 text-[0.9rem] !pt-0 !mt-0">Select the log you want to open</p>
551+
</div>
552+
<div class="flex flex-col gap-2 justify-center items-center" style="font-size: 0.8125rem">
553+
<x-button
554+
@click="
555+
logTitle = 'Winboat log (winboat.log)';
556+
logContent = fs.readFileSync(path.join(WINBOAT_DIR, 'winboat.log'));
557+
logDialog!.showModal();
558+
"
559+
>
560+
Winboat log (winboat.log)
561+
</x-button>
562+
<x-button
563+
@click="
564+
logTitle = 'Install log (install.log)';
565+
logContent = fs.readFileSync(path.join(WINBOAT_DIR, 'install.log'));
566+
logDialog!.showModal();
567+
"
568+
>
569+
Install log (winboat.log)
570+
</x-button>
571+
<dialog ref="logDialog">
572+
<div class="flex flex-row gap-0 align-middle" style="margin-bottom: 16px">
573+
<h3 class="mb-0 mt-0 content-center">{{ logTitle }}</h3>
574+
<x-button
575+
title="Copy to clipboard"
576+
class="p-0 w-9 h-6"
577+
@click="electron.clipboard.writeText(logContent.toString())"
578+
skin="flat"
579+
>
580+
<x-popover modal>
581+
<x-label>Copied!</x-label>
582+
</x-popover>
583+
<icon icon="flowbite:clipboard-clean-outline" class="size-5"></icon>
584+
</x-button>
585+
</div>
586+
<div class="overflow-y-scroll" style="max-height: 60vh; max-width: 90vh">
587+
<pre class="text-sm text-gray-400 bg-neutral-800 p-4 rounded-lg overflow-auto m-0">{{
588+
logContent
589+
}}</pre>
590+
</div>
591+
<footer>
592+
<x-button v-on:click="logDialog?.close()">
593+
<x-label>Close</x-label>
594+
</x-button>
595+
</footer>
596+
</dialog>
597+
</div>
598+
</x-card>
540599
</div>
541600
</div>
542601

@@ -572,7 +631,7 @@
572631
>
573632
<div>
574633
<div class="flex flex-row items-center gap-2 mb-2">
575-
<Icon class="text-violet-400 inline-flex size-8" icon="mdi:administrator"> </Icon>
634+
<Icon class="text-violet-400 inline-flex size-8" icon="mdi:administrator"></Icon>
576635
<h1 class="text-lg my-0 font-semibold">Advanced Settings</h1>
577636
</div>
578637
<p class="text-neutral-400 text-[0.9rem] !pt-0 !mt-0">
@@ -633,9 +692,14 @@ import {
633692
RESTART_NO,
634693
GUEST_RDP_PORT,
635694
DEFAULT_HOST_QMP_PORT,
695+
WINBOAT_DIR,
636696
} from "../lib/constants";
637697
import { PortManager } from "../utils/port";
698+
638699
const { app }: typeof import("@electron/remote") = require("@electron/remote");
700+
const fs: typeof import("fs") = require("node:fs");
701+
const path: typeof import("path") = require("node:path");
702+
const electron: typeof import("electron") = require("electron");
639703
640704
// Emits
641705
const $emit = defineEmits(["rerender"]);
@@ -669,6 +733,9 @@ const isResettingWinboat = ref(false);
669733
const isUpdatingUSBPrerequisites = ref(false);
670734
const origApplicationScale = ref(0);
671735
const rdpArgs = ref<RdpArg[]>([]);
736+
const logDialog = ref<HTMLDialogElement | null>(null);
737+
const logContent = ref("");
738+
const logTitle = ref("");
672739
673740
// For USB Devices
674741
const availableDevices = ref<Device[]>([]);

0 commit comments

Comments
 (0)