feat: support custom server deployment drafts
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import type {
|
||||
GamePluginResponse,
|
||||
JobResponse,
|
||||
RunEndpointResponse,
|
||||
ServerInstanceResponse,
|
||||
GamePluginResponse,
|
||||
JobResponse,
|
||||
RunEndpointResponse,
|
||||
ServerDeploymentMode,
|
||||
ServerInstanceResponse,
|
||||
ServerInstanceState
|
||||
} from "../api/types";
|
||||
|
||||
@@ -15,8 +16,17 @@ export interface ServerCreateFormState {
|
||||
name: string;
|
||||
pluginId: string;
|
||||
runEndpointId: string;
|
||||
profileKey: string;
|
||||
bindings: Record<string, string>;
|
||||
profileKey: string;
|
||||
bindings: Record<string, string>;
|
||||
createInputs: Record<string, string>;
|
||||
deploymentMode: ServerDeploymentMode;
|
||||
serverRoot: string;
|
||||
workingDirectory: string;
|
||||
installCommand: string;
|
||||
startCommand: string;
|
||||
stopCommand: string;
|
||||
statusCommand: string;
|
||||
shell: "" | "posix-sh" | "powershell" | "cmd";
|
||||
}
|
||||
|
||||
export interface RuntimeBindingField {
|
||||
@@ -55,8 +65,17 @@ export const emptyServerCreateForm: ServerCreateFormState = {
|
||||
name: "",
|
||||
pluginId: "",
|
||||
runEndpointId: "",
|
||||
profileKey: "",
|
||||
bindings: {}
|
||||
profileKey: "",
|
||||
bindings: {},
|
||||
createInputs: {},
|
||||
deploymentMode: "guided-install",
|
||||
serverRoot: "",
|
||||
workingDirectory: "",
|
||||
installCommand: "",
|
||||
startCommand: "",
|
||||
stopCommand: "",
|
||||
statusCommand: "",
|
||||
shell: ""
|
||||
};
|
||||
|
||||
export function summarizeServerManagement(instances: ServerInstanceResponse[], jobs: JobResponse[]): ServerManagementSummary {
|
||||
@@ -104,8 +123,13 @@ export function defaultServerCreateForm(plugins: GamePluginResponse[], endpoints
|
||||
...emptyServerCreateForm,
|
||||
pluginId: plugin?.id ?? "",
|
||||
profileKey: plugin?.runtimeProfiles?.lifecycleProfiles?.[0]?.key ?? "",
|
||||
runEndpointId: endpoints[0]?.id ?? ""
|
||||
};
|
||||
runEndpointId: "",
|
||||
createInputs: pluginCreateInputDefaults(plugin)
|
||||
};
|
||||
}
|
||||
|
||||
export function pluginCreateInputDefaults(plugin: GamePluginResponse | undefined): Record<string, string> {
|
||||
return Object.fromEntries((plugin?.createFields ?? []).map((field) => [field.key, field.defaultValue ?? ""]));
|
||||
}
|
||||
|
||||
export function runtimeBindingFields(plugin: GamePluginResponse | undefined, profileKey: string): RuntimeBindingField[] {
|
||||
|
||||
Reference in New Issue
Block a user