From 666bc6de525ec0513833ea8c9219499cc03713e0 Mon Sep 17 00:00:00 2001 From: Yaroslav Serhieiev Date: Fri, 29 Mar 2024 09:20:14 +0200 Subject: [PATCH] Refactor Category and Severity JS views --- .../plugins/testresult-category/CategoryView.js | 4 ++-- .../plugins/testresult-severity/SeverityView.hbs | 4 ++++ .../plugins/testresult-severity/SeverityView.js | 10 +++------- 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.hbs diff --git a/allure-generator/src/main/javascript/plugins/testresult-category/CategoryView.js b/allure-generator/src/main/javascript/plugins/testresult-category/CategoryView.js index 0296efa43..020fa834c 100644 --- a/allure-generator/src/main/javascript/plugins/testresult-category/CategoryView.js +++ b/allure-generator/src/main/javascript/plugins/testresult-category/CategoryView.js @@ -3,7 +3,7 @@ import { className } from "../../decorators/index"; import template from "./CategoryView.hbs"; @className("pane__section") -class SeverityView extends View { +class CategoryView extends View { template = template; serializeData() { @@ -14,4 +14,4 @@ class SeverityView extends View { } } -export default SeverityView; +export default CategoryView; diff --git a/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.hbs b/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.hbs new file mode 100644 index 000000000..467043120 --- /dev/null +++ b/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.hbs @@ -0,0 +1,4 @@ +{{#if severity}} + {{t 'testResult.severity.name'}}: + {{t (concat 'testResult.severity.' severity)}} +{{/if}} diff --git a/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.js b/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.js index a7f8bc3c7..707a6f174 100644 --- a/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.js +++ b/allure-generator/src/main/javascript/plugins/testresult-severity/SeverityView.js @@ -1,14 +1,10 @@ import { View } from "backbone.marionette"; -import { className } from "../../decorators/index"; -import translate from "../../helpers/t"; +import { className } from "../../decorators"; +import template from "./SeverityView.hbs"; @className("pane__section") class SeverityView extends View { - template({ severity }) { - return severity - ? `${translate("testResult.severity.name")}: ${translate(`testResult.severity.${severity}`)}` - : ""; - } + template = template; serializeData() { const extra = this.model.get("extra");