[FEATURE] Cleaned up terminal display
This commit is contained in:
parent
1bdc10c81e
commit
beca266eef
1 changed files with 25 additions and 8 deletions
|
@ -2,10 +2,21 @@ import { useState, useEffect, useRef } from "react";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import RconSocket from "./RconSocket.js";
|
import RconSocket from "./RconSocket.js";
|
||||||
import "@mcl/css/rcon.css";
|
import "@mcl/css/rcon.css";
|
||||||
|
|
||||||
|
function RconLogSkeleton() {
|
||||||
|
return (
|
||||||
|
<Skeleton
|
||||||
|
variant="text"
|
||||||
|
width="100%"
|
||||||
|
sx={{ backgroundColor: "rgba(255,255,255,.25)" }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function RconView(props) {
|
export default function RconView(props) {
|
||||||
const { serverId } = props;
|
const { serverId } = props;
|
||||||
const logsRef = useRef(0);
|
const logsRef = useRef(0);
|
||||||
|
@ -49,10 +60,13 @@ export default function RconView(props) {
|
||||||
backgroundColor: "rgba(0,0,0,.815)",
|
backgroundColor: "rgba(0,0,0,.815)",
|
||||||
color: "white",
|
color: "white",
|
||||||
borderRadius: "4px",
|
borderRadius: "4px",
|
||||||
width:"100%"
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{logs.map((v, k) => (
|
{logs.length === 0 &&
|
||||||
|
[...Array(20).keys()].map((_v, i) => <RconLogSkeleton key={i} />)}
|
||||||
|
{logs.length > 0 &&
|
||||||
|
logs.map((v, k) => (
|
||||||
<Box key={k}>
|
<Box key={k}>
|
||||||
<Typography variant="subtitle2">{v}</Typography>
|
<Typography variant="subtitle2">{v}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -60,7 +74,7 @@ export default function RconView(props) {
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
className="rconActions"
|
className="rconActions"
|
||||||
sx={{ marginTop: "auto", paddingTop: "1rem" }}
|
sx={{ marginTop: "auto", paddingTop: "1rem", width: "100%" }}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
id="outlined-basic"
|
id="outlined-basic"
|
||||||
|
@ -69,9 +83,12 @@ export default function RconView(props) {
|
||||||
value={cmd}
|
value={cmd}
|
||||||
onChange={updateCmd}
|
onChange={updateCmd}
|
||||||
disabled={!(rcon && rcon.rconLive && !rcon.rconError)}
|
disabled={!(rcon && rcon.rconLive && !rcon.rconError)}
|
||||||
|
sx={{ width: "100%" }}
|
||||||
/>
|
/>
|
||||||
{rcon && rcon.rconLive && !rcon.rconError && (
|
{rcon && rcon.rconLive && !rcon.rconError && (
|
||||||
<Button onClick={sendCommand}>Send</Button>
|
<Button onClick={sendCommand} sx={{ padding: "0 2rem" }}>
|
||||||
|
Send
|
||||||
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!(rcon && rcon.rconLive && !rcon.rconError) && (
|
{!(rcon && rcon.rconLive && !rcon.rconError) && (
|
||||||
<Button color="secondary">Not Connected</Button>
|
<Button color="secondary">Not Connected</Button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue