diff --git a/plugins/reporters/web-app-template/src/components/IssuesTable.jsx b/plugins/reporters/web-app-template/src/components/IssuesTable.jsx index 300579facb86c..4ad0a8049a62b 100644 --- a/plugins/reporters/web-app-template/src/components/IssuesTable.jsx +++ b/plugins/reporters/web-app-template/src/components/IssuesTable.jsx @@ -45,7 +45,11 @@ import SeverityTag from './SeverityTag'; import { getColumnSearchProps } from './Shared'; // Generates the HTML to display issues as a table -const IssuesTable = ({ webAppOrtIssues = [], showExcludesColumn = true }) => { +const IssuesTable = ({ + webAppOrtIssues = [], + showExcludesColumn = true, + severeThreshold +}) => { // Convert issues as Antd only accepts vanilla objects as input const issues = useMemo( () => { @@ -66,6 +70,19 @@ const IssuesTable = ({ webAppOrtIssues = [], showExcludesColumn = true }) => { [] ); + let defaultSeverityIndex = []; + switch (severeThreshold) { + case 'ERROR': + defaultSeverityIndex = [0]; + break; + case 'WARNING': + defaultSeverityIndex = [0, 1]; + break; + case 'HINT': + defaultSeverityIndex = [0, 1, 2]; + break; + } + /* === Table state handling === */ // State variable for displaying table in various pages @@ -77,7 +94,7 @@ const IssuesTable = ({ webAppOrtIssues = [], showExcludesColumn = true }) => { message: [], packageId: [], source: [], - severityIndex: [] + severityIndex: defaultSeverityIndex }); // State variable for sorting table columns diff --git a/plugins/reporters/web-app-template/src/components/ResultsSummary.jsx b/plugins/reporters/web-app-template/src/components/ResultsSummary.jsx index 0c669e8971e21..e2232d4f8901e 100644 --- a/plugins/reporters/web-app-template/src/components/ResultsSummary.jsx +++ b/plugins/reporters/web-app-template/src/components/ResultsSummary.jsx @@ -418,6 +418,7 @@ const ResultsSummary = ({ webAppOrtResult }) => { ) }, @@ -439,6 +440,7 @@ const ResultsSummary = ({ webAppOrtResult }) => { ) }, diff --git a/plugins/reporters/web-app-template/src/components/RuleViolationsTable.jsx b/plugins/reporters/web-app-template/src/components/RuleViolationsTable.jsx index 01b8c29b9a5d8..ae5c894925b4d 100644 --- a/plugins/reporters/web-app-template/src/components/RuleViolationsTable.jsx +++ b/plugins/reporters/web-app-template/src/components/RuleViolationsTable.jsx @@ -45,7 +45,11 @@ import SeverityTag from './SeverityTag'; import { getColumnSearchProps } from './Shared'; // Generates the HTML to display violations as a table -const RuleViolationsTable = ({ webAppRuleViolations = [], showExcludesColumn = true }) => { +const RuleViolationsTable = ({ + webAppRuleViolations = [], + showExcludesColumn = true, + severeThreshold +}) => { // Convert rule violations as Antd only accepts vanilla objects as input const violations = useMemo( () => { @@ -66,6 +70,19 @@ const RuleViolationsTable = ({ webAppRuleViolations = [], showExcludesColumn = t [] ); + let defaultSeverityIndex = []; + switch (severeThreshold) { + case 'ERROR': + defaultSeverityIndex = [0]; + break; + case 'WARNING': + defaultSeverityIndex = [0, 1]; + break; + case 'HINT': + defaultSeverityIndex = [0, 1, 2]; + break; + } + /* === Table state handling === */ // State variable for displaying table in various pages @@ -77,7 +94,7 @@ const RuleViolationsTable = ({ webAppRuleViolations = [], showExcludesColumn = t message: [], packageId: [], rule: [], - severityIndex: [] + severityIndex: defaultSeverityIndex }); // State variable for sorting table columns @@ -130,17 +147,17 @@ const RuleViolationsTable = ({ webAppRuleViolations = [], showExcludesColumn = t if (webAppPackage) { return webAppPackage.isExcluded ? ( - - - - - + + + + + ) : ( - + ); }