@@ -11,6 +11,7 @@ import ValidatorMetrics from "./ValidatorMetrics.vue"
1111import BlocksTable from " ./tables/BlocksTable.vue"
1212import DelegatorsTable from " ./tables/DelegatorsTable.vue"
1313import JailsTable from " ./tables/JailsTable.vue"
14+ import MessagesTable from " ./tables/MessagesTable.vue"
1415import SignalsTable from " ./tables/SignalsTable.vue"
1516import VotesTable from " ./tables/VotesTable.vue"
1617
@@ -22,6 +23,7 @@ import {
2223 fetchValidatorBlocks ,
2324 fetchValidatorDelegators ,
2425 fetchValidatorJails ,
26+ fetchValidatorMessages ,
2527 fetchValidatorUptime ,
2628 fetchSignals
2729} from " @/services/api/validator"
@@ -64,6 +66,10 @@ const tabs = ref([
6466 name: " signals" ,
6567 icon: " bell-ringing" ,
6668 },
69+ {
70+ name: " messages" ,
71+ icon: " message" ,
72+ },
6773])
6874const preselectedTab = route .query .tab && tabs .value .map ((tab ) => tab .name ).includes (route .query .tab ) ? route .query .tab : tabs .value [0 ].name
6975const activeTab = ref (preselectedTab)
@@ -72,6 +78,7 @@ const isRefetching = ref(false)
7278const delegators = ref ([])
7379const blocks = ref ([])
7480const jails = ref ([])
81+ const messages = ref ([])
7582const signals = ref ([])
7683const votes = ref ([])
7784const uptime = ref ([])
@@ -165,6 +172,23 @@ const getVotes = async () => {
165172 isRefetching .value = false
166173}
167174
175+ const getMessages = async () => {
176+ isRefetching .value = true
177+
178+ const { data } = await fetchValidatorMessages ({
179+ id: props .validator .id ,
180+ limit: limit,
181+ offset: (page .value - 1 ) * limit,
182+ })
183+
184+ if (data .value ? .length ) {
185+ messages .value = data .value
186+ handleNextCondition .value = blocks .value ? .length < limit
187+ }
188+
189+ isRefetching .value = false
190+ }
191+
168192const getUptime = async () => {
169193 const { data } = await fetchValidatorUptime ({
170194 id: props .validator .id ,
@@ -180,6 +204,7 @@ const getUptime = async () => {
180204if (activeTab .value ? .toLowerCase () === " delegators" ) await getDelegators ()
181205if (activeTab .value ? .toLowerCase () === " proposed blocks" ) await getBlocks ()
182206if (activeTab .value ? .toLowerCase () === " jails" ) await getJails ()
207+ if (activeTab .value ? .toLowerCase () === " messages" ) await getMessages ()
183208if (activeTab .value ? .toLowerCase () === " signals" ) await getSignals ()
184209if (activeTab .value ? .toLowerCase () === " votes" ) await getVotes ()
185210await getUptime ()
@@ -267,6 +292,9 @@ watch(
267292 case " votes" :
268293 getVotes ()
269294 break
295+ case " messages" :
296+ getMessages ()
297+ break
270298 }
271299 },
272300)
@@ -298,6 +326,9 @@ watch(
298326 case " votes" :
299327 getVotes ()
300328 break
329+ case " messages" :
330+ getMessages ()
331+ break
301332 }
302333 },
303334)
@@ -571,6 +602,17 @@ const handleDelegate = () => {
571602 </Flex>
572603 </template>
573604
605+ <template v-if="activeTab === ' messages' ">
606+ <MessagesTable v-if="messages.length" :messages="messages" />
607+
608+ <Flex v-else align="center" justify="center" direction="column" gap="8" wide :class="$style.empty">
609+ <Text size="13" weight="600" color="secondary" align="center"> No messages </Text>
610+ <Text size="12" weight="500" height="160" color="tertiary" align="center" style="max-width: 220px">
611+ No {{ page === 1 ? "" : "more" }} messages from this validator
612+ </Text>
613+ </Flex>
614+ </template>
615+
574616 <!-- Pagination -->
575617 <Flex align="center" gap="6" :class="$style.pagination">
576618 <Button @click="page = 1" type="secondary" size="mini" :disabled="page === 1">
0 commit comments