mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
26 lines
660 B
TypeScript
26 lines
660 B
TypeScript
import React, { useContext } from "react";
|
|
|
|
import * as lib from "@clusterio/lib";
|
|
|
|
import BaseConfigTree from "./BaseConfigTree";
|
|
import ControlContext from "./ControlContext";
|
|
|
|
|
|
export default function ControllerConfigTree() {
|
|
let control = useContext(ControlContext);
|
|
|
|
async function retrieveConfig() {
|
|
return await control.send(new lib.ControllerConfigGetRequest());
|
|
}
|
|
|
|
async function setConfig(fields: Record<string, string | Record<string, string>>) {
|
|
await control.send(new lib.ControllerConfigSetRequest(fields));
|
|
}
|
|
|
|
return <BaseConfigTree
|
|
ConfigClass={lib.ControllerConfig}
|
|
retrieveConfig={retrieveConfig}
|
|
setConfig={setConfig}
|
|
/>;
|
|
}
|