[FEATURE] Fixed file manager and adjusted starting display (#5)
Co-authored-by: Dunemask <dunemask@gmail.com> Reviewed-on: https://gitea.dunemask.dev/elysium/minecluster/pulls/5
This commit is contained in:
parent
4f19cf19d9
commit
fb57c03ba7
9 changed files with 63 additions and 45 deletions
|
@ -19,12 +19,12 @@ import { Link } from "react-router-dom";
|
|||
|
||||
export default function ServerCard(props) {
|
||||
const { server, openRcon } = props;
|
||||
const { name, metrics, started } = server;
|
||||
const { name, metrics, ftpAvailable, serverAvailable, services } = server;
|
||||
const startServer = useStartServer(name);
|
||||
const stopServer = useStopServer(name);
|
||||
const deleteServer = useDeleteServer(name);
|
||||
function toggleRcon() {
|
||||
if (!started) return;
|
||||
if (!services.includes("server")) return;
|
||||
openRcon();
|
||||
}
|
||||
|
||||
|
@ -60,14 +60,26 @@ export default function ServerCard(props) {
|
|||
</Box>
|
||||
)}
|
||||
<Chip
|
||||
label={started ? "Online" : "Offline"}
|
||||
color={started ? "success" : "error"}
|
||||
label={
|
||||
services.includes("server")
|
||||
? serverAvailable
|
||||
? "Online"
|
||||
: "Starting"
|
||||
: "Offline"
|
||||
}
|
||||
color={
|
||||
services.includes("server")
|
||||
? serverAvailable
|
||||
? "success"
|
||||
: "info"
|
||||
: "error"
|
||||
}
|
||||
className="server-card-status-indicator"
|
||||
/>
|
||||
</CardContent>
|
||||
<div className="server-card-actions-wrapper">
|
||||
<CardActions className="server-card-actions server-card-element">
|
||||
{started && (
|
||||
{services.includes("server") && (
|
||||
<IconButton
|
||||
color="error"
|
||||
aria-label="Stop Server"
|
||||
|
@ -77,7 +89,7 @@ export default function ServerCard(props) {
|
|||
<StopIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
{!started && (
|
||||
{!services.includes("server") && (
|
||||
<IconButton
|
||||
color="success"
|
||||
aria-label="Start Server"
|
||||
|
@ -92,7 +104,7 @@ export default function ServerCard(props) {
|
|||
aria-label="RCON"
|
||||
onClick={toggleRcon}
|
||||
size="large"
|
||||
disabled={!started}
|
||||
disabled={!services.includes("server")}
|
||||
>
|
||||
<TerminalIcon />
|
||||
</IconButton>
|
||||
|
@ -106,11 +118,12 @@ export default function ServerCard(props) {
|
|||
<EditIcon />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
color="primary"
|
||||
color="info"
|
||||
aria-label="Files"
|
||||
size="large"
|
||||
component={Link}
|
||||
to={`/mcl/files?server=${name}`}
|
||||
disabled={!services.includes("ftp")}
|
||||
>
|
||||
<FolderIcon />
|
||||
</IconButton>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue