mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Rewrite instances page
Render the table in the instances page using an antd Table component directly and feed it the data via an automatically updating list of instances.
This commit is contained in:
1 parent
0e9893fcb6
commit
82c3d27bff
4 files changed
+136
-36
No files matched your search
@@ -154,14 +154,17 @@ export class Control extends libLink.Link {
|
||||
}
|
||||
|
||||
async instanceUpdateEventHandler(message) {
|
||||
let handlers = this.instanceUpdateHandlers.get(message.data.id);
|
||||
for (let handler of handlers || []) {
|
||||
let handlers = [].concat(
|
||||
this.instanceUpdateHandlers.get(null) || [],
|
||||
this.instanceUpdateHandlers.get(message.data.id) || [],
|
||||
);
|
||||
for (let handler of handlers) {
|
||||
handler(message.data);
|
||||
}
|
||||
};
|
||||
|
||||
async onInstanceUpdate(id, handler) {
|
||||
if (!Number.isInteger(id)) {
|
||||
if (id !== null && !Number.isInteger(id)) {
|
||||
throw new Error("Invalid instance id");
|
||||
}
|
||||
|
||||
@@ -202,8 +205,8 @@ export class Control extends libLink.Link {
|
||||
}
|
||||
|
||||
await libLink.messages.setInstanceSubscriptions.send(this, {
|
||||
all: false,
|
||||
instance_ids: [...this.instanceUpdateHandlers.keys()],
|
||||
all: this.instanceUpdateHandlers.has(null),
|
||||
instance_ids: [...this.instanceUpdateHandlers.keys()].filter(e => e !== null),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user