Rename enabled to load_plugin

Rename the config and status indicating whether to load a plugin or not
from "Enabled" to "Load Plugin".  The latter better describes what it
does, and unlike the former doesn't imply plugins can be enabled or
disabled on the fly.
This commit is contained in:
Hornwitser committed 2021-03-07 14:53:45 +01:00
1 parent 19259b2226
commit 63f76ce87a
7 files changed
+19 -19

No files matched your search

+7 -7
View File
@@ -130,10 +130,10 @@ Role to automatically grant to new users. If null no role is granted.
Defaults to 1 which correspond to the default Player role. Defaults to 1 which correspond to the default Player role.
### <plugin_name>.enabled ### <plugin_name>.load_plugin
Whether to enable the given plugin on the master server. Plugins Whether to load the plugin on the master server. Plugins not loaded on
disabled on the master server will not be loaded on instances. the master server will not be loaded on instances.
Defaults to true. Defaults to true.
@@ -425,11 +425,11 @@ maximum_segment_size), which is around 20 in normal circumstances.
Defaults to 5 Defaults to 5
### <plugin_name>.enabled ### <plugin_name>.load_plugin
Whether to enable the given plugin on the instance. Note that plugins Whether to load the given plugin on the instance. Note that plugins
need to be enabled on the master server in order for them to be loaded need to be loaded on the master server in order for them to be loaded on
on instances. instances.
Defaults to true Defaults to true
+1 -1
View File
@@ -115,7 +115,7 @@ The following properties are recognized:
for [defining link messages](#defining-link-messages) below. for [defining link messages](#defining-link-messages) below.
The optional module folder contains a Clusterio module that will be The optional module folder contains a Clusterio module that will be
patched into the save when the plugin is enabled. See the section on patched into the save when the plugin is loaded. See the section on
[Clusterio Modules](developing-for-clusterio.md) in the Developing for [Clusterio Modules](developing-for-clusterio.md) in the Developing for
Clusterio document. The only restriction imposed on modules embedded Clusterio document. The only restriction imposed on modules embedded
into plugins is that they must be named the same as the plugin. into plugins is that they must be named the same as the plugin.
+2 -2
View File
@@ -813,8 +813,8 @@ class PluginConfigGroup extends ConfigGroup {
if (!this._initialized) { if (!this._initialized) {
super._initSubclass(); super._initSubclass();
this.define({ this.define({
name: "enabled", name: "load_plugin",
description: "Enable plugin", title: "Load Plugin",
type: "boolean", type: "boolean",
initial_value: true, initial_value: true,
}); });
+3 -3
View File
@@ -278,8 +278,8 @@ app.get("/api/plugins", (req, res) => {
let plugins = []; let plugins = [];
for (let pluginInfo of pluginInfos) { for (let pluginInfo of pluginInfos) {
let name = pluginInfo.name; let name = pluginInfo.name;
let enabled = masterPlugins.has(name) && masterConfig.group(name).get("enabled"); let loaded = masterPlugins.has(name);
plugins.push({ name, version: pluginInfo.version, enabled }); plugins.push({ name, version: pluginInfo.version, loaded });
} }
res.send(plugins); res.send(plugins);
}); });
@@ -1699,7 +1699,7 @@ ${err.stack}`
async function loadPlugins() { async function loadPlugins() {
let plugins = new Map(); let plugins = new Map();
for (let pluginInfo of pluginInfos) { for (let pluginInfo of pluginInfos) {
if (!masterConfig.group(pluginInfo.name).get("enabled")) { if (!masterConfig.group(pluginInfo.name).get("load_plugin")) {
continue; continue;
} }
+1 -1
View File
@@ -274,7 +274,7 @@ class Instance extends libLink.Link {
if ( if (
!pluginInfo.instanceEntrypoint !pluginInfo.instanceEntrypoint
|| !this._slave.serverPlugins.has(pluginInfo.name) || !this._slave.serverPlugins.has(pluginInfo.name)
|| !this.config.group(pluginInfo.name).get("enabled") || !this.config.group(pluginInfo.name).get("load_plugin")
) { ) {
continue; continue;
} }
@@ -30,7 +30,7 @@ export default function PluginViewPage() {
title={pluginTitle} title={pluginTitle}
> >
<Descriptions.Item label="Version">{plugin.meta.version}</Descriptions.Item> <Descriptions.Item label="Version">{plugin.meta.version}</Descriptions.Item>
<Descriptions.Item label="Enabled">{plugin.meta.enabled ? "Yes" : "No"}</Descriptions.Item> <Descriptions.Item label="Loaded">{plugin.meta.loaded ? "Yes" : "No"}</Descriptions.Item>
</Descriptions> </Descriptions>
<Alert <Alert
style={{ style={{
@@ -56,7 +56,7 @@ export default function PluginViewPage() {
title={pluginTitle} title={pluginTitle}
> >
<Descriptions.Item label="Version">{plugin.meta.version}</Descriptions.Item> <Descriptions.Item label="Version">{plugin.meta.version}</Descriptions.Item>
<Descriptions.Item label="Enabled" span={2}>{plugin.meta.enabled ? "Yes" : "No"}</Descriptions.Item> <Descriptions.Item label="Loaded" span={2}>{plugin.meta.loaded ? "Yes" : "No"}</Descriptions.Item>
<Descriptions.Item label="Description" span={3}>{plugin.info.description}</Descriptions.Item> <Descriptions.Item label="Description" span={3}>{plugin.info.description}</Descriptions.Item>
{plugin.package.homepage ? <Descriptions.Item label="Homepage" span={3}> {plugin.package.homepage ? <Descriptions.Item label="Homepage" span={3}>
<a href={plugin.package.homepage}>{plugin.package.homepage}</a> <a href={plugin.package.homepage}>{plugin.package.homepage}</a>
@@ -33,9 +33,9 @@ export default function PluginsPage() {
}, },
}, },
{ {
title: "Enabled", title: "Loaded",
dataIndex: ["meta", "enabled"], dataIndex: ["meta", "loaded"],
render: enabled => (enabled ? "Yes" : null), render: loaded => (loaded ? "Yes" : null),
responsive: ["sm"], responsive: ["sm"],
}, },
]} ]}