mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 15:33:12 +09:00
Mark missing or missmatched checksum for mods in mod packs
Mark mods in the UI and the mod-pack show ctl command that are missing with a question mark and mark mods with a missmatched checksum with an exclamation mark.
This commit is contained in:
1 parent
e6add2f7e6
commit
fb75e47eda
3 files changed
+36
-4
No files matched your search
@@ -6,6 +6,8 @@ import {
|
||||
} from "antd";
|
||||
import InfoCircleOutlined from "@ant-design/icons/InfoCircleOutlined";
|
||||
import ExportOutlined from "@ant-design/icons/ExportOutlined";
|
||||
import FileUnknownOutlined from "@ant-design/icons/FileUnknownOutlined";
|
||||
import FileExclamationOutlined from "@ant-design/icons/FileExclamationOutlined";
|
||||
import CloseOutlined from "@ant-design/icons/CloseOutlined";
|
||||
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
||||
import PlusOutlined from "@ant-design/icons/PlusOutlined";
|
||||
@@ -213,8 +215,16 @@ function ModsTable(props) {
|
||||
const mods = [...props.modPack.mods.values(), ...deletedMods.values()].map(
|
||||
mod => {
|
||||
const candidate = modListMap.get(`${mod.name}_${mod.version}`);
|
||||
if (!candidate || mod.sha1 && candidate.sha1 !== mod.sha1) {
|
||||
return mod;
|
||||
if (!candidate) {
|
||||
return {
|
||||
...mod,
|
||||
error: "missing",
|
||||
};
|
||||
} else if (mod.sha1 && candidate.sha1 !== mod.sha1) {
|
||||
return {
|
||||
...mod,
|
||||
error: "bad_checksum",
|
||||
};
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
@@ -289,7 +299,15 @@ function ModsTable(props) {
|
||||
{
|
||||
title: "Name",
|
||||
key: "name",
|
||||
render: mod => mod.title || mod.name,
|
||||
render: mod => <>
|
||||
{mod.error === "missing" && <Tooltip title="Mod is missing from storage.">
|
||||
<FileUnknownOutlined style={{ color: "#a61d24" }} />{" "}
|
||||
</Tooltip>}
|
||||
{mod.error === "bad_checksum" && <Tooltip title="Mod checksum missmatch.">
|
||||
<FileExclamationOutlined style={{ color: "#a61d24" }} />{" "}
|
||||
</Tooltip>}
|
||||
{mod.title || mod.name}
|
||||
</>,
|
||||
defaultSortOrder: "ascend",
|
||||
sorter: (a, b) => strcmp(a.name, b.name),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user