@allurereport/web-dashboard 3.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc.js +22 -0
- package/.eslintrc.cjs +18 -0
- package/CONTRIBUTING.md +33 -0
- package/README.md +27 -0
- package/dist/multi/173.app-1ef294bc.js +1 -0
- package/dist/multi/174.app-1ef294bc.js +1 -0
- package/dist/multi/252.app-1ef294bc.js +1 -0
- package/dist/multi/282.app-1ef294bc.js +1 -0
- package/dist/multi/29.app-1ef294bc.js +1 -0
- package/dist/multi/416.app-1ef294bc.js +1 -0
- package/dist/multi/527.app-1ef294bc.js +1 -0
- package/dist/multi/600.app-1ef294bc.js +1 -0
- package/dist/multi/605.app-1ef294bc.js +1 -0
- package/dist/multi/638.app-1ef294bc.js +1 -0
- package/dist/multi/672.app-1ef294bc.js +1 -0
- package/dist/multi/686.app-1ef294bc.js +1 -0
- package/dist/multi/725.app-1ef294bc.js +1 -0
- package/dist/multi/741.app-1ef294bc.js +1 -0
- package/dist/multi/755.app-1ef294bc.js +1 -0
- package/dist/multi/894.app-1ef294bc.js +1 -0
- package/dist/multi/943.app-1ef294bc.js +1 -0
- package/dist/multi/980.app-1ef294bc.js +1 -0
- package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
- package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
- package/dist/multi/app-1ef294bc.js +2 -0
- package/dist/multi/app-1ef294bc.js.LICENSE.txt +15 -0
- package/dist/multi/manifest.json +26 -0
- package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
- package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
- package/dist/multi/styles-1ef294bc.css +8 -0
- package/dist/single/app-4b8d700b.js +2 -0
- package/dist/single/app-4b8d700b.js.LICENSE.txt +15 -0
- package/dist/single/manifest.json +3 -0
- package/package.json +98 -0
- package/postcss.config.js +5 -0
- package/src/assets/scss/_common.scss +143 -0
- package/src/assets/scss/day.scss +51 -0
- package/src/assets/scss/fonts.scss +3 -0
- package/src/assets/scss/index.scss +7 -0
- package/src/assets/scss/night.scss +61 -0
- package/src/assets/scss/palette.scss +393 -0
- package/src/assets/scss/theme.scss +119 -0
- package/src/assets/scss/vars.scss +8 -0
- package/src/assets/svg/line-alerts-alert-circle.svg +12 -0
- package/src/assets/svg/line-general-eye.svg +7 -0
- package/src/assets/svg/line-icon-bomb-2.svg +12 -0
- package/src/components/BaseLayout/index.tsx +17 -0
- package/src/components/BaseLayout/styles.scss +59 -0
- package/src/components/Dashboard/components/TrendChartWidget/index.tsx +69 -0
- package/src/components/Dashboard/components/Widget/index.tsx +19 -0
- package/src/components/Dashboard/components/Widget/styles.scss +31 -0
- package/src/components/Dashboard/index.tsx +75 -0
- package/src/components/Dashboard/styles.scss +29 -0
- package/src/components/Footer/FooterLogo.tsx +15 -0
- package/src/components/Footer/FooterVersion.tsx +37 -0
- package/src/components/Footer/index.tsx +13 -0
- package/src/components/Footer/styles.scss +14 -0
- package/src/components/Header/index.tsx +21 -0
- package/src/components/Header/styles.scss +33 -0
- package/src/components/MainReport/index.tsx +12 -0
- package/src/components/MainReport/styles.scss +6 -0
- package/src/index.html +39 -0
- package/src/index.tsx +34 -0
- package/src/locales/az.json +32 -0
- package/src/locales/de.json +32 -0
- package/src/locales/en.json +32 -0
- package/src/locales/es.json +32 -0
- package/src/locales/fr.json +32 -0
- package/src/locales/he.json +32 -0
- package/src/locales/hy.json +32 -0
- package/src/locales/it.json +32 -0
- package/src/locales/ja.json +32 -0
- package/src/locales/ka.json +32 -0
- package/src/locales/kr.json +32 -0
- package/src/locales/nl.json +32 -0
- package/src/locales/pl.json +32 -0
- package/src/locales/pt.json +32 -0
- package/src/locales/ru.json +32 -0
- package/src/locales/sv.json +32 -0
- package/src/locales/tr.json +32 -0
- package/src/locales/zh.json +32 -0
- package/src/stores/dashboard.ts +206 -0
- package/src/stores/locale.ts +75 -0
- package/src/stores/theme.ts +32 -0
- package/src/stores/types.ts +5 -0
- package/src/styles.scss +45 -0
- package/src/types/globals.d.ts +13 -0
- package/src/types/window.d.ts +8 -0
- package/src/utils/isMac.ts +8 -0
- package/tsconfig.json +27 -0
- package/types.d.ts +21 -0
- package/vitest.config.ts +19 -0
- package/webpack.config.js +112 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Անցած",
|
|
4
|
+
"failed": "Ձախողված",
|
|
5
|
+
"broken": "Կոտրված",
|
|
6
|
+
"skipped": "Բաց թողնված",
|
|
7
|
+
"unknown": "Անհայտ",
|
|
8
|
+
"total": "Ընդհանուր"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Արդյունքներ չկան"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Արգելափակող",
|
|
15
|
+
"critical": "Կրիտիկական",
|
|
16
|
+
"normal": "Նորմալ",
|
|
17
|
+
"minor": "Երկրորդական",
|
|
18
|
+
"trivial": "Աննշան"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Միտումների գրաֆիկ: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Կարգավիճակ",
|
|
25
|
+
"severity": "Ծանրություն"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Թեստերի հաջողության գործակից"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Superato",
|
|
4
|
+
"failed": "Fallito",
|
|
5
|
+
"broken": "Rotto",
|
|
6
|
+
"skipped": "Saltato",
|
|
7
|
+
"unknown": "Sconosciuto",
|
|
8
|
+
"total": "Totale"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Nessun risultato"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Bloccante",
|
|
15
|
+
"critical": "Critico",
|
|
16
|
+
"normal": "Normale",
|
|
17
|
+
"minor": "Minore",
|
|
18
|
+
"trivial": "Banale"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Grafico di tendenza: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Stato",
|
|
25
|
+
"severity": "Gravità"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Tasso di successo dei test"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "成功",
|
|
4
|
+
"failed": "失敗",
|
|
5
|
+
"broken": "壊れた",
|
|
6
|
+
"skipped": "スキップ",
|
|
7
|
+
"unknown": "不明",
|
|
8
|
+
"total": "合計"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "結果がありません"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "ブロッカー",
|
|
15
|
+
"critical": "重大",
|
|
16
|
+
"normal": "通常",
|
|
17
|
+
"minor": "小規模",
|
|
18
|
+
"trivial": "些細"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "トレンドチャート: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "ステータス",
|
|
25
|
+
"severity": "重要度"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "テスト成功率"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "გავლილი",
|
|
4
|
+
"failed": "ჩაჭრილი",
|
|
5
|
+
"broken": "გაფუჭებული",
|
|
6
|
+
"skipped": "გამოტოვებული",
|
|
7
|
+
"unknown": "უცნობი",
|
|
8
|
+
"total": "სულ"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "შედეგები არ არის"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "ბლოკერი",
|
|
15
|
+
"critical": "კრიტიკული",
|
|
16
|
+
"normal": "ნორმალური",
|
|
17
|
+
"minor": "მცირე",
|
|
18
|
+
"trivial": "უმნიშვნელო"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "ტრენდის გრაფიკი: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "სტატუსი",
|
|
25
|
+
"severity": "სიმძიმე"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "ტესტების წარმატების მაჩვენებელი"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "통과",
|
|
4
|
+
"failed": "실패",
|
|
5
|
+
"broken": "손상됨",
|
|
6
|
+
"skipped": "건너뜀",
|
|
7
|
+
"unknown": "알수없음",
|
|
8
|
+
"total": "전체"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "결과 없음"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "차단",
|
|
15
|
+
"critical": "심각",
|
|
16
|
+
"normal": "보통",
|
|
17
|
+
"minor": "경미",
|
|
18
|
+
"trivial": "사소"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "트렌드 차트: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "상태",
|
|
25
|
+
"severity": "심각도"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "테스트 성공률"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Geslaagd",
|
|
4
|
+
"failed": "Mislukt",
|
|
5
|
+
"broken": "Defect",
|
|
6
|
+
"skipped": "Overgeslagen",
|
|
7
|
+
"unknown": "Onbekend",
|
|
8
|
+
"total": "Totaal"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Geen resultaten"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Blokkeerder",
|
|
15
|
+
"critical": "Kritiek",
|
|
16
|
+
"normal": "Normaal",
|
|
17
|
+
"minor": "Klein",
|
|
18
|
+
"trivial": "Triviaal"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Trendgrafiek: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Status",
|
|
25
|
+
"severity": "Ernst"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Test slagingspercentage"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Zaliczone",
|
|
4
|
+
"failed": "Niezaliczone",
|
|
5
|
+
"broken": "Uszkodzone",
|
|
6
|
+
"skipped": "Pominięte",
|
|
7
|
+
"unknown": "Nieznane",
|
|
8
|
+
"total": "Razem"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Brak wyników"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Blokujący",
|
|
15
|
+
"critical": "Krytyczny",
|
|
16
|
+
"normal": "Normalny",
|
|
17
|
+
"minor": "Pomniejszy",
|
|
18
|
+
"trivial": "Trywialny"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Wykres trendu: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Status",
|
|
25
|
+
"severity": "Ważność"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Wskaźnik powodzenia testów"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Aprovado",
|
|
4
|
+
"failed": "Falhou",
|
|
5
|
+
"broken": "Quebrado",
|
|
6
|
+
"skipped": "Ignorado",
|
|
7
|
+
"unknown": "Desconhecido",
|
|
8
|
+
"total": "Total"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Sem resultados"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Bloqueador",
|
|
15
|
+
"critical": "Crítico",
|
|
16
|
+
"normal": "Normal",
|
|
17
|
+
"minor": "Menor",
|
|
18
|
+
"trivial": "Trivial"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Gráfico de tendência: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Estado",
|
|
25
|
+
"severity": "Severidade"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Taxa de sucesso dos testes"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Успешный",
|
|
4
|
+
"failed": "Неуспешный",
|
|
5
|
+
"broken": "Сломанный",
|
|
6
|
+
"skipped": "Пропущенный",
|
|
7
|
+
"unknown": "Неизвестный",
|
|
8
|
+
"total": "Все"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Нет результатов"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Блокер",
|
|
15
|
+
"critical": "Критическая",
|
|
16
|
+
"normal": "Обычная",
|
|
17
|
+
"minor": "Невысокая",
|
|
18
|
+
"trivial": "Минимальная"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "График тренда: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Статус",
|
|
25
|
+
"severity": "Важность"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Успешность тестирования"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Godkänd",
|
|
4
|
+
"failed": "Misslyckad",
|
|
5
|
+
"broken": "Trasig",
|
|
6
|
+
"skipped": "Överhoppad",
|
|
7
|
+
"unknown": "Okänd",
|
|
8
|
+
"total": "Totalt"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Inga resultat"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Blockerande",
|
|
15
|
+
"critical": "Kritisk",
|
|
16
|
+
"normal": "Normal",
|
|
17
|
+
"minor": "Mindre",
|
|
18
|
+
"trivial": "Trivial"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Trenddiagram: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Status",
|
|
25
|
+
"severity": "Allvarlighetsgrad"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Testframgångsfrekvens"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "Başarılı",
|
|
4
|
+
"failed": "Başarısız",
|
|
5
|
+
"broken": "Bozuk",
|
|
6
|
+
"skipped": "Atlanmış",
|
|
7
|
+
"unknown": "Bilinmeyen",
|
|
8
|
+
"total": "Toplam"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "Sonuç yok"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "Engelleyici",
|
|
15
|
+
"critical": "Kritik",
|
|
16
|
+
"normal": "Normal",
|
|
17
|
+
"minor": "Küçük",
|
|
18
|
+
"trivial": "Önemsiz"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "Trend Grafiği: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "Durum",
|
|
25
|
+
"severity": "Önem Derecesi"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "Test Başarı Oranı"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statuses": {
|
|
3
|
+
"passed": "通过",
|
|
4
|
+
"failed": "失败",
|
|
5
|
+
"broken": "损坏",
|
|
6
|
+
"skipped": "跳过",
|
|
7
|
+
"unknown": "未知",
|
|
8
|
+
"total": "总计"
|
|
9
|
+
},
|
|
10
|
+
"empty": {
|
|
11
|
+
"no-results": "无结果"
|
|
12
|
+
},
|
|
13
|
+
"severity": {
|
|
14
|
+
"blocker": "阻塞",
|
|
15
|
+
"critical": "严重",
|
|
16
|
+
"normal": "普通",
|
|
17
|
+
"minor": "次要",
|
|
18
|
+
"trivial": "轻微"
|
|
19
|
+
},
|
|
20
|
+
"charts": {
|
|
21
|
+
"trend": {
|
|
22
|
+
"title": "趋势图表: {{type}}",
|
|
23
|
+
"type": {
|
|
24
|
+
"status": "状态",
|
|
25
|
+
"severity": "严重程度"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pie": {
|
|
29
|
+
"title": "测试成功率"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { SeverityLevel, TestStatus } from "@allurereport/core-api";
|
|
2
|
+
import { severityLevels, statusesList } from "@allurereport/core-api";
|
|
3
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
4
|
+
import { signal } from "@preact/signals";
|
|
5
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
6
|
+
|
|
7
|
+
export enum ChartType {
|
|
8
|
+
Trend = "trend",
|
|
9
|
+
Pie = "pie",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
enum ChartDataType {
|
|
13
|
+
Status = "status",
|
|
14
|
+
Severity = "severity",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ChartId = string;
|
|
18
|
+
|
|
19
|
+
interface Point {
|
|
20
|
+
x: Date | string | number;
|
|
21
|
+
y: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Slice {
|
|
25
|
+
min: number;
|
|
26
|
+
max: number;
|
|
27
|
+
metadata: { executionId: string };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface ResponseTrendChartData {
|
|
31
|
+
type: ChartType.Trend;
|
|
32
|
+
dataType: ChartDataType;
|
|
33
|
+
title?: string;
|
|
34
|
+
min: number;
|
|
35
|
+
max: number;
|
|
36
|
+
points: Record<string, Point>;
|
|
37
|
+
slices: Record<string, Slice>;
|
|
38
|
+
series: Record<TestStatus | SeverityLevel, string[]>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface TrendChartItem {
|
|
42
|
+
id: string;
|
|
43
|
+
data: Point[];
|
|
44
|
+
color: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface TrendChartData {
|
|
48
|
+
type: ChartType.Trend;
|
|
49
|
+
dataType: ChartDataType;
|
|
50
|
+
min: number;
|
|
51
|
+
max: number;
|
|
52
|
+
items: TrendChartItem[];
|
|
53
|
+
slices: Slice[];
|
|
54
|
+
title?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface PieSlice {
|
|
58
|
+
status: TestStatus;
|
|
59
|
+
count: number;
|
|
60
|
+
d: string | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface ResponsePieChartData {
|
|
64
|
+
type: ChartType.Pie;
|
|
65
|
+
title?: string;
|
|
66
|
+
percentage: number;
|
|
67
|
+
slices: PieSlice[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type PieChartData = ResponsePieChartData;
|
|
71
|
+
|
|
72
|
+
export type ChartData = TrendChartData | PieChartData;
|
|
73
|
+
|
|
74
|
+
type ChartsResponse = Partial<Record<ChartId, ResponseTrendChartData | ResponsePieChartData>>;
|
|
75
|
+
|
|
76
|
+
type ChartsData = Record<ChartId, ChartData>;
|
|
77
|
+
|
|
78
|
+
const statusColors: Record<TestStatus, string> = {
|
|
79
|
+
failed: "var(--bg-support-capella)",
|
|
80
|
+
broken: "var(--bg-support-atlas)",
|
|
81
|
+
passed: "var(--bg-support-castor)",
|
|
82
|
+
skipped: "var(--bg-support-rau)",
|
|
83
|
+
unknown: "var(--bg-support-skat)",
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const severityColors: Record<SeverityLevel, string> = {
|
|
87
|
+
blocker: "var(--bg-support-capella)",
|
|
88
|
+
critical: "var(--bg-support-atlas)",
|
|
89
|
+
normal: "var(--bg-support-castor)",
|
|
90
|
+
minor: "var(--bg-support-rau)",
|
|
91
|
+
trivial: "var(--bg-support-skat)",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const dashboardStore = signal<StoreSignalState<ChartsData>>({
|
|
95
|
+
loading: true,
|
|
96
|
+
error: undefined,
|
|
97
|
+
data: undefined,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Helper function to create chart data for different chart types
|
|
102
|
+
*
|
|
103
|
+
* @param getChart - Function to get the chart data
|
|
104
|
+
* @param getGroups - Function to get the groups
|
|
105
|
+
* @param getColor - Function to get the color
|
|
106
|
+
* @returns TrendChartData or undefined if the chart data is not available
|
|
107
|
+
*/
|
|
108
|
+
const createTrendChartData = <T extends TestStatus | SeverityLevel>(
|
|
109
|
+
getChart: () => ResponseTrendChartData | undefined,
|
|
110
|
+
getGroups: () => readonly T[],
|
|
111
|
+
getColor: (group: T) => string,
|
|
112
|
+
): TrendChartData | undefined => {
|
|
113
|
+
const chart = getChart();
|
|
114
|
+
if (!chart) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const items = getGroups().reduce((acc, group) => {
|
|
119
|
+
const pointsByGroupBy =
|
|
120
|
+
chart.series[group]?.map((pointId) => ({
|
|
121
|
+
x: chart.points[pointId].x,
|
|
122
|
+
y: chart.points[pointId].y,
|
|
123
|
+
})) ?? [];
|
|
124
|
+
|
|
125
|
+
if (pointsByGroupBy.length) {
|
|
126
|
+
acc.push({
|
|
127
|
+
id: group.charAt(0).toUpperCase() + group.slice(1),
|
|
128
|
+
data: pointsByGroupBy,
|
|
129
|
+
color: getColor(group),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return acc;
|
|
134
|
+
}, [] as TrendChartItem[]);
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
type: chart.type,
|
|
138
|
+
dataType: chart.dataType,
|
|
139
|
+
title: chart.title,
|
|
140
|
+
items,
|
|
141
|
+
slices: Object.values(chart.slices),
|
|
142
|
+
min: chart.min,
|
|
143
|
+
max: chart.max,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const createStatusTrendChartData = (chartId: ChartId, res: ChartsResponse): TrendChartData | undefined =>
|
|
148
|
+
createTrendChartData(
|
|
149
|
+
() => res[chartId] as ResponseTrendChartData | undefined,
|
|
150
|
+
() => statusesList,
|
|
151
|
+
(status) => statusColors[status],
|
|
152
|
+
);
|
|
153
|
+
const createSeverityTrendChartData = (chartId: ChartId, res: ChartsResponse): TrendChartData | undefined =>
|
|
154
|
+
createTrendChartData(
|
|
155
|
+
() => res[chartId] as ResponseTrendChartData | undefined,
|
|
156
|
+
() => severityLevels,
|
|
157
|
+
(severity) => severityColors[severity],
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const createaTrendChartData = (
|
|
161
|
+
chartId: string,
|
|
162
|
+
chartData: ResponseTrendChartData,
|
|
163
|
+
res: ChartsResponse,
|
|
164
|
+
): TrendChartData | undefined => {
|
|
165
|
+
if (chartData.dataType === ChartDataType.Status) {
|
|
166
|
+
return createStatusTrendChartData(chartId, res);
|
|
167
|
+
} else if (chartData.dataType === ChartDataType.Severity) {
|
|
168
|
+
return createSeverityTrendChartData(chartId, res);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const createCharts = (res: ChartsResponse): ChartsData => {
|
|
173
|
+
return Object.entries(res).reduce((acc, [chartId, chart]) => {
|
|
174
|
+
if (chart.type === ChartType.Trend) {
|
|
175
|
+
acc[chartId] = createaTrendChartData(chartId, chart, res);
|
|
176
|
+
} else if (chart.type === ChartType.Pie) {
|
|
177
|
+
acc[chartId] = chart;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return acc;
|
|
181
|
+
}, {} as ChartsData);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const fetchDashboardData = async () => {
|
|
185
|
+
dashboardStore.value = {
|
|
186
|
+
...dashboardStore.value,
|
|
187
|
+
loading: true,
|
|
188
|
+
error: undefined,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
const res = await fetchReportJsonData<ChartsResponse>("widgets/charts.json");
|
|
193
|
+
|
|
194
|
+
dashboardStore.value = {
|
|
195
|
+
data: createCharts(res),
|
|
196
|
+
error: undefined,
|
|
197
|
+
loading: false,
|
|
198
|
+
};
|
|
199
|
+
} catch (err) {
|
|
200
|
+
dashboardStore.value = {
|
|
201
|
+
data: undefined,
|
|
202
|
+
error: err.message,
|
|
203
|
+
loading: false,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { DEFAULT_LOCALE, LANG_LOCALE, type LangLocale, getReportOptions } from "@allurereport/web-commons";
|
|
2
|
+
import { computed, signal } from "@preact/signals";
|
|
3
|
+
import i18next, { type TOptions } from "i18next";
|
|
4
|
+
import type { DashboardReportOptions } from "types";
|
|
5
|
+
|
|
6
|
+
const namespaces = [
|
|
7
|
+
"empty",
|
|
8
|
+
"execution",
|
|
9
|
+
"filters",
|
|
10
|
+
"search",
|
|
11
|
+
"severity",
|
|
12
|
+
"sort-by",
|
|
13
|
+
"sort-by.directions",
|
|
14
|
+
"sort-by.values",
|
|
15
|
+
"statuses",
|
|
16
|
+
"tabs",
|
|
17
|
+
"testSummary",
|
|
18
|
+
"ui",
|
|
19
|
+
"welcome",
|
|
20
|
+
"controls",
|
|
21
|
+
"errors",
|
|
22
|
+
"split",
|
|
23
|
+
"modal",
|
|
24
|
+
"charts",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export const currentLocale = signal<LangLocale>("en" as LangLocale);
|
|
28
|
+
export const currentLocaleIso = computed(() => LANG_LOCALE[currentLocale.value]?.iso ?? LANG_LOCALE.en.iso);
|
|
29
|
+
export const currentLocaleIsRTL = computed(() => ["ar", "he", "fa"].includes(currentLocale.value));
|
|
30
|
+
|
|
31
|
+
export const getLocale = async () => {
|
|
32
|
+
const { reportLanguage } = getReportOptions<DashboardReportOptions>() ?? {};
|
|
33
|
+
const locale = localStorage.getItem("currentLocale") || reportLanguage || DEFAULT_LOCALE;
|
|
34
|
+
|
|
35
|
+
await setLocale(locale as LangLocale);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const waitForI18next = i18next
|
|
39
|
+
.use({
|
|
40
|
+
type: "backend",
|
|
41
|
+
read: async (
|
|
42
|
+
language: LangLocale,
|
|
43
|
+
namespace: string,
|
|
44
|
+
callback: (errorValue: unknown, translations: null) => void,
|
|
45
|
+
) => {
|
|
46
|
+
await import(`@/locales/${language}.json`)
|
|
47
|
+
.then((resources: Record<string, null>) => {
|
|
48
|
+
callback(null, resources[namespace]);
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
callback(error, null);
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
.init({
|
|
56
|
+
lng: currentLocale.value,
|
|
57
|
+
fallbackLng: "en",
|
|
58
|
+
ns: namespaces,
|
|
59
|
+
interpolation: { escapeValue: false },
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const useI18n = (namespace?: string) => {
|
|
63
|
+
const t = computed(() => (key: string, options?: TOptions) => i18next.t(key, { ns: namespace, ...options }));
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
t: t.value,
|
|
67
|
+
currentLocale: currentLocale.value,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const setLocale = async (locale: LangLocale) => {
|
|
72
|
+
await i18next.changeLanguage(locale as string);
|
|
73
|
+
localStorage.setItem("currentLocale", locale as string);
|
|
74
|
+
currentLocale.value = locale;
|
|
75
|
+
};
|