@allurereport/plugin-dashboard 3.0.0-beta.18 → 3.0.0-beta.20

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.
Files changed (2) hide show
  1. package/dist/generators.js +24 -14
  2. package/package.json +4 -5
@@ -1,6 +1,5 @@
1
- import { ChartType } from "@allurereport/core-api";
2
- import { generateComingSoonChart, generatePieChart, generateTrendChart, } from "@allurereport/plugin-api";
3
- import { createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/web-commons";
1
+ import { ChartType, createBaseUrlScript, createFontLinkTag, createReportDataScript, createScriptTag, createStylesLinkTag, } from "@allurereport/core-api";
2
+ import { generateBarChart, generateComingSoonChart, generateHeatMapChart, generatePieChart, generateTreeMapChart, generateTrendChart, } from "@allurereport/plugin-api";
4
3
  import { randomUUID } from "crypto";
5
4
  import Handlebars from "handlebars";
6
5
  import { readFile } from "node:fs/promises";
@@ -53,29 +52,40 @@ export const generateCharts = async (options, store, context) => {
53
52
  if (!layout) {
54
53
  return undefined;
55
54
  }
56
- const trs = await store.allTestResults();
57
- const history = await store.allHistoryDataPoints();
58
- const statistic = await store.testsStatistic();
55
+ const storeData = await Promise.all([
56
+ store.allHistoryDataPoints(),
57
+ store.allTestResults(),
58
+ store.testsStatistic(),
59
+ ]).then(([historyDataPoints, testResults, statistic]) => ({
60
+ historyDataPoints,
61
+ testResults,
62
+ statistic,
63
+ }));
59
64
  const chartsData = {};
60
65
  for (const chartOptions of layout) {
61
66
  const chartId = randomUUID();
62
67
  let chart;
63
68
  if (chartOptions.type === ChartType.Trend) {
64
- chart = generateTrendChart(chartOptions, {
65
- trs,
66
- statistic,
67
- history,
68
- }, context);
69
+ chart = generateTrendChart(chartOptions, storeData, context);
69
70
  }
70
71
  else if (chartOptions.type === ChartType.Pie) {
71
- chart = generatePieChart(chartOptions, { statistic });
72
+ chart = generatePieChart(chartOptions, storeData);
72
73
  }
73
- else if ([ChartType.HeatMap, ChartType.Bar, ChartType.Funnel, ChartType.TreeMap].includes(chartOptions.type)) {
74
- chart = generateComingSoonChart(chartOptions);
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);
75
82
  }
76
83
  if (chart) {
77
84
  chartsData[chartId] = chart;
78
85
  }
86
+ else {
87
+ chartsData[chartId] = generateComingSoonChart(chartOptions);
88
+ }
79
89
  }
80
90
  return chartsData;
81
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-dashboard",
3
- "version": "3.0.0-beta.18",
3
+ "version": "3.0.0-beta.20",
4
4
  "description": "Allure Dashboard Plugin – plugin for generating dashboard with a mix of charts",
5
5
  "keywords": [
6
6
  "allure",
@@ -32,10 +32,9 @@
32
32
  "test": "rimraf ./out && vitest run"
33
33
  },
34
34
  "dependencies": {
35
- "@allurereport/core-api": "3.0.0-beta.18",
36
- "@allurereport/plugin-api": "3.0.0-beta.18",
37
- "@allurereport/web-commons": "3.0.0-beta.18",
38
- "@allurereport/web-dashboard": "3.0.0-beta.18",
35
+ "@allurereport/core-api": "3.0.0-beta.20",
36
+ "@allurereport/plugin-api": "3.0.0-beta.20",
37
+ "@allurereport/web-dashboard": "3.0.0-beta.20",
39
38
  "d3-shape": "^3.2.0",
40
39
  "handlebars": "^4.7.8"
41
40
  },