Merge pull request #577 from Hornwitser/small-things-15

Small things 15
This commit is contained in:
Cooldude2606 authored and GitHub committed 2024-01-24 03:18:07 +00:00
commit 2020024b68
7 files changed
+15 -5

No files matched your search

+1
View File
@@ -18,6 +18,7 @@
- Fixed host hanging if stopped while an instance is in the process of creating a save during startup. - Fixed host hanging if stopped while an instance is in the process of creating a save during startup.
- Fixed `instance.auto_start` option. - Fixed `instance.auto_start` option.
- Fixed host log spammed with errors when plugins broadcast messages to instances with the plugin disabled. - Fixed host log spammed with errors when plugins broadcast messages to instances with the plugin disabled.
- Fixed properties of object config fields not being possible to remove.
## Version 2.0.0-alpha.14 ## Version 2.0.0-alpha.14
+1 -1
View File
@@ -459,7 +459,7 @@ export class Config<
setProp<Field extends keyof Fields & string>( setProp<Field extends keyof Fields & string>(
name: Field, name: Field,
prop: string, prop: string,
value: unknown, value?: unknown,
location = this.location, location = this.location,
) { ) {
let def = this.constructor.fieldDefinitions[name]; let def = this.constructor.fieldDefinitions[name];
+1 -1
View File
@@ -87,7 +87,7 @@ export class Address {
} }
toString() { toString() {
const typeMap = ["controller", "instance", "host", "control"]; const typeMap = ["controller", "host", "instance", "control"];
const type = typeMap[this.type] || this.type; const type = typeMap[this.type] || this.type;
if (this.type === Address.broadcast) { if (this.type === Address.broadcast) {
return `[Address ${type}:${typeMap[this.id] || this.id}]`; return `[Address ${type}:${typeMap[this.id] || this.id}]`;
+1 -1
View File
@@ -208,7 +208,7 @@ export class InstanceConfigSetPropRequest {
"instanceId": Type.Integer(), "instanceId": Type.Integer(),
"field": Type.String(), "field": Type.String(),
"prop": Type.String(), "prop": Type.String(),
"value": Type.Unknown(), "value": Type.Optional(Type.Unknown()),
}); });
static fromJSON(json: Static<typeof this.jsonSchema>) { static fromJSON(json: Static<typeof this.jsonSchema>) {
+1 -1
View File
@@ -73,7 +73,7 @@ export class WebConsoleFormat {
transform(info: any, _options: object) { transform(info: any, _options: object) {
let src = " "; let src = " ";
if (info.host_id !== undefined) { if (info.host_id !== undefined) {
src += `s:${info.host_name} - `; src += `h:${info.host_name} - `;
} }
if (info.instance_id !== undefined) { if (info.instance_id !== undefined) {
src += `i:${info.instance_name}`; src += `i:${info.instance_name}`;
+1 -1
View File
@@ -163,7 +163,7 @@ export class TerminalFormat {
src += `i:${info.instance_name} `; src += `i:${info.instance_name} `;
} else if (info.host_name) { } else if (info.host_name) {
src += `s:${info.host_name} `; src += `h:${info.host_name} `;
} }
if (info.plugin) { if (info.plugin) {
src += `${info.plugin}: `; src += `${info.plugin}: `;
+9
View File
@@ -557,6 +557,15 @@ describe("Integration of Clusterio", function() {
slowTest(this); slowTest(this);
await checkInstanceStatus(44, "running"); await checkInstanceStatus(44, "running");
}); });
it("should allow creating and removing props", async function() {
slowTest(this);
await execCtl("instance config set-prop test factorio.settings new_property new-string-value");
let config = await getControl().send(new lib.InstanceConfigGetRequest(44));
assert.equal(config["factorio.settings"]["new_property"], "new-string-value");
await execCtl("instance config set-prop test factorio.settings new_property");
config = await getControl().send(new lib.InstanceConfigGetRequest(44));
assert.equal(config["factorio.settings"]["new_property"], undefined);
});
}); });
describe("user set-admin/whitelisted/banned", function() { describe("user set-admin/whitelisted/banned", function() {