@allurereport/web-classic 3.0.0-beta.21 → 3.0.0-beta.23
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/multi/app-5296476c01199f82d212.js +2 -0
- package/dist/multi/manifest.json +22 -22
- package/dist/multi/{styles-1a506a3ca8c2a7cefa96.css → styles-d45d3e6c674788d3eb5e.css} +1 -1
- package/dist/single/app-84ebc38ffa00e75e120e.js +2 -0
- package/dist/single/manifest.json +1 -1
- package/package.json +5 -5
- package/src/assets/scss/theme.scss +64 -61
- package/src/components/Behaviors/BehaviorsList.tsx +3 -3
- package/src/components/Categories/CategoriesList.tsx +3 -3
- package/src/components/Footer/FooterVersion.tsx +2 -2
- package/src/components/Modal/index.tsx +2 -2
- package/src/components/Packages/PackagesList.tsx +3 -3
- package/src/components/ReportHeader/ReportHeaderLogo.tsx +2 -2
- package/src/components/ReportHeader/index.tsx +2 -2
- package/src/components/TestResult/TestResultAttachmentsView/index.tsx +2 -2
- package/src/components/TestResult/TestResultDescription/index.tsx +2 -2
- package/src/components/TestResult/TestResultHeader/index.tsx +2 -2
- package/src/components/TestResult/TestResultHistory/index.tsx +2 -2
- package/src/components/TestResult/TestResultInfo/index.tsx +2 -2
- package/src/components/TestResult/TestResultLinks/index.tsx +2 -2
- package/src/components/TestResult/TestResultMetadata/index.tsx +2 -2
- package/src/components/TestResult/TestResultNavigation/index.tsx +2 -2
- package/src/components/TestResult/TestResultOverview.tsx +2 -2
- package/src/components/TestResult/TestResultParameters/index.tsx +2 -2
- package/src/components/TestResult/TestResultPrevStatuses/index.tsx +2 -2
- package/src/components/TestResult/TestResultRetriesView/index.tsx +2 -2
- package/src/components/TestResult/TestResultSetup/index.tsx +2 -2
- package/src/components/TestResult/TestResultSteps/index.tsx +4 -4
- package/src/components/TestResult/TestResultTeardown/index.tsx +2 -2
- package/src/components/TestResult/index.tsx +4 -4
- package/src/components/Tree/Tree.tsx +3 -3
- package/src/components/Tree/index.tsx +3 -3
- package/src/stores/behaviors.ts +6 -6
- package/src/stores/categories.ts +6 -6
- package/src/stores/locale.ts +2 -2
- package/src/stores/packages.ts +6 -6
- package/src/stores/testResults.ts +3 -3
- package/src/stores/theme.ts +15 -18
- package/src/stores/tree.ts +6 -6
- package/src/utils/treeFilters.ts +13 -13
- package/test/utils/treeFilters.test.ts +44 -44
- package/types.d.ts +22 -20
- package/dist/multi/app-363db15563ff7ed5d239.js +0 -2
- package/dist/single/app-ff898dcf0525b0bca38c.js +0 -2
- /package/dist/multi/{10.app-363db15563ff7ed5d239.js → 10.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{222.app-363db15563ff7ed5d239.js → 222.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{26.app-363db15563ff7ed5d239.js → 26.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{302.app-363db15563ff7ed5d239.js → 302.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{304.app-363db15563ff7ed5d239.js → 304.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{369.app-363db15563ff7ed5d239.js → 369.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{389.app-363db15563ff7ed5d239.js → 389.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{498.app-363db15563ff7ed5d239.js → 498.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{60.app-363db15563ff7ed5d239.js → 60.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{643.app-363db15563ff7ed5d239.js → 643.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{671.app-363db15563ff7ed5d239.js → 671.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{725.app-363db15563ff7ed5d239.js → 725.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{770.app-363db15563ff7ed5d239.js → 770.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{848.app-363db15563ff7ed5d239.js → 848.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{853.app-363db15563ff7ed5d239.js → 853.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{872.app-363db15563ff7ed5d239.js → 872.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{895.app-363db15563ff7ed5d239.js → 895.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{920.app-363db15563ff7ed5d239.js → 920.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{979.app-363db15563ff7ed5d239.js → 979.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{991.app-363db15563ff7ed5d239.js → 991.app-5296476c01199f82d212.js} +0 -0
- /package/dist/multi/{app-363db15563ff7ed5d239.js.LICENSE.txt → app-5296476c01199f82d212.js.LICENSE.txt} +0 -0
- /package/dist/single/{app-ff898dcf0525b0bca38c.js.LICENSE.txt → app-84ebc38ffa00e75e120e.js.LICENSE.txt} +0 -0
|
@@ -2,7 +2,7 @@ import type { Statistic } from "@allurereport/core-api";
|
|
|
2
2
|
import cx from "clsx";
|
|
3
3
|
import type { FunctionComponent } from "preact";
|
|
4
4
|
import { useState } from "preact/hooks";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ClassicRecursiveTree, ClassicStatus } from "types";
|
|
6
6
|
import TreeItem from "@/components/Tree/TreeItem";
|
|
7
7
|
import { route } from "@/stores/router";
|
|
8
8
|
import TreeHeader from "./TreeHeader";
|
|
@@ -10,10 +10,10 @@ import * as styles from "./styles.scss";
|
|
|
10
10
|
|
|
11
11
|
interface TreeProps {
|
|
12
12
|
statistic?: Statistic;
|
|
13
|
-
tree:
|
|
13
|
+
tree: ClassicRecursiveTree;
|
|
14
14
|
name?: string;
|
|
15
15
|
root?: boolean;
|
|
16
|
-
statusFilter?:
|
|
16
|
+
statusFilter?: ClassicStatus;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const Tree: FunctionComponent<TreeProps> = ({ tree, statusFilter, root, name, statistic }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button, Loadable, PageLoader, Text } from "@allurereport/web-components";
|
|
2
2
|
import { useEffect } from "preact/hooks";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassicStatus } from "types";
|
|
4
4
|
import Tree from "@/components/Tree/Tree";
|
|
5
5
|
import { useI18n } from "@/stores/locale";
|
|
6
6
|
import { currentTab } from "@/stores/tabs";
|
|
@@ -11,7 +11,7 @@ export const TreeList = () => {
|
|
|
11
11
|
const { t } = useI18n("empty");
|
|
12
12
|
|
|
13
13
|
useEffect(() => {
|
|
14
|
-
setTreeStatus(currentTab.value as
|
|
14
|
+
setTreeStatus(currentTab.value as ClassicStatus);
|
|
15
15
|
}, [currentTab.value]);
|
|
16
16
|
|
|
17
17
|
return (
|
|
@@ -51,7 +51,7 @@ export const TreeList = () => {
|
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
53
|
<div className={styles["tree-list"]}>
|
|
54
|
-
<Tree tree={filteredTree.value} statusFilter={currentTab.value as
|
|
54
|
+
<Tree tree={filteredTree.value} statusFilter={currentTab.value as ClassicStatus} root />
|
|
55
55
|
</div>
|
|
56
56
|
);
|
|
57
57
|
}}
|
package/src/stores/behaviors.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
2
|
import { computed, signal } from "@preact/signals";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassicStatus, ClassicTree, ClassicTreeGroup } from "types";
|
|
4
4
|
import type { StoreSignalState } from "@/stores/types";
|
|
5
5
|
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ export type TreeDirection = "asc" | "desc";
|
|
|
9
9
|
export type TreeFilters = "flaky" | "retry" | "new";
|
|
10
10
|
export type TreeFiltersState = {
|
|
11
11
|
query: string;
|
|
12
|
-
status:
|
|
12
|
+
status: ClassicStatus;
|
|
13
13
|
filter: Record<TreeFilters, boolean>;
|
|
14
14
|
sortBy: TreeSortBy;
|
|
15
15
|
direction: TreeDirection;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const behaviorsStore = signal<StoreSignalState<
|
|
18
|
+
export const behaviorsStore = signal<StoreSignalState<ClassicTree>>({
|
|
19
19
|
loading: true,
|
|
20
20
|
error: undefined,
|
|
21
21
|
data: undefined,
|
|
@@ -39,7 +39,7 @@ export const filteredBehaviors = computed(() => {
|
|
|
39
39
|
const { root, leavesById, groupsById } = behaviorsStore.value.data;
|
|
40
40
|
|
|
41
41
|
return createRecursiveTree({
|
|
42
|
-
group: root as
|
|
42
|
+
group: root as ClassicTreeGroup,
|
|
43
43
|
leavesById,
|
|
44
44
|
groupsById,
|
|
45
45
|
filterOptions: behaviorsFiltersStore.value,
|
|
@@ -71,7 +71,7 @@ export const setBehaviorsQuery = (query: string) => {
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
export const setBehaviorsStatus = (status:
|
|
74
|
+
export const setBehaviorsStatus = (status: ClassicStatus) => {
|
|
75
75
|
behaviorsFiltersStore.value = {
|
|
76
76
|
...behaviorsFiltersStore.value,
|
|
77
77
|
status,
|
|
@@ -110,7 +110,7 @@ export const fetchBehaviorsData = async () => {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
const res = await fetchReportJsonData<
|
|
113
|
+
const res = await fetchReportJsonData<ClassicTree>("widgets/behaviors.json", { bustCache: true });
|
|
114
114
|
|
|
115
115
|
behaviorsStore.value = {
|
|
116
116
|
data: res,
|
package/src/stores/categories.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
2
|
import { computed, signal } from "@preact/signals";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassicStatus, ClassicTree, ClassicTreeGroup } from "types";
|
|
4
4
|
import type { StoreSignalState } from "@/stores/types";
|
|
5
5
|
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ export type TreeDirection = "asc" | "desc";
|
|
|
9
9
|
export type TreeFilters = "flaky" | "retry" | "new";
|
|
10
10
|
export type TreeFiltersState = {
|
|
11
11
|
query: string;
|
|
12
|
-
status:
|
|
12
|
+
status: ClassicStatus;
|
|
13
13
|
filter: Record<TreeFilters, boolean>;
|
|
14
14
|
sortBy: TreeSortBy;
|
|
15
15
|
direction: TreeDirection;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const categoriesStore = signal<StoreSignalState<
|
|
18
|
+
export const categoriesStore = signal<StoreSignalState<ClassicTree>>({
|
|
19
19
|
loading: true,
|
|
20
20
|
error: undefined,
|
|
21
21
|
data: undefined,
|
|
@@ -39,7 +39,7 @@ export const filteredCategories = computed(() => {
|
|
|
39
39
|
const { root, leavesById, groupsById } = categoriesStore.value.data;
|
|
40
40
|
|
|
41
41
|
return createRecursiveTree({
|
|
42
|
-
group: root as
|
|
42
|
+
group: root as ClassicTreeGroup,
|
|
43
43
|
leavesById,
|
|
44
44
|
groupsById,
|
|
45
45
|
filterOptions: categoriesFiltersStore.value,
|
|
@@ -71,7 +71,7 @@ export const setCategoriesQuery = (query: string) => {
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
export const setCategoriesStatus = (status:
|
|
74
|
+
export const setCategoriesStatus = (status: ClassicStatus) => {
|
|
75
75
|
categoriesFiltersStore.value = {
|
|
76
76
|
...categoriesFiltersStore.value,
|
|
77
77
|
status,
|
|
@@ -110,7 +110,7 @@ export const fetchCategoriesData = async () => {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
const res = await fetchReportJsonData<
|
|
113
|
+
const res = await fetchReportJsonData<ClassicTree>("widgets/categories.json", { bustCache: true });
|
|
114
114
|
|
|
115
115
|
categoriesStore.value = {
|
|
116
116
|
data: res,
|
package/src/stores/locale.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { getReportOptions } from "@allurereport/web-commons";
|
|
|
2
2
|
import { computed, signal } from "@preact/signals";
|
|
3
3
|
import i18next, { type TOptions } from "i18next";
|
|
4
4
|
import { DEFAULT_LOCALE, LANG_LOCALE, type LangLocale } from "@/translations/constants";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ClassicReportOptions } from "../../types.js";
|
|
6
6
|
|
|
7
|
-
const { reportLanguage } = getReportOptions<
|
|
7
|
+
const { reportLanguage } = getReportOptions<ClassicReportOptions>() ?? {};
|
|
8
8
|
|
|
9
9
|
const namespaces = [
|
|
10
10
|
"empty",
|
package/src/stores/packages.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
2
|
import { computed, signal } from "@preact/signals";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassicStatus, ClassicTree, ClassicTreeGroup } from "types";
|
|
4
4
|
import type { StoreSignalState } from "@/stores/types";
|
|
5
5
|
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ export type TreeDirection = "asc" | "desc";
|
|
|
9
9
|
export type TreeFilters = "flaky" | "retry" | "new";
|
|
10
10
|
export type TreeFiltersState = {
|
|
11
11
|
query: string;
|
|
12
|
-
status:
|
|
12
|
+
status: ClassicStatus;
|
|
13
13
|
filter: Record<TreeFilters, boolean>;
|
|
14
14
|
sortBy: TreeSortBy;
|
|
15
15
|
direction: TreeDirection;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const packagesStore = signal<StoreSignalState<
|
|
18
|
+
export const packagesStore = signal<StoreSignalState<ClassicTree>>({
|
|
19
19
|
loading: true,
|
|
20
20
|
error: undefined,
|
|
21
21
|
data: undefined,
|
|
@@ -39,7 +39,7 @@ export const filteredPackages = computed(() => {
|
|
|
39
39
|
const { root, leavesById, groupsById } = packagesStore.value.data;
|
|
40
40
|
|
|
41
41
|
return createRecursiveTree({
|
|
42
|
-
group: root as
|
|
42
|
+
group: root as ClassicTreeGroup,
|
|
43
43
|
leavesById,
|
|
44
44
|
groupsById,
|
|
45
45
|
filterOptions: packagesFiltersStore.value,
|
|
@@ -71,7 +71,7 @@ export const setPackagesQuery = (query: string) => {
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
export const setPackagesStatus = (status:
|
|
74
|
+
export const setPackagesStatus = (status: ClassicStatus) => {
|
|
75
75
|
packagesFiltersStore.value = {
|
|
76
76
|
...packagesFiltersStore.value,
|
|
77
77
|
status,
|
|
@@ -110,7 +110,7 @@ export const fetchPackagesData = async () => {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
const res = await fetchReportJsonData<
|
|
113
|
+
const res = await fetchReportJsonData<ClassicTree>("widgets/packages.json", { bustCache: true });
|
|
114
114
|
|
|
115
115
|
packagesStore.value = {
|
|
116
116
|
data: res,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
2
|
import { signal } from "@preact/signals";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ClassicTestResult } from "types";
|
|
4
4
|
import { type StoreSignalState } from "./types";
|
|
5
5
|
|
|
6
|
-
export type TestResultsStoreState = Record<string,
|
|
6
|
+
export type TestResultsStoreState = Record<string, ClassicTestResult>;
|
|
7
7
|
|
|
8
8
|
export type TestResultNavStoreState = string[];
|
|
9
9
|
|
|
@@ -49,7 +49,7 @@ export const fetchTestResult = async (testResultId: string) => {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
try {
|
|
52
|
-
const data = await fetchReportJsonData<
|
|
52
|
+
const data = await fetchReportJsonData<ClassicTestResult>(`data/test-results/${testResultId}.json`);
|
|
53
53
|
|
|
54
54
|
testResultStore.value = {
|
|
55
55
|
data: { ...testResultStore.value.data, [testResultId]: data },
|
package/src/stores/theme.ts
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
import { getReportOptions } from "@allurereport/web-commons";
|
|
2
|
+
import type { Theme } from "@allurereport/web-components";
|
|
2
3
|
import { signal } from "@preact/signals";
|
|
3
|
-
import type {
|
|
4
|
+
import type { ClassicReportOptions } from "../../types.js";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
export const themeStore = signal<Theme>("auto");
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
export const setTheme = (mode: "light" | "dark" | "auto") => {
|
|
9
|
+
themeStore.value = mode;
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
try {
|
|
12
|
+
window.localStorage.setItem("theme", mode);
|
|
13
|
+
} catch {}
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
themeStore.value = newTheme;
|
|
13
|
-
document.documentElement.setAttribute("data-theme", newTheme);
|
|
14
|
-
window.localStorage.setItem("theme", newTheme);
|
|
15
|
+
document.documentElement.setAttribute("data-theme", mode);
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export const toggleTheme = () => {
|
|
18
|
-
|
|
19
|
+
const order = ["light", "dark", "auto"];
|
|
20
|
+
const current = themeStore.value;
|
|
21
|
+
const next = order[(order.indexOf(current) + 1) % order.length] as Theme;
|
|
22
|
+
setTheme(next);
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
export const getTheme = () => {
|
|
26
|
+
const { theme } = getReportOptions<ClassicReportOptions>() ?? {};
|
|
22
27
|
const themeFromLS = (window.localStorage.getItem("theme") as Theme | null) || (theme as Theme);
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
setTheme(themeFromLS);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
30
|
-
const initialTheme = prefersDarkScheme ? "dark" : "light";
|
|
31
|
-
|
|
32
|
-
setTheme(initialTheme);
|
|
29
|
+
setTheme(themeFromLS);
|
|
33
30
|
};
|
package/src/stores/tree.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
2
|
import { computed, signal } from "@preact/signals";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassicStatus, ClassicTree, ClassicTreeGroup } from "types";
|
|
4
4
|
import type { StoreSignalState } from "@/stores/types";
|
|
5
5
|
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ export type TreeDirection = "asc" | "desc";
|
|
|
9
9
|
export type TreeFilters = "flaky" | "retry" | "new";
|
|
10
10
|
export type TreeFiltersState = {
|
|
11
11
|
query: string;
|
|
12
|
-
status:
|
|
12
|
+
status: ClassicStatus;
|
|
13
13
|
filter: Record<TreeFilters, boolean>;
|
|
14
14
|
sortBy: TreeSortBy;
|
|
15
15
|
direction: TreeDirection;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const treeStore = signal<StoreSignalState<
|
|
18
|
+
export const treeStore = signal<StoreSignalState<ClassicTree>>({
|
|
19
19
|
loading: true,
|
|
20
20
|
error: undefined,
|
|
21
21
|
data: undefined,
|
|
@@ -39,7 +39,7 @@ export const filteredTree = computed(() => {
|
|
|
39
39
|
const { root, leavesById, groupsById } = treeStore.value.data;
|
|
40
40
|
|
|
41
41
|
return createRecursiveTree({
|
|
42
|
-
group: root as
|
|
42
|
+
group: root as ClassicTreeGroup,
|
|
43
43
|
leavesById,
|
|
44
44
|
groupsById,
|
|
45
45
|
filterOptions: treeFiltersStore.value,
|
|
@@ -71,7 +71,7 @@ export const setTreeQuery = (query: string) => {
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
export const setTreeStatus = (status:
|
|
74
|
+
export const setTreeStatus = (status: ClassicStatus) => {
|
|
75
75
|
treeFiltersStore.value = {
|
|
76
76
|
...treeFiltersStore.value,
|
|
77
77
|
status,
|
|
@@ -110,7 +110,7 @@ export const fetchTreeData = async () => {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
const res = await fetchReportJsonData<
|
|
113
|
+
const res = await fetchReportJsonData<ClassicTree>("widgets/tree.json", { bustCache: true });
|
|
114
114
|
|
|
115
115
|
treeStore.value = {
|
|
116
116
|
data: res,
|
package/src/utils/treeFilters.ts
CHANGED
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
reverse,
|
|
13
13
|
} from "@allurereport/core-api";
|
|
14
14
|
import type { TreeFiltersState, TreeSortBy } from "@/stores/tree";
|
|
15
|
-
import type {
|
|
15
|
+
import type { ClassicRecursiveTree, ClassicTree, ClassicTreeGroup, ClassicTreeLeaf } from "../../types";
|
|
16
16
|
|
|
17
|
-
export const isIncluded = (leaf: TreeLeaf<
|
|
17
|
+
export const isIncluded = (leaf: TreeLeaf<ClassicTreeLeaf>, filterOptions: TreeFiltersState) => {
|
|
18
18
|
const queryMatched = !filterOptions?.query || leaf.name.toLowerCase().includes(filterOptions.query.toLowerCase());
|
|
19
19
|
const statusMatched =
|
|
20
20
|
!filterOptions?.status || filterOptions?.status === "total" || leaf.status === filterOptions.status;
|
|
@@ -26,8 +26,8 @@ export const isIncluded = (leaf: TreeLeaf<AwesomeTreeLeaf>, filterOptions: TreeF
|
|
|
26
26
|
return [queryMatched, statusMatched, flakyMatched, retryMatched].every(Boolean);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const leafComparatorByTreeSortBy = (sortBy: TreeSortBy): Comparator<TreeLeaf<
|
|
30
|
-
const typedCompareBy = compareBy<TreeLeaf<
|
|
29
|
+
const leafComparatorByTreeSortBy = (sortBy: TreeSortBy): Comparator<TreeLeaf<ClassicTreeLeaf>> => {
|
|
30
|
+
const typedCompareBy = compareBy<TreeLeaf<ClassicTreeLeaf>>;
|
|
31
31
|
switch (sortBy) {
|
|
32
32
|
case "order":
|
|
33
33
|
return typedCompareBy("groupOrder", ordinal());
|
|
@@ -52,7 +52,7 @@ const groupComparatorByTreeSortBy = (sortBy: TreeSortBy): Comparator<DefaultTree
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export const leafComparator = (filterOptions: TreeFiltersState): Comparator<TreeLeaf<
|
|
55
|
+
export const leafComparator = (filterOptions: TreeFiltersState): Comparator<TreeLeaf<ClassicTreeLeaf>> => {
|
|
56
56
|
const cmp = leafComparatorByTreeSortBy(filterOptions.sortBy);
|
|
57
57
|
const directional = filterOptions.direction === "asc" ? cmp : reverse(cmp);
|
|
58
58
|
// apply fallback sorting by name
|
|
@@ -68,12 +68,12 @@ export const groupComparator = (filterOptions: TreeFiltersState): Comparator<Def
|
|
|
68
68
|
|
|
69
69
|
export const filterLeaves = (
|
|
70
70
|
leaves: string[] = [],
|
|
71
|
-
leavesById:
|
|
71
|
+
leavesById: ClassicTree["leavesById"],
|
|
72
72
|
filterOptions: TreeFiltersState,
|
|
73
73
|
) => {
|
|
74
74
|
const filteredLeaves = [...leaves]
|
|
75
75
|
.map((leafId) => leavesById[leafId])
|
|
76
|
-
.filter((leaf: TreeLeaf<
|
|
76
|
+
.filter((leaf: TreeLeaf<ClassicTreeLeaf>) => isIncluded(leaf, filterOptions));
|
|
77
77
|
|
|
78
78
|
const comparator = leafComparator(filterOptions);
|
|
79
79
|
return filteredLeaves.sort(comparator);
|
|
@@ -85,11 +85,11 @@ export const filterLeaves = (
|
|
|
85
85
|
* @param payload
|
|
86
86
|
*/
|
|
87
87
|
export const createRecursiveTree = (payload: {
|
|
88
|
-
group:
|
|
89
|
-
groupsById:
|
|
90
|
-
leavesById:
|
|
88
|
+
group: ClassicTreeGroup;
|
|
89
|
+
groupsById: ClassicTree["groupsById"];
|
|
90
|
+
leavesById: ClassicTree["leavesById"];
|
|
91
91
|
filterOptions?: TreeFiltersState;
|
|
92
|
-
}):
|
|
92
|
+
}): ClassicRecursiveTree => {
|
|
93
93
|
const { group, groupsById, leavesById, filterOptions } = payload;
|
|
94
94
|
const groupLeaves: string[] = group.leaves ?? [];
|
|
95
95
|
|
|
@@ -107,7 +107,7 @@ export const createRecursiveTree = (payload: {
|
|
|
107
107
|
?.filter((rt) => !isRecursiveTreeEmpty(rt)) ?? [];
|
|
108
108
|
|
|
109
109
|
const statistic: Statistic = emptyStatistic();
|
|
110
|
-
trees.forEach((rt:
|
|
110
|
+
trees.forEach((rt: ClassicRecursiveTree) => {
|
|
111
111
|
if (rt.statistic) {
|
|
112
112
|
const additional: Statistic = rt.statistic;
|
|
113
113
|
mergeStatistic(statistic, additional);
|
|
@@ -126,7 +126,7 @@ export const createRecursiveTree = (payload: {
|
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
export const isRecursiveTreeEmpty = (tree:
|
|
129
|
+
export const isRecursiveTreeEmpty = (tree: ClassicRecursiveTree): boolean => {
|
|
130
130
|
if (!tree.trees?.length && !tree.leaves?.length) {
|
|
131
131
|
return true;
|
|
132
132
|
}
|