122
122
<div class =" row q-pb-md q-col-gutter-xl" >
123
123
<div class =" col-xs-12 col-sm-12 col-md-9 col-lg-9" >
124
124
<q-banner inline-actions class =" bg-vdark text-vgrey q-mb-sm" >
125
- <div class =" text-italic" >
126
- List of nodes on the network.
127
- <q-btn flat round size =" sm" color =" vgreen" icon =" fas fa-question" class =" " >
128
- <q-tooltip content-class =" bg-vgreen text-vdark" content-style =" font-size: 16px" :offset =" [10, 10]" >List of the nodes is automatically updated every 5 minutes</q-tooltip >
129
- </q-btn >
125
+ <div class =" row" >
126
+ <div class =" col" >
127
+ <div class =" text-italic" >
128
+ List of nodes on the network.
129
+ <q-btn flat round size =" sm" color =" vgreen" icon =" fas fa-question" class =" " >
130
+ <q-tooltip content-class =" bg-vgreen text-vdark" content-style =" font-size: 16px" :offset =" [10, 10]" >List of the nodes is automatically updated every 5 minutes</q-tooltip >
131
+ </q-btn >
132
+ </div >
133
+ <div class =" text-italic text-caption" >*You are required to vote for 21 nodes per day to activate the distribution of VTX.</div >
134
+ </div >
135
+ <div class =" col" >
136
+ <div class =" col bg-blue-grey" >Running nodes: {{ running_nodes }}</div >
137
+ <div class =" col bg-blue-grey" >Registered nodes: {{ registered_nodes }}</div >
138
+ </div >
130
139
</div >
131
- < div class = " text-italic text-caption " >*You are required to vote for 21 nodes per day to activate the distribution of VTX.</ div >
140
+
132
141
<template v-slot :action >
133
142
<q-btn size =" md" outline color =" vgreen" label =" Rules" class =" q-mx-xs" v-on:click =" rulesDialog=true" />
134
143
<q-btn size =" md" outline color =" vgreen" icon =" fas fa-sync-alt" class =" q-mx-xs" v-on:click =refresh />
142
151
<q-item-label class =" code text-vgreen" caption > {{ node.account }} </q-item-label >
143
152
</q-item-section >
144
153
<q-item-section side center >
145
- <q-item-label class =" code text-vgreen" caption > {{ node.balance }} </q-item-label >
154
+ <q-item-label class =" code text-vgreen" caption > {{ node.balance }}</q-item-label >
146
155
</q-item-section >
147
- <q-item-section avatar v-if =" identity.account_name && node.account != identity.account_name && node.account != 'No account found' " >
156
+ <q-item-section avatar v-if =" identity.account_name && node.vote && node.account != identity.account_name " >
148
157
<q-btn outline color =" vgreen" v-on:click =" addToVote(node)" v-if =" !voting_list.includes(node) " >Vote</q-btn >
149
158
<q-btn color =" vgreen" class =" text-vdark" v-on:click =" addToVote(node)" v-if =" voting_list.includes(node)" >Vote</q-btn >
150
159
</q-item-section >
@@ -436,6 +445,9 @@ export default {
436
445
rulesDialog: false ,
437
446
isPwd: true ,
438
447
isPrvt: true ,
448
+ running_nodes: 0 ,
449
+ registered_nodes: 0 ,
450
+ registered_nodes_names: [],
439
451
privateState: ' none' ,
440
452
geoData: ' test'
441
453
}
@@ -477,7 +489,6 @@ export default {
477
489
try {
478
490
const eos = new EosWrapper ()
479
491
const result = await eos .getTable (' vdexdposvote' , ' vdexdposvote' , ' producers' )
480
-
481
492
let nodeStats = result .find (row => row .owner === accountName)
482
493
if (nodeStats) {
483
494
this .identity .account_registered = true
@@ -517,6 +528,20 @@ export default {
517
528
this .errorDialog = true
518
529
}
519
530
},
531
+ async getRegisteredNodes () {
532
+ try {
533
+ const eos = new EosWrapper ()
534
+ const result = await eos .getTable (' vdexdposvote' , ' vdexdposvote' , ' producers' )
535
+ this .registered_nodes = result .length
536
+ var self = this
537
+ result .forEach (function (item ) {
538
+ self .registered_nodes_names .push (item .owner )
539
+ })
540
+ } catch (error) {
541
+ this .errorMessage = error
542
+ this .errorDialog = true
543
+ }
544
+ },
520
545
refresher () {
521
546
if (this .identity .account_name ) {
522
547
this .getBalance ()
@@ -666,6 +691,8 @@ export default {
666
691
}
667
692
},
668
693
refresh () {
694
+ this .running_nodes = 0
695
+ this .registered_nodes = 0
669
696
this .nodes = []
670
697
this .voting_list = []
671
698
this .getListOfNodes ()
@@ -764,6 +791,8 @@ export default {
764
791
async getListOfNodes () {
765
792
await this .getNodes ()
766
793
const eos = new EosWrapper ()
794
+ this .running_nodes = this .nodes .length
795
+ this .getRegisteredNodes ()
767
796
for (var id in this .nodes ) {
768
797
// this.getAccountByKey(id, this.nodes[id].key)
769
798
this .getAccountName (id, this .nodes [id].key , eos)
@@ -774,7 +803,7 @@ export default {
774
803
this .$http .get (process .env .NODES_API + ' /getConnectedNodes' ).then ((result ) => {
775
804
for (var key in result .data ) {
776
805
if (result .data [key].includes (' EOS' )) {
777
- this .nodes .push ({ id: key, key: result .data [key].trim (), account: ' ' })
806
+ this .nodes .push ({ id: key, key: result .data [key].trim (), account: ' ' , vote : true })
778
807
}
779
808
}
780
809
this .nodes = utils .getUnique (this .nodes , ' key' )
@@ -794,9 +823,15 @@ export default {
794
823
let balance = await eos .getBalance (name)
795
824
this .nodes [id].account = name
796
825
this .nodes [id].balance = balance[0 ] ? balance[0 ] : ' 0 VTX'
826
+ if (this .registered_nodes_names .includes (name)) {
827
+ this .nodes [id].vote = true
828
+ } else {
829
+ this .nodes [id].vote = false
830
+ }
797
831
} else {
798
832
this .nodes [id].account = ' No account found'
799
833
this .nodes [id].balance = ' '
834
+ this .nodes [id].vote = false
800
835
}
801
836
} catch (error) {
802
837
this .errorMessage = error
0 commit comments