Skip to content

Commit

Permalink
refactor(ui): improve findings impact dashboard (#972)
Browse files Browse the repository at this point in the history
* refactor: show rootkit message since too many unknown names

* refactor(ui): display misconfiguration message in dashboard
  • Loading branch information
paralta committed Nov 23, 2023
1 parent a87b65a commit d68ab44
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
1 change: 1 addition & 0 deletions pkg/uibackend/api/models/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/uibackend/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ components:
type: string
rootkitType:
$ref: '#/components/schemas/RootkitType'
message:
type: string

RootkitType:
type: string
Expand Down
22 changes: 11 additions & 11 deletions pkg/uibackend/api/server/server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/uibackend/rest/dashboard_findings_impact.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func createRootkitFindingImpact(findingInfo *backendmodels.Finding_FindingInfo,
return models.RootkitFindingImpact{
AffectedAssetsCount: &count,
Rootkit: &models.Rootkit{
Message: info.Message,
RootkitName: info.RootkitName,
RootkitType: toModelsRootkitType(info.RootkitType),
},
Expand Down
8 changes: 8 additions & 0 deletions pkg/uibackend/rest/dashboard_findings_impact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,20 +472,23 @@ func Test_createFindingsImpact(t *testing.T) {
{
AffectedAssetsCount: utils.PointerTo(19),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path1"),
RootkitName: utils.PointerTo("name1"),
RootkitType: utils.PointerTo(models.RootkitType("type1")),
},
},
{
AffectedAssetsCount: utils.PointerTo(7),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path2"),
RootkitName: utils.PointerTo("name2"),
RootkitType: utils.PointerTo(models.RootkitType("type2")),
},
},
{
AffectedAssetsCount: utils.PointerTo(5),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path3"),
RootkitName: utils.PointerTo("name3"),
RootkitType: utils.PointerTo(models.RootkitType("type3")),
},
Expand Down Expand Up @@ -532,34 +535,39 @@ func Test_createFindingsImpact(t *testing.T) {
{
AffectedAssetsCount: utils.PointerTo(19),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path1"),
RootkitName: utils.PointerTo("name1"),
RootkitType: utils.PointerTo(models.RootkitType("type1")),
},
},
{
AffectedAssetsCount: utils.PointerTo(7),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path2"),
RootkitName: utils.PointerTo("name2"),
RootkitType: utils.PointerTo(models.RootkitType("type2")),
},
},
{
AffectedAssetsCount: utils.PointerTo(5),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path3"),
RootkitName: utils.PointerTo("name3"),
RootkitType: utils.PointerTo(models.RootkitType("type3")),
},
},
{
AffectedAssetsCount: utils.PointerTo(4),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path4"),
RootkitName: utils.PointerTo("name3"),
RootkitType: utils.PointerTo(models.RootkitType("type3")),
},
},
{
AffectedAssetsCount: utils.PointerTo(3),
Rootkit: &models.Rootkit{
Message: utils.PointerTo("path5"),
RootkitName: utils.PointerTo("name3"),
RootkitType: utils.PointerTo(models.RootkitType("type3")),
},
Expand Down
9 changes: 5 additions & 4 deletions ui/src/layout/Dashboard/FindingsImpactWidget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const TABS_COLUMNS_MAPPING = {
]
},
[FINDINGS_MAPPING.MISCONFIGURATIONS.dataKey]: {
headerItems: ["Test description"],
headerItems: ["Message"],
bodyItems: [
{dataKey: "misconfiguration.testDescription"}
{dataKey: "misconfiguration.message"}
]
},
[FINDINGS_MAPPING.SECRETS.dataKey]: {
Expand All @@ -51,9 +51,10 @@ const TABS_COLUMNS_MAPPING = {
]
},
[FINDINGS_MAPPING.ROOTKITS.dataKey]: {
headerItems: ["Rootkit name"],
headerItems: ["Rootkit name", "Message"],
bodyItems: [
{dataKey: "rootkit.rootkitName"}
{dataKey: "rootkit.rootkitName"},
{dataKey: "rootkit.message"}
]
},
[FINDINGS_MAPPING.PACKAGES.dataKey]: {
Expand Down

0 comments on commit d68ab44

Please sign in to comment.