@allurereport/web-commons 3.16.0 → 3.17.0
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/accessors/coverageDiffTreeMapAccessor.js +1 -1
- package/dist/charts/accessors/successRateDistributionTreeMapAccessor.js +1 -1
- package/dist/charts/generateTrSeveritiesChart.js +2 -2
- package/dist/charts/treeMap.d.ts +1 -3
- package/dist/charts/treeMap.js +1 -70
- package/dist/charts/treeMapUtils.d.ts +4 -0
- package/dist/charts/treeMapUtils.js +70 -0
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTreeByLabels, md5 } from "@allurereport/plugin-api";
|
|
2
2
|
import { isChildrenLeavesOnly } from "../chart-utils.js";
|
|
3
|
-
import { convertTreeDataToTreeMapNode, transformTreeMapNode } from "../
|
|
3
|
+
import { convertTreeDataToTreeMapNode, transformTreeMapNode } from "../treeMapUtils.js";
|
|
4
4
|
import { behaviorLabels, filterTestsWithBehaviorLabels } from "./utils/behavior.js";
|
|
5
5
|
const groupFactoryFn = (parentId, groupClassifier) => ({
|
|
6
6
|
nodeId: md5((parentId ? `${parentId}.` : "") + groupClassifier),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTreeByLabels, md5 } from "@allurereport/plugin-api";
|
|
2
2
|
import { isChildrenLeavesOnly } from "../chart-utils.js";
|
|
3
|
-
import { convertTreeDataToTreeMapNode, transformTreeMapNode } from "../
|
|
3
|
+
import { convertTreeDataToTreeMapNode, transformTreeMapNode } from "../treeMapUtils.js";
|
|
4
4
|
import { behaviorLabels, filterTestsWithBehaviorLabels } from "./utils/behavior.js";
|
|
5
5
|
const leafFactoryFn = ({ id, name, status }) => ({
|
|
6
6
|
nodeId: id,
|
|
@@ -13,9 +13,9 @@ const getSeverity = (tr) => {
|
|
|
13
13
|
export const generateTrSeveritiesChart = (props) => {
|
|
14
14
|
const { options, storeData } = props;
|
|
15
15
|
const { levels, statuses, includeUnset = true } = options;
|
|
16
|
-
let trSeverityLevels = levels;
|
|
16
|
+
let trSeverityLevels = levels ? [...levels] : [];
|
|
17
17
|
let trStatuses = statuses;
|
|
18
|
-
if (
|
|
18
|
+
if (trSeverityLevels.length === 0) {
|
|
19
19
|
trSeverityLevels = DEFAULT_SEVERITY_LEVELS;
|
|
20
20
|
}
|
|
21
21
|
if (includeUnset) {
|
package/dist/charts/treeMap.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { AllureChartsStoreData, TreeMapChartData, TreeMapChartOptions, TreeMapDataAccessor, TreeMapNode } from "@allurereport/charts-api";
|
|
2
|
-
|
|
3
|
-
export declare const convertTreeDataToTreeMapNode: <T extends TreeMapNode, L, G>(treeData: TreeData<L, G>, transform: (treeDataNode: TreeLeaf<L> | TreeGroup<G>, isGroup: boolean, parentNode?: TreeGroup<G>) => T, transformRoot?: (root: WithChildren) => T) => T;
|
|
4
|
-
export declare const transformTreeMapNode: <T extends TreeMapNode>(tree: T, transform: (node: T) => T) => T;
|
|
2
|
+
export { convertTreeDataToTreeMapNode, transformTreeMapNode } from "./treeMapUtils.js";
|
|
5
3
|
export declare const generateTreeMapChartGeneric: <T extends TreeMapNode>(options: TreeMapChartOptions, storeData: AllureChartsStoreData, dataAccessor: TreeMapDataAccessor<T>) => TreeMapChartData | undefined;
|
|
6
4
|
export declare const generateTreeMapChart: (options: TreeMapChartOptions, storeData: AllureChartsStoreData) => TreeMapChartData | undefined;
|
package/dist/charts/treeMap.js
CHANGED
|
@@ -1,76 +1,7 @@
|
|
|
1
1
|
import { ChartType } from "@allurereport/charts-api";
|
|
2
2
|
import { coverageDiffTreeMapAccessor } from "./accessors/coverageDiffTreeMapAccessor.js";
|
|
3
3
|
import { successRateDistributionTreeMapAccessor } from "./accessors/successRateDistributionTreeMapAccessor.js";
|
|
4
|
-
export
|
|
5
|
-
id: "root",
|
|
6
|
-
value: undefined,
|
|
7
|
-
})) => {
|
|
8
|
-
const { root, leavesById, groupsById } = treeData;
|
|
9
|
-
const convertNode = (nodeId, parentGroup, isGroup) => {
|
|
10
|
-
const node = isGroup ? groupsById[nodeId] : leavesById[nodeId];
|
|
11
|
-
if (!node) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
const treeMapNode = transform(node, isGroup, parentGroup);
|
|
15
|
-
if (isGroup) {
|
|
16
|
-
const group = node;
|
|
17
|
-
const children = [];
|
|
18
|
-
if (group.groups) {
|
|
19
|
-
group.groups.forEach((groupId) => {
|
|
20
|
-
const childNode = convertNode(groupId, group, true);
|
|
21
|
-
if (childNode) {
|
|
22
|
-
children.push(childNode);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
if (group.leaves) {
|
|
27
|
-
group.leaves.forEach((leafId) => {
|
|
28
|
-
const childNode = convertNode(leafId, group, false);
|
|
29
|
-
if (childNode) {
|
|
30
|
-
children.push(childNode);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
if (children.length === 0) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
treeMapNode.children = children;
|
|
38
|
-
}
|
|
39
|
-
return treeMapNode;
|
|
40
|
-
};
|
|
41
|
-
const rootChildren = [];
|
|
42
|
-
if (root.groups) {
|
|
43
|
-
root.groups.forEach((groupId) => {
|
|
44
|
-
const childNode = convertNode(groupId, root, true);
|
|
45
|
-
if (childNode) {
|
|
46
|
-
rootChildren.push(childNode);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (root.leaves) {
|
|
51
|
-
root.leaves.forEach((leafId) => {
|
|
52
|
-
const childNode = convertNode(leafId, root, false);
|
|
53
|
-
if (childNode) {
|
|
54
|
-
rootChildren.push(childNode);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
children: rootChildren.length > 0 ? rootChildren : undefined,
|
|
60
|
-
...transformRoot(root),
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
export const transformTreeMapNode = (tree, transform) => {
|
|
64
|
-
const transformedNode = transform(tree);
|
|
65
|
-
if (transformedNode.children) {
|
|
66
|
-
const transformedChildren = transformedNode.children.map((child) => transformTreeMapNode(child, transform));
|
|
67
|
-
return {
|
|
68
|
-
...transformedNode,
|
|
69
|
-
children: transformedChildren,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return transformedNode;
|
|
73
|
-
};
|
|
4
|
+
export { convertTreeDataToTreeMapNode, transformTreeMapNode } from "./treeMapUtils.js";
|
|
74
5
|
export const generateTreeMapChartGeneric = (options, storeData, dataAccessor) => ({
|
|
75
6
|
type: options.type,
|
|
76
7
|
title: options.title,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TreeMapNode } from "@allurereport/charts-api";
|
|
2
|
+
import type { TreeData, TreeGroup, TreeLeaf, WithChildren } from "@allurereport/core-api";
|
|
3
|
+
export declare const convertTreeDataToTreeMapNode: <T extends TreeMapNode, L, G>(treeData: TreeData<L, G>, transform: (treeDataNode: TreeLeaf<L> | TreeGroup<G>, isGroup: boolean, parentNode?: TreeGroup<G>) => T, transformRoot?: (root: WithChildren) => T) => T;
|
|
4
|
+
export declare const transformTreeMapNode: <T extends TreeMapNode>(tree: T, transform: (node: T) => T) => T;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export const convertTreeDataToTreeMapNode = (treeData, transform, transformRoot = () => ({
|
|
2
|
+
id: "root",
|
|
3
|
+
value: undefined,
|
|
4
|
+
})) => {
|
|
5
|
+
const { root, leavesById, groupsById } = treeData;
|
|
6
|
+
const convertNode = (nodeId, parentGroup, isGroup) => {
|
|
7
|
+
const node = isGroup ? groupsById[nodeId] : leavesById[nodeId];
|
|
8
|
+
if (!node) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const treeMapNode = transform(node, isGroup, parentGroup);
|
|
12
|
+
if (isGroup) {
|
|
13
|
+
const group = node;
|
|
14
|
+
const children = [];
|
|
15
|
+
if (group.groups) {
|
|
16
|
+
group.groups.forEach((groupId) => {
|
|
17
|
+
const childNode = convertNode(groupId, group, true);
|
|
18
|
+
if (childNode) {
|
|
19
|
+
children.push(childNode);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (group.leaves) {
|
|
24
|
+
group.leaves.forEach((leafId) => {
|
|
25
|
+
const childNode = convertNode(leafId, group, false);
|
|
26
|
+
if (childNode) {
|
|
27
|
+
children.push(childNode);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (children.length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
treeMapNode.children = children;
|
|
35
|
+
}
|
|
36
|
+
return treeMapNode;
|
|
37
|
+
};
|
|
38
|
+
const rootChildren = [];
|
|
39
|
+
if (root.groups) {
|
|
40
|
+
root.groups.forEach((groupId) => {
|
|
41
|
+
const childNode = convertNode(groupId, root, true);
|
|
42
|
+
if (childNode) {
|
|
43
|
+
rootChildren.push(childNode);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (root.leaves) {
|
|
48
|
+
root.leaves.forEach((leafId) => {
|
|
49
|
+
const childNode = convertNode(leafId, root, false);
|
|
50
|
+
if (childNode) {
|
|
51
|
+
rootChildren.push(childNode);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
children: rootChildren.length > 0 ? rootChildren : undefined,
|
|
57
|
+
...transformRoot(root),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export const transformTreeMapNode = (tree, transform) => {
|
|
61
|
+
const transformedNode = transform(tree);
|
|
62
|
+
if (transformedNode.children) {
|
|
63
|
+
const transformedChildren = transformedNode.children.map((child) => transformTreeMapNode(child, transform));
|
|
64
|
+
return {
|
|
65
|
+
...transformedNode,
|
|
66
|
+
children: transformedChildren,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return transformedNode;
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-commons",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "Collection of utilities used across the web Allure reports",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@allurereport/aql": "3.
|
|
30
|
-
"@allurereport/charts-api": "3.
|
|
31
|
-
"@allurereport/core-api": "3.
|
|
32
|
-
"@allurereport/plugin-api": "3.
|
|
29
|
+
"@allurereport/aql": "3.17.0",
|
|
30
|
+
"@allurereport/charts-api": "3.17.0",
|
|
31
|
+
"@allurereport/core-api": "3.17.0",
|
|
32
|
+
"@allurereport/plugin-api": "3.17.0",
|
|
33
33
|
"@preact/signals": "^2.6.1",
|
|
34
34
|
"@preact/signals-core": "^1.12.2",
|
|
35
35
|
"ansi-to-html": "^0.7.2",
|