mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
display Factorio version in Instances web UI
This commit is contained in:
1 parent
e341adfb29
commit
8a57d9b5f6
7 files changed
+35
-4
No files matched your search
@@ -9,7 +9,7 @@ import { useAccount } from "../model/account";
|
||||
import { useHosts } from "../model/host";
|
||||
import InstanceStatusTag from "./InstanceStatusTag";
|
||||
import StartStopInstanceButton from "./StartStopInstanceButton";
|
||||
import { InstanceDetails } from "@clusterio/lib";
|
||||
import { InstanceDetails, integerFactorioVersion } from "@clusterio/lib";
|
||||
import Link from "./Link";
|
||||
|
||||
const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare;
|
||||
@@ -46,6 +46,13 @@ export default function InstanceList(props: InstanceListProps) {
|
||||
return `${host.publicAddress}:${instance.gamePort}`;
|
||||
}
|
||||
|
||||
function integerFactorioVersionOrDefault(instance: InstanceDetails) {
|
||||
if (instance.factorioVersion === undefined) {
|
||||
return -1;
|
||||
}
|
||||
return integerFactorioVersion(instance.factorioVersion);
|
||||
}
|
||||
|
||||
let columns: ColumnsType<InstanceDetails> = [
|
||||
{
|
||||
title: "Name",
|
||||
@@ -86,6 +93,12 @@ export default function InstanceList(props: InstanceListProps) {
|
||||
sorter: (a, b) => strcmp(instancePublicAddress(a), instancePublicAddress(b)),
|
||||
responsive: ["lg"],
|
||||
},
|
||||
{
|
||||
title: "Factorio Version",
|
||||
key: "version",
|
||||
render: (_, instance) => instance.factorioVersion ?? "unknown",
|
||||
sorter: (a, b) => integerFactorioVersionOrDefault(a) - integerFactorioVersionOrDefault(b)
|
||||
},
|
||||
{
|
||||
title: "Status",
|
||||
key: "status",
|
||||
|
||||
Reference in new issue
Block a user