Skip to content

Commit a386f75

Browse files
ashmodanother-rex
andauthored
feat(frontend): Group affected packages by ecosystem in vertical view (#3788)
This PR refactors the "Affected packages" component on the vulnerability details page to improve the user experience for vulnerabilities with many affected packages. The vertical layout has been redesigned as a two-level accordion, grouped by ecosystem: - Ecosystems are now the top-level collapsible headers. - Packages belonging to an ecosystem are nested inside as their own individual collapsible cards. - Ecosystems and packages are collapsed by default if their count is above a set threshold. Fixes #3087 --------- Co-authored-by: Shehab <[email protected]> Co-authored-by: Rex P <[email protected]>
1 parent 66c122d commit a386f75

File tree

3 files changed

+367
-20
lines changed

3 files changed

+367
-20
lines changed

gcp/website/frontend3/src/styles.scss

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ dl.vulnerability-details,
855855

856856
.vulnerability-packages-container {
857857
margin-top: 50px;
858+
padding-bottom: 50px;
858859

859860
.title {
860861
margin-left: 20px;
@@ -950,6 +951,153 @@ dl.vulnerability-details,
950951
pointer-events: none;
951952
}
952953

954+
&.force-collapse {
955+
h2.package-header {
956+
width: 100%;
957+
background: #393939;
958+
color: #fff;
959+
padding: 16px;
960+
margin-bottom: 2px;
961+
border-radius: 0;
962+
font-weight: normal;
963+
transition: background-color 0.2s ease-in-out;
964+
cursor: pointer;
965+
966+
&::before {
967+
content: '';
968+
width: 12px;
969+
height: 12px;
970+
margin-right: 8px;
971+
background-image: url(/static/img/filled-triangle.svg);
972+
background-position: center;
973+
background-repeat: no-repeat;
974+
transition: transform 0.2s ease-in-out;
975+
transform: rotate(0deg);
976+
filter: invert(100%);
977+
}
978+
979+
&[expanded]::before {
980+
transform: rotate(90deg);
981+
}
982+
983+
&:hover {
984+
background: #4F4F4F;
985+
}
986+
987+
&[expanded] {
988+
background: #fff;
989+
color: $osv-accent-color;
990+
font-weight: bold;
991+
992+
&::before {
993+
filter: invert(24%) sepia(89%) saturate(2293%) hue-rotate(345deg) brightness(81%) contrast(107%);
994+
}
995+
996+
&:hover {
997+
background: #f0f0f0;
998+
}
999+
}
1000+
}
1001+
1002+
.ecosystem-content-panel {
1003+
position: relative;
1004+
padding: 8px 0 16px 16px;
1005+
1006+
// The vertical "tree" line
1007+
&::before {
1008+
content: '';
1009+
position: absolute;
1010+
left: 8px;
1011+
top: 0;
1012+
bottom: 0;
1013+
width: 1px;
1014+
background: #555;
1015+
}
1016+
}
1017+
1018+
.package-accordion {
1019+
position: relative;
1020+
margin-bottom: 8px;
1021+
1022+
// The horizontal "connector" line
1023+
&::before {
1024+
content: '';
1025+
position: absolute;
1026+
left: -8px;
1027+
width: 8px;
1028+
top: 20px;
1029+
height: 1px;
1030+
background: #555;
1031+
}
1032+
}
1033+
1034+
.package-accordion h3.package-name-title {
1035+
font-family: $osv-heading-font-family;
1036+
font-size: 1.1rem;
1037+
color: #f1f1f1;
1038+
padding: 12px 16px;
1039+
cursor: pointer;
1040+
background: #333333;
1041+
border: 1px solid #444;
1042+
border-radius: 0;
1043+
1044+
&::before {
1045+
content: '';
1046+
width: 12px;
1047+
height: 12px;
1048+
margin-right: 8px;
1049+
background-image: url(/static/img/filled-triangle.svg);
1050+
background-position: center;
1051+
background-repeat: no-repeat;
1052+
filter: invert(100%);
1053+
transition: transform 0.2s ease-in-out;
1054+
display: inline-block;
1055+
vertical-align: middle;
1056+
transform: rotate(0deg);
1057+
}
1058+
1059+
&[expanded] {
1060+
border-bottom: 1px dashed #fff;
1061+
1062+
&::before {
1063+
transform: rotate(90deg);
1064+
}
1065+
}
1066+
}
1067+
1068+
.package-accordion .package-details-card {
1069+
background: #333333;
1070+
border: 1px solid #444;
1071+
border-top: none;
1072+
border-radius: 0;
1073+
1074+
.vulnerability-package-subsection {
1075+
padding: 14px 0;
1076+
border-bottom: 1px dashed #555;
1077+
1078+
&.affected-ranges-subsection {
1079+
padding-bottom: 4px;
1080+
}
1081+
1082+
h3 {
1083+
font-size: 16.55px;
1084+
}
1085+
1086+
dl {
1087+
font-size: 15px;
1088+
}
1089+
1090+
&:last-child {
1091+
border-bottom: none;
1092+
}
1093+
}
1094+
1095+
.mdc-layout-grid {
1096+
padding: 8px 16px 16px;
1097+
}
1098+
}
1099+
}
1100+
9531101
&[affordance="collapse"] h2.package-header {
9541102
.vuln-ecosystem {
9551103
display: inline;
@@ -1863,4 +2011,4 @@ div.highlight {
18632011

18642012
.search-suggestions::-webkit-scrollbar-thumb:hover {
18652013
background-color: $osv-grey-800;
1866-
}
2014+
}

0 commit comments

Comments
 (0)