Skip to content

Commit

Permalink
minor improves
Browse files Browse the repository at this point in the history
  • Loading branch information
olton committed Oct 14, 2021
1 parent d0bfb93 commit eda004a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/css/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ body {
.rx-count {
top: 70px;
}

.tx-chart, .rx-chart {
min-height: 65px;
}

.response-count {
top: 80px;
}
Expand Down Expand Up @@ -403,6 +408,15 @@ body {
display: block;
}

.not-connected {
border: 1px solid red!important;
background-color: #efefef;

& > * {
opacity: .3!important;
}
}

.CATCHUP .catchup-process-right,
.CATCHUP .catchup-process-left {
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@
<div class="os-info text-small text-center text-bold">...</div>
</div>
<div class="cell-6 h-100">
<div class="server-time text-small text-center"></div>
<div class="server-time text-small text-center">...</div>
</div>
<div class="cell-6 h-100 border-left bd-system">
<div class="server-uptime text-small text-center"></div>
<div class="server-uptime text-small text-center">...</div>
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/js/helpers/disco.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const disco = (el, cls= "in-update", dur = 2000) => {
const _el = $(el)
_el.addClass(cls)
setTimeout(() => _el.removeClass("in-update"), 2000)
}
4 changes: 4 additions & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ fetch(configFile).then(r => {
template.content.querySelector(".panel").setAttribute("data-title-caption", node.name.toUpperCase())
clone = document.importNode(template.content, true)
elNodePanel[0].appendChild(clone)
elNodePanel.children(".panel").addClass("not-connected")

const connect = () => {
const ws = new WebSocket(`${node.https ? 'wss' : 'ws'}://${node.host}`)
Expand Down Expand Up @@ -145,6 +146,7 @@ fetch(configFile).then(r => {
}

ws.onclose = event => {
$(`#node-${i+1} > .panel`).addClass("not-connected")
$(`#node-${i+1} .node-load-status`)
.removeClass("label-success")
.addClass("label-alert")
Expand All @@ -153,9 +155,11 @@ fetch(configFile).then(r => {
}

ws.onopen = event => {
$(`#node-${i+1} > .panel`).removeClass("not-connected")
$(`#node-${i+1} .node-load-status`)
.removeClass("label-alert")
.addClass("label-success")
console.log(datetime().format("DD-MM-YYYY HH:mm ") + 'Connected to ', node.name);
}

globalThis.wsc.push(ws)
Expand Down
13 changes: 9 additions & 4 deletions src/js/modules/blockchain.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {isset} from "../helpers/utils";
import {EPOCH_DURATION, GENESIS_START, SLOT_DURATION} from "../helpers/consts";
import {disco} from "../helpers/disco";

export const processBlockchain = (i, node, data) => {
if (!data) return
Expand All @@ -20,6 +21,10 @@ export const updateBlockchain = ({resetCountdown = false}) => {
if (!state.blockchain) return

const elEpochCountdown = $("#epoch-countdown")
const elSlotNumber = $("#slot-number")
const elSlotsTotalNumber = $("#slot-since-genesis")
const elBlockHeight = $("#block-height")
const elBlockchainUpdated = $("#blockchain-updated")

const {
blockHeight,
Expand All @@ -29,10 +34,10 @@ export const updateBlockchain = ({resetCountdown = false}) => {
timestamp
} = state.blockchain

$("#slot-number").text(Number(slot).format(0, null, " ", "."))
$("#slot-since-genesis").text(Number(slotSinceGenesis).format(0, null, " ", "."))
$("#block-height").text(Number(blockHeight).format(0, null, " ", "."))
$("#blockchain-updated").html(timestamp.format("DD-MM-YYYY HH:mm"))
elSlotNumber.text(Number(slot).format(0, null, " ", "."))
elSlotsTotalNumber.text(Number(slotSinceGenesis).format(0, null, " ", "."))
elBlockHeight.text(Number(blockHeight).format(0, null, " ", "."))
elBlockchainUpdated.html(timestamp.format("DD-MM-YYYY HH:mm"))

const epochDurationProgress = (+slot * SLOT_DURATION * 100) / EPOCH_DURATION
const progress = Metro.getPlugin('#epoch-number', 'donut')
Expand Down
1 change: 1 addition & 0 deletions src/js/modules/price.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {isset} from "../helpers/utils";
import {disco} from "../helpers/disco";

export const processMinaPrice = (i, node, data) => {
if (!data || !isset(data[0], false)) return
Expand Down
1 change: 1 addition & 0 deletions src/js/modules/uptime.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {shortAddress} from "../helpers/utils";
import {MINA_EXPLORER, STAKETAB_EXPLORER} from "../helpers/consts";
import {disco} from "../helpers/disco";

export const processUptime = (i, node, data) => {
if (!data) return
Expand Down

0 comments on commit eda004a

Please sign in to comment.