diff --git a/components/DataTableMyRelays.vue b/components/DataTableMyRelays.vue index ab9edec..6eeeb2f 100644 --- a/components/DataTableMyRelays.vue +++ b/components/DataTableMyRelays.vue @@ -52,48 +52,6 @@ const fingerprints = computed(() => { return allRelays.value.map((relay) => relay.fingerprint); }); -console.log('STAGE LOG: fingerprints', fingerprints); -console.log('STAGE LOG: metricsStore', metricsStore); - -const relayMeta = computed(() => { - if (!userStore.userData) { - return null; - } - if (!allRelays.value) { - return null; - } - if (!metricsStore.relays.latest) { - return null; - } - - return fingerprints.value.reduce( - // @ts-ignore - (acc, fp) => { - const myMetrics = metricsStore.relays.latest!.find( - ({ relay }) => fp === relay.fingerprint - ); - const relay = myMetrics ? myMetrics.relay : null; - - // @ts-ignore - acc[fp] = relay - ? { - ...relay, - consensus_weight: BigNumber(relay.consensus_weight).toFormat(), - observed_bandwidth: - BigNumber(relay.observed_bandwidth) - .dividedBy(Math.pow(1024, 2)) - .toFormat(3) + ' MiB/s', - } - : { fingerprint: fp }; - - return acc; - }, - {} as Record - ); -}); - -console.log('STAGE LOG: relayMeta', relayMeta); - const relayAction = async (action: FunctionName, fingerprint: string) => { //TODO: Sign the message // See: The following resources @@ -171,6 +129,14 @@ const getVerifiedItems = (row: RelayRow) => [ const handleTabChange = (key: string) => { currentTab.value = key; }; + +const getObservedBandwidth = (fingerprint: string) => { + return ( + BigNumber(userStore?.relaysMeta?.[fingerprint]?.observed_bandwidth) + .dividedBy(Math.pow(1024, 2)) + .toFormat(3) + ' MiB/s' + ); +};