@allurereport/web-dashboard 3.0.0-beta.17 → 3.0.0-beta.18
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/app-770edf6bb23c8d10ac62.js +2 -0
- package/dist/multi/manifest.json +20 -20
- package/dist/multi/{styles-600a3c9312864071f88c.css → styles-c42a1719237d936665e9.css} +1 -1
- package/dist/single/{app-e1eede23fa367bd3d2ad.js → app-24e261ecaf6a189105f2.js} +2 -2
- package/dist/single/manifest.json +1 -1
- package/package.json +5 -5
- package/src/components/Dashboard/index.tsx +13 -3
- package/src/stores/dashboard.ts +2 -166
- package/vitest.config.ts +15 -1
- package/dist/multi/app-581d52a3d2d3c17644ee.js +0 -2
- /package/dist/multi/{173.app-581d52a3d2d3c17644ee.js → 173.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{174.app-581d52a3d2d3c17644ee.js → 174.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{252.app-581d52a3d2d3c17644ee.js → 252.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{282.app-581d52a3d2d3c17644ee.js → 282.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{29.app-581d52a3d2d3c17644ee.js → 29.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{416.app-581d52a3d2d3c17644ee.js → 416.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{527.app-581d52a3d2d3c17644ee.js → 527.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{600.app-581d52a3d2d3c17644ee.js → 600.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{605.app-581d52a3d2d3c17644ee.js → 605.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{638.app-581d52a3d2d3c17644ee.js → 638.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{672.app-581d52a3d2d3c17644ee.js → 672.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{686.app-581d52a3d2d3c17644ee.js → 686.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{725.app-581d52a3d2d3c17644ee.js → 725.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{741.app-581d52a3d2d3c17644ee.js → 741.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{755.app-581d52a3d2d3c17644ee.js → 755.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{894.app-581d52a3d2d3c17644ee.js → 894.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{943.app-581d52a3d2d3c17644ee.js → 943.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{980.app-581d52a3d2d3c17644ee.js → 980.app-770edf6bb23c8d10ac62.js} +0 -0
- /package/dist/multi/{app-581d52a3d2d3c17644ee.js.LICENSE.txt → app-770edf6bb23c8d10ac62.js.LICENSE.txt} +0 -0
- /package/dist/single/{app-e1eede23fa367bd3d2ad.js.LICENSE.txt → app-24e261ecaf6a189105f2.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.18",
|
|
4
4
|
"description": "The static files for Allure Dashboard Report",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"IE 11"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
35
|
-
"@allurereport/web-commons": "3.0.0-beta.
|
|
36
|
-
"@allurereport/web-components": "3.0.0-beta.
|
|
34
|
+
"@allurereport/core-api": "3.0.0-beta.18",
|
|
35
|
+
"@allurereport/web-commons": "3.0.0-beta.18",
|
|
36
|
+
"@allurereport/web-components": "3.0.0-beta.18",
|
|
37
37
|
"@preact/signals": "^1.3.0",
|
|
38
38
|
"clsx": "^2.1.1",
|
|
39
39
|
"i18next": "^24.0.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@typescript-eslint/parser": "^8.0.0",
|
|
59
59
|
"@vitest/runner": "^2.1.9",
|
|
60
60
|
"@vitest/snapshot": "^2.1.9",
|
|
61
|
-
"allure-vitest": "^3.3.
|
|
61
|
+
"allure-vitest": "^3.3.3",
|
|
62
62
|
"autoprefixer": "^10.4.20",
|
|
63
63
|
"babel-loader": "^9.2.1",
|
|
64
64
|
"babel-plugin-prismjs": "^2.1.0",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2
|
-
import { ChartType
|
|
2
|
+
import { ChartType } from "@allurereport/core-api";
|
|
3
|
+
import { type UIChartData, capitalize } from "@allurereport/web-commons";
|
|
3
4
|
import {
|
|
5
|
+
ComingSoonChartWidget,
|
|
4
6
|
Grid,
|
|
5
7
|
GridItem,
|
|
6
8
|
Loadable,
|
|
@@ -10,12 +12,12 @@ import {
|
|
|
10
12
|
Widget,
|
|
11
13
|
} from "@allurereport/web-components";
|
|
12
14
|
import { useEffect } from "preact/hooks";
|
|
13
|
-
import {
|
|
15
|
+
import { dashboardStore, fetchDashboardData } from "@/stores/dashboard";
|
|
14
16
|
import { useI18n } from "@/stores/locale";
|
|
15
17
|
import * as styles from "./styles.scss";
|
|
16
18
|
|
|
17
19
|
const getChartWidgetByType = (
|
|
18
|
-
chartData:
|
|
20
|
+
chartData: UIChartData,
|
|
19
21
|
{ t, empty }: Record<string, (key: string, options?: any) => string>,
|
|
20
22
|
) => {
|
|
21
23
|
switch (chartData.type) {
|
|
@@ -48,6 +50,14 @@ const getChartWidgetByType = (
|
|
|
48
50
|
</Widget>
|
|
49
51
|
);
|
|
50
52
|
}
|
|
53
|
+
case ChartType.HeatMap:
|
|
54
|
+
case ChartType.Bar:
|
|
55
|
+
case ChartType.Funnel:
|
|
56
|
+
case ChartType.TreeMap: {
|
|
57
|
+
const title = chartData.title ?? t(`charts.${chartData.type}.title`, { fallback: `${chartData.type} Chart` });
|
|
58
|
+
|
|
59
|
+
return <ComingSoonChartWidget title={title} />;
|
|
60
|
+
}
|
|
51
61
|
}
|
|
52
62
|
};
|
|
53
63
|
|
package/src/stores/dashboard.ts
CHANGED
|
@@ -1,177 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { severityLevels, statusesList } from "@allurereport/core-api";
|
|
3
|
-
import { ChartDataType, type ChartId, type ChartMode, ChartType, fetchReportJsonData } from "@allurereport/web-commons";
|
|
1
|
+
import { type ChartsResponse, type UIChartsData, createCharts, fetchReportJsonData } from "@allurereport/web-commons";
|
|
4
2
|
import { signal } from "@preact/signals";
|
|
5
3
|
import type { StoreSignalState } from "@/stores/types";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
x: Date | string | number;
|
|
9
|
-
y: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface Slice {
|
|
13
|
-
min: number;
|
|
14
|
-
max: number;
|
|
15
|
-
metadata: { executionId: string };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ResponseTrendChartData {
|
|
19
|
-
type: ChartType.Trend;
|
|
20
|
-
dataType: ChartDataType;
|
|
21
|
-
mode: ChartMode;
|
|
22
|
-
title?: string;
|
|
23
|
-
min: number;
|
|
24
|
-
max: number;
|
|
25
|
-
points: Record<string, Point>;
|
|
26
|
-
slices: Record<string, Slice>;
|
|
27
|
-
series: Record<TestStatus | SeverityLevel, string[]>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface TrendChartItem {
|
|
31
|
-
id: string;
|
|
32
|
-
data: Point[];
|
|
33
|
-
color: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface TrendChartData {
|
|
37
|
-
type: ChartType.Trend;
|
|
38
|
-
dataType: ChartDataType;
|
|
39
|
-
mode: ChartMode;
|
|
40
|
-
min: number;
|
|
41
|
-
max: number;
|
|
42
|
-
items: TrendChartItem[];
|
|
43
|
-
slices: Slice[];
|
|
44
|
-
title?: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface PieSlice {
|
|
48
|
-
status: TestStatus;
|
|
49
|
-
count: number;
|
|
50
|
-
d: string | null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface ResponsePieChartData {
|
|
54
|
-
type: ChartType.Pie;
|
|
55
|
-
title?: string;
|
|
56
|
-
percentage: number;
|
|
57
|
-
slices: PieSlice[];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type PieChartData = ResponsePieChartData;
|
|
61
|
-
|
|
62
|
-
export type ChartData = TrendChartData | PieChartData;
|
|
63
|
-
|
|
64
|
-
type ChartsResponse = Partial<Record<ChartId, ResponseTrendChartData | ResponsePieChartData>>;
|
|
65
|
-
|
|
66
|
-
type ChartsData = Record<ChartId, ChartData>;
|
|
67
|
-
|
|
68
|
-
const statusColors: Record<TestStatus, string> = {
|
|
69
|
-
failed: "var(--bg-support-capella)",
|
|
70
|
-
broken: "var(--bg-support-atlas)",
|
|
71
|
-
passed: "var(--bg-support-castor)",
|
|
72
|
-
skipped: "var(--bg-support-rau)",
|
|
73
|
-
unknown: "var(--bg-support-skat)",
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const severityColors: Record<SeverityLevel, string> = {
|
|
77
|
-
blocker: "var(--bg-support-capella)",
|
|
78
|
-
critical: "var(--bg-support-atlas)",
|
|
79
|
-
normal: "var(--bg-support-castor)",
|
|
80
|
-
minor: "var(--bg-support-rau)",
|
|
81
|
-
trivial: "var(--bg-support-skat)",
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const dashboardStore = signal<StoreSignalState<ChartsData>>({
|
|
5
|
+
export const dashboardStore = signal<StoreSignalState<UIChartsData>>({
|
|
85
6
|
loading: true,
|
|
86
7
|
error: undefined,
|
|
87
8
|
data: undefined,
|
|
88
9
|
});
|
|
89
10
|
|
|
90
|
-
/**
|
|
91
|
-
* Helper function to create chart data for different chart types
|
|
92
|
-
*
|
|
93
|
-
* @param getChart - Function to get the chart data
|
|
94
|
-
* @param getGroups - Function to get the groups
|
|
95
|
-
* @param getColor - Function to get the color
|
|
96
|
-
* @returns TrendChartData or undefined if the chart data is not available
|
|
97
|
-
*/
|
|
98
|
-
const createTrendChartData = <T extends TestStatus | SeverityLevel>(
|
|
99
|
-
getChart: () => ResponseTrendChartData | undefined,
|
|
100
|
-
getGroups: () => readonly T[],
|
|
101
|
-
getColor: (group: T) => string,
|
|
102
|
-
): TrendChartData | undefined => {
|
|
103
|
-
const chart = getChart();
|
|
104
|
-
if (!chart) {
|
|
105
|
-
return undefined;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const items = getGroups().reduce((acc, group) => {
|
|
109
|
-
const pointsByGroupBy =
|
|
110
|
-
chart.series[group]?.map((pointId) => ({
|
|
111
|
-
x: chart.points[pointId].x,
|
|
112
|
-
y: chart.points[pointId].y,
|
|
113
|
-
})) ?? [];
|
|
114
|
-
|
|
115
|
-
if (pointsByGroupBy.length) {
|
|
116
|
-
acc.push({
|
|
117
|
-
id: group.charAt(0).toUpperCase() + group.slice(1),
|
|
118
|
-
data: pointsByGroupBy,
|
|
119
|
-
color: getColor(group),
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return acc;
|
|
124
|
-
}, [] as TrendChartItem[]);
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
type: chart.type,
|
|
128
|
-
dataType: chart.dataType,
|
|
129
|
-
mode: chart.mode,
|
|
130
|
-
title: chart.title,
|
|
131
|
-
items,
|
|
132
|
-
slices: Object.values(chart.slices),
|
|
133
|
-
min: chart.min,
|
|
134
|
-
max: chart.max,
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const createStatusTrendChartData = (chartId: ChartId, res: ChartsResponse): TrendChartData | undefined =>
|
|
139
|
-
createTrendChartData(
|
|
140
|
-
() => res[chartId] as ResponseTrendChartData | undefined,
|
|
141
|
-
() => statusesList,
|
|
142
|
-
(status) => statusColors[status],
|
|
143
|
-
);
|
|
144
|
-
const createSeverityTrendChartData = (chartId: ChartId, res: ChartsResponse): TrendChartData | undefined =>
|
|
145
|
-
createTrendChartData(
|
|
146
|
-
() => res[chartId] as ResponseTrendChartData | undefined,
|
|
147
|
-
() => severityLevels,
|
|
148
|
-
(severity) => severityColors[severity],
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
const createaTrendChartData = (
|
|
152
|
-
chartId: string,
|
|
153
|
-
chartData: ResponseTrendChartData,
|
|
154
|
-
res: ChartsResponse,
|
|
155
|
-
): TrendChartData | undefined => {
|
|
156
|
-
if (chartData.dataType === ChartDataType.Status) {
|
|
157
|
-
return createStatusTrendChartData(chartId, res);
|
|
158
|
-
} else if (chartData.dataType === ChartDataType.Severity) {
|
|
159
|
-
return createSeverityTrendChartData(chartId, res);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const createCharts = (res: ChartsResponse): ChartsData => {
|
|
164
|
-
return Object.entries(res).reduce((acc, [chartId, chart]) => {
|
|
165
|
-
if (chart.type === ChartType.Trend) {
|
|
166
|
-
acc[chartId] = createaTrendChartData(chartId, chart, res);
|
|
167
|
-
} else if (chart.type === ChartType.Pie) {
|
|
168
|
-
acc[chartId] = chart;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return acc;
|
|
172
|
-
}, {} as ChartsData);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
11
|
export const fetchDashboardData = async () => {
|
|
176
12
|
dashboardStore.value = {
|
|
177
13
|
...dashboardStore.value,
|
package/vitest.config.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import { platform } from "node:os";
|
|
2
3
|
import { defineConfig } from "vitest/config";
|
|
3
4
|
|
|
5
|
+
const getOsLabel = () => {
|
|
6
|
+
switch (platform()) {
|
|
7
|
+
case "win32":
|
|
8
|
+
return "Windows";
|
|
9
|
+
case "darwin":
|
|
10
|
+
return "macOS";
|
|
11
|
+
case "linux":
|
|
12
|
+
return "Linux";
|
|
13
|
+
default:
|
|
14
|
+
return platform();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
4
18
|
const require = createRequire(import.meta.url);
|
|
5
19
|
|
|
6
20
|
export default defineConfig({
|
|
@@ -12,7 +26,7 @@ export default defineConfig({
|
|
|
12
26
|
"default",
|
|
13
27
|
[
|
|
14
28
|
"allure-vitest/reporter",
|
|
15
|
-
{ resultsDir: "./out/allure-results", globalLabels: [{ name: "module", value: "web-dashboard" }] },
|
|
29
|
+
{ resultsDir: "./out/allure-results", globalLabels: [{ name: "module", value: "web-dashboard" }, { name: "os", value: getOsLabel() }] },
|
|
16
30
|
],
|
|
17
31
|
],
|
|
18
32
|
},
|