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
67703471
Unverified
Commit
67703471
authored
Sep 13, 2024
by
tom goriunov
Committed by
GitHub
Sep 13, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support new CSV export limit in the UI (#2237)
Fixes #2215
parent
6da61c8a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
4 deletions
+21
-4
resources.ts
lib/api/resources.ts
+5
-1
configs.ts
types/api/configs.ts
+4
-0
CsvExport.pw.tsx
ui/pages/CsvExport.pw.tsx
+1
-0
CsvExport.tsx
ui/pages/CsvExport.tsx
+11
-3
CsvExport.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png
...t.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png
+0
-0
CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png
...CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png
+0
-0
CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png
.../CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png
+0
-0
No files found.
lib/api/resources.ts
View file @
67703471
...
...
@@ -61,7 +61,7 @@ import type {
BlockEpochElectionRewardDetailsResponse
,
}
from
'
types/api/block
'
;
import
type
{
ChartMarketResponse
,
ChartSecondaryCoinPriceResponse
,
ChartTransactionResponse
}
from
'
types/api/charts
'
;
import
type
{
BackendVersionConfig
}
from
'
types/api/configs
'
;
import
type
{
BackendVersionConfig
,
CsvExportConfig
}
from
'
types/api/configs
'
;
import
type
{
SmartContract
,
SmartContractVerificationConfigRaw
,
...
...
@@ -917,6 +917,9 @@ export const RESOURCES = {
config_backend_version
:
{
path
:
'
/api/v2/config/backend-version
'
,
},
config_csv_export
:
{
path
:
'
/api/v2/config/csv-export
'
,
},
// CSV EXPORT
csv_export_token_holders
:
{
...
...
@@ -1114,6 +1117,7 @@ never;
/* eslint-disable @typescript-eslint/indent */
export
type
ResourcePayloadB
<
Q
extends
ResourceName
>
=
Q
extends
'
config_backend_version
'
?
BackendVersionConfig
:
Q
extends
'
config_csv_export
'
?
CsvExportConfig
:
Q
extends
'
address_metadata_info
'
?
AddressMetadataInfo
:
Q
extends
'
address_metadata_tag_types
'
?
PublicTagTypesResponse
:
Q
extends
'
blob
'
?
Blob
:
...
...
types/api/configs.ts
View file @
67703471
export
interface
BackendVersionConfig
{
backend_version
:
string
;
}
export
interface
CsvExportConfig
{
limit
:
number
;
}
ui/pages/CsvExport.pw.tsx
View file @
67703471
...
...
@@ -15,6 +15,7 @@ test('base view +@mobile +@dark-mode', async({ render, page, mockApiResponse })
},
};
await
mockApiResponse
(
'
address
'
,
addressMock
.
validator
,
{
pathParams
:
{
hash
:
addressMock
.
hash
}
});
await
mockApiResponse
(
'
config_csv_export
'
,
{
limit
:
42123
});
const
component
=
await
render
(<
Box
sx=
{
{
'
.recaptcha
'
:
{
w
:
'
304px
'
,
h
:
'
78px
'
}
}
}
><
CsvExport
/></
Box
>,
{
hooksConfig
});
...
...
ui/pages/CsvExport.tsx
View file @
67703471
...
...
@@ -88,7 +88,13 @@ const CsvExport = () => {
},
});
const
isLoading
=
addressQuery
.
isPending
||
(
exportTypeParam
===
'
holders
'
&&
tokenQuery
.
isPending
);
const
configQuery
=
useApiQuery
(
'
config_csv_export
'
,
{
queryOptions
:
{
enabled
:
Boolean
(
addressHash
),
},
});
const
isLoading
=
addressQuery
.
isPending
||
configQuery
.
isPending
||
(
exportTypeParam
===
'
holders
'
&&
tokenQuery
.
isPending
);
const
backLink
=
React
.
useMemo
(()
=>
{
const
hasGoBackLink
=
appProps
.
referrer
&&
appProps
.
referrer
.
includes
(
'
/address
'
);
...
...
@@ -147,6 +153,8 @@ const CsvExport = () => {
return
null
;
}
const
limit
=
(
configQuery
.
data
?.
limit
||
10
_000
).
toLocaleString
(
undefined
,
{
maximumFractionDigits
:
3
,
notation
:
'
compact
'
});
if
(
exportTypeParam
===
'
holders
'
)
{
return
(
<
Flex
mb=
{
10
}
whiteSpace=
"pre-wrap"
flexWrap=
"wrap"
>
...
...
@@ -160,7 +168,7 @@ const CsvExport = () => {
noSymbol
/>
<
span
>
to CSV file.
</
span
>
<
span
>
Exports are limited to the top
10K
holders by amount held.
</
span
>
<
span
>
Exports are limited to the top
{
limit
}
holders by amount held.
</
span
>
</
Flex
>
);
}
...
...
@@ -176,7 +184,7 @@ const CsvExport = () => {
<
span
>
{
nbsp
}
</
span
>
{
filterType
&&
filterValue
&&
<
span
>
with applied filter by
{
filterType
}
(
{
filterValue
}
)
</
span
>
}
<
span
>
to CSV file.
</
span
>
<
span
>
Exports are limited to the last
10K
{
exportType
.
text
}
.
</
span
>
<
span
>
Exports are limited to the last
{
limit
}
{
exportType
.
text
}
.
</
span
>
</
Flex
>
);
})();
...
...
ui/pages/__screenshots__/CsvExport.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png
View replaced file @
6da61c8a
View file @
67703471
21.9 KB
|
W:
|
H:
22.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/pages/__screenshots__/CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png
View replaced file @
6da61c8a
View file @
67703471
21.4 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/pages/__screenshots__/CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png
View replaced file @
6da61c8a
View file @
67703471
21.3 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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