Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Block Explorer UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
Block Explorer UI
Commits
97f6e997
Commit
97f6e997
authored
4 months ago
by
Dima Rifai
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#380
- Handle no result scenario
parent
e4d7167d
No related branches found
No related tags found
2 merge requests
!481
bring recent develop changes to mater to match the backend
,
!476
Issue #380 - Handle no result scenario
Pipeline
#109524
failed
4 months ago
Stage: build
Stage: test
Stage: test-report-aggregate
Stage: cleanup
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/Witnesses/VotersDialog.tsx
+101
-93
101 additions, 93 deletions
components/Witnesses/VotersDialog.tsx
components/Witnesses/VotesHistoryDialog.tsx
+76
-66
76 additions, 66 deletions
components/Witnesses/VotesHistoryDialog.tsx
with
177 additions
and
159 deletions
components/Witnesses/VotersDialog.tsx
+
101
−
93
View file @
97f6e997
...
...
@@ -117,7 +117,6 @@ const VotersDialog: React.FC<VotersDialogProps> = ({
}
return
formatNumber
(
parseInt
(
value
),
true
,
false
)
+
"
Vests
"
;
// Return raw vests if not toggled to HP
};
return
(
<
Dialog
open
=
{
isVotersOpen
}
...
...
@@ -131,32 +130,34 @@ const VotersDialog: React.FC<VotersDialogProps> = ({
>
{
witnessVoters
?
(
<>
<
div
className
=
"flex justify-center items-centertext-center font-semibold "
data-testid
=
"voters-dialog-witness-name"
>
{
accountName
.
toUpperCase
()
}
- Voters
{
isWitnessVotersLoading
&&
(
<
Loader2
className
=
"animate-spin mt-1 h-4 w-4 ml-3 ..."
/>
)
}
</
div
>
<
div
className
=
"flex justify-between items-center w-full"
>
<
div
className
=
"flex items-center"
>
{
witnessDetails
&&
(
<
LastUpdatedTooltip
lastUpdatedAt
=
{
witnessDetails
.
votes_updated_at
}
/>
<
div
>
<
div
className
=
"flex justify-center items-centertext-center font-semibold "
data-testid
=
"voters-dialog-witness-name"
>
{
accountName
.
toUpperCase
()
}
- Voters
{
isWitnessVotersLoading
&&
(
<
Loader2
className
=
"animate-spin mt-1 h-4 w-4 ml-3 ..."
/>
)
}
</
div
>
<
div
className
=
"flex justify-between items-center w-full pt-4 pb-4"
>
<
div
className
=
"flex items-center"
>
{
witnessDetails
&&
(
<
LastUpdatedTooltip
lastUpdatedAt
=
{
witnessDetails
.
votes_updated_at
}
/>
)
}
</
div
>
<
div
className
=
"flex items-center"
>
<
label
className
=
"mr-2"
>
Vests
</
label
>
<
Switch
checked
=
{
isHP
}
onCheckedChange
=
{
()
=>
setIsHP
((
prev
)
=>
!
prev
)
}
className
=
"mx-1"
/>
<
label
>
HP
</
label
>
<
div
className
=
"flex items-center"
>
<
label
className
=
"mr-2"
>
Vests
</
label
>
<
Switch
checked
=
{
isHP
}
onCheckedChange
=
{
()
=>
setIsHP
((
prev
)
=>
!
prev
)
}
className
=
"mx-1"
/>
<
label
>
HP
</
label
>
</
div
>
</
div
>
</
div
>
<
CustomPagination
...
...
@@ -169,80 +170,87 @@ const VotersDialog: React.FC<VotersDialogProps> = ({
className
=
"text-black dark:text-white"
isMirrored
=
{
false
}
/>
<
Table
className
=
"
text-white
"
>
<
TableHeader
>
<
TableRow
>
{
tableColums
.
map
((
column
,
index
)
=>
(
<
TableHead
onClick
=
{
()
=>
{
onHeaderClick
(
column
.
key
);
}
}
key
=
{
column
.
key
}
className
=
{
cn
({
"
sticky md:static left-0
"
:
!
index
,
})
}
>
<
span
className
=
{
cn
(
"
flex
"
,
{
"
ju
sti
fy-end
"
:
column
.
isRightAligned
,
{
witnessVoters
?.
voters
?.
length
===
0
&&
!
isWitnessVotersLoading
?
(
<
div
className
=
"
flex justify-center w-full
"
>
No results matching given criteria
<
/
div
>
)
:
(
<>
<
Table
className
=
"text-white"
>
<
TableHeader
>
<
TableRow
>
{
tableColums
.
map
((
column
,
index
)
=>
(
<
TableHead
onClick
=
{
()
=>
{
onHeaderClick
(
column
.
key
);
}
}
key
=
{
column
.
key
}
className
=
{
cn
({
"
sti
cky md:static left-0
"
:
!
index
,
})
}
>
{
column
.
name
}
{
showSorter
(
column
.
key
)
}
</
span
>
</
TableHead
>
))
}
</
TableRow
>
</
TableHeader
>
<
TableBody
data-testid
=
"voters-dialog-table-body"
>
{
witnessVoters
&&
witnessVoters
.
voters
.
map
((
voter
,
index
)
=>
(
<
TableRow
key
=
{
index
}
className
=
{
`
${
index
%
2
===
0
?
"
bg-rowEven
"
:
"
bg-rowOdd
"
}
`
}
>
<
TableCell
className
=
{
`text-link sticky md:static left-0
${
index
%
2
===
0
?
"
bg-rowEven md:bg-inherit
"
:
"
bg-rowOdd md:bg-inherit
"
<
span
className
=
{
cn
(
"
flex
"
,
{
"
justify-end
"
:
column
.
isRightAligned
,
})
}
>
{
column
.
name
}
{
showSorter
(
column
.
key
)
}
</
span
>
</
TableHead
>
))
}
</
TableRow
>
</
TableHeader
>
<
TableBody
data-testid
=
"voters-dialog-table-body"
>
{
witnessVoters
&&
witnessVoters
.
voters
.
map
((
voter
,
index
)
=>
(
<
TableRow
key
=
{
index
}
className
=
{
`
${
index
%
2
===
0
?
"
bg-rowEven
"
:
"
bg-rowOdd
"
}
`
}
>
<
Link
href
=
{
`/@
${
voter
.
voter_name
}
`
}
data-testid
=
"voter-name"
<
TableCell
className
=
{
`text-link sticky md:static left-0
${
index
%
2
===
0
?
"
bg-rowEven md:bg-inherit
"
:
"
bg-rowOdd md:bg-inherit
"
}
`
}
>
{
voter
.
voter_name
}
</
Link
>
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"vote-power"
>
{
fetchHivePower
(
voter
.
vests
.
toString
(),
isHP
)
}
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"account-power"
>
{
fetchHivePower
(
voter
.
account_vests
.
toString
(),
isHP
)
}
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"proxied-power"
>
{
fetchHivePower
(
voter
.
proxied_vests
.
toString
(),
isHP
)
}
</
TableCell
>
</
TableRow
>
))
}
</
TableBody
>
</
Table
>
</>
)
:
(
<
Loader2
className
=
"animate-spin mt-1 h-8 w-8 ml-3 ..."
/>
)
}
<
Link
href
=
{
`/@
${
voter
.
voter_name
}
`
}
data-testid
=
"voter-name"
>
{
voter
.
voter_name
}
</
Link
>
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"vote-power"
>
{
fetchHivePower
(
voter
.
vests
.
toString
(),
isHP
)
}
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"account-power"
>
{
fetchHivePower
(
voter
.
account_vests
.
toString
(),
isHP
)
}
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"proxied-power"
>
{
fetchHivePower
(
voter
.
proxied_vests
.
toString
(),
isHP
)
}
</
TableCell
>
</
TableRow
>
))
}
</
TableBody
>
</
Table
>
</>
)
}
</>
)
:
(
<
Loader2
className
=
"animate-spin mt-1 h-8 w-8 ml-3 ..."
/>
)
}
</
DialogContent
>
</
Dialog
>
);
...
...
This diff is collapsed.
Click to expand it.
components/Witnesses/VotesHistoryDialog.tsx
+
76
−
66
View file @
97f6e997
...
...
@@ -136,6 +136,7 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({
>
{
votesHistory
?
(
<>
<
div
>
<
div
className
=
"flex justify-center items-centertext-center font-semibold"
data-testid
=
"votes-history-dialog-witness-name"
...
...
@@ -145,7 +146,7 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({
<
Loader2
className
=
"animate-spin mt-1 h-4 w-4 ml-3 ..."
/>
)
}
</
div
>
<
div
className
=
"flex justify-between items-center w-full"
>
<
div
className
=
"flex justify-between items-center w-full
pt-4 pb-4
"
>
<
div
className
=
"flex items-center"
>
{
witnessDetails
&&
(
<
LastUpdatedTooltip
...
...
@@ -183,6 +184,7 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({
/>
</
div
>
</
div
>
</
div
>
{
votesHistory
&&
votesHistory
?.
length
>
PAGE_SIZE
&&
(
<
div
className
=
"flex justify-center items-center"
>
<
CustomPagination
...
...
@@ -199,72 +201,80 @@ const VotesHistoryDialog: React.FC<VotersDialogProps> = ({
</
div
>
</
div
>
)
}
<
Table
className
=
"text-text"
>
<
TableHeader
>
<
TableRow
>
{
tableColums
.
map
((
column
,
index
)
=>
(
<
TableHead
key
=
{
column
.
key
}
className
=
{
cn
(
"
min-h-12 h-auto p-3
"
,
{
"
sticky md:static left-0
"
:
!
index
,
"
flex justify-end items-center
"
:
column
.
isRightAligned
,
})
}
>
<
span
className
=
"flex "
>
{
column
.
name
}
</
span
>
</
TableHead
>
))
}
</
TableRow
>
</
TableHeader
>
<
TableBody
data-testid
=
"votes-history-dialog-table-body"
>
{
displayData
?.
votes_history
&&
displayData
?.
votes_history
.
map
((
vote
,
index
)
=>
(
<
TableRow
key
=
{
index
}
className
=
{
`
${
index
%
2
===
0
?
"
bg-rowEven
"
:
"
bg-rowOdd
"
}
`
}
>
<
TableCell
className
=
{
`sticky md:static left-0
${
index
%
2
===
0
?
"
bg-rowEven md:bg-inherit
"
:
"
bg-rowOdd md:bg-inherit
"
}
`
}
data-testid
=
"date-format"
>
{
formatAndDelocalizeTime
(
vote
.
timestamp
)
}
</
TableCell
>
<
TableCell
className
=
"text-link"
data-testid
=
"voter"
>
<
Link
href
=
{
`/@
${
vote
.
voter_name
}
`
}
>
{
vote
.
voter_name
}
</
Link
>
</
TableCell
>
<
TableCell
className
=
{
`
${
vote
.
approve
?
"
text-explorer-light-green
"
:
"
text-explorer-red
"
}
`
}
data-testid
=
"vote-arrow"
>
{
vote
.
approve
?
(
<
ArrowUpCircleIcon
color
=
"#17e405"
/>
)
:
(
<
ArrowDownCircleIcon
color
=
"#f71b1b"
/>
)
}
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"current-voter-power"
>
{
fetchHivePower
(
vote
.
vests
.
toString
(),
isHP
)
}
</
TableCell
>
{
votesHistory
?.
votes_history
?.
length
===
0
&&
!
isVotesHistoryLoading
?
(
<
div
className
=
"flex justify-center w-full"
>
No results matching given criteria
</
div
>
)
:
(
<>
<
Table
className
=
"text-text"
>
<
TableHeader
>
<
TableRow
>
{
tableColums
.
map
((
column
,
index
)
=>
(
<
TableHead
key
=
{
column
.
key
}
className
=
{
cn
(
"
min-h-12 h-auto p-3
"
,
{
"
sticky md:static left-0
"
:
!
index
,
"
flex justify-end items-center
"
:
column
.
isRightAligned
,
})
}
>
<
span
className
=
"flex "
>
{
column
.
name
}
</
span
>
</
TableHead
>
))
}
</
TableRow
>
))
}
</
TableBody
>
</
Table
>
</
TableHeader
>
<
TableBody
data-testid
=
"votes-history-dialog-table-body"
>
{
displayData
?.
votes_history
&&
displayData
?.
votes_history
.
map
((
vote
,
index
)
=>
(
<
TableRow
key
=
{
index
}
className
=
{
`
${
index
%
2
===
0
?
"
bg-rowEven
"
:
"
bg-rowOdd
"
}
`
}
>
<
TableCell
className
=
{
`sticky md:static left-0
${
index
%
2
===
0
?
"
bg-rowEven md:bg-inherit
"
:
"
bg-rowOdd md:bg-inherit
"
}
`
}
data-testid
=
"date-format"
>
{
formatAndDelocalizeTime
(
vote
.
timestamp
)
}
</
TableCell
>
<
TableCell
className
=
"text-link"
data-testid
=
"voter"
>
<
Link
href
=
{
`/@
${
vote
.
voter_name
}
`
}
>
{
vote
.
voter_name
}
</
Link
>
</
TableCell
>
<
TableCell
className
=
{
`
${
vote
.
approve
?
"
text-explorer-light-green
"
:
"
text-explorer-red
"
}
`
}
data-testid
=
"vote-arrow"
>
{
vote
.
approve
?
(
<
ArrowUpCircleIcon
color
=
"#17e405"
/>
)
:
(
<
ArrowDownCircleIcon
color
=
"#f71b1b"
/>
)
}
</
TableCell
>
<
TableCell
className
=
"text-right"
data-testid
=
"current-voter-power"
>
{
fetchHivePower
(
vote
.
vests
.
toString
(),
isHP
)
}
</
TableCell
>
</
TableRow
>
))
}
</
TableBody
>
</
Table
>
</>
)
}
</>
)
:
(
<
Loader2
className
=
"animate-spin mt-1 h-8 w-8 ml-3 ..."
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment