diff --git a/src/pages/status.svelte b/src/pages/status.svelte
index dc6e50a1..fab2524b 100644
--- a/src/pages/status.svelte
+++ b/src/pages/status.svelte
@@ -9,6 +9,7 @@
let message = "Loading...";
let shards = [];
+ let clusters = {};
let pingAverage = "";
let currentCommitMsg = "";
@@ -27,20 +28,32 @@
const get = async () => {
const pkdata = await api().private.meta.get();
- shards = pkdata.shards.sort((x, y) => (x.id > y.id) ? 1 : -1);
- let pings = 0;
- shards = shards.map(shard => {
- pings += shard.ping;
- shard.last_connection = new Date(Number(shard.last_connection) * 1000).toUTCString().match(/([0-9][0-9]:[0-9][0-9]:[0-9][0-9])/)?.shift()
- shard.last_heartbeat = new Date(Number(shard.last_heartbeat) * 1000).toUTCString().match(/([0-9][0-9]:[0-9][0-9]:[0-9][0-9])/)?.shift()
- return shard;
+ let data = pkdata.shards.sort((x, y) => (x.id > y.id) ? 1 : -1);
+ let pings = 0;
+ data = data.map(shard => {
+ pings += shard.ping;
+ shard.last_connection = new Date(Number(shard.last_connection) * 1000).toUTCString().match(/([0-9][0-9]:[0-9][0-9]:[0-9][0-9])/)?.shift()
+ shard.last_heartbeat = new Date(Number(shard.last_heartbeat) * 1000).toUTCString().match(/([0-9][0-9]:[0-9][0-9]:[0-9][0-9])/)?.shift()
+ return shard;
+ });
+ console.log(data[0].cluster_id);
+
+ pingAverage = Math.trunc(pings / shards.length).toString();
+
+ currentCommitMsg = `Current Git commit: ${pkdata.version.slice(0,7)}`;
+
+ if (data[0].cluster_id === 0) {
+ let clusterData = {};
+ data.forEach(shard => {
+ if (clusterData[shard.cluster_id] === undefined) clusterData[shard.cluster_id] = [];
+ clusterData[shard.cluster_id].push(shard);
});
-
- pingAverage = Math.trunc(pings / shards.length).toString();
-
- currentCommitMsg = `Current Git commit: ${pkdata.version.slice(0,7)}`;
-
- message = "";
+ clusters = clusterData;
+ } else {
+ shards = data;
+ }
+
+ message = "";
};
get();
@@ -129,16 +142,35 @@
-
-
-
-
- { message }
- {#each shards as shard}
-
- {/each}
-
-
-
-
+ {#if shards.length > 0}
+
+
+
+
+ { message }
+ {#each shards as shard}
+
+ {/each}
+
+
+
+
+ {/if}
+ {#each Object.keys(clusters) as key}
+
+
+
+
+
+ Cluster {key}
+
+
+ {#each clusters[key] as shard}
+
+ {/each}
+
+
+
+
+ {/each}
\ No newline at end of file