Rename Master to Controller

The role of the master server as the party controlling every part of the
cluster is not well reflected in its name and has caused confusion among
users on several occasions.  Rename master to controller to better
reflects its role.
This commit is contained in:
Hornwitser committed 2023-02-22 15:30:51 +01:00
1 parent 6ae4c8ef46
commit 70ad295a89
119 files changed
+1394 -1376

No files matched your search

+3 -3
View File
@@ -25,18 +25,18 @@ function ErrorCard(props) {
export default function App(props) {
let [connected, setConnected] = useState(false);
let [token, setToken] = useState(localStorage.getItem("master_token") || null);
let [token, setToken] = useState(localStorage.getItem("controller_token") || null);
let connector = props.control.connector;
function clearToken() {
setToken(null);
connector.token = null;
localStorage.removeItem("master_token");
localStorage.removeItem("controller_token");
}
useEffect(() => {
function onConnect() {
localStorage.setItem("master_token", token);
localStorage.setItem("controller_token", token);
setConnected(true);
}
@@ -6,16 +6,16 @@ import BaseConfigTree from "./BaseConfigTree";
import ControlContext from "./ControlContext";
export default function MasterConfigTree(props) {
export default function ControllerConfigTree(props) {
let control = useContext(ControlContext);
async function retrieveConfig() {
let result = await libLink.messages.getMasterConfig.send(control);
let result = await libLink.messages.getControllerConfig.send(control);
return result.serialized_config;
}
async function setField(field, value) {
await libLink.messages.setMasterConfigField.send(control, {
await libLink.messages.setControllerConfigField.send(control, {
field,
value: String(value),
});
@@ -30,11 +30,11 @@ export default function MasterConfigTree(props) {
return;
}
}
await libLink.messages.setMasterConfigProp.send(control, data);
await libLink.messages.setControllerConfigProp.send(control, data);
}
return <BaseConfigTree
ConfigClass={libConfig.MasterConfig}
ConfigClass={libConfig.ControllerConfig}
retrieveConfig={retrieveConfig}
setField={setField}
setProp={setProp}
@@ -4,22 +4,22 @@ import { Typography } from "antd";
import PluginExtra from "./PluginExtra";
import LogConsole from "./LogConsole";
import { useAccount } from "../model/account";
import MasterConfigTree from "./MasterConfigTree";
import ControllerConfigTree from "./ControllerConfigTree";
import PageLayout from "./PageLayout";
const { Title } = Typography;
export default function MasterPage() {
export default function ControllerPage() {
let account = useAccount();
return <PageLayout nav={[{ name: "Master" }]}>
<h2>Master</h2>
return <PageLayout nav={[{ name: "Controller" }]}>
<h2>Controller</h2>
{account.hasPermission("core.log.follow") && <>
<Title level={5} style={{ marginTop: 16 }}>Console</Title>
<LogConsole master={true} />
<LogConsole controller={true} />
</>}
{account.hasPermission("core.master.get_config") && <MasterConfigTree />}
<PluginExtra component="MasterPage" />
{account.hasPermission("core.controller.get_config") && <ControllerConfigTree />}
<PluginExtra component="ControllerPage" />
</PageLayout>;
};
@@ -78,7 +78,7 @@ export default function InstanceViewPage(props) {
<Alert
message={instance["status"] === "deleted" ? "Instance has been deleted" : "Instance not found" }
showIcon
description={<>Instance with id {instanceId} was not found on the master server.</>}
description={<>Instance with id {instanceId} was not found on the controller.</>}
type="warning"
action={
<Button
@@ -28,7 +28,7 @@ function CreateInstanceButton(props) {
let instanceConfig = new libConfig.InstanceConfig("control");
await instanceConfig.init();
instanceConfig.set("instance.name", values.instanceName);
let serialized_config = instanceConfig.serialize("master");
let serialized_config = instanceConfig.serialize("controller");
await libLink.messages.createInstance.send(control, { serialized_config });
setVisible(false);
history.push(`/instances/${instanceConfig.get("instance.id")}/view`);
@@ -59,7 +59,7 @@ export default function LogConsole(props) {
useEffect(() => {
let logFilter = {
all: props.all || false,
master: props.master || false,
controller: props.controller || false,
slave_ids: props.slaves || [],
instance_ids: props.instances || [],
};
@@ -94,7 +94,7 @@ export default function LogConsole(props) {
return () => {
control.offLog(logFilter, logHandler);
};
}, [props.all, props.master, (props.slaves || []).join(), (props.instances || []).join()]);
}, [props.all, props.controller, (props.slaves || []).join(), (props.instances || []).join()]);
return <>
<Paragraph code className="instance-console">
+1 -1
View File
@@ -10,7 +10,7 @@ const { Paragraph } = Typography;
function TokenAuth(props) {
return <>
<Paragraph>If you have generated an authentication token from the master server, use that here.</Paragraph>
<Paragraph>If you have generated an authentication token from the controller, use that here.</Paragraph>
<Form
name="login"
onFinish={(values) => { props.setToken(values.token.trim()); }}
@@ -13,9 +13,10 @@ export default function ModDetails(props) {
return <Descriptions className="borderless" bordered size="small" column={{ xs: 1, sm: 1, md: 1, lg: 2 }}>
{mod.error && <Descriptions.Item label={<><ExclamationCircleOutlined/> Error</>} span={2}>
{mod.error === "missing" && "The given version of this mod is missing from the master storage."}
{mod.error === "missing" && "The given version of this mod is missing from the controller storage."}
{mod.error === "bad_checksum"
&& "Checksum of the mod in the master storage does not match the checksum provided by this mod pack."
&& "Checksum of the mod in the controller storage does not match the checksum provided " +
"by this mod pack."
}
</Descriptions.Item>}
{props.actions && !screens.lg
@@ -670,7 +670,7 @@ export default function ModPackViewPage() {
className="site-page-header"
title="Mod Pack Not Found"
/>
<p>Mod pack with id {modPackId} was not found on the master server.</p>
<p>Mod pack with id {modPackId} was not found on the controller.</p>
</PageLayout>;
}
@@ -37,7 +37,7 @@ export default function PluginViewPage() {
if (!pluginMeta) {
return <PageLayout nav={nav}>
<h2>Plugin not found</h2>
<p>Plugin with name {pluginName} was not found on the master server.</p>
<p>Plugin with name {pluginName} was not found on the controller.</p>
</PageLayout>;
}
@@ -84,9 +84,9 @@ export default function PluginViewPage() {
message="Version missmatch detected"
description={
`The version of the web interface module for this plugin (${plugin.package.version}) `+
`does not match the version running on the master server (${pluginMeta.version}), `+
`does not match the version running on the controller (${pluginMeta.version}), `+
"spurious errors may occur. This usually happens when the plugin is updated but the "+
"master server has not been restarted yet, but may also be due to an outdated build."
"controller has not been restarted yet, but may also be due to an outdated build."
}
type="warning"
showIcon
@@ -67,7 +67,7 @@ export default function RoleViewPage() {
className="site-page-header"
title="Role not found"
/>
<p>Role with id {roleId} was not found on the master server.</p>
<p>Role with id {roleId} was not found on the controller.</p>
</PageLayout>;
}
@@ -33,7 +33,7 @@ export default function SlaveViewPage(props) {
className="site-page-header"
title={slaveId}
/>
<p>Slave with id {slaveId} was not found on the master server.</p>
<p>Slave with id {slaveId} was not found on the controller.</p>
</PageLayout>;
}
@@ -99,10 +99,10 @@ function GenerateSlaveTokenButton(props) {
<div className="codeblock">
<CopyButton
message={"Copied configuration commands to clipboard"}
text={`npx clusterioslave config set slave.master_token ${token}
text={`npx clusterioslave config set slave.controller_token ${token}
npx clusterioslave config set slave.id ${slaveId}`}
/>
<p>npx clusterioslave config set slave.master_token &lt;token&gt;</p>
<p>npx clusterioslave config set slave.controller_token &lt;token&gt;</p>
<p>npx clusterioslave config set slave.id &lt;slaveId&gt;</p>
</div>
<Typography.Paragraph>
@@ -116,16 +116,16 @@ function GenerateSlaveTokenButton(props) {
cd clusterio
`+
// eslint-disable-next-line max-len
`npm init "@clusterio" -- --master-token ${token} --mode "slave" --download-headless --master-url ${document.location.origin}/ --slave-name "Slave ${slaveId || "?"}" --public-address localhost ${pluginString.length ? "--plugins" : ""} ${pluginString}`
`npm init "@clusterio" -- --controller-token ${token} --mode "slave" --download-headless --controller-url ${document.location.origin}/ --slave-name "Slave ${slaveId || "?"}" --public-address localhost ${pluginString.length ? "--plugins" : ""} ${pluginString}`
}/>
<p>&gt; mkdir clusterio</p>
<p>&gt; cd clusterio</p>
<p>
&gt; npm init "@clusterio" --
--master-token <span className="highlight">{token} </span>
--controller-token <span className="highlight">{token} </span>
--mode "slave"
--download-headless
--master-url <span className="highlight">{document.location.origin}/ </span>
--controller-url <span className="highlight">{document.location.origin}/ </span>
--slave-name <span className="highlight">"Slave {slaveId || "?"}" </span>
--public-address <span className="highlight">localhost </span>
{pluginString.length ? "--plugins" : ""} <span className="highlight">{pluginString}</span>
@@ -76,7 +76,7 @@ export default function UserViewPage() {
className="site-page-header"
title="User not found"
/>
<p>User with name {userName} was not found on the master server.</p>
<p>User with name {userName} was not found on the controller.</p>
</PageLayout>;
}