mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Merge pull request #539 from Hornwitser/small-things-13
Small things 13
This commit is contained in:
23 files changed
+82
-48
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../lib" },
|
||||
{ "path": "../lib/tsconfig.web.json" },
|
||||
{ "path": "../web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "package.json" ],
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
dist/web/build
|
||||
@@ -77,5 +77,3 @@ export default class ExponentialBackoff {
|
||||
return Math.random() * this.base * 2 ** this._exp * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ExponentialBackoff;
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"include": [
|
||||
"browser.ts",
|
||||
"package.json",
|
||||
"./src/api.ts",
|
||||
"./src/config/*.ts",
|
||||
"./src/data/*.ts",
|
||||
"./src/errors.ts",
|
||||
"./src/factorio/exchange_string.ts",
|
||||
"./src/helpers.ts",
|
||||
"./src/hash.ts",
|
||||
"./src/ini.ts",
|
||||
"./src/link/*.ts",
|
||||
"./src/logging.ts",
|
||||
"./src/permissions.ts",
|
||||
"./src/prometheus.ts",
|
||||
"./src/plugin.ts",
|
||||
"./src/schema.ts",
|
||||
"./src/subscriptions.ts",
|
||||
"./src/zip_ops.ts",
|
||||
"./src/ExponentialBackoff.ts",
|
||||
"./src/RateLimiter.ts",
|
||||
"./src/TypedEventEmitter.ts",
|
||||
],
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist/web/build",
|
||||
}
|
||||
}
|
||||
@@ -26,14 +26,14 @@ export default function AssignInstanceModal(props: AssignInstanceModalProps) {
|
||||
let control = useContext(ControlContext);
|
||||
|
||||
function handleAssign() {
|
||||
let hostId = form.getFieldValue("host");
|
||||
let hostId: number | string | undefined = form.getFieldValue("host");
|
||||
if (hostId === undefined) {
|
||||
setOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (hostId === "null") {
|
||||
hostId = null;
|
||||
if (typeof hostId === "string") {
|
||||
hostId = undefined;
|
||||
}
|
||||
|
||||
setApplying(true);
|
||||
|
||||
@@ -218,7 +218,7 @@ export default function HostsPage() {
|
||||
{
|
||||
title: "Connected",
|
||||
key: "connected",
|
||||
render: host => <Tag
|
||||
render: (_, host) => <Tag
|
||||
color={host.connected ? "#389e0d" : "#cf1322"}
|
||||
>
|
||||
{host.connected ? "Connected" : "Disconnected"}
|
||||
|
||||
@@ -55,14 +55,14 @@ export default function InstanceList(props: InstanceListProps) {
|
||||
{
|
||||
title: "Assigned Host",
|
||||
key: "assignedHost",
|
||||
render: instance => hostName(instance.assignedHost),
|
||||
render: (_, instance) => hostName(instance.assignedHost),
|
||||
sorter: (a, b) => strcmp(hostName(a.assignedHost), hostName(b.assignedHost)),
|
||||
responsive: ["sm"],
|
||||
},
|
||||
{
|
||||
title: "Public address",
|
||||
key: "publicAddress",
|
||||
render: instance => {
|
||||
render: (_, instance) => {
|
||||
let publicAddress = instancePublicAddress(instance);
|
||||
return publicAddress ? <>
|
||||
{publicAddress}
|
||||
@@ -83,7 +83,7 @@ export default function InstanceList(props: InstanceListProps) {
|
||||
{
|
||||
title: "Status",
|
||||
key: "status",
|
||||
render: instance => <InstanceStatusTag status={instance["status"]} />,
|
||||
render: (_, instance) => <InstanceStatusTag status={instance["status"]} />,
|
||||
sorter: (a, b) => strcmp(a["status"], b["status"]),
|
||||
},
|
||||
];
|
||||
@@ -91,7 +91,7 @@ export default function InstanceList(props: InstanceListProps) {
|
||||
if (account.hasAnyPermission("core.instance.start", "core.instance.stop")) {
|
||||
columns.push({
|
||||
key: "action",
|
||||
render: instance => <StartStopInstanceButton
|
||||
render: (_, instance) => <StartStopInstanceButton
|
||||
buttonProps={{ size: "small" }}
|
||||
instance={instance}
|
||||
/>,
|
||||
|
||||
@@ -185,14 +185,14 @@ function SearchModsTable(props: SearchModsTableProps) {
|
||||
{
|
||||
title: "Title",
|
||||
key: "title",
|
||||
render: (result:ModResult) => result.versions[0].title,
|
||||
render: (_, result) => result.versions[0].title,
|
||||
defaultSortOrder: "ascend",
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: "Author",
|
||||
key: "author",
|
||||
render: (result:ModResult) => result.versions[0].author,
|
||||
render: (_, result) => result.versions[0].author,
|
||||
responsive: ["lg"],
|
||||
sorter: true,
|
||||
},
|
||||
@@ -200,7 +200,7 @@ function SearchModsTable(props: SearchModsTableProps) {
|
||||
title: "Version",
|
||||
key: "version",
|
||||
align: "right",
|
||||
render: (result:ModResult) => <Select
|
||||
render: (_, result) => <Select
|
||||
size="small"
|
||||
bordered={false}
|
||||
value={modResultSelectedVersion.get(result.name) || 0}
|
||||
@@ -216,7 +216,7 @@ function SearchModsTable(props: SearchModsTableProps) {
|
||||
title: "Action",
|
||||
key: "action",
|
||||
responsive: ["lg"],
|
||||
render: (result:ModResult) => (
|
||||
render: (_, result) => (
|
||||
actions(result.versions[modResultSelectedVersion.get(result.name) || 0])
|
||||
),
|
||||
},
|
||||
@@ -352,7 +352,7 @@ function ModsTable(props: ModsTableProps) {
|
||||
{
|
||||
title: "Name",
|
||||
key: "name",
|
||||
render: mod => <>
|
||||
render: (_, mod: any) => <>
|
||||
{mod.error === "missing" && <Tooltip title="Mod is missing from storage.">
|
||||
<FileUnknownOutlined style={{ color: "#a61d24" }} />{" "}
|
||||
</Tooltip>}
|
||||
|
||||
@@ -206,7 +206,7 @@ export default function ModsPage() {
|
||||
{
|
||||
title: "Mods",
|
||||
key: "roles",
|
||||
render: modPack => modPack.mods.size,
|
||||
render: (_, modPack) => modPack.mods.size,
|
||||
},
|
||||
]}
|
||||
dataSource={[...modPacks.values()]}
|
||||
@@ -233,7 +233,7 @@ export default function ModsPage() {
|
||||
title: "Version",
|
||||
key: "version",
|
||||
align: "right",
|
||||
render: mod => <>
|
||||
render: (_, mod) => <>
|
||||
{`${mod.version} `}
|
||||
<Typography.Text type="secondary">{`/ ${mod.factorioVersion}`}</Typography.Text>
|
||||
</>,
|
||||
@@ -248,7 +248,7 @@ export default function ModsPage() {
|
||||
title: "Size",
|
||||
key: "size",
|
||||
responsive: ["lg"],
|
||||
render: mod => lib.formatBytes(mod.size),
|
||||
render: (_, mod) => lib.formatBytes(mod.size),
|
||||
align: "right",
|
||||
sorter: (a, b) => a.size - b.size,
|
||||
},
|
||||
@@ -256,7 +256,7 @@ export default function ModsPage() {
|
||||
title: "Action",
|
||||
key: "action",
|
||||
responsive: ["lg"],
|
||||
render: mod => actions(mod),
|
||||
render: (_, mod) => actions(mod),
|
||||
},
|
||||
]}
|
||||
expandable={{
|
||||
|
||||
@@ -13,11 +13,15 @@ type PageLayoutProps = {
|
||||
};
|
||||
export default function PageLayout(props: PageLayoutProps) {
|
||||
return <>
|
||||
<Breadcrumb className="site-breadcrumb">
|
||||
{props.nav.map((part, index) => <Breadcrumb.Item key={index}>
|
||||
{part.path ? <Link to={part.path}>{part.name}</Link> : part.name}
|
||||
</Breadcrumb.Item>)}
|
||||
</Breadcrumb>
|
||||
<Breadcrumb
|
||||
className="site-breadcrumb"
|
||||
itemRender={(route, params, routes, paths) => (
|
||||
route.href ? <Link to={route.href}>{route.title}</Link> : route.title
|
||||
)}
|
||||
items={props.nav.map(
|
||||
(part, index) => ({ href: part.path, title: part.name }))
|
||||
}
|
||||
/>
|
||||
<Content className="site-layout-content" >
|
||||
{props.children}
|
||||
</Content>
|
||||
|
||||
@@ -50,14 +50,14 @@ export default function PluginsPage() {
|
||||
{
|
||||
title: "Name",
|
||||
key: "name",
|
||||
render: plugin => (plugin.info ? plugin.info.title : plugin.meta.name),
|
||||
render: (_, plugin) => (plugin.info ? plugin.info.title : plugin.meta.name),
|
||||
defaultSortOrder: "ascend",
|
||||
sorter: (a, b) => strcmp(a.info ? a.info.title : a.meta.name, b.info ? b.info.title : b.meta.name),
|
||||
},
|
||||
{
|
||||
title: "Version",
|
||||
key: "version",
|
||||
render: plugin => {
|
||||
render: (_, plugin) => {
|
||||
if (!plugin.package) {
|
||||
return "Error loading module";
|
||||
}
|
||||
|
||||
@@ -211,10 +211,10 @@ export default function SavesList(props: { instance: lib.InstanceDetails }) {
|
||||
columns={[
|
||||
{
|
||||
title: "Name",
|
||||
render: save => <>
|
||||
render: (_, save) => <>
|
||||
{save.name}
|
||||
{save.loaded && <Tooltip title="Currently loaded save"><CaretLeftOutlined/></Tooltip>}
|
||||
{save.default && <Tooltip title="Save loaded by default"><LeftOutlined/></Tooltip>}
|
||||
{save.loadByDefault && <Tooltip title="Save loaded by default"><LeftOutlined/></Tooltip>}
|
||||
</>,
|
||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||
},
|
||||
@@ -222,14 +222,14 @@ export default function SavesList(props: { instance: lib.InstanceDetails }) {
|
||||
title: "Size",
|
||||
key: "size",
|
||||
responsive: ["sm"],
|
||||
render: save => lib.formatBytes(save.size),
|
||||
render: (_, save) => lib.formatBytes(save.size),
|
||||
align: "right",
|
||||
sorter: (a, b) => a.size - b.size,
|
||||
},
|
||||
{
|
||||
title: "Last Modified",
|
||||
key: "mtimeMs",
|
||||
render: save => new Date(save.mtimeMs).toLocaleString(),
|
||||
render: (_, save) => new Date(save.mtimeMs).toLocaleString(),
|
||||
sorter: (a, b) => a.mtimeMs - b.mtimeMs,
|
||||
defaultSortOrder: "descend",
|
||||
},
|
||||
|
||||
@@ -304,27 +304,27 @@ export default function UserViewPage() {
|
||||
{
|
||||
title: "Instance",
|
||||
key: "instance",
|
||||
render: ([id]) => instanceName(id),
|
||||
render: (_, [id]) => instanceName(id),
|
||||
defaultSortOrder: "ascend",
|
||||
sorter: (a, b) => strcmp(instanceName(a[0]), instanceName(b[0])),
|
||||
},
|
||||
{
|
||||
title: "Online time",
|
||||
key: "onlineTime",
|
||||
render: ([, stats]) => formatDuration(stats.onlineTimeMs || 0),
|
||||
render: (_, [, stats]) => formatDuration(stats.onlineTimeMs || 0),
|
||||
sorter: (a, b) => (a[1].onlineTimeMs || 0) - (b[1].onlineTimeMs || 0),
|
||||
},
|
||||
{
|
||||
title: "Join count",
|
||||
key: "joinCoint",
|
||||
render: ([, stats]) => stats.joinCount || 0,
|
||||
render: (_, [, stats]) => stats.joinCount || 0,
|
||||
sorter: (a, b) => (a[1].joinCount || 0) - (b[1].joinCount || 0),
|
||||
responsive: ["sm"],
|
||||
},
|
||||
{
|
||||
title: "Last seen",
|
||||
key: "lastSeen",
|
||||
render: ([id]) => formatLastSeen(user, id),
|
||||
render: (_, [id]) => formatLastSeen(user, id),
|
||||
sorter: (a, b) => sortLastSeen(user, user, a[0], b[0]),
|
||||
},
|
||||
]}
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function UsersPage() {
|
||||
{
|
||||
title: "Name",
|
||||
key: "name",
|
||||
render: (user: lib.User) => <Space>
|
||||
render: (_, user) => <Space>
|
||||
{user.name}
|
||||
<span>
|
||||
{user.isAdmin && <Tag color="gold">Admin</Tag>}
|
||||
@@ -96,14 +96,14 @@ export default function UsersPage() {
|
||||
{
|
||||
title: "Roles",
|
||||
key: "roles",
|
||||
render: (user: lib.User) => (
|
||||
render: (_, user) => (
|
||||
[...user.roleIds].map(id => <Tag key={id}>{(roles.get(id) || { name: id }).name}</Tag>)
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "Online time",
|
||||
key: "onlineTime",
|
||||
render: (user: lib.User) => (user.playerStats?.onlineTimeMs
|
||||
render: (_, user) => (user.playerStats?.onlineTimeMs
|
||||
? formatDuration(user.playerStats.onlineTimeMs) : null),
|
||||
sorter: (a, b) => (a.playerStats?.onlineTimeMs ?? 0) -
|
||||
(b.playerStats?.onlineTimeMs ?? 0),
|
||||
@@ -112,7 +112,7 @@ export default function UsersPage() {
|
||||
{
|
||||
title: "Last seen",
|
||||
key: "lastSeen",
|
||||
render: (user: lib.User) => formatLastSeen(user),
|
||||
render: (_, user) => formatLastSeen(user),
|
||||
sorter: (a, b) => sortLastSeen(a, b),
|
||||
responsive: ["lg"],
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../lib" },
|
||||
{ "path": "../lib/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "src/**/*.tsx", "src/**/*.ts", "package.json", "global.d.ts" ],
|
||||
"compilerOptions": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../../packages/lib" },
|
||||
{ "path": "../../packages/lib/tsconfig.web.json" },
|
||||
{ "path": "../../packages/web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../../packages/lib" },
|
||||
{ "path": "../../packages/lib/tsconfig.web.json" },
|
||||
{ "path": "../../packages/web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../../packages/lib" },
|
||||
{ "path": "../../packages/lib/tsconfig.web.json" },
|
||||
{ "path": "../../packages/web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../../packages/lib" },
|
||||
{ "path": "../../packages/lib/tsconfig.web.json" },
|
||||
{ "path": "../../packages/web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../../packages/lib" },
|
||||
{ "path": "../../packages/lib/tsconfig.web.json" },
|
||||
{ "path": "../../packages/web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "package.json" ],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.web.json",
|
||||
"references": [
|
||||
{ "path": "../../packages/lib" },
|
||||
{ "path": "../../packages/lib/tsconfig.web.json" },
|
||||
{ "path": "../../packages/web_ui/tsconfig.web.json" },
|
||||
],
|
||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
|
||||
|
||||
@@ -92,7 +92,7 @@ function StoragePage() {
|
||||
if (aName > bName) { return 1; }
|
||||
return 0;
|
||||
},
|
||||
render: item => {
|
||||
render: (_, item) => {
|
||||
let localeName = getLocaleName(item[0]);
|
||||
let hasMeta = itemMetadata.get(item[0]);
|
||||
|
||||
@@ -108,7 +108,7 @@ function StoragePage() {
|
||||
align: "right",
|
||||
defaultSortOrder: "descend",
|
||||
sorter: (a, b) => a[1] - b[1],
|
||||
render: item => numberFormat.format(item[1]),
|
||||
render: (_, item) => numberFormat.format(item[1]),
|
||||
},
|
||||
]}
|
||||
dataSource={filter ? storage.filter(filter) : storage}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./packages/lib" },
|
||||
{ "path": "./packages/lib/tsconfig.web.json" },
|
||||
{ "path": "./packages/controller" },
|
||||
{ "path": "./packages/controller/tsconfig.web.json" },
|
||||
{ "path": "./packages/host" },
|
||||
|
||||
Reference in new issue
Block a user