mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Add slave update subscriptions
Allow the web interface to listen for updates to the slave list and apply it live to the places where slaves are shown in the web interface.
This commit is contained in:
1 parent
cc438574ff
commit
2be91cbd3a
12 files changed
+275
-29
No files matched your search
@@ -25,10 +25,14 @@ class TestControl extends libLink.Link {
|
||||
constructor(connector) {
|
||||
super("control", "master", connector);
|
||||
libLink.attachAllMessages(this);
|
||||
this.slaveUpdates = [];
|
||||
this.instanceUpdates = [];
|
||||
this.saveListUpdates = [];
|
||||
|
||||
this.connector.on("connect", () => {
|
||||
libLink.messages.setSlaveSubscriptions.send(
|
||||
this, { all: true, slave_ids: [] }
|
||||
).catch(err => logger.error(`Error setting slave subscriptions:\n${err.stack}`));
|
||||
libLink.messages.setInstanceSubscriptions.send(
|
||||
this, { all: true, instance_ids: [] }
|
||||
).catch(err => logger.error(`Error setting instance subscriptions:\n${err.stack}`));
|
||||
@@ -45,6 +49,10 @@ class TestControl extends libLink.Link {
|
||||
|
||||
async debugWsMessageEventHandler() { }
|
||||
|
||||
async slaveUpdateEventHandler(message) {
|
||||
this.slaveUpdates.push(message.data);
|
||||
}
|
||||
|
||||
async instanceUpdateEventHandler(message) {
|
||||
this.instanceUpdates.push(message.data);
|
||||
}
|
||||
@@ -223,6 +231,7 @@ module.exports = {
|
||||
execCtl,
|
||||
sendRcon,
|
||||
getControl,
|
||||
spawn,
|
||||
|
||||
url,
|
||||
controlToken,
|
||||
|
||||
Reference in new issue
Block a user