From 63f76ce87a1790513e0e7e01fac593751e898748 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 7 Mar 2021 14:53:45 +0100 Subject: [PATCH] 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. --- docs/configuration.md | 14 +++++++------- docs/writing-plugins.md | 2 +- packages/lib/config/classes.js | 4 ++-- packages/master/master.js | 6 +++--- packages/slave/slave.js | 2 +- packages/web_ui/src/components/PluginViewPage.jsx | 4 ++-- packages/web_ui/src/components/PluginsPage.jsx | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 889a1eaa..82b631c2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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. -### .enabled +### .load_plugin -Whether to enable the given plugin on the master server. Plugins -disabled on the master server will not be loaded on instances. +Whether to load the plugin on the master server. Plugins not loaded on +the master server will not be loaded on instances. Defaults to true. @@ -425,11 +425,11 @@ maximum_segment_size), which is around 20 in normal circumstances. Defaults to 5 -### .enabled +### .load_plugin -Whether to enable the given plugin on the instance. Note that plugins -need to be enabled on the master server in order for them to be loaded -on instances. +Whether to load the given plugin on the instance. Note that plugins +need to be loaded on the master server in order for them to be loaded on +instances. Defaults to true diff --git a/docs/writing-plugins.md b/docs/writing-plugins.md index 1f624fad..b80ace0c 100644 --- a/docs/writing-plugins.md +++ b/docs/writing-plugins.md @@ -115,7 +115,7 @@ The following properties are recognized: for [defining link messages](#defining-link-messages) below. 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 document. The only restriction imposed on modules embedded into plugins is that they must be named the same as the plugin. diff --git a/packages/lib/config/classes.js b/packages/lib/config/classes.js index 0394564a..dd85012f 100644 --- a/packages/lib/config/classes.js +++ b/packages/lib/config/classes.js @@ -813,8 +813,8 @@ class PluginConfigGroup extends ConfigGroup { if (!this._initialized) { super._initSubclass(); this.define({ - name: "enabled", - description: "Enable plugin", + name: "load_plugin", + title: "Load Plugin", type: "boolean", initial_value: true, }); diff --git a/packages/master/master.js b/packages/master/master.js index bb5a7da9..ffe9eb68 100755 --- a/packages/master/master.js +++ b/packages/master/master.js @@ -278,8 +278,8 @@ app.get("/api/plugins", (req, res) => { let plugins = []; for (let pluginInfo of pluginInfos) { let name = pluginInfo.name; - let enabled = masterPlugins.has(name) && masterConfig.group(name).get("enabled"); - plugins.push({ name, version: pluginInfo.version, enabled }); + let loaded = masterPlugins.has(name); + plugins.push({ name, version: pluginInfo.version, loaded }); } res.send(plugins); }); @@ -1699,7 +1699,7 @@ ${err.stack}` async function loadPlugins() { let plugins = new Map(); for (let pluginInfo of pluginInfos) { - if (!masterConfig.group(pluginInfo.name).get("enabled")) { + if (!masterConfig.group(pluginInfo.name).get("load_plugin")) { continue; } diff --git a/packages/slave/slave.js b/packages/slave/slave.js index 9366c5bc..a1217226 100755 --- a/packages/slave/slave.js +++ b/packages/slave/slave.js @@ -274,7 +274,7 @@ class Instance extends libLink.Link { if ( !pluginInfo.instanceEntrypoint || !this._slave.serverPlugins.has(pluginInfo.name) - || !this.config.group(pluginInfo.name).get("enabled") + || !this.config.group(pluginInfo.name).get("load_plugin") ) { continue; } diff --git a/packages/web_ui/src/components/PluginViewPage.jsx b/packages/web_ui/src/components/PluginViewPage.jsx index 98313720..ae847103 100644 --- a/packages/web_ui/src/components/PluginViewPage.jsx +++ b/packages/web_ui/src/components/PluginViewPage.jsx @@ -30,7 +30,7 @@ export default function PluginViewPage() { title={pluginTitle} > {plugin.meta.version} - {plugin.meta.enabled ? "Yes" : "No"} + {plugin.meta.loaded ? "Yes" : "No"} {plugin.meta.version} - {plugin.meta.enabled ? "Yes" : "No"} + {plugin.meta.loaded ? "Yes" : "No"} {plugin.info.description} {plugin.package.homepage ? {plugin.package.homepage} diff --git a/packages/web_ui/src/components/PluginsPage.jsx b/packages/web_ui/src/components/PluginsPage.jsx index 7b9b0065..2537019a 100644 --- a/packages/web_ui/src/components/PluginsPage.jsx +++ b/packages/web_ui/src/components/PluginsPage.jsx @@ -33,9 +33,9 @@ export default function PluginsPage() { }, }, { - title: "Enabled", - dataIndex: ["meta", "enabled"], - render: enabled => (enabled ? "Yes" : null), + title: "Loaded", + dataIndex: ["meta", "loaded"], + render: loaded => (loaded ? "Yes" : null), responsive: ["sm"], }, ]}