mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Allow removing properties with set-prop
Implement removal of properties in ConfigGroup.setProp, set_instance_config_prop, and the set-prop clusterioctl command.
This commit is contained in:
1 parent
dea3a30cae
commit
0e21060ea3
4 files changed
+24
-11
No files matched your search
@@ -448,7 +448,11 @@ class ConfigGroup {
|
||||
let prev = this._fields.get(name);
|
||||
let updated = {...prev || {}};
|
||||
|
||||
updated[prop] = value;
|
||||
if (value !== undefined) {
|
||||
updated[prop] = value;
|
||||
} else {
|
||||
delete updated[prop];
|
||||
}
|
||||
this._fields.set(name, updated);
|
||||
if (this._config && !isDeepStrictEqual(updated, prev)) {
|
||||
this._config.emit("fieldChanged", this, name, prev);
|
||||
|
||||
@@ -407,6 +407,7 @@ messages.setInstanceConfigProp = new Request({
|
||||
type: "set_instance_config_prop",
|
||||
links: ["control-master"],
|
||||
permission: "core.instance.update_config",
|
||||
requestRequired: ["instance_id", "field", "prop"],
|
||||
requestProperties: {
|
||||
"instance_id": { type: "integer" },
|
||||
"field": { type: "string" },
|
||||
|
||||
Reference in new issue
Block a user