mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Add config cloning on instance creation (#747)
* Add instance config cloning on creation * Add test for instance cloning * Add tooltip to copy config button
This commit is contained in:
1 parent
0055f28f45
commit
ce85149b4c
6 files changed
+63
-10
No files matched your search
@@ -312,11 +312,16 @@ export class Config<
|
||||
* Serialize the config to a plain JavaScript object
|
||||
*
|
||||
* @param remote - Location this serialised representation is for
|
||||
* @param filter - When provided, only the given fields are serialized
|
||||
* @returns JSON serializable representation of the config.
|
||||
*/
|
||||
toRemote(remote: ConfigLocation): Static<typeof Config.jsonSchema> {
|
||||
toRemote(remote: ConfigLocation, filter?: (keyof Fields)[]): Static<typeof Config.jsonSchema> {
|
||||
let fields: Record<string, FieldValue> = {};
|
||||
for (let [name, value] of Object.entries(this.fields)) {
|
||||
if (filter && !filter.includes(name as keyof Fields)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let def = this.constructor.fieldDefinitions[name];
|
||||
if (
|
||||
this.location !== "control" && !this._checkAccess(name, def, this.location, ConfigAccess.write, false)
|
||||
|
||||
Reference in new issue
Block a user