@allurereport/plugin-dashboard 3.0.0-beta.15 → 3.0.0-beta.16
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/severityTrend.js +1 -0
- package/dist/charts/statusTrend.js +1 -0
- package/dist/generators.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/model.d.ts +5 -1
- package/dist/model.js +5 -0
- package/dist/utils/trend.d.ts +1 -1
- package/dist/utils/trend.js +5 -3
- package/package.json +7 -7
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag,
|
|
1
|
+
import { DEFAULT_CHART_HISTORY_LIMIT, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/web-commons";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import Handlebars from "handlebars";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
package/dist/index.d.ts
CHANGED
package/dist/model.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export declare enum ChartData {
|
|
|
7
7
|
Status = "status",
|
|
8
8
|
Severity = "severity"
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export declare enum ChartMode {
|
|
11
|
+
Raw = "raw",
|
|
12
|
+
Percent = "percent"
|
|
13
|
+
}
|
|
11
14
|
export type ChartId = string;
|
|
12
15
|
export type ExecutionIdFn = (executionOrder: number) => string;
|
|
13
16
|
export type ExecutionNameFn = (executionOrder: number) => string;
|
|
@@ -43,6 +46,7 @@ export type TrendSlice<Metadata extends BaseMetadata> = {
|
|
|
43
46
|
export type GenericTrendChartData<Metadata extends BaseMetadata, SeriesType extends string> = {
|
|
44
47
|
type: ChartType.Trend;
|
|
45
48
|
dataType: ChartData;
|
|
49
|
+
mode: ChartMode;
|
|
46
50
|
title?: string;
|
|
47
51
|
points: Record<TrendPointId, TrendPoint>;
|
|
48
52
|
slices: Record<TrendSliceId, TrendSlice<Metadata>>;
|
package/dist/model.js
CHANGED
|
@@ -8,3 +8,8 @@ export var ChartData;
|
|
|
8
8
|
ChartData["Status"] = "status";
|
|
9
9
|
ChartData["Severity"] = "severity";
|
|
10
10
|
})(ChartData || (ChartData = {}));
|
|
11
|
+
export var ChartMode;
|
|
12
|
+
(function (ChartMode) {
|
|
13
|
+
ChartMode["Raw"] = "raw";
|
|
14
|
+
ChartMode["Percent"] = "percent";
|
|
15
|
+
})(ChartMode || (ChartMode = {}));
|
package/dist/utils/trend.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SeverityLevel, TestStatus } from "@allurereport/core-api";
|
|
2
|
-
import type
|
|
2
|
+
import { type BaseTrendSliceMetadata, type GenericTrendChartData, type TrendChartOptions } from "../model.js";
|
|
3
3
|
type TrendDataType = TestStatus | SeverityLevel;
|
|
4
4
|
export declare const createEmptyStats: <T extends TrendDataType>(items: readonly T[]) => Record<T, number>;
|
|
5
5
|
export declare const createEmptySeries: <T extends TrendDataType>(items: readonly T[]) => Record<T, string[]>;
|
package/dist/utils/trend.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChartMode, } from "../model.js";
|
|
1
2
|
export const createEmptyStats = (items) => items.reduce((acc, item) => ({ ...acc, [item]: 0 }), {});
|
|
2
3
|
export const createEmptySeries = (items) => items.reduce((acc, item) => ({ ...acc, [item]: [] }), {});
|
|
3
4
|
export const normalizeStatistic = (statistic, itemType) => {
|
|
@@ -33,7 +34,7 @@ const calculatePercentValues = (stats, executionId, itemType) => {
|
|
|
33
34
|
const value = stats[item] ?? 0;
|
|
34
35
|
points[pointId] = {
|
|
35
36
|
x: executionId,
|
|
36
|
-
y:
|
|
37
|
+
y: value / total,
|
|
37
38
|
};
|
|
38
39
|
series[item].push(pointId);
|
|
39
40
|
});
|
|
@@ -64,10 +65,10 @@ export const mergeTrendDataGeneric = (trendData, trendDataPart, itemType) => {
|
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
67
|
export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType, chartOptions) => {
|
|
67
|
-
const { type, dataType, title, mode =
|
|
68
|
+
const { type, dataType, title, mode = ChartMode.Raw, metadata = {} } = chartOptions;
|
|
68
69
|
const { executionIdAccessor, executionNameAccessor } = metadata;
|
|
69
70
|
const executionId = executionIdAccessor ? executionIdAccessor(executionOrder) : `execution-${executionOrder}`;
|
|
70
|
-
const { points, series } = mode ===
|
|
71
|
+
const { points, series } = mode === ChartMode.Percent
|
|
71
72
|
? calculatePercentValues(stats, executionId, itemType)
|
|
72
73
|
: calculateRawValues(stats, executionId, itemType);
|
|
73
74
|
const slices = {};
|
|
@@ -90,6 +91,7 @@ export const getTrendDataGeneric = (stats, reportName, executionOrder, itemType,
|
|
|
90
91
|
return {
|
|
91
92
|
type,
|
|
92
93
|
dataType,
|
|
94
|
+
mode,
|
|
93
95
|
title,
|
|
94
96
|
points,
|
|
95
97
|
slices,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-dashboard",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.16",
|
|
4
4
|
"description": "Allure Dashboard Plugin – plugin for generating dashboard with a mix of charts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"test": "rimraf ./out && vitest run"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
36
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
37
|
-
"@allurereport/web-commons": "3.0.0-beta.
|
|
38
|
-
"@allurereport/web-dashboard": "3.0.0-beta.
|
|
35
|
+
"@allurereport/core-api": "3.0.0-beta.16",
|
|
36
|
+
"@allurereport/plugin-api": "3.0.0-beta.16",
|
|
37
|
+
"@allurereport/web-commons": "3.0.0-beta.16",
|
|
38
|
+
"@allurereport/web-dashboard": "3.0.0-beta.16",
|
|
39
39
|
"d3-shape": "^3.2.0",
|
|
40
40
|
"handlebars": "^4.7.8"
|
|
41
41
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/node": "^20.17.9",
|
|
47
47
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
48
48
|
"@typescript-eslint/parser": "^8.0.0",
|
|
49
|
-
"@vitest/runner": "^2.1.
|
|
49
|
+
"@vitest/runner": "^2.1.9",
|
|
50
50
|
"allure-vitest": "^3.0.9",
|
|
51
51
|
"eslint": "^8.57.0",
|
|
52
52
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
58
58
|
"rimraf": "^6.0.1",
|
|
59
59
|
"typescript": "^5.6.3",
|
|
60
|
-
"vitest": "^2.1.
|
|
60
|
+
"vitest": "^2.1.9"
|
|
61
61
|
}
|
|
62
62
|
}
|