Skip to content

Commit

Permalink
Merge pull request #891 from intuitem/add_library_content_type_filter
Browse files Browse the repository at this point in the history
Add library content type filter
  • Loading branch information
nas-tabchiche authored Oct 3, 2024
2 parents 606177d + ca56e26 commit 95ce9a7
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"justification": "التبرير",
"parentFolder": "المجلد الرئيسي",
"contentType": "نوع المحتوى",
"objectType": "نوع الكائن",
"type": "النوع",
"lcStatus": "حالة LC",
"internalReference": "المرجع الداخلي",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Begründung",
"parentFolder": "Übergeordneter Ordner",
"contentType": "Inhaltstyp",
"objectType": "Objekttyp",
"type": "Typ",
"lcStatus": "Status",
"internalReference": "Interne Referenz",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"justification": "Justification",
"parentFolder": "Parent folder",
"contentType": "Content type",
"objectType": "Object type",
"type": "Type",
"lcStatus": "Status",
"internalReference": "Internal reference",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Justificación",
"parentFolder": "Carpeta principal",
"contentType": "Tipo de contenido",
"objectType": "abcdef",
"type": "Tipo",
"lcStatus": "Estado",
"internalReference": "Referencia interna",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Justification",
"parentFolder": "Domaine parent",
"contentType": "Type de contenu",
"objectType": "Type d'objet",
"type": "Type",
"lcStatus": "Statut",
"internalReference": "Référence interne",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"justification": "औचित्य",
"parentFolder": "अभिभावक फ़ोल्डर",
"contentType": "सामग्री प्रकार",
"objectType": "ऑब्जेक्ट प्रकार",
"type": "प्रकार",
"lcStatus": "स्थिति",
"internalReference": "आंतरिक संदर्भ",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Giustificazione",
"parentFolder": "Cartella principale",
"contentType": "Tipo di contenuto",
"objectType": "Tipo di oggetto",
"type": "Tipo",
"lcStatus": "Stato",
"internalReference": "Riferimento interno",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Rechtvaardiging",
"parentFolder": "Bovenliggende map",
"contentType": "Inhoudstype",
"objectType": "Objecttype",
"type": "Type",
"lcStatus": "Status",
"internalReference": "Interne referentie",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Uzasadnienie",
"parentFolder": "Folder nadrzędny",
"contentType": "Rodzaj treści",
"objectType": "Typ obiektu",
"type": "Typ",
"lcStatus": "Status LC",
"internalReference": "Referencja wewnętrzna",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"justification": "Justificativa",
"parentFolder": "Pasta pai",
"contentType": "Tipo de conteúdo",
"objectType": "Tipo de objeto",
"type": "Tipo",
"lcStatus": "Status",
"internalReference": "Referência interna",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"justification": "Justificare",
"parentFolder": "Dosar părinte",
"contentType": "Tip conținut",
"objectType": "Tipul obiectului",
"type": "Tip",
"lcStatus": "Stare LC",
"internalReference": "Referință internă",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/ur.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"justification": "جواز",
"parentFolder": "مرکزی فولڈر",
"contentType": "مواد کی قسم",
"objectType": "آبجیکٹ کی قسم",
"type": "قسم",
"lcStatus": "حیثیت",
"internalReference": "داخلی حوالہ",
Expand Down
32 changes: 29 additions & 3 deletions frontend/src/lib/utils/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,31 @@ const OWNER_FILTER: ListViewFilterConfig = {
}
}; */

const LIBRARY_TYPE_FILTER = {
component: SelectFilter,
getColumn: (row) => {
const overviewKeys = new Set(row.overview.map((overviewRow) => overviewRow.split(':')[0]));
const libraryDatatypeSet = new Set([
'framework',
'risk_matrix',
'threats',
'requirement_mapping_set',
'reference_controls'
]);
const datatypes = [...libraryDatatypeSet].filter((datatype) => overviewKeys.has(datatype));
return datatypes;
},
extraProps: {
defaultOptionName: 'objectType',
optionLabels: {
reference_controls: 'referenceControls',
requirement_mapping_set: 'requirementMappingSet',
risk_matrix: 'riskMatrix'
}
},
alwaysDisplay: true
};

export const listViewFields: ListViewFieldsConfig = {
folders: {
head: ['name', 'description', 'parentDomain'],
Expand Down Expand Up @@ -409,16 +434,17 @@ export const listViewFields: ListViewFieldsConfig = {
body: ['provider', 'name', 'description', 'locales', 'overview'],
filters: {
locales: LANGUAGE_FILTER,
provider: PROVIDER_FILTER_FOR_LIBRARIES
// has_risk_matrix: HAS_RISK_MATRIX_FILTER
provider: PROVIDER_FILTER_FOR_LIBRARIES,
objectType: LIBRARY_TYPE_FILTER
}
},
'loaded-libraries': {
head: ['provider', 'name', 'description', 'language', 'overview'],
body: ['provider', 'name', 'description', 'locales', 'overview'],
filters: {
locales: LANGUAGE_FILTER,
provider: PROVIDER_FILTER_FOR_LIBRARIES
provider: PROVIDER_FILTER_FOR_LIBRARIES,
objectType: LIBRARY_TYPE_FILTER
}
},
'sso-settings': {
Expand Down

0 comments on commit 95ce9a7

Please sign in to comment.