@allurereport/web-dashboard 3.0.0-beta.19 → 3.0.0-beta.21
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/dist/multi/{173.app-b98a18c7d6561114f354.js → 173.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{174.app-b98a18c7d6561114f354.js → 174.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{252.app-b98a18c7d6561114f354.js → 252.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{282.app-b98a18c7d6561114f354.js → 282.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/29.app-8213f1e81b4008062105.js +1 -0
- package/dist/multi/{416.app-b98a18c7d6561114f354.js → 416.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{527.app-b98a18c7d6561114f354.js → 527.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{600.app-b98a18c7d6561114f354.js → 600.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{605.app-b98a18c7d6561114f354.js → 605.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{638.app-b98a18c7d6561114f354.js → 638.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/672.app-8213f1e81b4008062105.js +1 -0
- package/dist/multi/{686.app-b98a18c7d6561114f354.js → 686.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{725.app-b98a18c7d6561114f354.js → 725.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{741.app-b98a18c7d6561114f354.js → 741.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{755.app-b98a18c7d6561114f354.js → 755.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{894.app-b98a18c7d6561114f354.js → 894.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{943.app-b98a18c7d6561114f354.js → 943.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/{980.app-b98a18c7d6561114f354.js → 980.app-8213f1e81b4008062105.js} +1 -1
- package/dist/multi/app-8213f1e81b4008062105.js +2 -0
- package/dist/multi/manifest.json +20 -20
- package/dist/multi/{styles-83a09f6b14587b27ed9c.css → styles-1969c7350c6d5e3cd569.css} +1 -0
- package/dist/single/app-478ea6270dbbc5c28920.js +2 -0
- package/dist/single/manifest.json +1 -1
- package/package.json +5 -4
- package/src/components/Dashboard/index.tsx +29 -2
- package/src/components/EnvironmentPicker/index.tsx +51 -0
- package/src/components/EnvironmentPicker/styles.scss +9 -0
- package/src/components/Header/index.tsx +2 -0
- package/src/locales/az.json +5 -0
- package/src/locales/de.json +5 -0
- package/src/locales/en.json +5 -0
- package/src/locales/es.json +5 -0
- package/src/locales/fr.json +5 -0
- package/src/locales/he.json +5 -0
- package/src/locales/hy.json +5 -0
- package/src/locales/it.json +5 -0
- package/src/locales/ja.json +5 -0
- package/src/locales/ka.json +5 -0
- package/src/locales/kr.json +5 -0
- package/src/locales/nl.json +5 -0
- package/src/locales/pl.json +5 -0
- package/src/locales/pt.json +5 -0
- package/src/locales/ru.json +5 -0
- package/src/locales/sv.json +5 -0
- package/src/locales/tr.json +5 -0
- package/src/locales/zh.json +5 -0
- package/src/stores/dashboard.ts +8 -3
- package/src/stores/env.ts +57 -0
- package/webpack.config.js +5 -0
- package/dist/multi/29.app-b98a18c7d6561114f354.js +0 -1
- package/dist/multi/672.app-b98a18c7d6561114f354.js +0 -1
- package/dist/multi/app-b98a18c7d6561114f354.js +0 -2
- package/dist/single/app-7bcc055d079abc1ab4eb.js +0 -2
- /package/dist/multi/{app-b98a18c7d6561114f354.js.LICENSE.txt → app-8213f1e81b4008062105.js.LICENSE.txt} +0 -0
- /package/dist/single/{app-7bcc055d079abc1ab4eb.js.LICENSE.txt → app-478ea6270dbbc5c28920.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-dashboard",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.21",
|
|
4
4
|
"description": "The static files for Allure Dashboard Report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
"IE 11"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@allurereport/
|
|
35
|
-
"@allurereport/
|
|
36
|
-
"@allurereport/web-
|
|
34
|
+
"@allurereport/charts-api": "3.0.0-beta.21",
|
|
35
|
+
"@allurereport/core-api": "3.0.0-beta.21",
|
|
36
|
+
"@allurereport/web-commons": "3.0.0-beta.21",
|
|
37
|
+
"@allurereport/web-components": "3.0.0-beta.21",
|
|
37
38
|
"@preact/signals": "^1.3.0",
|
|
38
39
|
"clsx": "^2.1.1",
|
|
39
40
|
"i18next": "^24.0.2",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2
|
-
import {
|
|
2
|
+
import { BarChartType, ChartType } from "@allurereport/charts-api";
|
|
3
|
+
import { capitalize } from "@allurereport/core-api";
|
|
3
4
|
import { type UIChartData } from "@allurereport/web-commons";
|
|
4
5
|
import {
|
|
5
6
|
BarChartWidget,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
HeatMapWidget,
|
|
10
11
|
Loadable,
|
|
11
12
|
PageLoader,
|
|
13
|
+
StabilityRateDistributionWidget,
|
|
12
14
|
SuccessRatePieChart,
|
|
13
15
|
TreeMapChartWidget,
|
|
14
16
|
TrendChartWidget,
|
|
@@ -16,6 +18,7 @@ import {
|
|
|
16
18
|
} from "@allurereport/web-components";
|
|
17
19
|
import { useEffect } from "preact/hooks";
|
|
18
20
|
import { dashboardStore, fetchDashboardData } from "@/stores/dashboard";
|
|
21
|
+
import { currentEnvironment, fetchEnvironments } from "@/stores/env";
|
|
19
22
|
import { useI18n } from "@/stores/locale";
|
|
20
23
|
import * as styles from "./styles.scss";
|
|
21
24
|
|
|
@@ -57,6 +60,25 @@ const getChartWidgetByType = (
|
|
|
57
60
|
const type = t(`bar.type.${chartData.dataType}`);
|
|
58
61
|
const title = chartData.title ?? t("bar.title", { type: capitalize(type) });
|
|
59
62
|
|
|
63
|
+
if (chartData.dataType === BarChartType.StabilityRateDistribution) {
|
|
64
|
+
return (
|
|
65
|
+
<StabilityRateDistributionWidget
|
|
66
|
+
title={title}
|
|
67
|
+
mode={chartData.mode}
|
|
68
|
+
data={chartData.data}
|
|
69
|
+
keys={chartData.keys}
|
|
70
|
+
indexBy={chartData.indexBy}
|
|
71
|
+
colors={chartData.colors}
|
|
72
|
+
groupMode={chartData.groupMode}
|
|
73
|
+
xAxisConfig={chartData.xAxisConfig}
|
|
74
|
+
yAxisConfig={chartData.yAxisConfig}
|
|
75
|
+
layout={chartData.layout}
|
|
76
|
+
threshold={chartData.threshold}
|
|
77
|
+
translations={{ "no-results": empty("no-results") }}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
60
82
|
return (
|
|
61
83
|
<BarChartWidget
|
|
62
84
|
title={title}
|
|
@@ -66,6 +88,8 @@ const getChartWidgetByType = (
|
|
|
66
88
|
indexBy={chartData.indexBy}
|
|
67
89
|
colors={chartData.colors}
|
|
68
90
|
groupMode={chartData.groupMode}
|
|
91
|
+
xAxisConfig={chartData.xAxisConfig}
|
|
92
|
+
yAxisConfig={chartData.yAxisConfig}
|
|
69
93
|
translations={{ "no-results": empty("no-results") }}
|
|
70
94
|
/>
|
|
71
95
|
);
|
|
@@ -107,6 +131,7 @@ export const Dashboard = () => {
|
|
|
107
131
|
|
|
108
132
|
useEffect(() => {
|
|
109
133
|
fetchDashboardData();
|
|
134
|
+
fetchEnvironments();
|
|
110
135
|
}, []);
|
|
111
136
|
|
|
112
137
|
return (
|
|
@@ -114,7 +139,9 @@ export const Dashboard = () => {
|
|
|
114
139
|
source={dashboardStore}
|
|
115
140
|
renderLoader={() => <PageLoader />}
|
|
116
141
|
renderData={(data) => {
|
|
117
|
-
const
|
|
142
|
+
const currentChartsData = currentEnvironment.value ? data.byEnv[currentEnvironment.value] : data.general;
|
|
143
|
+
|
|
144
|
+
const charts = Object.entries(currentChartsData).map(([chartId, value]) => {
|
|
118
145
|
const chartWidget = getChartWidgetByType(value, { t, empty });
|
|
119
146
|
return (
|
|
120
147
|
<GridItem key={chartId} className={styles["overview-grid-item"]}>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DropdownButton, Menu, SvgIcon, Text, allureIcons } from "@allurereport/web-components";
|
|
2
|
+
import { currentEnvironment, environmentsStore, setCurrentEnvironment } from "@/stores/env";
|
|
3
|
+
import { useI18n } from "@/stores/locale";
|
|
4
|
+
import * as styles from "./styles.scss";
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7
|
+
export const EnvironmentPicker = () => {
|
|
8
|
+
const { t } = useI18n("environments");
|
|
9
|
+
const environment = currentEnvironment.value;
|
|
10
|
+
const handleSelect = (selectedOption: string) => {
|
|
11
|
+
setCurrentEnvironment(selectedOption);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// TODO: use props instead
|
|
15
|
+
if (environmentsStore.value.data.length <= 1) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={styles["environment-picker"]} data-testid={"environment-picker"}>
|
|
21
|
+
<SvgIcon id={allureIcons.environment} size={"s"} />
|
|
22
|
+
<Text className={styles["environment-picker-label"]} type={"ui"} size={"s"} bold>
|
|
23
|
+
{t("environment", { count: 1 })}:
|
|
24
|
+
</Text>
|
|
25
|
+
<Menu
|
|
26
|
+
size="s"
|
|
27
|
+
menuTrigger={({ isOpened, onClick }) => (
|
|
28
|
+
<DropdownButton
|
|
29
|
+
style="ghost"
|
|
30
|
+
size="s"
|
|
31
|
+
text={environment || t("all")}
|
|
32
|
+
isExpanded={isOpened}
|
|
33
|
+
data-testid={"environment-picker-button"}
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
<Menu.Section>
|
|
39
|
+
<Menu.ItemWithCheckmark onClick={() => handleSelect("")} isChecked={!environment}>
|
|
40
|
+
{t("all")}
|
|
41
|
+
</Menu.ItemWithCheckmark>
|
|
42
|
+
{environmentsStore.value.data.map((env) => (
|
|
43
|
+
<Menu.ItemWithCheckmark onClick={() => handleSelect(env)} key={env} isChecked={env === environment}>
|
|
44
|
+
{env}
|
|
45
|
+
</Menu.ItemWithCheckmark>
|
|
46
|
+
))}
|
|
47
|
+
</Menu.Section>
|
|
48
|
+
</Menu>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -3,6 +3,7 @@ import type { ClassValue } from "clsx";
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { currentLocale, setLocale } from "@/stores/locale";
|
|
5
5
|
import { getTheme, themeStore, toggleTheme } from "@/stores/theme";
|
|
6
|
+
import { EnvironmentPicker } from "../EnvironmentPicker";
|
|
6
7
|
import * as styles from "./styles.scss";
|
|
7
8
|
|
|
8
9
|
interface HeaderProps {
|
|
@@ -13,6 +14,7 @@ export const Header = ({ className }: HeaderProps) => {
|
|
|
13
14
|
return (
|
|
14
15
|
<div className={clsx(styles.above, className)}>
|
|
15
16
|
<div className={styles.right}>
|
|
17
|
+
<EnvironmentPicker />
|
|
16
18
|
<LanguagePicker locale={currentLocale.value} setLocale={setLocale} />
|
|
17
19
|
<ThemeButton theme={themeStore.value} toggleTheme={toggleTheme} getTheme={getTheme} />
|
|
18
20
|
</div>
|
package/src/locales/az.json
CHANGED
package/src/locales/de.json
CHANGED
package/src/locales/en.json
CHANGED
package/src/locales/es.json
CHANGED
package/src/locales/fr.json
CHANGED
package/src/locales/he.json
CHANGED
package/src/locales/hy.json
CHANGED
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
"minor": "Երկրորդական",
|
|
18
18
|
"trivial": "Աննշան"
|
|
19
19
|
},
|
|
20
|
+
"environments": {
|
|
21
|
+
"environment_one": "Համակարգչային միջավայր",
|
|
22
|
+
"environment_other": "Համակարգչային միջավայրներ",
|
|
23
|
+
"all": "Բոլոր համակարգչային միջավայրները"
|
|
24
|
+
},
|
|
20
25
|
"charts": {
|
|
21
26
|
"trend": {
|
|
22
27
|
"title": "Միտումների գրաֆիկ: {{type}}",
|
package/src/locales/it.json
CHANGED
package/src/locales/ja.json
CHANGED
package/src/locales/ka.json
CHANGED
package/src/locales/kr.json
CHANGED
package/src/locales/nl.json
CHANGED
package/src/locales/pl.json
CHANGED
package/src/locales/pt.json
CHANGED
package/src/locales/ru.json
CHANGED
package/src/locales/sv.json
CHANGED
package/src/locales/tr.json
CHANGED
package/src/locales/zh.json
CHANGED
package/src/stores/dashboard.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ChartsResponse,
|
|
3
|
+
type UIChartsDataWithEnvs,
|
|
4
|
+
createChartsWithEnvs,
|
|
5
|
+
fetchReportJsonData,
|
|
6
|
+
} from "@allurereport/web-commons";
|
|
2
7
|
import { signal } from "@preact/signals";
|
|
3
8
|
import type { StoreSignalState } from "@/stores/types";
|
|
4
9
|
|
|
5
|
-
export const dashboardStore = signal<StoreSignalState<
|
|
10
|
+
export const dashboardStore = signal<StoreSignalState<UIChartsDataWithEnvs>>({
|
|
6
11
|
loading: true,
|
|
7
12
|
error: undefined,
|
|
8
13
|
data: undefined,
|
|
@@ -19,7 +24,7 @@ export const fetchDashboardData = async () => {
|
|
|
19
24
|
const res = await fetchReportJsonData<ChartsResponse>("widgets/charts.json", { bustCache: true });
|
|
20
25
|
|
|
21
26
|
dashboardStore.value = {
|
|
22
|
-
data:
|
|
27
|
+
data: createChartsWithEnvs(res),
|
|
23
28
|
error: undefined,
|
|
24
29
|
loading: false,
|
|
25
30
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { effect, signal } from "@preact/signals";
|
|
3
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
4
|
+
|
|
5
|
+
const loadFromLocalStorage = <T>(key: string, defaultValue?: T): T => {
|
|
6
|
+
try {
|
|
7
|
+
const stored = localStorage.getItem(key);
|
|
8
|
+
return stored ? (JSON.parse(stored) as T) : defaultValue;
|
|
9
|
+
} catch {
|
|
10
|
+
return defaultValue;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const environmentsStore = signal<StoreSignalState<string[]>>({
|
|
15
|
+
loading: false,
|
|
16
|
+
error: undefined,
|
|
17
|
+
data: [],
|
|
18
|
+
});
|
|
19
|
+
export const collapsedEnvironments = signal<string[]>(loadFromLocalStorage<string[]>("collapsedEnvironments", []));
|
|
20
|
+
|
|
21
|
+
export const currentEnvironment = signal<string>(loadFromLocalStorage<string>("currentEnvironment", ""));
|
|
22
|
+
|
|
23
|
+
export const setCurrentEnvironment = (env: string) => {
|
|
24
|
+
currentEnvironment.value = env;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const fetchEnvironments = async () => {
|
|
28
|
+
environmentsStore.value = {
|
|
29
|
+
...environmentsStore.value,
|
|
30
|
+
loading: true,
|
|
31
|
+
error: undefined,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const res = await fetchReportJsonData<string[]>("widgets/environments.json", { bustCache: true });
|
|
36
|
+
|
|
37
|
+
environmentsStore.value = {
|
|
38
|
+
data: res,
|
|
39
|
+
error: undefined,
|
|
40
|
+
loading: false,
|
|
41
|
+
};
|
|
42
|
+
} catch (e) {
|
|
43
|
+
environmentsStore.value = {
|
|
44
|
+
...environmentsStore.value,
|
|
45
|
+
error: e.message,
|
|
46
|
+
loading: false,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
effect(() => {
|
|
52
|
+
localStorage.setItem("currentEnvironment", JSON.stringify(currentEnvironment.value));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
effect(() => {
|
|
56
|
+
localStorage.setItem("collapsedEnvironments", JSON.stringify([...collapsedEnvironments.value]));
|
|
57
|
+
});
|
package/webpack.config.js
CHANGED
|
@@ -90,6 +90,11 @@ export default (env, argv) => {
|
|
|
90
90
|
"react-dom": "@preact/compat",
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
+
externals: {
|
|
94
|
+
// Some packages use crypto from node:crypto, but webpack doesn't support it
|
|
95
|
+
// I think this does not end up in a bundle, so it is safe to do this
|
|
96
|
+
"node:crypto": "crypto",
|
|
97
|
+
},
|
|
93
98
|
};
|
|
94
99
|
|
|
95
100
|
if (SINGLE_FILE_MODE) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_allurereport_web_dashboard=self.webpackChunk_allurereport_web_dashboard||[]).push([[29],{29:function(e){e.exports=JSON.parse('{"statuses":{"passed":"Zaliczone","failed":"Niezaliczone","broken":"Uszkodzone","skipped":"Pominięte","unknown":"Nieznane","total":"Razem"},"empty":{"no-results":"Brak wyników"},"severity":{"blocker":"Blokujący","critical":"Krytyczny","normal":"Normalny","minor":"Pomniejszy","trivial":"Trywialny"},"charts":{"trend":{"title":"Wykres trendu: {{type}}","type":{"status":"Status","severity":"Ważność"}},"pie":{"title":"Wskaźnik powodzenia testów"}}}')}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_allurereport_web_dashboard=self.webpackChunk_allurereport_web_dashboard||[]).push([[672],{672:function(t){t.exports=JSON.parse('{"statuses":{"passed":"Superato","failed":"Fallito","broken":"Rotto","skipped":"Saltato","unknown":"Sconosciuto","total":"Totale"},"empty":{"no-results":"Nessun risultato"},"severity":{"blocker":"Bloccante","critical":"Critico","normal":"Normale","minor":"Minore","trivial":"Banale"},"charts":{"trend":{"title":"Grafico di tendenza: {{type}}","type":{"status":"Stato","severity":"Gravità"}},"pie":{"title":"Tasso di successo dei test"}}}')}}]);
|