mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 15:30:41 +09:00
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:
1 parent
80f0c63113
commit
863d90c7fb
8 files changed
+86
-13
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type React from "react";
|
||||
import type { AccountRole, Logger, PluginWebpackEnvInfo } from "@clusterio/lib";
|
||||
import type { AccountRole, FieldDefinition, Logger, PluginWebpackEnvInfo } from "@clusterio/lib";
|
||||
import type { Control } from "./util/websocket";
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,14 @@ export interface PluginLoginForm {
|
||||
* when an authentication token is aquired via this form.
|
||||
*/
|
||||
Component: React.ComponentType<{ setToken(token: string): void }>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InputComponentProps {
|
||||
fieldDefinition: FieldDefinition,
|
||||
value: null | boolean | number | string,
|
||||
onChange: (value: null | boolean | number | string) => void,
|
||||
}
|
||||
export type InputComponent = React.ComponentType<InputComponentProps>;
|
||||
|
||||
export type UserAccount = {
|
||||
/** Name of the currently logged in account. */
|
||||
@@ -94,6 +101,11 @@ export default class BaseWebPlugin {
|
||||
* List of pages provided by this plugin
|
||||
*/
|
||||
pages: PluginPage[] = [];
|
||||
/**
|
||||
* Additional Config inputComponent types available to render config
|
||||
* entries with.
|
||||
*/
|
||||
inputComponents: Record<string, InputComponent> = {};
|
||||
/**
|
||||
* Extra react component to add to core components
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user