feat: split backend debug logs into dedicated page
This commit is contained in:
31
src/App.tsx
31
src/App.tsx
@@ -24,12 +24,6 @@ import {
|
||||
} from "~/service/update";
|
||||
import { versionApi } from "~/service/wk";
|
||||
|
||||
const asideList = [
|
||||
{ label: "账号", url: "/account" },
|
||||
{ label: "日志", url: "/logs" },
|
||||
{ label: "设置", url: "/setting" },
|
||||
];
|
||||
|
||||
type DownloadState = "idle" | "downloading" | "done" | "error";
|
||||
type UpdateCheckState =
|
||||
| "idle"
|
||||
@@ -175,6 +169,23 @@ const App: ParentComponent = (props) => {
|
||||
const buildText = createMemo(() => version()?.data.BuildAt ?? "unknown");
|
||||
const authorText = createMemo(() => version()?.data.GitAuthor ?? "unknown");
|
||||
const emailText = createMemo(() => version()?.data.GitEmail ?? "unknown");
|
||||
const modeText = createMemo(() => version()?.data.Mode ?? "unknown");
|
||||
const isDebugMode = createMemo(
|
||||
() => modeText().toLowerCase() === "debug",
|
||||
);
|
||||
const asideList = createMemo(() => {
|
||||
const items = [
|
||||
{ label: "账号", url: "/account" },
|
||||
{ label: "日志", url: "/logs" },
|
||||
];
|
||||
|
||||
if (isDebugMode()) {
|
||||
items.push({ label: "后端日志", url: "/debug-logs" });
|
||||
}
|
||||
|
||||
items.push({ label: "设置", url: "/setting" });
|
||||
return items;
|
||||
});
|
||||
const versionErrorText = createMemo(() => {
|
||||
const error = version.error;
|
||||
if (!error) {
|
||||
@@ -186,6 +197,7 @@ const App: ParentComponent = (props) => {
|
||||
const versionPayloadText = createMemo(() =>
|
||||
[
|
||||
`Version: ${versionText()}`,
|
||||
`Mode: ${modeText()}`,
|
||||
`Commit: ${commitText()}`,
|
||||
`Build: ${buildText()}`,
|
||||
`Author: ${authorText()}`,
|
||||
@@ -355,7 +367,7 @@ const App: ParentComponent = (props) => {
|
||||
</div>
|
||||
|
||||
<nav class="flex gap-2 overflow-x-auto pb-1 xl:flex-col xl:overflow-visible xl:pb-0">
|
||||
{asideList.map((item) => {
|
||||
{asideList().map((item) => {
|
||||
const active = isActive(item.url);
|
||||
|
||||
return (
|
||||
@@ -387,7 +399,10 @@ const App: ParentComponent = (props) => {
|
||||
<div class="mt-3 rounded-2xl border border-zinc-200/80 bg-zinc-50/90 px-4 py-4 xl:mt-auto">
|
||||
<p class="text-sm font-medium text-zinc-800">当前页面</p>
|
||||
<p class="mt-1 text-sm text-zinc-500">
|
||||
{asideList.find((item) => isActive(item.url))?.label ?? "账号"}
|
||||
{asideList().find((item) => isActive(item.url))?.label ?? "账号"}
|
||||
</p>
|
||||
<p class="mt-1 text-xs text-zinc-500">
|
||||
模式: {modeText()}
|
||||
</p>
|
||||
<p class="mt-3 text-xs font-medium tracking-[0.18em] text-cyan-700/75 uppercase">
|
||||
Runtime
|
||||
|
||||
Reference in New Issue
Block a user