From 0cb60b41d09796aac337ef29937b06cdedd83096 Mon Sep 17 00:00:00 2001 From: Nicholas Castelli Date: Tue, 24 Sep 2024 11:29:55 -0500 Subject: [PATCH] JS prettier changes and localization updates Signed-off-by: Nicholas Castelli --- src/i18n/locales/de.json | 4 +- src/i18n/locales/en.json | 4 +- src/i18n/locales/es.json | 4 +- src/i18n/locales/fr.json | 4 +- src/i18n/locales/hi.json | 4 +- src/i18n/locales/it.json | 4 +- src/i18n/locales/ja.json | 4 +- src/i18n/locales/pl.json | 4 +- src/i18n/locales/pt-BR.json | 4 +- src/i18n/locales/pt.json | 4 +- src/i18n/locales/ru.json | 4 +- src/i18n/locales/uk-UA.json | 4 +- src/i18n/locales/zh.json | 4 +- .../portfolio/projects/ProjectComponents.vue | 46 +++++++++++-------- 14 files changed, 64 insertions(+), 34 deletions(-) diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 979d5e06d..629457355 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -855,7 +855,9 @@ "weakness": "Schwäche", "will_not_fix": "Wird nicht repariert", "workaround_available": "Problemumgehung verfügbar", - "x_trust_boundary": "Vertrauensgrenzen überschreiten" + "x_trust_boundary": "Vertrauensgrenzen überschreiten", + "download_component": "Komponenten herunterladen", + "csv_filetype": "CSV" }, "operator": { "contains_all": "enthält alle", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index b5f516e28..f0e8ac2b0 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -419,7 +419,7 @@ "create_vulnerability": "Create Vulnerability", "created": "Created", "credits": "Credits", - "csv_filetype": "CSV", + "csv_filetype": "CSV ", "custom_license": "Custom License", "custom_license_deleted": "Custom License Deleted", "cvss": "CVSS", @@ -476,7 +476,7 @@ "direct_only": "Direct only", "direction": "Direction", "download_bom": "Download BOM", - "download_component":"Download Components", + "download_component": "Download Components", "email": "Email", "empty_selection": "No items selected", "endpoints": "Endpoints", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index 7297b7afa..29fb528b5 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -855,7 +855,9 @@ "weakness": "Debilidad", "will_not_fix": "No se reparara", "workaround_available": "Solución alternativa disponible", - "x_trust_boundary": "Cruzar el límite de confianza" + "x_trust_boundary": "Cruzar el límite de confianza", + "download_component": "Descargar componentes", + "csv_filetype": "CSV" }, "operator": { "contains_all": "contiene todo", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 14bba4b07..2b39df532 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -855,7 +855,9 @@ "weakness": "Faiblesse", "will_not_fix": "Ne sera pas corrigée", "workaround_available": "Solution de contournement disponible", - "x_trust_boundary": "Limte de confiance mutuelle" + "x_trust_boundary": "Limte de confiance mutuelle", + "download_component": "Télécharger les composants", + "csv_filetype": "CSV" }, "operator": { "contains_all": "contient tous", diff --git a/src/i18n/locales/hi.json b/src/i18n/locales/hi.json index 47dbed1fe..4de1ef8e3 100644 --- a/src/i18n/locales/hi.json +++ b/src/i18n/locales/hi.json @@ -855,7 +855,9 @@ "weakness": "कमजोरी", "will_not_fix": "ठीक नहीं होगा", "workaround_available": "वैकल्पिक उपाय उपलब्ध है", - "x_trust_boundary": "क्रॉस ट्रस्ट सीमा" + "x_trust_boundary": "क्रॉस ट्रस्ट सीमा", + "download_component": "घटक डाउनलोड करें", + "csv_filetype": "CSV" }, "operator": { "contains_all": "इसमें सभी शामिल हैं", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index c58b0c783..609fc0620 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -855,7 +855,9 @@ "weakness": "Debolezza", "will_not_fix": "Non risolverà", "workaround_available": "Soluzione disponibile", - "x_trust_boundary": "Confine di fiducia incrociata" + "x_trust_boundary": "Confine di fiducia incrociata", + "download_component": "Scarica Componenti", + "csv_filetype": "CSV" }, "operator": { "contains_all": "contiene tutto", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index b054b3749..8cb1e2229 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -855,7 +855,9 @@ "weakness": "弱点", "will_not_fix": "修正しない", "workaround_available": "回避策あり", - "x_trust_boundary": "信頼境界を越える" + "x_trust_boundary": "信頼境界を越える", + "download_component": "コンポーネントをダウンロードする", + "csv_filetype": "CSV" }, "operator": { "contains_all": "すべてを含む", diff --git a/src/i18n/locales/pl.json b/src/i18n/locales/pl.json index 83cebffef..d16b5226f 100644 --- a/src/i18n/locales/pl.json +++ b/src/i18n/locales/pl.json @@ -855,7 +855,9 @@ "weakness": "Słabość", "will_not_fix": "Nie naprawi", "workaround_available": "Dostępne obejście", - "x_trust_boundary": "Granica zaufania krzyżowego" + "x_trust_boundary": "Granica zaufania krzyżowego", + "download_component": "Pobierz komponenty", + "csv_filetype": "CSV" }, "operator": { "contains_all": "zawiera wszystko", diff --git a/src/i18n/locales/pt-BR.json b/src/i18n/locales/pt-BR.json index 0b7bc9225..9d698aba9 100644 --- a/src/i18n/locales/pt-BR.json +++ b/src/i18n/locales/pt-BR.json @@ -855,7 +855,9 @@ "weakness": "Fraqueza", "will_not_fix": "Não irá corrigir", "workaround_available": "Solução alternativa disponível", - "x_trust_boundary": "Limite de confiança cruzada" + "x_trust_boundary": "Limite de confiança cruzada", + "download_component": "Baixar componentes", + "csv_filetype": "CSV" }, "operator": { "contains_all": "contém tudo", diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index 9b9ea0e53..87f22599c 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -855,7 +855,9 @@ "weakness": "Fraqueza", "will_not_fix": "Não irá corrigir", "workaround_available": "Solução alternativa disponível", - "x_trust_boundary": "Limite de confiança cruzada" + "x_trust_boundary": "Limite de confiança cruzada", + "download_component": "Baixar componentes", + "csv_filetype": "CSV" }, "operator": { "contains_all": "contém tudo", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 149ccc33d..a1629e22d 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -855,7 +855,9 @@ "weakness": "Слабость", "will_not_fix": "Не будет исправлено", "workaround_available": "Доступное решение", - "x_trust_boundary": "Пересечение границы доверия" + "x_trust_boundary": "Пересечение границы доверия", + "download_component": "Загрузить компоненты", + "csv_filetype": "CSV" }, "operator": { "contains_all": "содержит все", diff --git a/src/i18n/locales/uk-UA.json b/src/i18n/locales/uk-UA.json index afa35d362..eb02ec65d 100644 --- a/src/i18n/locales/uk-UA.json +++ b/src/i18n/locales/uk-UA.json @@ -855,7 +855,9 @@ "weakness": "Слабкість", "will_not_fix": "Не виправить", "workaround_available": "Доступний обхідний шлях", - "x_trust_boundary": "Перетнути кордон довіри" + "x_trust_boundary": "Перетнути кордон довіри", + "download_component": "Завантажити компоненти", + "csv_filetype": "CSV" }, "operator": { "contains_all": "містить усе", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index bcfa26d72..60a3e5e3b 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -855,7 +855,9 @@ "weakness": "弱点", "will_not_fix": "不会修复", "workaround_available": "有解决方法", - "x_trust_boundary": "跨越信任边界" + "x_trust_boundary": "跨越信任边界", + "download_component": "下载组件", + "csv_filetype": "CSV" }, "operator": { "contains_all": "包含全部", diff --git a/src/views/portfolio/projects/ProjectComponents.vue b/src/views/portfolio/projects/ProjectComponents.vue index f0c5f6370..1a8468067 100644 --- a/src/views/portfolio/projects/ProjectComponents.vue +++ b/src/views/portfolio/projects/ProjectComponents.vue @@ -422,38 +422,44 @@ export default { link.click(); }); }, -buildTableFile: function (json, fileType) { - if(fileType == "csv") { + buildTableFile: function (json, fileType) { + if (fileType == 'csv') { const items = json.data; - const header = ['name', 'version', 'group', 'internal', 'resolvedLicense.licenseId', 'lastInheritedRiskScore', 'metrics.vulnerabilities'];//Object.keys(items[0])//as long as the structure of the json doesnt change these can be static + const header = [ + 'name', + 'version', + 'group', + 'internal', + 'resolvedLicense.licenseId', + 'lastInheritedRiskScore', + 'metrics.vulnerabilities', + ]; //Object.keys(items[0])//as long as the structure of the json doesnt change these can be static const csv = [ header.join(','), - ...items.map(row => - header.map(header => get(row, header)).join(','), - ), - ].join('\r\n') - - const url = window.URL.createObjectURL(new Blob([csv])); - const link = document.createElement('a'); - link.href = url; - let filename = 'componentTable.csv'; - link.setAttribute('download', filename); - document.body.appendChild(link); - link.click(); - } + ...items.map((row) => + header.map((header) => get(row, header)).join(','), + ), + ].join('\r\n'); + const url = window.URL.createObjectURL(new Blob([csv])); + const link = document.createElement('a'); + link.href = url; + let filename = 'componentTable.csv'; + link.setAttribute('download', filename); + document.body.appendChild(link); + link.click(); + } }, downloadTable: async function (fileType) { const result = await this.downloadTableJson(); - this.buildTableFile(result, fileType) + this.buildTableFile(result, fileType); }, downloadTableJson: async function () { - let url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/project/${this.uuid}?limit=1000000&offset=0`; + let url = `${this.$api.BASE_URL}/${this.$api.URL_COMPONENT}/project/${this.uuid}?limit=1000000&offset=0`; try { let response = await this.axios.get(url); return response; - } - catch (e) { + } catch (e) { console.log(e); return e; }