diff options
Diffstat (limited to 'app/assets/javascripts/security_configuration/utils.js')
-rw-r--r-- | app/assets/javascripts/security_configuration/utils.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/security_configuration/utils.js b/app/assets/javascripts/security_configuration/utils.js index ec6b93c6193..47231497b8f 100644 --- a/app/assets/javascripts/security_configuration/utils.js +++ b/app/assets/javascripts/security_configuration/utils.js @@ -1,4 +1,5 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; +import { SCANNER_NAMES_MAP } from '~/security_configuration/components/constants'; export const augmentFeatures = (securityFeatures, complianceFeatures, features = []) => { const featuresByType = features.reduce((acc, feature) => { @@ -24,3 +25,13 @@ export const augmentFeatures = (securityFeatures, complianceFeatures, features = augmentedComplianceFeatures: complianceFeatures.map((feature) => augmentFeature(feature)), }; }; + +/** + * Converts a list of security scanner IDs (such as SAST_IAC) into a list of their translated + * names defined in the SCANNER_NAMES_MAP constant (eg. IaC Scanning). + * + * @param {String[]} scannerNames + * @returns {String[]} + */ +export const translateScannerNames = (scannerNames = []) => + scannerNames.map((scannerName) => SCANNER_NAMES_MAP[scannerName] || scannerName); |