Skip to content

Commit

Permalink
fix: add key to table components (#122)
Browse files Browse the repository at this point in the history
* fix: add key to the report tables

The report tables aren't being rerendered when the selected report
changes so adding a key to the component to trigger a rerender on report
change

* chore: remove the .env from UI

* chore: tidy up code

* chore: add names to the workflows
  • Loading branch information
owenrumney authored Feb 26, 2025
1 parent 5c936c5 commit 4bf937d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: lint

on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: package

on:
pull_request:

jobs:
package:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: publish

on:
push:
tags:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.vsix
node_modules
.idea
**/tsconfig.tsbuildinfo
**/tsconfig.tsbuildinfo
.env
1 change: 0 additions & 1 deletion ui/.env

This file was deleted.

39 changes: 24 additions & 15 deletions ui/src/BaseReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ export class BaseReport extends React.Component<
const licensesCount = countReportLicenses(this.props.report);
const assuranceCount = this.countAssuranceIssues(this.props.assurance);

const hasReportResults =
this.props.report &&
this.props.report.Results &&
this.props.report.Results.length > 0;

return (
<div className="flex-grow">
<div className="flex-grow">
Expand Down Expand Up @@ -122,30 +117,44 @@ export class BaseReport extends React.Component<
</TabBar>
</div>
<div className="tab-content flex-row">
{this.state.selectedTabId === 'vulnerabilities' &&
hasReportResults && (
<div className="flex-grow">
<VulnerabilitiesTable report={this.props.report} />
</div>
)}
{this.state.selectedTabId === 'vulnerabilities' && (
<div className="flex-grow">
<VulnerabilitiesTable
key={this.props.report.DisplayName}
report={this.props.report}
/>
</div>
)}
{this.state.selectedTabId === 'misconfigurations' && (
<div className="flex-grow">
<MisconfigurationsTable report={this.props.report} />
<MisconfigurationsTable
key={this.props.report.DisplayName}
report={this.props.report}
/>
</div>
)}
{this.state.selectedTabId === 'secrets' && (
<div className="flex-grow">
<SecretsTable report={this.props.report} />
<SecretsTable
key={this.props.report.DisplayName}
report={this.props.report}
/>
</div>
)}
{this.state.selectedTabId === 'licenses' && (
<div className="flex-grow">
<LicensesTable report={this.props.report} />
<LicensesTable
key={this.props.report.DisplayName}
report={this.props.report}
/>
</div>
)}
{this.state.selectedTabId === 'assurance' && (
<div className="flex-grow">
<AssuranceTable report={this.props.assurance} />
<AssuranceTable
key={this.props.report.DisplayName}
report={this.props.assurance}
/>
</div>
)}
</div>
Expand Down

0 comments on commit 4bf937d

Please sign in to comment.