mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +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,6 +1,6 @@
|
||||
import React, { useContext, useState } from "react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { Alert, Button, Descriptions, Dropdown, MenuProps, Modal, Space, Spin, Typography } from "antd";
|
||||
import { Alert, Button, Descriptions, Dropdown, Flex, MenuProps, Modal, Space, Spin, Switch, Typography } from "antd";
|
||||
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
||||
import DownOutlined from "@ant-design/icons/DownOutlined";
|
||||
|
||||
@@ -12,7 +12,7 @@ import PageHeader from "./PageHeader";
|
||||
import PageLayout from "./PageLayout";
|
||||
import PluginExtra from "./PluginExtra";
|
||||
import InstanceConfigTree from "./InstanceConfigTree";
|
||||
import LogConsole from "./LogConsole";
|
||||
import LogConsole, { SelectMaxLogLevel } from "./LogConsole";
|
||||
import InstanceRcon from "./InstanceRcon";
|
||||
import AssignInstanceModal from "./AssignInstanceModal";
|
||||
import StartStopInstanceButton from "./StartStopInstanceButton";
|
||||
@@ -185,6 +185,8 @@ function InstanceButtons(props: { instance: lib.InstanceDetails }) {
|
||||
export default function InstanceViewPage() {
|
||||
let params = useParams();
|
||||
let instanceId = Number(params.id);
|
||||
const [maxLevel, setMaxLevel] = useState<keyof typeof lib.levels>("server");
|
||||
const [actionsOnly, setActionsOnly] = useState<boolean>(true);
|
||||
|
||||
let navigate = useNavigate();
|
||||
|
||||
@@ -229,9 +231,30 @@ export default function InstanceViewPage() {
|
||||
}
|
||||
{
|
||||
account.hasAnyPermission("core.log.follow", "core.instance.send_rcon")
|
||||
&& <Title level={5} style={{ marginTop: 16 }}>Console</Title>
|
||||
&& <Flex justify="space-between" align="baseline">
|
||||
<Title level={5} style={{ marginTop: 16 }}>Console</Title>
|
||||
{
|
||||
account.hasPermission("core.log.follow")
|
||||
&& <Flex align="center" gap="middle">
|
||||
<Switch
|
||||
checkedChildren="Chat"
|
||||
unCheckedChildren="Log"
|
||||
checked={actionsOnly}
|
||||
onChange={setActionsOnly}
|
||||
/>
|
||||
<SelectMaxLogLevel
|
||||
value={maxLevel}
|
||||
onChange={setMaxLevel}
|
||||
hidden={["http"]}
|
||||
/>
|
||||
</Flex>
|
||||
}
|
||||
</Flex>
|
||||
}
|
||||
{
|
||||
account.hasPermission("core.log.follow")
|
||||
&& <LogConsole instances={[instanceId]} maxLevel={maxLevel} actionsOnly={actionsOnly}/>
|
||||
}
|
||||
{account.hasPermission("core.log.follow") && <LogConsole instances={[instanceId]} />}
|
||||
{
|
||||
account.hasPermission("core.instance.send_rcon")
|
||||
&& <InstanceRcon id={instanceId} disabled={instance.status !== "running"} />
|
||||
|
||||
Reference in new issue
Block a user