Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
a344becc
Commit
a344becc
authored
Dec 30, 2022
by
Yuri Mikhin
Committed by
Yuri Mikhin
Jan 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add units to number widgets in the Stats.
parent
acd2e7ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
NumberWidgetsList.tsx
ui/stats/NumberWidgetsList.tsx
+13
-4
number-widgets-scheme.ts
ui/stats/constants/number-widgets-scheme.ts
+2
-1
No files found.
ui/stats/NumberWidgetsList.tsx
View file @
a344becc
...
@@ -22,14 +22,23 @@ const NumberWidgetsList = () => {
...
@@ -22,14 +22,23 @@ const NumberWidgetsList = () => {
gridGap=
{
4
}
gridGap=
{
4
}
>
>
{
isLoading
?
skeletonElement
:
{
isLoading
?
skeletonElement
:
numberWidgetsScheme
.
map
(({
id
,
title
})
=>
numberWidgetsScheme
.
map
(({
id
,
title
,
formatFn
})
=>
{
data
?.
counters
[
id
]
?
(
if
(
!
data
?.
counters
[
id
])
{
return
null
;
}
const
value
=
formatNumberToMetricPrefix
(
Number
(
data
.
counters
[
id
]));
return
(
<
NumberWidget
<
NumberWidget
key=
{
id
}
key=
{
id
}
label=
{
title
}
label=
{
title
}
value=
{
formatNumberToMetricPrefix
(
Number
(
data
.
counters
[
id
]))
}
value=
{
formatFn
?
formatFn
(
value
)
:
value
}
/>
/>
)
:
null
)
}
);
})
}
</
Grid
>
</
Grid
>
);
);
};
};
...
...
ui/stats/constants/number-widgets-scheme.ts
View file @
a344becc
...
@@ -2,7 +2,7 @@ import type { Stats } from 'types/api/stats';
...
@@ -2,7 +2,7 @@ import type { Stats } from 'types/api/stats';
type
Key
=
keyof
Stats
[
'
counters
'
];
type
Key
=
keyof
Stats
[
'
counters
'
];
export
const
numberWidgetsScheme
:
Array
<
{
id
:
Key
;
title
:
string
}
>
=
[
export
const
numberWidgetsScheme
:
Array
<
{
id
:
Key
;
title
:
string
;
formatFn
?:
(
n
:
string
)
=>
string
}
>
=
[
{
{
id
:
'
totalBlocks
'
,
id
:
'
totalBlocks
'
,
title
:
'
Total blocks
'
,
title
:
'
Total blocks
'
,
...
@@ -10,6 +10,7 @@ export const numberWidgetsScheme: Array<{id: Key; title: string}> = [
...
@@ -10,6 +10,7 @@ export const numberWidgetsScheme: Array<{id: Key; title: string}> = [
{
{
id
:
'
averageBlockTime
'
,
id
:
'
averageBlockTime
'
,
title
:
'
Average block time
'
,
title
:
'
Average block time
'
,
formatFn
:
(
n
)
=>
`
${
n
}
s`
,
},
},
{
{
id
:
'
totalTransactions
'
,
id
:
'
totalTransactions
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment