Implement custom input for mod pack config (#547)

Add custom input component support to the Web UI config in order to
provide a user friendly dropdown selector for the Mod Pack that is
configured as default on the controller and overridden instances.
This commit is contained in:
Hornwitser authored and GitHub committed 2024-01-17 20:29:04 +01:00
1 parent 80f0c63113
commit 863d90c7fb
8 files changed
+86 -13

No files matched your search

+5
View File
@@ -77,6 +77,11 @@ export interface FieldDefinition {
* Text used to describe the config field in user interfaces.
*/
description?: string;
/**
* Web UI component to use for rending this input. Can be extended by
* @{link "@clusterio/web_ui".BaseWebPlugin.inputComponents}
*/
inputComponent?: string;
/**
* True if this field can be set to null. Defaults to false.
*/
+7 -3
View File
@@ -150,6 +150,7 @@ export class ControllerConfig extends classes.Config<ControllerConfigFields> {
"controller.default_mod_pack_id": {
title: "Default Mod Pack",
description: "Mod pack used by default for instances.",
inputComponent: "mod_pack",
type: "number",
optional: true,
},
@@ -265,7 +266,7 @@ export interface InstanceConfigFields {
"factorio.rcon_port": number | null;
"factorio.rcon_password": string | null;
"factorio.player_online_autosave_slots": number;
"factorio.mod_pack": number | null;
"factorio.mod_pack_id": number | null;
"factorio.enable_save_patching": boolean;
"factorio.enable_whitelist": boolean;
"factorio.enable_authserver_bans": boolean;
@@ -340,8 +341,11 @@ export class InstanceConfig extends classes.Config<InstanceConfigFields> {
type: "number",
initialValue: 5,
},
"factorio.mod_pack": {
description: "Mod pack to use on this server",
"factorio.mod_pack_id": {
title: "Mod Pack",
description:
"Mod pack to use on this server, if not set the default configured on the controller will be used",
inputComponent: "mod_pack",
restartRequired: true,
type: "number",
optional: true,