mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(dashboard): order shards correctly
This commit is contained in:
parent
fd6909cd96
commit
d1b617f6be
3 changed files with 9 additions and 7 deletions
|
|
@ -25,12 +25,12 @@
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div
|
<div
|
||||||
class="shard" id={`shard-${shard.id.toString()}`}
|
class="shard" id={`shard-${shard.shard_id.toString()}`}
|
||||||
style={color}
|
style={color}
|
||||||
>{ shard.id }</div>
|
>{ shard.shard_id }</div>
|
||||||
<Tooltip target={`shard-${shard.id.toString()}`} placement="bottom">
|
<Tooltip target={`shard-${shard.shard_id.toString()}`} placement="bottom">
|
||||||
<br>
|
<br>
|
||||||
<h3>Shard { shard.id }</h3>
|
<h3>Shard { shard.shard_id }</h3>
|
||||||
<br>
|
<br>
|
||||||
<span>Status: <b>{ shard.up ? "up" : "down" }</b></span><br>
|
<span>Status: <b>{ shard.up ? "up" : "down" }</b></span><br>
|
||||||
<span>Latency: { shard.latency }ms</span><br>
|
<span>Latency: { shard.latency }ms</span><br>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
return shard;
|
return shard;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data[0].cluster_id === 0) {
|
if (data[0].cluster_id !== undefined) {
|
||||||
let clusterData = {};
|
let clusterData = {};
|
||||||
data.forEach(shard => {
|
data.forEach(shard => {
|
||||||
if (clusterData[shard.cluster_id] === undefined) clusterData[shard.cluster_id] = [];
|
if (clusterData[shard.cluster_id] === undefined) clusterData[shard.cluster_id] = [];
|
||||||
|
|
@ -45,6 +45,8 @@
|
||||||
clusters = clusterData;
|
clusters = clusterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object.keys(clusters).map(c => clusters[c] = clusters[c].reverse());
|
||||||
|
|
||||||
shards = data;
|
shards = data;
|
||||||
pingAverage = Math.trunc(latencies / shards.length).toString();
|
pingAverage = Math.trunc(latencies / shards.length).toString();
|
||||||
|
|
||||||
|
|
@ -141,7 +143,7 @@
|
||||||
{shardInfoMsg}
|
{shardInfoMsg}
|
||||||
{/if}
|
{/if}
|
||||||
{#if foundShard}
|
{#if foundShard}
|
||||||
Your shard is: Shard { foundShard.id }
|
Your shard is: Shard { foundShard.shard_id }
|
||||||
{/if}
|
{/if}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ pub async fn discord_state(State(ctx): State<ApiContext>) -> Json<Value> {
|
||||||
.map(|v| serde_json::from_str(v).expect("could not deserialize shard"))
|
.map(|v| serde_json::from_str(v).expect("could not deserialize shard"))
|
||||||
.collect::<Vec<ShardState>>();
|
.collect::<Vec<ShardState>>();
|
||||||
|
|
||||||
shard_status.sort_by(|a, b| a.shard_id.cmp(&b.shard_id));
|
shard_status.sort_by(|a, b| b.shard_id.cmp(&a.shard_id));
|
||||||
|
|
||||||
Json(json!({
|
Json(json!({
|
||||||
"shards": shard_status,
|
"shards": shard_status,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue