mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 00:13:13 +09:00
Add log filters to web ui (#746)
* Add max level select to logs Closes: #745 * Add log filter for server actions Closes: #744 * Respond to comments Change name of component, clean up onChange anon function
This commit is contained in:
1 parent
81fb223d5e
commit
f3a62e585f
8 files changed
+113
-27
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import React, { useContext } from "react";
|
||||
import { Descriptions, Spin, Tag, Typography, Button, Space, Modal, Popconfirm } from "antd";
|
||||
import React, { useContext, useState } from "react";
|
||||
import { Descriptions, Spin, Tag, Typography, Button, Space, Modal, Popconfirm, Flex } from "antd";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import * as lib from "@clusterio/lib";
|
||||
@@ -7,7 +7,7 @@ import notify, { notifyErrorHandler } from "../util/notify";
|
||||
import ControlContext from "./ControlContext";
|
||||
import HostConfigTree from "./HostConfigTree";
|
||||
import InstanceList from "./InstanceList";
|
||||
import LogConsole from "./LogConsole";
|
||||
import LogConsole, { SelectMaxLogLevel } from "./LogConsole";
|
||||
import { useAccount } from "../model/account";
|
||||
import { useInstances } from "../model/instance";
|
||||
import { useHost } from "../model/host";
|
||||
@@ -32,6 +32,7 @@ export default function HostViewPage() {
|
||||
const [systems] = useSystems();
|
||||
const system = systems.get(hostId);
|
||||
const [host, synced] = useHost(hostId);
|
||||
const [maxLevel, setMaxLevel] = useState<keyof typeof lib.levels>("info");
|
||||
const hostInstances = new Map([...instances].filter(([_id, instance]) => instance.assignedHost === hostId));
|
||||
|
||||
let nav = [{ name: "Hosts", path: "/hosts" }, { name: host?.name ?? String(hostId) }];
|
||||
@@ -141,8 +142,15 @@ export default function HostViewPage() {
|
||||
<InstanceList instances={hostInstances} size="small" hideAssignedHost />
|
||||
</>}
|
||||
{account.hasPermission("core.log.follow") && <>
|
||||
<Title level={5} style={{ marginTop: 16 }}>Console</Title>
|
||||
<LogConsole hosts={[hostId]} />
|
||||
<Flex justify="space-between" align="baseline">
|
||||
<Title level={5} style={{ marginTop: 16 }}>Console</Title>
|
||||
<SelectMaxLogLevel
|
||||
value={maxLevel}
|
||||
onChange={setMaxLevel}
|
||||
hidden={["server", "http"]}
|
||||
/>
|
||||
</Flex>
|
||||
<LogConsole hosts={[hostId]} maxLevel={maxLevel}/>
|
||||
</>}
|
||||
{account.hasPermission("core.host.get_config") && <HostConfigTree id={hostId} available={host.connected} />}
|
||||
<PluginExtra component="HostViewPage" host={host} />
|
||||
|
||||
Reference in new issue
Block a user