Skip to content

Commit

Permalink
feat: add ro-to filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Dec 17, 2024
1 parent 005ad21 commit ad48197
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions frontend/src/lib/utils/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,33 @@ const IS_SELECTED_FILTER: ListViewFilterConfig = {
alwaysDisplay: true
};

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

const FEARED_EVENT_FILTER: ListViewFilterConfig = {
component: SelectFilter,
getColumn: (row) => (row.feared_events?.length ? row.feared_events.map((t) => t.str) : null),
extraProps: {
defaultOptionName: 'feared_event'
},
alwaysDisplay: true
};

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

const FRAMEWORK_FILTER: ListViewFilterConfig = {
component: SelectFilter,
getColumn: (row) => row.framework.ref_id,
Expand Down Expand Up @@ -612,18 +639,22 @@ export const listViewFields: ListViewFieldsConfig = {
'isSelected',
'riskOrigin',
'targetObjective',
'motivation',
'fearedEvents',
'pertinence'
],
body: [
'is_selected',
'risk_origin',
'target_objective',
'motivation',
'feared_events',
'pertinence'
]
],
filters: {
is_selected: IS_SELECTED_FILTER,
risk_origin: RISK_ORIGIN_FILTER,
feared_events: FEARED_EVENT_FILTER,
pertinence: PERTINENCE_FILTER
}
},
stakeholders: {
head: ['entity', 'category', 'current_criticality', 'applied_controls', 'residual_criticality'],
Expand Down

0 comments on commit ad48197

Please sign in to comment.