mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 08:23:12 +09:00
Merge pull request #660 from clusterio/bugfix/special-case-base-mod
Fix built-in mods showing up as missing in web UI
This commit is contained in:
1 file changed
+15
-2
@@ -242,6 +242,7 @@ type ModsTableProps = {
|
|||||||
changes: ModChange[];
|
changes: ModChange[];
|
||||||
onChange: (change: ModChange) => void;
|
onChange: (change: ModChange) => void;
|
||||||
onRevert: (change: ModChange) => void;
|
onRevert: (change: ModChange) => void;
|
||||||
|
builtInMods: string[];
|
||||||
};
|
};
|
||||||
function ModsTable(props: ModsTableProps) {
|
function ModsTable(props: ModsTableProps) {
|
||||||
const [showAddMods, setShowAddMods] = useState(false);
|
const [showAddMods, setShowAddMods] = useState(false);
|
||||||
@@ -263,6 +264,12 @@ function ModsTable(props: ModsTableProps) {
|
|||||||
|
|
||||||
const mods = [...props.modPack.mods.values(), ...deletedMods.values()].map(
|
const mods = [...props.modPack.mods.values(), ...deletedMods.values()].map(
|
||||||
(mod: lib.ModRecord|lib.ModInfo): lib.ModInfo|lib.ModRecord => {
|
(mod: lib.ModRecord|lib.ModInfo): lib.ModInfo|lib.ModRecord => {
|
||||||
|
if (props.builtInMods.includes(mod.name)) {
|
||||||
|
return {
|
||||||
|
...mod,
|
||||||
|
enabled: (mod as any).enabled ?? false,
|
||||||
|
};
|
||||||
|
}
|
||||||
const candidate = modsMap.get(`${mod.name}_${mod.version}`);
|
const candidate = modsMap.get(`${mod.name}_${mod.version}`);
|
||||||
if (!candidate) {
|
if (!candidate) {
|
||||||
return {
|
return {
|
||||||
@@ -283,7 +290,7 @@ function ModsTable(props: ModsTableProps) {
|
|||||||
|
|
||||||
function actions(mod: lib.ModRecord|lib.ModInfo) {
|
function actions(mod: lib.ModRecord|lib.ModInfo) {
|
||||||
return <Space>
|
return <Space>
|
||||||
{!deletedMods.has(mod.name) && <Typography.Link
|
{!deletedMods.has(mod.name) && !props.builtInMods.includes(mod.name) && <Typography.Link
|
||||||
type="danger"
|
type="danger"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onChange({
|
props.onChange({
|
||||||
@@ -882,7 +889,13 @@ export default function ModPackViewPage() {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
<ModsTable modPack={modifiedModPack} changes={changes} onChange={pushChange} onRevert={revertChange} />
|
<ModsTable
|
||||||
|
modPack={modifiedModPack}
|
||||||
|
changes={changes}
|
||||||
|
onChange={pushChange}
|
||||||
|
onRevert={revertChange}
|
||||||
|
builtInMods={["base", "core"]}
|
||||||
|
/>
|
||||||
<SettingsTable
|
<SettingsTable
|
||||||
modPack={modifiedModPack}
|
modPack={modifiedModPack}
|
||||||
changes={changes}
|
changes={changes}
|
||||||
|
|||||||
Reference in new issue
Block a user