@allurereport/web-commons 3.0.0-beta.22 → 3.0.0-beta.24
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/charts/generateCurrentStatusChart.d.ts +3 -0
- package/dist/charts/generateCurrentStatusChart.js +10 -0
- package/dist/charts/generators.js +4 -4
- package/dist/charts/index.d.ts +0 -1
- package/dist/charts/index.js +0 -1
- package/dist/charts/types.d.ts +12 -10
- package/dist/charts/utils.js +5 -2
- package/package.json +4 -4
- package/dist/charts/pie.d.ts +0 -6
- package/dist/charts/pie.js +0 -10
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type AllureChartsStoreData, type CurrentStatusChartOptions } from "@allurereport/charts-api";
|
|
2
|
+
import type { CurrentStatusChartData } from "./types.js";
|
|
3
|
+
export declare const generateCurrentStatusChart: (options: CurrentStatusChartOptions, storeData: AllureChartsStoreData) => CurrentStatusChartData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChartType } from "@allurereport/charts-api";
|
|
2
|
+
export const generateCurrentStatusChart = (options, storeData) => {
|
|
3
|
+
return {
|
|
4
|
+
type: ChartType.CurrentStatus,
|
|
5
|
+
title: options.title,
|
|
6
|
+
data: storeData.statistic,
|
|
7
|
+
statuses: options.statuses,
|
|
8
|
+
metric: options.metric,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -3,15 +3,15 @@ import { DEFAULT_ENVIRONMENT } from "@allurereport/core-api";
|
|
|
3
3
|
import { generateBarChart } from "./bar.js";
|
|
4
4
|
import { generateComingSoonChart } from "./comingSoon.js";
|
|
5
5
|
import { generateFunnelChart } from "./funnel/index.js";
|
|
6
|
+
import { generateCurrentStatusChart } from "./generateCurrentStatusChart.js";
|
|
6
7
|
import { generateHeatMapChart } from "./heatMap.js";
|
|
7
8
|
import { generateTrendChart } from "./line.js";
|
|
8
|
-
import { generatePieChart } from "./pie.js";
|
|
9
9
|
import { generateTreeMapChart } from "./treeMap.js";
|
|
10
10
|
const generateChartData = async (props) => {
|
|
11
11
|
const { env, chartsOptions, store, reportName, generateUuid } = props;
|
|
12
12
|
const result = {};
|
|
13
13
|
const storeData = await Promise.all([
|
|
14
|
-
await store.allHistoryDataPoints(),
|
|
14
|
+
env ? await store.allHistoryDataPointsByEnvironment(env) : await store.allHistoryDataPoints(),
|
|
15
15
|
env ? await store.testResultsByEnvironment(env) : await store.allTestResults(),
|
|
16
16
|
env ? await store.testsStatistic((tr) => tr.environment === env) : await store.testsStatistic(),
|
|
17
17
|
]).then(([historyDataPoints, testResults, statistic]) => ({
|
|
@@ -25,8 +25,8 @@ const generateChartData = async (props) => {
|
|
|
25
25
|
case ChartType.Trend:
|
|
26
26
|
result[chartId] = generateTrendChart(chartOption, storeData, reportName);
|
|
27
27
|
break;
|
|
28
|
-
case ChartType.
|
|
29
|
-
result[chartId] =
|
|
28
|
+
case ChartType.CurrentStatus:
|
|
29
|
+
result[chartId] = generateCurrentStatusChart(chartOption, storeData);
|
|
30
30
|
break;
|
|
31
31
|
case ChartType.Bar:
|
|
32
32
|
result[chartId] = generateBarChart(chartOption, storeData);
|
package/dist/charts/index.d.ts
CHANGED
package/dist/charts/index.js
CHANGED
package/dist/charts/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { BarChartType, BarGroup, BarGroupMode, BaseTrendSliceMetadata, ChartDataType, ChartId, ChartMode, ChartType, FunnelChartType, HeatMapSerie,
|
|
1
|
+
import type { BarChartType, BarGroup, BarGroupMode, BaseTrendSliceMetadata, ChartDataType, ChartId, ChartMode, ChartType, FunnelChartType, HeatMapSerie, TreeMapChartType, TreeMapNode, TrendPointId, TrendSlice, TrendSliceId } from "@allurereport/charts-api";
|
|
2
|
+
import type { Statistic, TestStatus } from "@allurereport/core-api";
|
|
2
3
|
export type TreeMapTooltipAccessor = <T>(node: T) => string[];
|
|
3
4
|
export interface Point {
|
|
4
5
|
x: Date | string | number;
|
|
@@ -20,11 +21,12 @@ export interface ResponseTrendChartData<SeriesType extends string = string, Meta
|
|
|
20
21
|
slices: Record<TrendSliceId, TrendSlice<Metadata>>;
|
|
21
22
|
series: Record<SeriesType, TrendPointId[]>;
|
|
22
23
|
}
|
|
23
|
-
export interface
|
|
24
|
-
type: ChartType.
|
|
24
|
+
export interface CurrentStatusChartData {
|
|
25
|
+
type: ChartType.CurrentStatus;
|
|
25
26
|
title?: string;
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
data: Statistic;
|
|
28
|
+
statuses?: TestStatus[];
|
|
29
|
+
metric?: TestStatus;
|
|
28
30
|
}
|
|
29
31
|
export interface ResponseBarChartData {
|
|
30
32
|
type: ChartType.Bar;
|
|
@@ -52,9 +54,9 @@ export interface ResponseHeatMapChartData {
|
|
|
52
54
|
data: HeatMapSerie[];
|
|
53
55
|
}
|
|
54
56
|
export type ChartsResponse<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = {
|
|
55
|
-
general: Record<ChartId, ResponseTrendChartData<SeriesType, Metadata> |
|
|
57
|
+
general: Record<ChartId, ResponseTrendChartData<SeriesType, Metadata> | CurrentStatusChartData | ResponseBarChartData | ResponseComingSoonChartData | ResponseTreeMapChartData | ResponseHeatMapChartData>;
|
|
56
58
|
byEnv: {
|
|
57
|
-
[env: string]: Record<ChartId, ResponseTrendChartData<SeriesType, Metadata> |
|
|
59
|
+
[env: string]: Record<ChartId, ResponseTrendChartData<SeriesType, Metadata> | CurrentStatusChartData | ResponseBarChartData | ResponseComingSoonChartData | ResponseTreeMapChartData | ResponseHeatMapChartData>;
|
|
58
60
|
};
|
|
59
61
|
};
|
|
60
62
|
export interface UITrendChartData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> {
|
|
@@ -67,7 +69,7 @@ export interface UITrendChartData<Metadata extends BaseTrendSliceMetadata = Base
|
|
|
67
69
|
slices: TrendSlice<Metadata>[];
|
|
68
70
|
title?: string;
|
|
69
71
|
}
|
|
70
|
-
export type
|
|
72
|
+
export type UICurrentStatusChartData = CurrentStatusChartData;
|
|
71
73
|
export interface UIBarChartData extends ResponseBarChartData {
|
|
72
74
|
colors: Record<string, string>;
|
|
73
75
|
xAxisConfig?: {
|
|
@@ -107,8 +109,8 @@ export interface ResponseTestingPyramidChartData {
|
|
|
107
109
|
percentage: number;
|
|
108
110
|
}[];
|
|
109
111
|
}
|
|
110
|
-
export type ChartData<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = ResponseTrendChartData<SeriesType, Metadata> |
|
|
111
|
-
export type UIChartData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = UITrendChartData<Metadata> |
|
|
112
|
+
export type ChartData<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = ResponseTrendChartData<SeriesType, Metadata> | CurrentStatusChartData | ResponseBarChartData | ResponseComingSoonChartData | ResponseTreeMapChartData | ResponseHeatMapChartData | ResponseTestingPyramidChartData;
|
|
113
|
+
export type UIChartData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = UITrendChartData<Metadata> | UICurrentStatusChartData | UIBarChartData | UIComingSoonChartData | UITreeMapChartData | UIHeatMapChartData | UITestingPyramidChartData;
|
|
112
114
|
export type ChartsData<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = Record<ChartId, ChartData<SeriesType, Metadata>>;
|
|
113
115
|
export type ChartsDataWithEnvs<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = {
|
|
114
116
|
general: Record<ChartId, ChartData<SeriesType, Metadata>>;
|
package/dist/charts/utils.js
CHANGED
|
@@ -198,7 +198,10 @@ export const createHeatMapChartData = (chartId, res) => {
|
|
|
198
198
|
};
|
|
199
199
|
export const createCharts = (res) => {
|
|
200
200
|
return Object.entries(res).reduce((acc, [chartId, chart]) => {
|
|
201
|
-
if (chart.type === ChartType.
|
|
201
|
+
if (chart.type === ChartType.CurrentStatus) {
|
|
202
|
+
acc[chartId] = res[chartId];
|
|
203
|
+
}
|
|
204
|
+
else if (chart.type === ChartType.Trend) {
|
|
202
205
|
const chartData = createaTrendChartData(chartId, chart, res);
|
|
203
206
|
if (chartData) {
|
|
204
207
|
acc[chartId] = chartData;
|
|
@@ -228,7 +231,7 @@ export const createCharts = (res) => {
|
|
|
228
231
|
acc[chartId] = chartData;
|
|
229
232
|
}
|
|
230
233
|
}
|
|
231
|
-
else if ([ChartType.
|
|
234
|
+
else if ([ChartType.ComingSoon].includes(chart.type)) {
|
|
232
235
|
return acc;
|
|
233
236
|
}
|
|
234
237
|
return acc;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-commons",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.24",
|
|
4
4
|
"description": "Collection of utilities used across the web Allure reports",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"clean": "rimraf ./dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@allurereport/charts-api": "3.0.0-beta.
|
|
27
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
28
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
26
|
+
"@allurereport/charts-api": "3.0.0-beta.24",
|
|
27
|
+
"@allurereport/core-api": "3.0.0-beta.24",
|
|
28
|
+
"@allurereport/plugin-api": "3.0.0-beta.24",
|
|
29
29
|
"ansi-to-html": "^0.7.2",
|
|
30
30
|
"d3-interpolate": "^3.0.1",
|
|
31
31
|
"d3-scale": "^4.0.2",
|
package/dist/charts/pie.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PieChartData, PieChartOptions } from "@allurereport/charts-api";
|
|
2
|
-
import type { Statistic } from "@allurereport/core-api";
|
|
3
|
-
export declare const getPieChartData: (stats: Statistic, chartOptions: PieChartOptions) => PieChartData;
|
|
4
|
-
export declare const generatePieChart: (options: PieChartOptions, stores: {
|
|
5
|
-
statistic: Statistic;
|
|
6
|
-
}) => PieChartData;
|
package/dist/charts/pie.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { getPieChartValues } from "./d3pie.js";
|
|
2
|
-
export const getPieChartData = (stats, chartOptions) => ({
|
|
3
|
-
type: chartOptions.type,
|
|
4
|
-
title: chartOptions?.title,
|
|
5
|
-
...getPieChartValues(stats),
|
|
6
|
-
});
|
|
7
|
-
export const generatePieChart = (options, stores) => {
|
|
8
|
-
const { statistic } = stores;
|
|
9
|
-
return getPieChartData(statistic, options);
|
|
10
|
-
};
|