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
e2c79df7
Commit
e2c79df7
authored
Mar 18, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display apps without security score
parent
21b4dc6b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
45 deletions
+70
-45
MarketplaceListWithScores.tsx
ui/marketplace/MarketplaceListWithScores.tsx
+8
-5
DataNotAvailable.tsx
...arketplace/MarketplaceListWithScores/DataNotAvailable.tsx
+19
-0
ListItem.tsx
ui/marketplace/MarketplaceListWithScores/ListItem.tsx
+22
-23
TableItem.tsx
ui/marketplace/MarketplaceListWithScores/TableItem.tsx
+21
-17
No files found.
ui/marketplace/MarketplaceListWithScores.tsx
View file @
e2c79df7
...
@@ -35,11 +35,14 @@ const MarketplaceListWithScores = ({
...
@@ -35,11 +35,14 @@ const MarketplaceListWithScores = ({
showContractList
,
showContractList
,
}:
Props
)
=>
{
}:
Props
)
=>
{
const
displayedApps
=
React
.
useMemo
(()
=>
const
displayedApps
=
React
.
useMemo
(()
=>
apps
.
sort
((
a
,
b
)
=>
{
apps
if
(
!
a
.
securityReport
)
{
.
filter
((
app
)
=>
app
.
securityReport
)
return
1
;
.
sort
((
a
,
b
)
=>
b
.
securityReport
.
overallInfo
.
securityScore
-
a
.
securityReport
.
overallInfo
.
securityScore
)
}
else
if
(
!
b
.
securityReport
)
{
,
[
apps
]);
return
-
1
;
}
return
b
.
securityReport
.
overallInfo
.
securityScore
-
a
.
securityReport
.
overallInfo
.
securityScore
;
}),
[
apps
]);
const
content
=
apps
.
length
>
0
?
(
const
content
=
apps
.
length
>
0
?
(
<>
<>
...
...
ui/marketplace/MarketplaceListWithScores/DataNotAvailable.tsx
0 → 100644
View file @
e2c79df7
import
{
Tooltip
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
const
DataNotAvailable
=
()
=>
{
return
(
<
Tooltip
label=
"Data will be available soon"
textAlign=
"center"
padding=
{
2
}
openDelay=
{
500
}
>
<
chakra
.
span
cursor=
"default"
fontWeight=
"500"
fontSize=
"sm"
>
n/a
</
chakra
.
span
>
</
Tooltip
>
);
};
export
default
DataNotAvailable
;
ui/marketplace/MarketplaceListWithScores/ListItem.tsx
View file @
e2c79df7
import
{
Flex
,
IconButton
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
IconButton
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
MouseEvent
}
from
'
react
'
;
import
type
{
MouseEvent
}
from
'
react
'
;
...
@@ -25,16 +25,7 @@ type Props = {
...
@@ -25,16 +25,7 @@ type Props = {
}
}
const
ListItem
=
({
app
,
onInfoClick
,
isFavorite
,
onFavoriteClick
,
isLoading
,
onAppClick
,
showContractList
}:
Props
)
=>
{
const
ListItem
=
({
app
,
onInfoClick
,
isFavorite
,
onFavoriteClick
,
isLoading
,
onAppClick
,
showContractList
}:
Props
)
=>
{
const
{
const
{
id
,
securityReport
}
=
app
;
id
,
securityReport
,
securityReport
:
{
overallInfo
:
{
verifiedNumber
,
totalContractsNumber
,
},
},
}
=
app
;
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -98,18 +89,26 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
...
@@ -98,18 +89,26 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
</
Flex
>
</
Flex
>
<
Flex
alignItems=
"center"
>
<
Flex
alignItems=
"center"
>
<
Flex
flex=
{
1
}
gap=
{
3
}
alignItems=
"center"
>
<
Flex
flex=
{
1
}
gap=
{
3
}
alignItems=
"center"
>
<
AppSecurityReport
{
securityReport
?
(
id=
{
id
}
<>
securityReport=
{
securityReport
}
<
AppSecurityReport
showContractList=
{
showContractList
}
id=
{
id
}
height=
"30px"
securityReport=
{
securityReport
}
/>
showContractList=
{
showContractList
}
<
ContractListButton
onClick=
{
showAllContracts
}
variant=
{
ContractListButtonVariants
.
ALL_CONTRACTS
}
>
height=
"30px"
{
totalContractsNumber
}
/>
</
ContractListButton
>
<
ContractListButton
onClick=
{
showAllContracts
}
variant=
{
ContractListButtonVariants
.
ALL_CONTRACTS
}
>
<
ContractListButton
onClick=
{
showVerifiedContracts
}
variant=
{
ContractListButtonVariants
.
VERIFIED_CONTRACTS
}
>
{
securityReport
.
overallInfo
.
totalContractsNumber
}
{
verifiedNumber
}
</
ContractListButton
>
</
ContractListButton
>
<
ContractListButton
onClick=
{
showVerifiedContracts
}
variant=
{
ContractListButtonVariants
.
VERIFIED_CONTRACTS
}
>
{
securityReport
.
overallInfo
.
verifiedNumber
}
</
ContractListButton
>
</>
)
:
(
<
chakra
.
span
fontWeight=
"500"
fontSize=
"sm"
>
Data will be available soon
</
chakra
.
span
>
)
}
</
Flex
>
</
Flex
>
{
!
isLoading
&&
(
{
!
isLoading
&&
(
<
MoreInfoButton
onClick=
{
handleInfoClick
}
/>
<
MoreInfoButton
onClick=
{
handleInfoClick
}
/>
...
...
ui/marketplace/MarketplaceListWithScores/TableItem.tsx
View file @
e2c79df7
...
@@ -11,6 +11,7 @@ import IconSvg from 'ui/shared/IconSvg';
...
@@ -11,6 +11,7 @@ import IconSvg from 'ui/shared/IconSvg';
import
AppSecurityReport
from
'
../AppSecurityReport
'
;
import
AppSecurityReport
from
'
../AppSecurityReport
'
;
import
ContractListButton
,
{
ContractListButtonVariants
}
from
'
../ContractListButton
'
;
import
ContractListButton
,
{
ContractListButtonVariants
}
from
'
../ContractListButton
'
;
import
AppLink
from
'
./AppLink
'
;
import
AppLink
from
'
./AppLink
'
;
import
DataNotAvailable
from
'
./DataNotAvailable
'
;
import
MoreInfoButton
from
'
./MoreInfoButton
'
;
import
MoreInfoButton
from
'
./MoreInfoButton
'
;
type
Props
=
{
type
Props
=
{
...
@@ -33,16 +34,7 @@ const TableItem = ({
...
@@ -33,16 +34,7 @@ const TableItem = ({
showContractList
,
showContractList
,
}:
Props
)
=>
{
}:
Props
)
=>
{
const
{
const
{
id
,
securityReport
}
=
app
;
id
,
securityReport
,
securityReport
:
{
overallInfo
:
{
verifiedNumber
,
totalContractsNumber
,
},
},
}
=
app
;
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -83,17 +75,29 @@ const TableItem = ({
...
@@ -83,17 +75,29 @@ const TableItem = ({
<
AppLink
app=
{
app
}
isLoading=
{
isLoading
}
onAppClick=
{
onAppClick
}
isLarge
/>
<
AppLink
app=
{
app
}
isLoading=
{
isLoading
}
onAppClick=
{
onAppClick
}
isLarge
/>
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
<
AppSecurityReport
id=
{
id
}
securityReport=
{
securityReport
}
showContractList=
{
showContractList
}
/>
{
securityReport
?
(
<
AppSecurityReport
id=
{
id
}
securityReport=
{
securityReport
}
showContractList=
{
showContractList
}
/>
)
:
(
<
DataNotAvailable
/>
)
}
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
<
ContractListButton
onClick=
{
showAllContracts
}
variant=
{
ContractListButtonVariants
.
ALL_CONTRACTS
}
>
{
securityReport
?
(
{
totalContractsNumber
}
<
ContractListButton
onClick=
{
showAllContracts
}
variant=
{
ContractListButtonVariants
.
ALL_CONTRACTS
}
>
</
ContractListButton
>
{
securityReport
.
overallInfo
.
totalContractsNumber
}
</
ContractListButton
>
)
:
(
<
DataNotAvailable
/>
)
}
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
<
ContractListButton
onClick=
{
showVerifiedContracts
}
variant=
{
ContractListButtonVariants
.
VERIFIED_CONTRACTS
}
>
{
securityReport
?
(
{
verifiedNumber
}
<
ContractListButton
onClick=
{
showVerifiedContracts
}
variant=
{
ContractListButtonVariants
.
VERIFIED_CONTRACTS
}
>
</
ContractListButton
>
{
securityReport
.
overallInfo
.
verifiedNumber
}
</
ContractListButton
>
)
:
(
<
DataNotAvailable
/>
)
}
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
isNumeric
>
<
Td
verticalAlign=
"middle"
isNumeric
>
<
MoreInfoButton
onClick=
{
handleInfoClick
}
/>
<
MoreInfoButton
onClick=
{
handleInfoClick
}
/>
...
...
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