@allurereport/plugin-dashboard 3.0.0-beta.20 → 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/generators.d.ts +2 -2
- package/dist/generators.js +11 -46
- package/dist/model.d.ts +1 -1
- package/dist/plugin.js +2 -1
- package/package.json +6 -4
package/dist/generators.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type AllureStore, type
|
|
1
|
+
import { type AllureStore, type PluginContext, type ReportFiles } from "@allurereport/plugin-api";
|
|
2
2
|
import type { DashboardOptions, DashboardPluginOptions, TemplateManifest } from "./model.js";
|
|
3
3
|
import type { DashboardDataWriter, ReportFile } from "./writer.js";
|
|
4
4
|
export declare const readTemplateManifest: (singleFileMode?: boolean) => Promise<TemplateManifest>;
|
|
5
|
-
export declare const generateCharts: (options: DashboardPluginOptions, store: AllureStore, context: PluginContext) => Promise<GeneratedChartsData | undefined>;
|
|
6
5
|
export declare const generateAllCharts: (writer: DashboardDataWriter, store: AllureStore, options: DashboardPluginOptions, context: PluginContext) => Promise<void>;
|
|
6
|
+
export declare const generateEnvirontmentsList: (writer: DashboardDataWriter, store: AllureStore) => Promise<void>;
|
|
7
7
|
export declare const generateStaticFiles: (payload: DashboardOptions & {
|
|
8
8
|
allureVersion: string;
|
|
9
9
|
reportFiles: ReportFiles;
|
package/dist/generators.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { randomUUID } from "crypto";
|
|
1
|
+
import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/core-api";
|
|
2
|
+
import { generateCharts } from "@allurereport/web-commons";
|
|
4
3
|
import Handlebars from "handlebars";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { basename, join } from "node:path";
|
|
@@ -47,53 +47,19 @@ export const readTemplateManifest = async (singleFileMode) => {
|
|
|
47
47
|
const templateManifest = await readFile(templateManifestSource, { encoding: "utf-8" });
|
|
48
48
|
return JSON.parse(templateManifest);
|
|
49
49
|
};
|
|
50
|
-
export const
|
|
50
|
+
export const generateAllCharts = async (writer, store, options, context) => {
|
|
51
51
|
const { layout } = options;
|
|
52
52
|
if (!layout) {
|
|
53
|
-
return
|
|
53
|
+
return;
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
store.testsStatistic(),
|
|
59
|
-
]).then(([historyDataPoints, testResults, statistic]) => ({
|
|
60
|
-
historyDataPoints,
|
|
61
|
-
testResults,
|
|
62
|
-
statistic,
|
|
63
|
-
}));
|
|
64
|
-
const chartsData = {};
|
|
65
|
-
for (const chartOptions of layout) {
|
|
66
|
-
const chartId = randomUUID();
|
|
67
|
-
let chart;
|
|
68
|
-
if (chartOptions.type === ChartType.Trend) {
|
|
69
|
-
chart = generateTrendChart(chartOptions, storeData, context);
|
|
70
|
-
}
|
|
71
|
-
else if (chartOptions.type === ChartType.Pie) {
|
|
72
|
-
chart = generatePieChart(chartOptions, storeData);
|
|
73
|
-
}
|
|
74
|
-
else if (chartOptions.type === ChartType.Bar) {
|
|
75
|
-
chart = generateBarChart(chartOptions, storeData);
|
|
76
|
-
}
|
|
77
|
-
else if (chartOptions.type === ChartType.TreeMap) {
|
|
78
|
-
chart = generateTreeMapChart(chartOptions, storeData);
|
|
79
|
-
}
|
|
80
|
-
else if (chartOptions.type === ChartType.HeatMap) {
|
|
81
|
-
chart = generateHeatMapChart(chartOptions, storeData);
|
|
82
|
-
}
|
|
83
|
-
if (chart) {
|
|
84
|
-
chartsData[chartId] = chart;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
chartsData[chartId] = generateComingSoonChart(chartOptions);
|
|
88
|
-
}
|
|
55
|
+
const generatedChartsData = await generateCharts(layout, store, context.reportName, randomUUID);
|
|
56
|
+
if (Object.keys(generatedChartsData.general).length > 0) {
|
|
57
|
+
await writer.writeWidget("charts.json", generatedChartsData);
|
|
89
58
|
}
|
|
90
|
-
return chartsData;
|
|
91
59
|
};
|
|
92
|
-
export const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
await writer.writeWidget("charts.json", charts);
|
|
96
|
-
}
|
|
60
|
+
export const generateEnvirontmentsList = async (writer, store) => {
|
|
61
|
+
const environments = await store.allEnvironments();
|
|
62
|
+
await writer.writeWidget("environments.json", environments);
|
|
97
63
|
};
|
|
98
64
|
export const generateStaticFiles = async (payload) => {
|
|
99
65
|
const { reportName = "Allure Report", reportLanguage = "en", singleFile, logo = "", theme = "light", reportFiles, reportDataFiles, reportUuid, allureVersion, } = payload;
|
|
@@ -154,7 +120,6 @@ export const generateStaticFiles = async (payload) => {
|
|
|
154
120
|
if (err instanceof RangeError) {
|
|
155
121
|
console.error("The report is too large to be generated in the single file mode!");
|
|
156
122
|
process.exit(1);
|
|
157
|
-
return;
|
|
158
123
|
}
|
|
159
124
|
throw err;
|
|
160
125
|
}
|
package/dist/model.d.ts
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -12,7 +12,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
12
12
|
var _DashboardPlugin_writer, _DashboardPlugin_generate;
|
|
13
13
|
import { getWorstStatus } from "@allurereport/core-api";
|
|
14
14
|
import { convertToSummaryTestResult, } from "@allurereport/plugin-api";
|
|
15
|
-
import { generateAllCharts, generateStaticFiles } from "./generators.js";
|
|
15
|
+
import { generateAllCharts, generateEnvirontmentsList, generateStaticFiles } from "./generators.js";
|
|
16
16
|
import { InMemoryDashboardDataWriter, ReportFileDashboardDataWriter } from "./writer.js";
|
|
17
17
|
export class DashboardPlugin {
|
|
18
18
|
constructor(options = {}) {
|
|
@@ -20,6 +20,7 @@ export class DashboardPlugin {
|
|
|
20
20
|
_DashboardPlugin_writer.set(this, void 0);
|
|
21
21
|
_DashboardPlugin_generate.set(this, async (context, store) => {
|
|
22
22
|
await generateAllCharts(__classPrivateFieldGet(this, _DashboardPlugin_writer, "f"), store, this.options, context);
|
|
23
|
+
await generateEnvirontmentsList(__classPrivateFieldGet(this, _DashboardPlugin_writer, "f"), store);
|
|
23
24
|
const reportDataFiles = this.options.singleFile ? __classPrivateFieldGet(this, _DashboardPlugin_writer, "f").reportFiles() : [];
|
|
24
25
|
await generateStaticFiles({
|
|
25
26
|
...this.options,
|
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.21",
|
|
4
4
|
"description": "Allure Dashboard Plugin – plugin for generating dashboard with a mix of charts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
"test": "rimraf ./out && vitest run"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@allurereport/
|
|
36
|
-
"@allurereport/
|
|
37
|
-
"@allurereport/
|
|
35
|
+
"@allurereport/charts-api": "3.0.0-beta.21",
|
|
36
|
+
"@allurereport/core-api": "3.0.0-beta.21",
|
|
37
|
+
"@allurereport/plugin-api": "3.0.0-beta.21",
|
|
38
|
+
"@allurereport/web-commons": "3.0.0-beta.21",
|
|
39
|
+
"@allurereport/web-dashboard": "3.0.0-beta.21",
|
|
38
40
|
"d3-shape": "^3.2.0",
|
|
39
41
|
"handlebars": "^4.7.8"
|
|
40
42
|
},
|