Skip to content

Commit

Permalink
fix: created correct filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Axxiar committed Jan 28, 2025
1 parent c1c9f95 commit 93a3080
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions frontend/src/lib/utils/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,27 @@ const ENTITY_FILTER: ListViewFilterConfig = {
alwaysDisplay: true
};

const CURRENT_LEVEL_FILTER: ListViewFilterConfig = {
component: SelectFilter,
getColumn: (row) => row.current_level.name,
extraProps: {
defaultOptionName: 'current_level'
},
alwaysDisplay: true
};

const RESIDUAL_LEVEL_FILTER: ListViewFilterConfig = {
component: SelectFilter,
getColumn: (row) => row.residual_level.name,
extraProps: {
defaultOptionName: 'residual_level'
},
alwaysDisplay: true
};

const CURRENT_CRITICALITY_FILTER: ListViewFilterConfig = {
component: SelectFilter,
getColumn: (row) => row.current_criticality?.toString() ?? row.current_level.name,
getColumn: (row) => row.current_criticality?.toString(),
extraProps: {
defaultOptionName: 'current_criticality'
},
Expand All @@ -239,7 +257,7 @@ const CURRENT_CRITICALITY_FILTER: ListViewFilterConfig = {

const RESIDUAL_CRITICALITY_FILTER: ListViewFilterConfig = {
component: SelectFilter,
getColumn: (row) => row.residual_criticality?.toString() ?? row.residual_level.name,
getColumn: (row) => row.residual_criticality?.toString(),
extraProps: {
defaultOptionName: 'residual_criticality'
},
Expand Down Expand Up @@ -459,8 +477,8 @@ export const listViewFields: ListViewFieldsConfig = {
risk_assessment: RISK_ASSESSMENT_FILTER,
threats: THREAT_FILTER,
assets: ASSET_FILTER,
current_level: CURRENT_CRITICALITY_FILTER,
residual_level: RESIDUAL_CRITICALITY_FILTER
current_level: CURRENT_LEVEL_FILTER,
residual_level: RESIDUAL_LEVEL_FILTER
}
},
'risk-acceptances': {
Expand Down

0 comments on commit 93a3080

Please sign in to comment.