@allurereport/web-awesome 3.0.1 → 3.1.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/multi/173.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/174.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/252.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/282.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/29.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/416.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/527.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/600.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/605.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/638.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/672.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/686.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/725.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/741.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/755.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/894.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/91.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/943.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/980.app-79c65c7bff941abcbc51.js +1 -0
- package/dist/multi/app-79c65c7bff941abcbc51.js +2 -0
- package/dist/multi/{app-bae2a0fe5738d77cd976.js.LICENSE.txt → app-79c65c7bff941abcbc51.js.LICENSE.txt} +7 -0
- package/dist/multi/manifest.json +21 -21
- package/dist/multi/styles-9e390bad7ce54a807a8e.css +49 -0
- package/dist/single/app-3ca67f29d0f1166c08ca.js +2 -0
- package/dist/single/{app-996d3b5869f8fc942b66.js.LICENSE.txt → app-3ca67f29d0f1166c08ca.js.LICENSE.txt} +7 -0
- package/dist/single/manifest.json +1 -1
- package/package.json +7 -7
- package/src/assets/scss/vars.scss +3 -0
- package/src/components/BaseLayout/index.tsx +25 -21
- package/src/components/BaseLayout/styles.scss +1 -0
- package/src/components/Charts/index.tsx +5 -2
- package/src/components/Footer/FooterVersion.tsx +14 -8
- package/src/components/Header/index.tsx +9 -7
- package/src/components/HeaderControls/index.tsx +5 -2
- package/src/components/MainReport/styles.scss +1 -0
- package/src/components/Metadata/index.tsx +24 -7
- package/src/components/ReportBody/HeaderActions.tsx +4 -13
- package/src/components/ReportBody/SortBy.tsx +27 -13
- package/src/components/ReportBody/index.tsx +1 -1
- package/src/components/ReportBody/styles.scss +4 -1
- package/src/components/ReportFilters/BaseFilters.tsx +345 -0
- package/src/components/ReportFilters/RetryFlaky.tsx +29 -0
- package/src/components/ReportFilters/TagsFilter.tsx +41 -0
- package/src/components/ReportFilters/TransitionFilter.tsx +49 -0
- package/src/components/ReportFilters/index.tsx +44 -0
- package/src/components/ReportFilters/styles.scss +55 -0
- package/src/components/ReportSearch/index.tsx +29 -0
- package/src/components/ReportTabs/index.tsx +1 -1
- package/src/components/SectionPicker/index.tsx +1 -1
- package/src/components/SplitLayout/index.tsx +7 -3
- package/src/components/TestResult/TrEnvironmentItem/index.tsx +2 -2
- package/src/components/TestResult/TrHeader/TrBreadcrumbs.tsx +2 -2
- package/src/components/TestResult/TrHistory/TrHistoryItem.tsx +38 -7
- package/src/components/TestResult/TrHistory/index.tsx +18 -8
- package/src/components/TestResult/TrHistory/styles.scss +4 -7
- package/src/components/TestResult/TrInfo/styles.scss +1 -0
- package/src/components/TestResult/TrNavigation/index.tsx +109 -68
- package/src/components/TestResult/TrNavigation/styles.scss +15 -25
- package/src/components/TestResult/TrPwTraces/PwTraceButton.tsx +1 -8
- package/src/components/TestResult/TrRetriesView/TrRetriesItem.tsx +2 -3
- package/src/components/TestResult/TrRetriesView/index.tsx +4 -3
- package/src/components/TestResult/TrSteps/TrAttachment.tsx +5 -3
- package/src/components/TestResult/TrSteps/TrAttachmentInfo.tsx +10 -3
- package/src/components/TestResult/TrTabs/index.tsx +7 -23
- package/src/components/TestResult/index.tsx +9 -4
- package/src/components/TestResult/styles.scss +1 -0
- package/src/components/Tree/index.tsx +14 -9
- package/src/index.html +19 -18
- package/src/index.tsx +20 -27
- package/src/locales/az.json +39 -11
- package/src/locales/de.json +39 -11
- package/src/locales/en.json +39 -11
- package/src/locales/es.json +39 -11
- package/src/locales/fr.json +39 -11
- package/src/locales/he.json +39 -11
- package/src/locales/hy.json +39 -11
- package/src/locales/it.json +39 -11
- package/src/locales/ja.json +39 -11
- package/src/locales/ka.json +39 -11
- package/src/locales/kr.json +39 -11
- package/src/locales/nl.json +39 -11
- package/src/locales/pl.json +39 -11
- package/src/locales/pt.json +39 -11
- package/src/locales/ru.json +39 -11
- package/src/locales/sv.json +39 -11
- package/src/locales/tr.json +39 -11
- package/src/locales/ua.json +39 -11
- package/src/locales/zh.json +39 -11
- package/src/stores/chart.ts +2 -2
- package/src/stores/env.ts +6 -6
- package/src/stores/envInfo.ts +2 -2
- package/src/stores/globals.ts +1 -1
- package/src/stores/index.ts +0 -1
- package/src/stores/layout.ts +20 -11
- package/src/stores/locale.ts +2 -1
- package/src/stores/qualityGate.ts +2 -2
- package/src/stores/router.ts +25 -91
- package/src/stores/sections.ts +32 -45
- package/src/stores/stats.ts +4 -4
- package/src/stores/testResult.ts +5 -0
- package/src/stores/testResults.ts +7 -5
- package/src/stores/tree.ts +20 -13
- package/src/stores/treeFilters/actions.ts +48 -52
- package/src/stores/treeFilters/constants.ts +11 -5
- package/src/stores/treeFilters/model.ts +51 -0
- package/src/stores/treeFilters/store.ts +260 -60
- package/src/stores/treeFilters/utils.ts +132 -0
- package/src/stores/treeSort.ts +71 -0
- package/src/stores/variables.ts +3 -3
- package/src/utils/treeFilters.ts +48 -66
- package/test/components/Header.test.tsx +49 -58
- package/test/utils/treeFilters.test.ts +18 -321
- package/types.d.ts +2 -1
- package/dist/multi/173.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/174.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/252.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/282.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/29.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/416.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/527.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/600.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/605.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/638.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/672.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/686.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/725.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/741.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/755.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/894.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/91.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/943.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/980.app-bae2a0fe5738d77cd976.js +0 -1
- package/dist/multi/app-bae2a0fe5738d77cd976.js +0 -2
- package/dist/multi/styles-bbf68b2ba63c38b53c38.css +0 -48
- package/dist/single/app-996d3b5869f8fc942b66.js +0 -2
- package/src/components/ReportBody/Filters.tsx +0 -122
- package/src/stores/theme.ts +0 -30
- package/src/stores/treeFilters/index.ts +0 -3
- package/src/stores/treeFilters/types.ts +0 -12
- package/test/stores/treeFilters.test.ts +0 -302
package/src/stores/sections.ts
CHANGED
|
@@ -1,63 +1,50 @@
|
|
|
1
1
|
import { getReportOptions } from "@allurereport/web-commons";
|
|
2
|
-
import {
|
|
3
|
-
import { navigateTo, parseHash, route } from "@/stores/router";
|
|
2
|
+
import { computed, effect } from "@preact/signals";
|
|
4
3
|
import type { AwesomeReportOptions } from "../../types.js";
|
|
4
|
+
import { navigateToRoot, navigateToSection, sectionRoute } from "./router";
|
|
5
5
|
|
|
6
6
|
const DEFAULT_SECTION = "default";
|
|
7
|
-
type Section = string;
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
export const availableSections = signal<Section[]>([]);
|
|
8
|
+
type Section = "timeline" | "charts" | "default";
|
|
11
9
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
document.documentElement.setAttribute("data-section", section);
|
|
15
|
-
globalThis.localStorage.setItem("chosenSection", section);
|
|
16
|
-
};
|
|
10
|
+
const reportOptions = getReportOptions<AwesomeReportOptions>();
|
|
11
|
+
const defaultSectionFromReportOptions: Section = (reportOptions?.defaultSection as Section) ?? "default";
|
|
17
12
|
|
|
18
|
-
export const
|
|
19
|
-
const isDefaultSection = chosenSection === DEFAULT_SECTION;
|
|
20
|
-
const isValidSection = availableSections.value?.includes(chosenSection);
|
|
21
|
-
const isSectionChanged = currentSection.value !== chosenSection;
|
|
13
|
+
export const availableSections = (reportOptions?.sections ?? []) as Section[];
|
|
22
14
|
|
|
23
|
-
|
|
15
|
+
const onInit = () => {
|
|
16
|
+
const isSectionRoute = sectionRoute.peek().matches;
|
|
17
|
+
const isDefaultSection = defaultSectionFromReportOptions === DEFAULT_SECTION;
|
|
18
|
+
const isValidSection = availableSections.includes(defaultSectionFromReportOptions);
|
|
24
19
|
|
|
25
|
-
if (isDefaultSection) {
|
|
26
|
-
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (isSectionChanged && isValidSection) {
|
|
31
|
-
navigateTo({ category: chosenSection });
|
|
20
|
+
if (!isSectionRoute && !isDefaultSection && isValidSection) {
|
|
21
|
+
navigateToSection({ section: defaultSectionFromReportOptions });
|
|
32
22
|
}
|
|
33
23
|
};
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
currentSection.value = sectionFromUrl || sectionFromLS;
|
|
45
|
-
|
|
46
|
-
if (category) {
|
|
47
|
-
setSection(category);
|
|
48
|
-
return;
|
|
25
|
+
onInit();
|
|
26
|
+
|
|
27
|
+
export const currentSection = computed(() => sectionRoute.value.params.section ?? "default");
|
|
28
|
+
|
|
29
|
+
effect(() => {
|
|
30
|
+
const section = currentSection.value;
|
|
31
|
+
|
|
32
|
+
if (section) {
|
|
33
|
+
document.documentElement.setAttribute("data-section", section);
|
|
49
34
|
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const setSection = (chosenSection: Section | string): void => {
|
|
38
|
+
const isDefaultSection = chosenSection === DEFAULT_SECTION;
|
|
39
|
+
const isValidSection = availableSections.includes(chosenSection as Section);
|
|
40
|
+
const isSectionChanged = currentSection.peek() !== chosenSection;
|
|
50
41
|
|
|
51
|
-
if (
|
|
52
|
-
|
|
42
|
+
if (isDefaultSection) {
|
|
43
|
+
navigateToRoot();
|
|
53
44
|
return;
|
|
54
45
|
}
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
if (isSectionChanged && isValidSection) {
|
|
48
|
+
navigateToSection({ section: chosenSection as "timeline" | "charts" });
|
|
49
|
+
}
|
|
57
50
|
};
|
|
58
|
-
|
|
59
|
-
effect(() => {
|
|
60
|
-
const category = route.value.category;
|
|
61
|
-
|
|
62
|
-
setSection(category || "");
|
|
63
|
-
});
|
package/src/stores/stats.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const statsByEnvStore = signal<StoreSignalState<Record<string, Statistic>
|
|
|
20
20
|
|
|
21
21
|
export const fetchReportStats = async () => {
|
|
22
22
|
reportStatsStore.value = {
|
|
23
|
-
...reportStatsStore.
|
|
23
|
+
...reportStatsStore.peek(),
|
|
24
24
|
loading: true,
|
|
25
25
|
error: undefined,
|
|
26
26
|
};
|
|
@@ -43,7 +43,7 @@ export const fetchReportStats = async () => {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export const fetchEnvStats = async (envs: string[]) => {
|
|
46
|
-
const envsToFetch = envs.filter((env) => !statsByEnvStore.
|
|
46
|
+
const envsToFetch = envs.filter((env) => !statsByEnvStore.peek().data?.[env]);
|
|
47
47
|
|
|
48
48
|
// all envs have already been fetched
|
|
49
49
|
if (envsToFetch.length === 0) {
|
|
@@ -51,7 +51,7 @@ export const fetchEnvStats = async (envs: string[]) => {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
statsByEnvStore.value = {
|
|
54
|
-
...statsByEnvStore.
|
|
54
|
+
...statsByEnvStore.peek(),
|
|
55
55
|
loading: true,
|
|
56
56
|
error: undefined,
|
|
57
57
|
};
|
|
@@ -73,7 +73,7 @@ export const fetchEnvStats = async (envs: string[]) => {
|
|
|
73
73
|
};
|
|
74
74
|
} catch (err) {
|
|
75
75
|
statsByEnvStore.value = {
|
|
76
|
-
...statsByEnvStore.
|
|
76
|
+
...statsByEnvStore.peek(),
|
|
77
77
|
error: err.message,
|
|
78
78
|
loading: false,
|
|
79
79
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { computed } from "@preact/signals";
|
|
2
|
+
import { testResultRoute } from "./router";
|
|
3
|
+
|
|
4
|
+
export const trCurrentTab = computed(() => testResultRoute.value.params.tab ?? "overview");
|
|
5
|
+
export const currentTrId = computed(() => testResultRoute.value.params.testResultId);
|
|
@@ -32,7 +32,7 @@ export const fetchTestResultNav = async (env?: string) => {
|
|
|
32
32
|
};
|
|
33
33
|
} catch (err) {
|
|
34
34
|
testResultNavStore.value = {
|
|
35
|
-
...testResultNavStore.
|
|
35
|
+
...testResultNavStore.peek(),
|
|
36
36
|
error: err.message,
|
|
37
37
|
loading: false,
|
|
38
38
|
};
|
|
@@ -40,12 +40,14 @@ export const fetchTestResultNav = async (env?: string) => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export const fetchTestResult = async (testResultId: string) => {
|
|
43
|
-
|
|
43
|
+
const trData = testResultStore.peek().data;
|
|
44
|
+
|
|
45
|
+
if (!testResultId || (trData && testResultId in trData)) {
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
testResultStore.value = {
|
|
48
|
-
...testResultStore.
|
|
50
|
+
...testResultStore.peek(),
|
|
49
51
|
loading: true,
|
|
50
52
|
error: undefined,
|
|
51
53
|
};
|
|
@@ -56,13 +58,13 @@ export const fetchTestResult = async (testResultId: string) => {
|
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
testResultStore.value = {
|
|
59
|
-
data: { ...testResultStore.
|
|
61
|
+
data: { ...testResultStore.peek().data, [testResultId]: data },
|
|
60
62
|
error: undefined,
|
|
61
63
|
loading: false,
|
|
62
64
|
};
|
|
63
65
|
} catch (err) {
|
|
64
66
|
testResultStore.value = {
|
|
65
|
-
...testResultStore.
|
|
67
|
+
...testResultStore.peek(),
|
|
66
68
|
error: err.message,
|
|
67
69
|
loading: false,
|
|
68
70
|
};
|
package/src/stores/tree.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
1
|
+
import { buildFilterPredicate, fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
2
|
import type { RecursiveTree } from "@allurereport/web-components/global";
|
|
3
3
|
import { computed, effect, signal } from "@preact/signals";
|
|
4
4
|
import type { AwesomeTree, AwesomeTreeGroup } from "types";
|
|
5
5
|
import type { StoreSignalState } from "@/stores/types";
|
|
6
6
|
import { loadFromLocalStorage } from "@/utils/loadFromLocalStorage";
|
|
7
7
|
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
8
|
-
import {
|
|
8
|
+
import { treeFilters } from "./treeFilters/store";
|
|
9
|
+
import { sortBy } from "./treeSort";
|
|
9
10
|
|
|
10
11
|
export const treeStore = signal<StoreSignalState<Record<string, AwesomeTree>>>({
|
|
11
12
|
loading: true,
|
|
@@ -36,7 +37,7 @@ export const toggleTree = (id: string) => {
|
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const fetchEnvTreesData = async (envs: string[]) => {
|
|
39
|
-
const envsToFetch = envs.filter((env) => !treeStore.
|
|
40
|
+
const envsToFetch = envs.filter((env) => !treeStore.peek().data?.[env]);
|
|
40
41
|
|
|
41
42
|
// all envs have already been fetched
|
|
42
43
|
if (envsToFetch.length === 0) {
|
|
@@ -44,7 +45,7 @@ export const fetchEnvTreesData = async (envs: string[]) => {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
treeStore.value = {
|
|
47
|
-
...treeStore.
|
|
48
|
+
...treeStore.peek(),
|
|
48
49
|
loading: true,
|
|
49
50
|
error: undefined,
|
|
50
51
|
};
|
|
@@ -54,7 +55,7 @@ export const fetchEnvTreesData = async (envs: string[]) => {
|
|
|
54
55
|
envsToFetch.map((env) => fetchReportJsonData<AwesomeTree>(`widgets/${env}/tree.json`, { bustCache: true })),
|
|
55
56
|
);
|
|
56
57
|
|
|
57
|
-
const previous = treeStore.
|
|
58
|
+
const previous = treeStore.peek().data;
|
|
58
59
|
treeStore.value = {
|
|
59
60
|
data: envsToFetch.reduce(
|
|
60
61
|
(acc, env, index) => {
|
|
@@ -70,7 +71,7 @@ export const fetchEnvTreesData = async (envs: string[]) => {
|
|
|
70
71
|
};
|
|
71
72
|
} catch (e) {
|
|
72
73
|
treeStore.value = {
|
|
73
|
-
...treeStore.
|
|
74
|
+
...treeStore.peek(),
|
|
74
75
|
error: e.message,
|
|
75
76
|
loading: false,
|
|
76
77
|
};
|
|
@@ -79,6 +80,16 @@ export const fetchEnvTreesData = async (envs: string[]) => {
|
|
|
79
80
|
|
|
80
81
|
const treeEntries = computed(() => (treeStore.value.data ? Object.entries(treeStore.value.data) : []));
|
|
81
82
|
|
|
83
|
+
const alwaysTruePredicate = () => true;
|
|
84
|
+
|
|
85
|
+
const filterPredicate = computed(() => {
|
|
86
|
+
if (treeFilters.value.length === 0) {
|
|
87
|
+
return alwaysTruePredicate;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return buildFilterPredicate(treeFilters.value);
|
|
91
|
+
});
|
|
92
|
+
|
|
82
93
|
export const filteredTree = computed(() => {
|
|
83
94
|
return treeEntries.value.reduce(
|
|
84
95
|
(acc, [key, value]) => {
|
|
@@ -87,17 +98,13 @@ export const filteredTree = computed(() => {
|
|
|
87
98
|
}
|
|
88
99
|
|
|
89
100
|
const { root, leavesById, groupsById } = value;
|
|
101
|
+
|
|
90
102
|
const tree = createRecursiveTree({
|
|
91
103
|
group: root as AwesomeTreeGroup,
|
|
92
104
|
leavesById,
|
|
93
105
|
groupsById,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
status: treeStatus.value,
|
|
97
|
-
filter: treeFilter.value,
|
|
98
|
-
sortBy: treeSortBy.value,
|
|
99
|
-
direction: treeDirection.value,
|
|
100
|
-
},
|
|
106
|
+
filterPredicate: filterPredicate.value,
|
|
107
|
+
sortBy: sortBy.value,
|
|
101
108
|
});
|
|
102
109
|
|
|
103
110
|
return Object.assign(acc, {
|
|
@@ -1,67 +1,63 @@
|
|
|
1
|
-
import type { TestStatusTransition } from "@allurereport/core-api";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
treeStatus.value = "total";
|
|
12
|
-
treeFilter.value = {
|
|
13
|
-
flaky: false,
|
|
14
|
-
retry: false,
|
|
15
|
-
new: false,
|
|
16
|
-
fixed: false,
|
|
17
|
-
regressed: false,
|
|
18
|
-
malfunctioned: false,
|
|
19
|
-
};
|
|
1
|
+
import type { TestStatus, TestStatusTransition } from "@allurereport/core-api";
|
|
2
|
+
import { ReportFetchError, fetchReportJsonData, setParams } from "@allurereport/web-commons";
|
|
3
|
+
import { PARAMS } from "./constants";
|
|
4
|
+
import type { TreeFiltersData } from "./model";
|
|
5
|
+
import { treeTags } from "./store";
|
|
6
|
+
|
|
7
|
+
export const setQueryFilter = (query?: string) => {
|
|
8
|
+
setParams({
|
|
9
|
+
key: PARAMS.QUERY,
|
|
10
|
+
value: query?.trim() === "" ? undefined : query,
|
|
20
11
|
});
|
|
21
12
|
};
|
|
22
13
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
14
|
+
export const setStatusFilter = (status?: TestStatus) => {
|
|
15
|
+
setParams({
|
|
16
|
+
key: PARAMS.STATUS,
|
|
17
|
+
value: status,
|
|
18
|
+
});
|
|
25
19
|
};
|
|
26
20
|
|
|
27
|
-
export const
|
|
28
|
-
|
|
21
|
+
export const setFlakyFilter = (flaky?: boolean) => {
|
|
22
|
+
setParams({
|
|
23
|
+
key: PARAMS.FLAKY,
|
|
24
|
+
value: flaky ? "true" : undefined,
|
|
25
|
+
});
|
|
29
26
|
};
|
|
30
27
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
28
|
+
export const setRetryFilter = (retry?: boolean) => {
|
|
29
|
+
setParams({
|
|
30
|
+
key: PARAMS.RETRY,
|
|
31
|
+
value: retry ? "true" : undefined,
|
|
32
|
+
});
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export const
|
|
36
|
-
|
|
35
|
+
export const setTransitionFilter = (transitions: TestStatusTransition[]) => {
|
|
36
|
+
setParams({
|
|
37
|
+
key: PARAMS.TRANSITION,
|
|
38
|
+
value: transitions,
|
|
39
|
+
});
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
export const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
42
|
+
export const setTagsFilter = (tags: string[]) => {
|
|
43
|
+
setParams({
|
|
44
|
+
key: PARAMS.TAGS,
|
|
45
|
+
value: tags,
|
|
46
|
+
});
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
export const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
49
|
+
export const fetchTreeFiltersData = async () => {
|
|
50
|
+
try {
|
|
51
|
+
const response = await fetchReportJsonData<TreeFiltersData>("widgets/tree-filters.json", { bustCache: true });
|
|
52
|
+
|
|
53
|
+
treeTags.value = response.tags;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (error instanceof ReportFetchError && error.response.status === 404) {
|
|
56
|
+
treeTags.value = [];
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...transitionFiltersList.reduce(
|
|
57
|
-
(acc, t) => {
|
|
58
|
-
acc[t] = false;
|
|
59
|
-
if (t === transition) {
|
|
60
|
-
acc[t] = value;
|
|
61
|
-
}
|
|
62
|
-
return acc;
|
|
63
|
-
},
|
|
64
|
-
{} as Record<TestStatusTransition, boolean>,
|
|
65
|
-
),
|
|
66
|
-
};
|
|
60
|
+
// eslint-disable-next-line no-console
|
|
61
|
+
console.error("Failed to fetch tree filters data:\n\n", error);
|
|
62
|
+
}
|
|
67
63
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { TestStatusTransition } from "@allurereport/core-api";
|
|
1
|
+
import type { TestStatus, TestStatusTransition } from "@allurereport/core-api";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const TRANSITIONS: TestStatusTransition[] = ["new", "fixed", "regressed", "malfunctioned"];
|
|
4
|
+
export const STATUSES: TestStatus[] = ["passed", "failed", "skipped", "broken", "unknown"];
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export const PARAMS = {
|
|
7
|
+
QUERY: "query",
|
|
8
|
+
STATUS: "status",
|
|
9
|
+
FLAKY: "flaky",
|
|
10
|
+
RETRY: "retry",
|
|
11
|
+
TRANSITION: "transition",
|
|
12
|
+
TAGS: "tags",
|
|
13
|
+
} as const;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { TestStatus, TestStatusTransition } from "@allurereport/core-api";
|
|
2
|
+
import type {
|
|
3
|
+
ArrayField,
|
|
4
|
+
BooleanField,
|
|
5
|
+
Field,
|
|
6
|
+
FieldFilter,
|
|
7
|
+
FieldFilterGroup,
|
|
8
|
+
StringField,
|
|
9
|
+
} from "@allurereport/web-commons";
|
|
10
|
+
import type { AwesomeTreeLeaf } from "types";
|
|
11
|
+
|
|
12
|
+
export type Filters = {
|
|
13
|
+
query?: string;
|
|
14
|
+
status?: TestStatus;
|
|
15
|
+
flaky?: boolean;
|
|
16
|
+
retry?: boolean;
|
|
17
|
+
transition?: TestStatusTransition[];
|
|
18
|
+
tags?: string[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type AwesomeFieldFilter = FieldFilter<keyof AwesomeTreeLeaf>;
|
|
22
|
+
|
|
23
|
+
export type AwesomeFieldFilterGroup = FieldFilterGroup<keyof AwesomeTreeLeaf> & {
|
|
24
|
+
fieldKey?: keyof AwesomeTreeLeaf;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type AwesomeFilterGroupSimple = AwesomeFieldFilterGroup & {
|
|
28
|
+
value: AwesomeFieldFilter[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type AwesomeFilter = AwesomeFieldFilter | AwesomeFilterGroupSimple;
|
|
32
|
+
|
|
33
|
+
export type AwesomeField = Field<keyof AwesomeTreeLeaf>;
|
|
34
|
+
|
|
35
|
+
export type AwesomeBooleanField = BooleanField<keyof AwesomeTreeLeaf>;
|
|
36
|
+
|
|
37
|
+
export type AwesomeStringFieldFilter = AwesomeFieldFilter & {
|
|
38
|
+
value: StringField<keyof AwesomeTreeLeaf>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type AwesomeArrayFieldFilter = AwesomeFieldFilter & {
|
|
42
|
+
value: ArrayField<keyof AwesomeTreeLeaf>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type AwesomeBooleanFieldFilter = AwesomeFieldFilter & {
|
|
46
|
+
value: AwesomeBooleanField;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type TreeFiltersData = {
|
|
50
|
+
tags: string[];
|
|
51
|
+
};
|