2022-01-11 22:09:50 -05:00
|
|
|
<script lang="ts">
|
2022-01-23 03:46:54 -05:00
|
|
|
export let hover;
|
2022-01-11 22:09:50 -05:00
|
|
|
|
|
|
|
export let shard = {
|
|
|
|
id: 1,
|
|
|
|
status: "",
|
|
|
|
ping:0,
|
2022-01-23 03:32:59 -05:00
|
|
|
disconnection_count:0,
|
2022-01-11 22:09:50 -05:00
|
|
|
last_connection:0,
|
|
|
|
last_heartbeat:0.
|
|
|
|
};
|
|
|
|
|
|
|
|
let color = "background-color: #fff";
|
|
|
|
|
|
|
|
// shard is down
|
|
|
|
// todo: check if last heartbeat is really recent, since database up/down status can get out of sync
|
|
|
|
if (shard.status != "up") color = "background-color: #000;";
|
|
|
|
// shard latency is < 250ms: OK!
|
|
|
|
else if (shard.ping < 300) color = "background-color: #00cc00;";
|
|
|
|
// shard latency is 250ms < ping < 600ms: slow, but OK
|
|
|
|
else if (shard.ping < 600) color = "background-color: #da9317;";
|
|
|
|
// shard latency is >600ms, this might be problematic
|
|
|
|
else color = "background-color: #cc0000;"
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="wrapper">
|
|
|
|
<div
|
2022-01-23 03:46:54 -05:00
|
|
|
on:click={() => hover = (hover != shard.id) ? shard.id : null}
|
2022-01-11 22:09:50 -05:00
|
|
|
class="shard" id={shard.id.toString()}
|
|
|
|
style={color}
|
|
|
|
>{ shard.id }</div>
|
2022-01-23 03:46:54 -05:00
|
|
|
{#if hover == shard.id}
|
2022-01-11 22:09:50 -05:00
|
|
|
<div class="more-info">
|
2022-01-23 09:27:37 -05:00
|
|
|
<br>
|
2022-01-11 22:09:50 -05:00
|
|
|
<h3>Shard { shard.id }</h3>
|
|
|
|
<br>
|
|
|
|
<span>Status: <b>{ shard.status }</b></span><br>
|
|
|
|
<span>Latency: { shard.ping }ms</span><br>
|
2022-01-23 02:49:04 -05:00
|
|
|
<span>Disconnection count: { shard.disconnection_count }</span><br>
|
|
|
|
<span>Last connection: { shard.last_connection }</span><br>
|
|
|
|
<span>Last heartbeat: { shard.last_heartbeat }</span><br>
|
2022-01-11 22:09:50 -05:00
|
|
|
<br>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.wrapper {
|
|
|
|
height: 55px;
|
|
|
|
width: 55px;
|
|
|
|
display: block;
|
|
|
|
float: left;
|
|
|
|
}
|
2022-01-23 02:49:25 -05:00
|
|
|
.shard:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2022-01-11 22:09:50 -05:00
|
|
|
.shard {
|
|
|
|
color: #fff;
|
|
|
|
display: block;
|
|
|
|
float: left;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
text-align: center;
|
|
|
|
justify-content: center;
|
|
|
|
z-index: 1;
|
|
|
|
height: 50px;
|
|
|
|
width: 50px;
|
|
|
|
margin-right: 5px;
|
|
|
|
margin-bottom: 5px;
|
|
|
|
border-radius: 2px;
|
|
|
|
-webkit-touch-callout: none; /* iOS Safari */
|
|
|
|
-webkit-user-select: none; /* Safari */
|
|
|
|
-khtml-user-select: none; /* Konqueror HTML */
|
|
|
|
-moz-user-select: none; /* Old versions of Firefox */
|
|
|
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
|
|
user-select: none; /* Non-prefixed version, currently
|
|
|
|
supported by Chrome, Edge, Opera and Firefox */
|
|
|
|
}
|
|
|
|
.more-info {
|
|
|
|
/* display: none; */
|
|
|
|
position: absolute;
|
|
|
|
margin-top: 3em;
|
|
|
|
will-change: transform;
|
|
|
|
min-height: 150px;
|
|
|
|
width: 200px;
|
|
|
|
z-index: 2;
|
|
|
|
border-radius: 5px;
|
|
|
|
background-color: #333;
|
|
|
|
color: #fff;
|
|
|
|
opacity: 95%;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|