From 616a09a2e83def7a87723e327e995630539d7bb3 Mon Sep 17 00:00:00 2001 From: decodersingh <107138786+decodersingh@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:59:55 +0530 Subject: [PATCH 1/4] Fix:Demo Model Page --- td.vue/src/i18n/ar.js | 9 ++++-- td.vue/src/i18n/de.js | 10 +++++-- td.vue/src/i18n/el.js | 8 ++++-- td.vue/src/i18n/en.js | 8 ++++-- td.vue/src/i18n/es.js | 8 ++++-- td.vue/src/i18n/fi.js | 8 ++++-- td.vue/src/i18n/fr.js | 8 ++++-- td.vue/src/i18n/hi.js | 8 ++++-- td.vue/src/i18n/pt.js | 34 +++++++++++++---------- td.vue/src/i18n/zh.js | 8 ++++-- td.vue/src/views/demo/SelectDemoModel.vue | 2 +- 11 files changed, 76 insertions(+), 35 deletions(-) diff --git a/td.vue/src/i18n/ar.js b/td.vue/src/i18n/ar.js index d25a54009..2516ec6f3 100644 --- a/td.vue/src/i18n/ar.js +++ b/td.vue/src/i18n/ar.js @@ -47,7 +47,12 @@ const ara = { } }, demo: { - select: 'حدد نموذج تهديد تجريبي من القائمة أدناه' + select: 'حدد نموذج تهديد تجريبي من القائمة أدناه', + "New Threat Model": "نموذج تهديد جديد", + "Demo Threat Model": "نموذج تهديد تجريبي", + "Version 2 New Model": "الإصدار ٢ نموذج جديد", + "Version 2 Demo Model": "الإصدار ٢ نموذج تجريبي" + }, desktop: { file: { @@ -376,4 +381,4 @@ const ara = { } }; -export default ara; +export default ara; \ No newline at end of file diff --git a/td.vue/src/i18n/de.js b/td.vue/src/i18n/de.js index f22542b27..aedc87684 100644 --- a/td.vue/src/i18n/de.js +++ b/td.vue/src/i18n/de.js @@ -47,7 +47,11 @@ const deu = { } }, demo: { - select: 'Wählen Sie ein Beispiel Bedrohungsmodell aus der folgenden Liste' + select: 'Wählen Sie ein Beispiel Bedrohungsmodell aus der folgenden Liste', + "New Threat Model": "Neues Bedrohungsmodell", + "Demo Threat Model": "Demo-Bedrohungsmodell", + "Version 2 New Model": "Version 2 Neues Modell", + "Version 2 Demo Model": "Version 2 Demo-Modell" }, desktop: { file: { @@ -73,7 +77,7 @@ const deu = { }, repository: { select: 'Wählen Sie ein', - from: 'Repository aus folgender Liste', //in line with Github wording https://docs.github.com/de/repositories + from: 'Repository aus folgender Liste', //in line with Github wording https://docs.github.com/de/repositories noneFound: 'Kein Repository gefunden. Legen Sie zum Starten eine neues Repository an.' }, branch: { @@ -374,4 +378,4 @@ const deu = { } }; -export default deu; +export default deu; \ No newline at end of file diff --git a/td.vue/src/i18n/el.js b/td.vue/src/i18n/el.js index dcd65ba96..0486aca68 100644 --- a/td.vue/src/i18n/el.js +++ b/td.vue/src/i18n/el.js @@ -47,7 +47,11 @@ const ell = { } }, demo: { - select: 'Επιλέξτε ένα δείγμα μοντέλου απειλών από την παρακάτω λίστα' + select: 'Επιλέξτε ένα δείγμα μοντέλου απειλών από την παρακάτω λίστα', + "New Threat Model": "Νέο μοντέλο απειλής", + "Demo Threat Model": "Δοκιμαστικό μοντέλο απειλής", + "Version 2 New Model": "Έκδοση 2 Νέο μοντέλο", + "Version 2 Demo Model": "Έκδοση 2 Δοκιμαστικό μοντέλο" }, desktop: { file: { @@ -374,4 +378,4 @@ const ell = { } }; -export default ell; +export default ell; \ No newline at end of file diff --git a/td.vue/src/i18n/en.js b/td.vue/src/i18n/en.js index ac35da54f..f30679e94 100644 --- a/td.vue/src/i18n/en.js +++ b/td.vue/src/i18n/en.js @@ -47,7 +47,11 @@ const eng = { } }, demo: { - select: 'Select a demo threat model from the list below' + select: 'Select a demo threat model from the list below', + "New Threat Model": "New Threat Model", + "Demo Threat Model": "Demo Threat Model", + "Version 2 New Model": "Version 2 New Model", + "Version 2 Demo Model": "Version 2 Demo Model" }, desktop: { file: { @@ -374,4 +378,4 @@ const eng = { } }; -export default eng; +export default eng; \ No newline at end of file diff --git a/td.vue/src/i18n/es.js b/td.vue/src/i18n/es.js index cc48b8060..315e09cc6 100644 --- a/td.vue/src/i18n/es.js +++ b/td.vue/src/i18n/es.js @@ -47,7 +47,11 @@ const spa = { } }, demo: { - select: 'Seleccione un ejemplo de modelo de amenazas (threat model) de la lista a continuación' + select: 'Seleccione un ejemplo de modelo de amenazas (threat model) de la lista a continuación', + "New Threat Model": "Nuevo modelo de amenaza", + "Demo Threat Model": "Modelo de amenaza de demostración", + "Version 2 New Model": "Versión 2 Nuevo modelo", + "Version 2 Demo Model": "Versión 2 Modelo de demostración" }, desktop: { file: { @@ -374,4 +378,4 @@ const spa = { } }; -export default spa; +export default spa; \ No newline at end of file diff --git a/td.vue/src/i18n/fi.js b/td.vue/src/i18n/fi.js index f3cd3e06c..e41e9325f 100644 --- a/td.vue/src/i18n/fi.js +++ b/td.vue/src/i18n/fi.js @@ -47,7 +47,11 @@ const fin = { } }, demo: { - select: 'Valitse uhkamalli alla olevista' + select: 'Valitse uhkamalli alla olevista', + "New Threat Model": "Uusi uhkamalli", + "Demo Threat Model": "Demouhkamalli", + "Version 2 New Model": "Versio 2 Uusi malli", + "Version 2 Demo Model": "Versio 2 Demomalli" }, desktop: { file: { @@ -374,4 +378,4 @@ const fin = { } }; -export default fin; +export default fin; \ No newline at end of file diff --git a/td.vue/src/i18n/fr.js b/td.vue/src/i18n/fr.js index 6f507fcc5..f6fc4abd8 100644 --- a/td.vue/src/i18n/fr.js +++ b/td.vue/src/i18n/fr.js @@ -47,7 +47,11 @@ const fra = { } }, demo: { - select: 'Sélectionnez une démo de modèle de menace dans la liste ci-dessous' + select: 'Sélectionnez une démo de modèle de menace dans la liste ci-dessous', + "New Threat Model": "Nouveau modèle de menace", + "Demo Threat Model": "Modèle de menace de démonstration", + "Version 2 New Model": "Version 2 Nouveau modèle", + "Version 2 Demo Model": "Version 2 Modèle de démonstration" }, desktop: { file: { @@ -374,4 +378,4 @@ const fra = { } }; -export default fra; +export default fra; \ No newline at end of file diff --git a/td.vue/src/i18n/hi.js b/td.vue/src/i18n/hi.js index 562f73cb0..b1e2d3e4b 100644 --- a/td.vue/src/i18n/hi.js +++ b/td.vue/src/i18n/hi.js @@ -47,7 +47,11 @@ const hin = { } }, demo: { - select: 'नीचे दी गई सूची से एक डेमो थ्रेट मॉडल चुनें' + select: 'नीचे दी गई सूची से एक डेमो थ्रेट मॉडल चुनें', + 'New Threat Model': 'नया थ्रेट मॉडल', + 'Demo Threat Model': 'डेमो थ्रेट मॉडल', + 'Version 2 New Model': 'संस्करण 2 नया मॉडल', + 'Version 2 Demo Model': 'संस्करण 2 डेमो मॉडल' }, desktop: { file: { @@ -374,4 +378,4 @@ const hin = { } }; -export default hin; +export default hin; \ No newline at end of file diff --git a/td.vue/src/i18n/pt.js b/td.vue/src/i18n/pt.js index be23699ae..f6c082631 100644 --- a/td.vue/src/i18n/pt.js +++ b/td.vue/src/i18n/pt.js @@ -47,7 +47,11 @@ const por = { } }, demo: { - select: 'Select a demo threat model from the list below' + select: "Selecione um modelo de ameaça de demonstração da lista abaixo.", + "New Threat Model": "Novo modelo de ameaça", + "Demo Threat Model": "Modelo de ameaça de demonstração", + "Version 2 New Model": "Versão 2 Novo modelo", + "Version 2 Demo Model": "Versão 2 Modelo de demonstração" }, desktop: { file: { @@ -302,10 +306,10 @@ const por = { }, generic: { dafault: 'Nova ameaça genérica', - cia : 'Nova ameaça da CIA', - die : 'Nova ameaça da DIE', - linddun : 'Nova ameaça LINDDUN', - plot4ai : 'Nova ameaça PLOT4ai', + cia: 'Nova ameaça da CIA', + die: 'Nova ameaça da DIE', + linddun: 'Nova ameaça LINDDUN', + plot4ai: 'Nova ameaça PLOT4ai', stride: 'Nova ameaça STRIDE' }, edit: 'Edit Threat', @@ -348,18 +352,18 @@ const por = { showBranding: 'Threat Dragon logo' }, title: 'Relatório do modelo de ameaças para', - dateGenerated : 'Data Gerada', - executiveSummary : 'Resumo Executivo', - notProvided : 'Não fornecido', + dateGenerated: 'Data Gerada', + executiveSummary: 'Resumo Executivo', + notProvided: 'Não fornecido', summary: 'Resumo', - threatStats : { + threatStats: { total: 'Ameaças totais', mitigated: 'Total Mitigado', - notMitigated : 'Não atenuado', - openHigh : 'Abrir / Alta Prioridade', - openMedium : 'Abrir / Prioridade Média', - openLow : 'Abrir / Baixa Prioridade', - openUnknown : 'Prioridade Aberta / Desconhecida' + notMitigated: 'Não atenuado', + openHigh: 'Abrir / Alta Prioridade', + openMedium: 'Abrir / Prioridade Média', + openLow: 'Abrir / Baixa Prioridade', + openUnknown: 'Prioridade Aberta / Desconhecida' } }, upgrade: { @@ -374,4 +378,4 @@ const por = { } }; -export default por; +export default por; \ No newline at end of file diff --git a/td.vue/src/i18n/zh.js b/td.vue/src/i18n/zh.js index 4f3e4f930..30626c560 100644 --- a/td.vue/src/i18n/zh.js +++ b/td.vue/src/i18n/zh.js @@ -47,7 +47,11 @@ const zho = { } }, demo: { - select: '从下面的列表中选择一个演示威胁模型' + select: '从下面的列表中选择一个演示威胁模型', + "New Threat Model": "新威胁模型", + "Demo Threat Model": "演示威胁模型", + "Version 2 New Model": "第二版新模型", + "Version 2 Demo Model": "第二版演示模型" }, desktop: { file: { @@ -374,4 +378,4 @@ const zho = { } }; -export default zho; +export default zho; \ No newline at end of file diff --git a/td.vue/src/views/demo/SelectDemoModel.vue b/td.vue/src/views/demo/SelectDemoModel.vue index 2764d7c9d..b12a479ae 100644 --- a/td.vue/src/views/demo/SelectDemoModel.vue +++ b/td.vue/src/views/demo/SelectDemoModel.vue @@ -18,7 +18,7 @@ href="javascript:void(0)" @click="onModelClick(model)" :data-model-name="model.name" - >{{ model.name }} + >{{ $t(`demo.${ model.name }`) }} From 6b65b873da5f1beb98b92a0177695fc9916a9aec Mon Sep 17 00:00:00 2001 From: decodersingh <107138786+decodersingh@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:10:58 +0530 Subject: [PATCH 2/4] made changes in selectDemoMode.spec.js --- td.vue/tests/unit/views/demo/selectDemoModel.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/td.vue/tests/unit/views/demo/selectDemoModel.spec.js b/td.vue/tests/unit/views/demo/selectDemoModel.spec.js index d9a17dbbc..7ec79636c 100644 --- a/td.vue/tests/unit/views/demo/selectDemoModel.spec.js +++ b/td.vue/tests/unit/views/demo/selectDemoModel.spec.js @@ -44,7 +44,7 @@ describe('views/demo/SelectDemoModel.vue', () => { it('displays the demo threat model', () => { expect( wrapper.findAllComponents(BListGroupItem) - .filter(x => x.text() === 'Demo Threat Model') + .filter(x => x.text() === 'Demo Threat Model' || x.text()===`demo.${ "New Threat Model" }` || x.text()===`demo.${ "Demo Threat Model" }` || x.text()===`demo.${ "Version 2 New Model" }` || x.text()===`demo.${ "Version 2 Demo Model" }`) .at(0) .exists() ).toEqual(true); From dc2478a634d3ee5333e4df6bce5cf6def1f965b2 Mon Sep 17 00:00:00 2001 From: decodersingh <107138786+decodersingh@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:22:03 +0530 Subject: [PATCH 3/4] Updated selectDemoModel.spec.js --- .../unit/views/demo/selectDemoModel.spec.js | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/td.vue/tests/unit/views/demo/selectDemoModel.spec.js b/td.vue/tests/unit/views/demo/selectDemoModel.spec.js index 7ec79636c..4aed64d84 100644 --- a/td.vue/tests/unit/views/demo/selectDemoModel.spec.js +++ b/td.vue/tests/unit/views/demo/selectDemoModel.spec.js @@ -41,15 +41,16 @@ describe('views/demo/SelectDemoModel.vue', () => { expect(wrapper.findComponent(BJumbotron).text()).toEqual('demo.select'); }); - it('displays the demo threat model', () => { - expect( - wrapper.findAllComponents(BListGroupItem) - .filter(x => x.text() === 'Demo Threat Model' || x.text()===`demo.${ "New Threat Model" }` || x.text()===`demo.${ "Demo Threat Model" }` || x.text()===`demo.${ "Version 2 New Model" }` || x.text()===`demo.${ "Version 2 Demo Model" }`) - .at(0) - .exists() - ).toEqual(true); + it('displays the demo threat models', () => { + const demoModelNames = ['Demo Threat Model', 'New Threat Model', 'Version 2 New Model', 'Version 2 Demo Model']; + + demoModelNames.forEach(modelName => { + const translationKey = `demo.${modelName}`; + expect(wrapper.text()).toContain(translationKey); + }); }); - + + it('clears the threatmodels', () => { expect(mockStore.dispatch).toHaveBeenCalledWith('THREATMODEL_CLEAR'); }); @@ -61,7 +62,7 @@ describe('views/demo/SelectDemoModel.vue', () => { describe('selecting a demo model', () => { let demoModelItem; - beforeEach(async () => { + beforeEach(async() => { demoModelItem = await wrapper.findAllComponents(BListGroupItem) .filter(x => x.text() === 'Demo Threat Model') .at(0); @@ -73,9 +74,7 @@ describe('views/demo/SelectDemoModel.vue', () => { }); it('navigates to the threat model page', () => { - expect(mockRouter.push).toHaveBeenCalledWith( - { name: 'localThreatModel', params: { threatmodel: 'Demo Threat Model' }} - ); + expect(mockRouter.push).toHaveBeenCalledWith({ name: 'localThreatModel', params: { threatmodel: 'Demo Threat Model' } }); }); }); }); \ No newline at end of file From e5d8b6ca6532f3d1a535da7cb39440d953373343 Mon Sep 17 00:00:00 2001 From: decodersingh <107138786+decodersingh@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:28:42 +0530 Subject: [PATCH 4/4] revert the changes in unit test --- .../tests/unit/views/demo/selectDemoModel.spec.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/td.vue/tests/unit/views/demo/selectDemoModel.spec.js b/td.vue/tests/unit/views/demo/selectDemoModel.spec.js index 4aed64d84..0ed05b0f4 100644 --- a/td.vue/tests/unit/views/demo/selectDemoModel.spec.js +++ b/td.vue/tests/unit/views/demo/selectDemoModel.spec.js @@ -41,16 +41,15 @@ describe('views/demo/SelectDemoModel.vue', () => { expect(wrapper.findComponent(BJumbotron).text()).toEqual('demo.select'); }); - it('displays the demo threat models', () => { - const demoModelNames = ['Demo Threat Model', 'New Threat Model', 'Version 2 New Model', 'Version 2 Demo Model']; - - demoModelNames.forEach(modelName => { - const translationKey = `demo.${modelName}`; - expect(wrapper.text()).toContain(translationKey); - }); + it('displays the demo threat model', () => { + expect( + wrapper.findAllComponents(BListGroupItem) + .filter(x => x.text() === 'Demo Threat Model') + .at(0) + .exists() + ).toEqual(true); }); - it('clears the threatmodels', () => { expect(mockStore.dispatch).toHaveBeenCalledWith('THREATMODEL_CLEAR'); });