Add save listing and subscriptions

Add link messages for listing saves and listening for changes to the
list of saves for instances along with a table in the instance view page
showing the save list for the instance and a list-saves command to ctl.
This commit is contained in:
Hornwitser committed 2021-06-01 11:22:22 +02:00
1 parent b53ed7f6ca
commit a96fae5ffd
16 files changed
+390 -3

No files matched your search

+17
View File
@@ -338,6 +338,21 @@ async function loadMapSettings(args) {
};
}
instanceCommands.add(new libCommand.Command({
definition: ["list-saves <instance>", "list saves on an instance", (yargs) => {
yargs.positional("instance", { describe: "Instance to list saves on", type: "string" });
}],
handler: async function(args, control) {
let instanceId = await libCommand.resolveInstance(control, args.instance);
let response = await libLink.messages.listSaves.send(control, { instance_id: instanceId });
for (let entry of response.list) {
entry.mtime = new Date(entry.mtime_ms).toLocaleString();
delete entry.mtime_ms;
}
print(asTable(response.list));
},
}));
instanceCommands.add(new libCommand.Command({
definition: ["create-save <instance> [name]", "Create a new save on an instance", (yargs) => {
yargs.positional("instance", { describe: "Instance to create on", type: "string" });
@@ -794,6 +809,8 @@ class Control extends libLink.Link {
async instanceUpdateEventHandler() { }
async saveListUpdateEventHandler() { }
async setLogSubscriptions({
all = false,
master = false,