@allurereport/web-classic 3.0.0-beta.10
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/.babelrc--old.cjs +18 -0
- package/.babelrc.js +46 -0
- package/.eslintrc--old.cjs +125 -0
- package/.eslintrc.cjs +22 -0
- package/README.md +27 -0
- package/dist/multi/10.app-970f027d.js +1 -0
- package/dist/multi/222.app-970f027d.js +1 -0
- package/dist/multi/26.app-970f027d.js +1 -0
- package/dist/multi/302.app-970f027d.js +1 -0
- package/dist/multi/304.app-970f027d.js +1 -0
- package/dist/multi/369.app-970f027d.js +1 -0
- package/dist/multi/389.app-970f027d.js +1 -0
- package/dist/multi/498.app-970f027d.js +1 -0
- package/dist/multi/60.app-970f027d.js +1 -0
- package/dist/multi/643.app-970f027d.js +1 -0
- package/dist/multi/671.app-970f027d.js +1 -0
- package/dist/multi/725.app-970f027d.js +1 -0
- package/dist/multi/770.app-970f027d.js +1 -0
- package/dist/multi/848.app-970f027d.js +1 -0
- package/dist/multi/853.app-970f027d.js +1 -0
- package/dist/multi/872.app-970f027d.js +1 -0
- package/dist/multi/895.app-970f027d.js +1 -0
- package/dist/multi/920.app-970f027d.js +1 -0
- package/dist/multi/979.app-970f027d.js +1 -0
- package/dist/multi/991.app-970f027d.js +1 -0
- package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
- package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
- package/dist/multi/app-970f027d.js +2 -0
- package/dist/multi/app-970f027d.js.LICENSE.txt +25 -0
- package/dist/multi/manifest.json +28 -0
- package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
- package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
- package/dist/multi/styles-970f027d.css +283 -0
- package/dist/single/app-2babff54.js +2 -0
- package/dist/single/app-2babff54.js.LICENSE.txt +25 -0
- package/dist/single/manifest.json +3 -0
- package/package--old.json +106 -0
- package/package.json +107 -0
- package/postcss.config.js +5 -0
- package/src/assets/scss/_common.scss +142 -0
- package/src/assets/scss/code.scss +71 -0
- package/src/assets/scss/day.scss +51 -0
- package/src/assets/scss/fonts.scss +3 -0
- package/src/assets/scss/index.scss +9 -0
- package/src/assets/scss/night.scss +61 -0
- package/src/assets/scss/palette.scss +393 -0
- package/src/assets/scss/theme.scss +117 -0
- package/src/assets/scss/typography.scss +218 -0
- package/src/assets/scss/vars.scss +8 -0
- package/src/components/ArrowButton/index.tsx +36 -0
- package/src/components/ArrowButton/styles.scss +35 -0
- package/src/components/BaseLayout/index.tsx +23 -0
- package/src/components/BaseLayout/styles.scss +63 -0
- package/src/components/Behaviors/BehaviorsList.tsx +67 -0
- package/src/components/Behaviors/index.tsx +60 -0
- package/src/components/Behaviors/styles.scss +196 -0
- package/src/components/Categories/CategoriesList.tsx +67 -0
- package/src/components/Categories/index.tsx +60 -0
- package/src/components/Categories/styles.scss +196 -0
- package/src/components/Footer/FooterLogo.tsx +16 -0
- package/src/components/Footer/FooterVersion.tsx +33 -0
- package/src/components/Footer/index.tsx +13 -0
- package/src/components/Footer/styles.scss +14 -0
- package/src/components/Graphs/index.tsx +2 -0
- package/src/components/Header/index.tsx +14 -0
- package/src/components/Header/styles.scss +26 -0
- package/src/components/HeaderActions/Filters.tsx +90 -0
- package/src/components/HeaderActions/HeaderActions.tsx +59 -0
- package/src/components/HeaderActions/SortBy.tsx +128 -0
- package/src/components/HeaderActions/styles.scss +82 -0
- package/src/components/LanguagePicker/index.tsx +41 -0
- package/src/components/LanguagePicker/styles.scss +3 -0
- package/src/components/MainReport/index.tsx +19 -0
- package/src/components/Metadata/index.tsx +121 -0
- package/src/components/Metadata/styles.scss +146 -0
- package/src/components/MetadataButton/index.tsx +32 -0
- package/src/components/MetadataButton/styles.scss +53 -0
- package/src/components/Modal/ModalView.hbs +13 -0
- package/src/components/Modal/ModalView.js +43 -0
- package/src/components/Modal/index.tsx +174 -0
- package/src/components/Modal/styles.scss +126 -0
- package/src/components/Overview/index.tsx +9 -0
- package/src/components/Packages/PackagesList.tsx +67 -0
- package/src/components/Packages/index.tsx +59 -0
- package/src/components/Packages/styles.scss +196 -0
- package/src/components/ReportBody/Filters.tsx +92 -0
- package/src/components/ReportBody/HeaderActions.tsx +21 -0
- package/src/components/ReportBody/SortBy.tsx +132 -0
- package/src/components/ReportBody/context.tsx +106 -0
- package/src/components/ReportBody/index.tsx +71 -0
- package/src/components/ReportBody/styles.scss +64 -0
- package/src/components/ReportHeader/ReportHeaderLabelList.tsx +12 -0
- package/src/components/ReportHeader/ReportHeaderLogo.tsx +10 -0
- package/src/components/ReportHeader/ReportHeaderPie.tsx +14 -0
- package/src/components/ReportHeader/index.tsx +33 -0
- package/src/components/ReportHeader/styles.scss +49 -0
- package/src/components/ReportLogo/index.tsx +16 -0
- package/src/components/ReportLogo/styles.scss +20 -0
- package/src/components/ReportLogoFull/index.tsx +20 -0
- package/src/components/ReportLogoFull/styles.scss +7 -0
- package/src/components/ReportMetadata/MetadataItem.tsx +45 -0
- package/src/components/ReportMetadata/MetadataSummary.tsx +81 -0
- package/src/components/ReportMetadata/MetadataTestType.tsx +16 -0
- package/src/components/ReportMetadata/MetadataWithIcon.tsx +21 -0
- package/src/components/ReportMetadata/index.tsx +46 -0
- package/src/components/ReportMetadata/styles.scss +99 -0
- package/src/components/SideBySide/index.tsx +54 -0
- package/src/components/SideBySide/styles.scss +59 -0
- package/src/components/SideNav/SideNav.tsx +78 -0
- package/src/components/SideNav/SideNavView.hbs +39 -0
- package/src/components/SideNav/SideNavView.js +81 -0
- package/src/components/SideNav/styles.scss +126 -0
- package/src/components/Suites/index.tsx +62 -0
- package/src/components/Suites/styles.scss +10 -0
- package/src/components/Tabs/index.tsx +33 -0
- package/src/components/Tabs/styles.scss +56 -0
- package/src/components/TestResult/TestResultAttachmentsView/index.tsx +27 -0
- package/src/components/TestResult/TestResultAttachmentsView/styles.scss +12 -0
- package/src/components/TestResult/TestResultDescription/index.tsx +27 -0
- package/src/components/TestResult/TestResultDescription/styles.scss +12 -0
- package/src/components/TestResult/TestResultDropdown/index.tsx +23 -0
- package/src/components/TestResult/TestResultDropdown/styles.scss +34 -0
- package/src/components/TestResult/TestResultEmpty/index.tsx +33 -0
- package/src/components/TestResult/TestResultEmpty/styles.scss +25 -0
- package/src/components/TestResult/TestResultError/index.tsx +48 -0
- package/src/components/TestResult/TestResultError/styles.scss +51 -0
- package/src/components/TestResult/TestResultHeader/index.tsx +53 -0
- package/src/components/TestResult/TestResultHeader/styles.scss +43 -0
- package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +67 -0
- package/src/components/TestResult/TestResultHistory/index.tsx +26 -0
- package/src/components/TestResult/TestResultHistory/styles.scss +63 -0
- package/src/components/TestResult/TestResultInfo/TestResultInfoStatuses.tsx +30 -0
- package/src/components/TestResult/TestResultInfo/index.tsx +79 -0
- package/src/components/TestResult/TestResultInfo/styles.scss +50 -0
- package/src/components/TestResult/TestResultLinks/index.tsx +56 -0
- package/src/components/TestResult/TestResultLinks/styles.scss +30 -0
- package/src/components/TestResult/TestResultMetadata/index.tsx +27 -0
- package/src/components/TestResult/TestResultMetadata/styles.scss +8 -0
- package/src/components/TestResult/TestResultNavigation/index.tsx +80 -0
- package/src/components/TestResult/TestResultNavigation/styles.scss +48 -0
- package/src/components/TestResult/TestResultOverview.tsx +40 -0
- package/src/components/TestResult/TestResultParameters/index.tsx +30 -0
- package/src/components/TestResult/TestResultParameters/styles.scss +8 -0
- package/src/components/TestResult/TestResultPrevStatuses/index.tsx +49 -0
- package/src/components/TestResult/TestResultPrevStatuses/styles.scss +57 -0
- package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +49 -0
- package/src/components/TestResult/TestResultRetriesView/index.tsx +20 -0
- package/src/components/TestResult/TestResultRetriesView/styles.scss +69 -0
- package/src/components/TestResult/TestResultSetup/index.tsx +49 -0
- package/src/components/TestResult/TestResultSeverity/index.tsx +27 -0
- package/src/components/TestResult/TestResultSeverity/styles.scss +29 -0
- package/src/components/TestResult/TestResultStatus/index.tsx +26 -0
- package/src/components/TestResult/TestResultStatus/styles.scss +36 -0
- package/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +12 -0
- package/src/components/TestResult/TestResultSteps/attachment.tsx +68 -0
- package/src/components/TestResult/TestResultSteps/attachmentCode.tsx +20 -0
- package/src/components/TestResult/TestResultSteps/attachmentImage.tsx +32 -0
- package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +15 -0
- package/src/components/TestResult/TestResultSteps/index.tsx +49 -0
- package/src/components/TestResult/TestResultSteps/styles.scss +225 -0
- package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +77 -0
- package/src/components/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +83 -0
- package/src/components/TestResult/TestResultSteps/testResultStep.tsx +78 -0
- package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +30 -0
- package/src/components/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
- package/src/components/TestResult/TestResultTabs/index.tsx +59 -0
- package/src/components/TestResult/TestResultTabs/styles.scss +76 -0
- package/src/components/TestResult/TestResultTeardown/index.tsx +49 -0
- package/src/components/TestResult/TestResultView.hbs +32 -0
- package/src/components/TestResult/TestResultView.js +90 -0
- package/src/components/TestResult/index.tsx +54 -0
- package/src/components/TestResult/styles.scss +29 -0
- package/src/components/TestResultView/index.tsx +31 -0
- package/src/components/ThemeButton/ThemeButton.tsx +20 -0
- package/src/components/Timeline/index.tsx +2 -0
- package/src/components/Tree/Tree.tsx +76 -0
- package/src/components/Tree/TreeHeader.tsx +82 -0
- package/src/components/Tree/TreeItem.tsx +49 -0
- package/src/components/Tree/TreeItemIcon.tsx +32 -0
- package/src/components/Tree/index.tsx +60 -0
- package/src/components/Tree/styles.scss +185 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +40 -0
- package/src/index.js +52 -0
- package/src/index.tsx +60 -0
- package/src/mixins.scss +128 -0
- package/src/rtl.scss +19 -0
- package/src/stores/behaviors.ts +127 -0
- package/src/stores/categories.ts +127 -0
- package/src/stores/chart.ts +32 -0
- package/src/stores/envInfo.ts +34 -0
- package/src/stores/index.ts +4 -0
- package/src/stores/locale.ts +83 -0
- package/src/stores/packages.ts +127 -0
- package/src/stores/router.ts +55 -0
- package/src/stores/stats.ts +36 -0
- package/src/stores/tabs.ts +7 -0
- package/src/stores/testResults.ts +66 -0
- package/src/stores/theme.ts +33 -0
- package/src/stores/tree.ts +127 -0
- package/src/stores/types.ts +5 -0
- package/src/styles.scss +91 -0
- package/src/translations/am.json +127 -0
- package/src/translations/az.json +127 -0
- package/src/translations/br.json +214 -0
- package/src/translations/constants.ts +124 -0
- package/src/translations/de.json +127 -0
- package/src/translations/en.json +128 -0
- package/src/translations/es.json +118 -0
- package/src/translations/fr.json +118 -0
- package/src/translations/he.json +118 -0
- package/src/translations/isv.json +216 -0
- package/src/translations/it.json +118 -0
- package/src/translations/ja.json +118 -0
- package/src/translations/ka.json +118 -0
- package/src/translations/kr.json +118 -0
- package/src/translations/nl.json +118 -0
- package/src/translations/pl.json +116 -0
- package/src/translations/pt.json +118 -0
- package/src/translations/ru.json +116 -0
- package/src/translations/sv.json +118 -0
- package/src/translations/tr.json +118 -0
- package/src/translations/zh.json +118 -0
- package/src/types/globals.d.ts +13 -0
- package/src/types/window.d.ts +8 -0
- package/src/utils/attachments.ts +156 -0
- package/src/utils/capitalize.ts +6 -0
- package/src/utils/copyToClipboard.ts +16 -0
- package/src/utils/isMac.ts +8 -0
- package/src/utils/navigate.ts +7 -0
- package/src/utils/statuses.js +1 -0
- package/src/utils/statuses.ts +55 -0
- package/src/utils/time.ts +17 -0
- package/src/utils/treeFilters.ts +139 -0
- package/src/variables.scss +71 -0
- package/test/utils/treeFilters.test.ts +448 -0
- package/tsconfig.json +25 -0
- package/types.d.ts +85 -0
- package/vitest.config.ts +18 -0
- package/webpack.config--old.js +127 -0
- package/webpack.config.js +108 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { computed, signal } from "@preact/signals";
|
|
3
|
+
import type { AwesomeStatus, AwesomeTree, AwesomeTreeGroup } from "types";
|
|
4
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
5
|
+
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
6
|
+
|
|
7
|
+
export type TreeSortBy = "order" | "duration" | "status" | "alphabet";
|
|
8
|
+
export type TreeDirection = "asc" | "desc";
|
|
9
|
+
export type TreeFilters = "flaky" | "retry" | "new";
|
|
10
|
+
export type TreeFiltersState = {
|
|
11
|
+
query: string;
|
|
12
|
+
status: AwesomeStatus;
|
|
13
|
+
filter: Record<TreeFilters, boolean>;
|
|
14
|
+
sortBy: TreeSortBy;
|
|
15
|
+
direction: TreeDirection;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const categoriesStore = signal<StoreSignalState<AwesomeTree>>({
|
|
19
|
+
loading: true,
|
|
20
|
+
error: undefined,
|
|
21
|
+
data: undefined,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const noTests = computed(() => !Object.keys(categoriesStore?.value?.data?.leavesById).length);
|
|
25
|
+
|
|
26
|
+
export const categoriesFiltersStore = signal<TreeFiltersState>({
|
|
27
|
+
query: "",
|
|
28
|
+
status: "total",
|
|
29
|
+
filter: {
|
|
30
|
+
flaky: false,
|
|
31
|
+
retry: false,
|
|
32
|
+
new: false,
|
|
33
|
+
},
|
|
34
|
+
sortBy: "order",
|
|
35
|
+
direction: "asc",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const filteredCategories = computed(() => {
|
|
39
|
+
const { root, leavesById, groupsById } = categoriesStore.value.data;
|
|
40
|
+
|
|
41
|
+
return createRecursiveTree({
|
|
42
|
+
group: root as AwesomeTreeGroup,
|
|
43
|
+
leavesById,
|
|
44
|
+
groupsById,
|
|
45
|
+
filterOptions: categoriesFiltersStore.value,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const noTestsFound = computed(() => {
|
|
50
|
+
return isRecursiveTreeEmpty(filteredCategories.value);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const clearCategoriesFilters = () => {
|
|
54
|
+
categoriesFiltersStore.value = {
|
|
55
|
+
query: "",
|
|
56
|
+
status: "total",
|
|
57
|
+
filter: {
|
|
58
|
+
flaky: false,
|
|
59
|
+
retry: false,
|
|
60
|
+
new: false,
|
|
61
|
+
},
|
|
62
|
+
sortBy: "order",
|
|
63
|
+
direction: "asc",
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const setCategoriesQuery = (query: string) => {
|
|
68
|
+
categoriesFiltersStore.value = {
|
|
69
|
+
...categoriesFiltersStore.value,
|
|
70
|
+
query,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const setCategoriesStatus = (status: AwesomeStatus) => {
|
|
75
|
+
categoriesFiltersStore.value = {
|
|
76
|
+
...categoriesFiltersStore.value,
|
|
77
|
+
status,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const setCategoriesSortBy = (sortBy: TreeSortBy) => {
|
|
82
|
+
categoriesFiltersStore.value = {
|
|
83
|
+
...categoriesFiltersStore.value,
|
|
84
|
+
sortBy,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const setCategoriesDirection = (direction: TreeDirection) => {
|
|
89
|
+
categoriesFiltersStore.value = {
|
|
90
|
+
...categoriesFiltersStore.value,
|
|
91
|
+
direction,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const setCategoriesFilter = (filterKey: TreeFilters, value: boolean) => {
|
|
96
|
+
categoriesFiltersStore.value = {
|
|
97
|
+
...categoriesFiltersStore.value,
|
|
98
|
+
filter: {
|
|
99
|
+
...categoriesFiltersStore.value.filter,
|
|
100
|
+
[filterKey]: value,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const fetchCategoriesData = async () => {
|
|
106
|
+
categoriesStore.value = {
|
|
107
|
+
...categoriesStore.value,
|
|
108
|
+
loading: true,
|
|
109
|
+
error: undefined,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const res = await fetchReportJsonData<AwesomeTree>("widgets/categories.json");
|
|
114
|
+
|
|
115
|
+
categoriesStore.value = {
|
|
116
|
+
data: res,
|
|
117
|
+
error: undefined,
|
|
118
|
+
loading: false,
|
|
119
|
+
};
|
|
120
|
+
} catch (e) {
|
|
121
|
+
categoriesStore.value = {
|
|
122
|
+
...categoriesStore.value,
|
|
123
|
+
error: e.message,
|
|
124
|
+
loading: false,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import { StoreSignalState } from "@/stores/types";
|
|
4
|
+
|
|
5
|
+
export const pieChartStore = signal<StoreSignalState<any>>({
|
|
6
|
+
loading: true,
|
|
7
|
+
error: undefined,
|
|
8
|
+
data: undefined,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const fetchPieChartData = async () => {
|
|
12
|
+
pieChartStore.value = {
|
|
13
|
+
...pieChartStore.value,
|
|
14
|
+
loading: true,
|
|
15
|
+
error: undefined,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetchReportJsonData("widgets/allure_pie_chart.json");
|
|
20
|
+
|
|
21
|
+
pieChartStore.value = {
|
|
22
|
+
data: res,
|
|
23
|
+
error: undefined,
|
|
24
|
+
loading: false,
|
|
25
|
+
};
|
|
26
|
+
} catch (err) {
|
|
27
|
+
pieChartStore.value = {
|
|
28
|
+
error: err.message,
|
|
29
|
+
loading: false,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EnvironmentItem } from "@allurereport/core-api";
|
|
2
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
3
|
+
import { signal } from "@preact/signals";
|
|
4
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
5
|
+
|
|
6
|
+
export const envInfoStore = signal<StoreSignalState<EnvironmentItem[]>>({
|
|
7
|
+
loading: false,
|
|
8
|
+
error: undefined,
|
|
9
|
+
data: undefined,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const fetchEnvInfo = async () => {
|
|
13
|
+
envInfoStore.value = {
|
|
14
|
+
...envInfoStore.value,
|
|
15
|
+
loading: true,
|
|
16
|
+
error: undefined,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const res = await fetchReportJsonData<EnvironmentItem[]>("widgets/allure_environment.json");
|
|
21
|
+
|
|
22
|
+
envInfoStore.value = {
|
|
23
|
+
data: res,
|
|
24
|
+
error: undefined,
|
|
25
|
+
loading: false,
|
|
26
|
+
};
|
|
27
|
+
} catch (e) {
|
|
28
|
+
envInfoStore.value = {
|
|
29
|
+
...envInfoStore.value,
|
|
30
|
+
error: e.message,
|
|
31
|
+
loading: false,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getReportOptions } from "@allurereport/web-commons";
|
|
2
|
+
import { computed, signal } from "@preact/signals";
|
|
3
|
+
import i18next, { type TOptions } from "i18next";
|
|
4
|
+
import { DEFAULT_LOCALE, LANG_LOCALE, type LangLocale } from "@/translations/constants";
|
|
5
|
+
import type { AwesomeReportOptions } from "../../types.js";
|
|
6
|
+
|
|
7
|
+
const { reportLanguage } = getReportOptions<AwesomeReportOptions>() ?? {};
|
|
8
|
+
|
|
9
|
+
const namespaces = [
|
|
10
|
+
"empty",
|
|
11
|
+
"execution",
|
|
12
|
+
"filters",
|
|
13
|
+
"search",
|
|
14
|
+
"severity",
|
|
15
|
+
"sort-by",
|
|
16
|
+
"sort-by.directions",
|
|
17
|
+
"sort-by.values",
|
|
18
|
+
"statuses",
|
|
19
|
+
"tabs",
|
|
20
|
+
"testSummary",
|
|
21
|
+
"ui",
|
|
22
|
+
"welcome",
|
|
23
|
+
"controls",
|
|
24
|
+
"errors",
|
|
25
|
+
"nav",
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export const currentLocale = signal<LangLocale>("" as LangLocale);
|
|
29
|
+
|
|
30
|
+
export const currentLocaleIso = computed(() => {
|
|
31
|
+
const locale = currentLocale.value;
|
|
32
|
+
|
|
33
|
+
return LANG_LOCALE[locale].iso;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const currentLocaleIsRTL = computed(() => {
|
|
37
|
+
return ["ar", "he", "fa"].includes(currentLocale.value as string);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const getLocale = () => {
|
|
41
|
+
const locale = localStorage.getItem("currentLocale") || reportLanguage || DEFAULT_LOCALE;
|
|
42
|
+
setLocale(locale as LangLocale);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
i18next
|
|
46
|
+
.use({
|
|
47
|
+
type: "backend",
|
|
48
|
+
read: async (
|
|
49
|
+
language: LangLocale,
|
|
50
|
+
namespace: string,
|
|
51
|
+
callback: (errorValue: unknown, translations: Record<string, string> | null) => void,
|
|
52
|
+
) => {
|
|
53
|
+
try {
|
|
54
|
+
const resources = await import(`@/translations/${language}.json`);
|
|
55
|
+
callback(null, (resources[namespace] as Record<string, string>) || null);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
callback(error, null);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
.init({
|
|
62
|
+
lng: currentLocale.value,
|
|
63
|
+
fallbackLng: "en",
|
|
64
|
+
ns: namespaces,
|
|
65
|
+
interpolation: {
|
|
66
|
+
escapeValue: false,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export const useI18n = (namespace?: string) => {
|
|
71
|
+
const t = computed(() => (key: string, options?: TOptions) => i18next.t(key, { ns: namespace, ...options }));
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
t: t.value,
|
|
75
|
+
currentLocale: currentLocale.value,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const setLocale = async (locale: LangLocale) => {
|
|
80
|
+
await i18next.changeLanguage(locale);
|
|
81
|
+
localStorage.setItem("currentLocale", locale);
|
|
82
|
+
currentLocale.value = locale;
|
|
83
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { computed, signal } from "@preact/signals";
|
|
3
|
+
import type { AwesomeStatus, AwesomeTree, AwesomeTreeGroup } from "types";
|
|
4
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
5
|
+
import { createRecursiveTree, isRecursiveTreeEmpty } from "@/utils/treeFilters";
|
|
6
|
+
|
|
7
|
+
export type TreeSortBy = "order" | "duration" | "status" | "alphabet";
|
|
8
|
+
export type TreeDirection = "asc" | "desc";
|
|
9
|
+
export type TreeFilters = "flaky" | "retry" | "new";
|
|
10
|
+
export type TreeFiltersState = {
|
|
11
|
+
query: string;
|
|
12
|
+
status: AwesomeStatus;
|
|
13
|
+
filter: Record<TreeFilters, boolean>;
|
|
14
|
+
sortBy: TreeSortBy;
|
|
15
|
+
direction: TreeDirection;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const packagesStore = signal<StoreSignalState<AwesomeTree>>({
|
|
19
|
+
loading: true,
|
|
20
|
+
error: undefined,
|
|
21
|
+
data: undefined,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const noTests = computed(() => !Object.keys(packagesStore?.value?.data?.leavesById).length);
|
|
25
|
+
|
|
26
|
+
export const packagesFiltersStore = signal<TreeFiltersState>({
|
|
27
|
+
query: "",
|
|
28
|
+
status: "total",
|
|
29
|
+
filter: {
|
|
30
|
+
flaky: false,
|
|
31
|
+
retry: false,
|
|
32
|
+
new: false,
|
|
33
|
+
},
|
|
34
|
+
sortBy: "order",
|
|
35
|
+
direction: "asc",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const filteredPackages = computed(() => {
|
|
39
|
+
const { root, leavesById, groupsById } = packagesStore.value.data;
|
|
40
|
+
|
|
41
|
+
return createRecursiveTree({
|
|
42
|
+
group: root as AwesomeTreeGroup,
|
|
43
|
+
leavesById,
|
|
44
|
+
groupsById,
|
|
45
|
+
filterOptions: packagesFiltersStore.value,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const noTestsFound = computed(() => {
|
|
50
|
+
return isRecursiveTreeEmpty(filteredPackages.value);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const clearPackagesFilters = () => {
|
|
54
|
+
packagesFiltersStore.value = {
|
|
55
|
+
query: "",
|
|
56
|
+
status: "total",
|
|
57
|
+
filter: {
|
|
58
|
+
flaky: false,
|
|
59
|
+
retry: false,
|
|
60
|
+
new: false,
|
|
61
|
+
},
|
|
62
|
+
sortBy: "order",
|
|
63
|
+
direction: "asc",
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const setPackagesQuery = (query: string) => {
|
|
68
|
+
packagesFiltersStore.value = {
|
|
69
|
+
...packagesFiltersStore.value,
|
|
70
|
+
query,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const setPackagesStatus = (status: AwesomeStatus) => {
|
|
75
|
+
packagesFiltersStore.value = {
|
|
76
|
+
...packagesFiltersStore.value,
|
|
77
|
+
status,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const setPackagesSortBy = (sortBy: TreeSortBy) => {
|
|
82
|
+
packagesFiltersStore.value = {
|
|
83
|
+
...packagesFiltersStore.value,
|
|
84
|
+
sortBy,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const setPackagesDirection = (direction: TreeDirection) => {
|
|
89
|
+
packagesFiltersStore.value = {
|
|
90
|
+
...packagesFiltersStore.value,
|
|
91
|
+
direction,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const setPackagesFilter = (filterKey: TreeFilters, value: boolean) => {
|
|
96
|
+
packagesFiltersStore.value = {
|
|
97
|
+
...packagesFiltersStore.value,
|
|
98
|
+
filter: {
|
|
99
|
+
...packagesFiltersStore.value.filter,
|
|
100
|
+
[filterKey]: value,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const fetchPackagesData = async () => {
|
|
106
|
+
packagesStore.value = {
|
|
107
|
+
...packagesStore.value,
|
|
108
|
+
loading: true,
|
|
109
|
+
error: undefined,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const res = await fetchReportJsonData<AwesomeTree>("widgets/packages.json");
|
|
114
|
+
|
|
115
|
+
packagesStore.value = {
|
|
116
|
+
data: res,
|
|
117
|
+
error: undefined,
|
|
118
|
+
loading: false,
|
|
119
|
+
};
|
|
120
|
+
} catch (e) {
|
|
121
|
+
packagesStore.value = {
|
|
122
|
+
...packagesStore.value,
|
|
123
|
+
error: e.message,
|
|
124
|
+
loading: false,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { computed, signal } from "@preact/signals";
|
|
2
|
+
|
|
3
|
+
type NavigateToString = string;
|
|
4
|
+
type NavigateToObject = {
|
|
5
|
+
tabName?: string;
|
|
6
|
+
params?: {
|
|
7
|
+
id?: string | null;
|
|
8
|
+
testResultId?: string | null;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const parseHash = () => {
|
|
13
|
+
const hash = globalThis.location.hash.slice(1);
|
|
14
|
+
const [tabName, ...params] = hash.split("/");
|
|
15
|
+
return {
|
|
16
|
+
tabName: tabName,
|
|
17
|
+
params: { id: params[0] || null, testResultId: params[1] || null },
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const route = signal(parseHash());
|
|
22
|
+
|
|
23
|
+
export const handleHashChange = () => {
|
|
24
|
+
const newRoute = parseHash();
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
newRoute.tabName !== route.value.tabName ||
|
|
28
|
+
newRoute.params.id !== route.value.params.id ||
|
|
29
|
+
newRoute.params.testResultId !== route.value.params.testResultId
|
|
30
|
+
) {
|
|
31
|
+
route.value = newRoute;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const navigateTo = (path: NavigateToString | NavigateToObject) => {
|
|
36
|
+
let newHash = "";
|
|
37
|
+
|
|
38
|
+
if (typeof path === "string") {
|
|
39
|
+
newHash = path.startsWith("#") ? path.slice(1) : path;
|
|
40
|
+
} else {
|
|
41
|
+
const { tabName = "overview", params = {} } = path;
|
|
42
|
+
const { id = null, testResultId = null } = params;
|
|
43
|
+
newHash = `${tabName}/${id || ""}/${testResultId || ""}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
history.pushState(null, "", `#${newHash}`);
|
|
47
|
+
|
|
48
|
+
handleHashChange();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const openInNewTab = (path: string) => {
|
|
52
|
+
window.open(`#${path}`, "_blank");
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const activeTab = computed(() => route.value.tabName);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Statistic } from "@allurereport/core-api";
|
|
2
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
3
|
+
import { signal } from "@preact/signals";
|
|
4
|
+
import type { StoreSignalState } from "@/stores/types";
|
|
5
|
+
|
|
6
|
+
export const statsStore = signal<StoreSignalState<Statistic>>({
|
|
7
|
+
loading: true,
|
|
8
|
+
error: undefined,
|
|
9
|
+
data: {
|
|
10
|
+
total: 0,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const fetchStats = async () => {
|
|
15
|
+
statsStore.value = {
|
|
16
|
+
...statsStore.value,
|
|
17
|
+
loading: true,
|
|
18
|
+
error: undefined,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetchReportJsonData<Statistic>("widgets/allure_statistic.json");
|
|
23
|
+
|
|
24
|
+
statsStore.value = {
|
|
25
|
+
data: res,
|
|
26
|
+
error: undefined,
|
|
27
|
+
loading: false,
|
|
28
|
+
};
|
|
29
|
+
} catch (err) {
|
|
30
|
+
statsStore.value = {
|
|
31
|
+
data: { total: 0 },
|
|
32
|
+
error: err.message,
|
|
33
|
+
loading: false,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { fetchReportJsonData } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import { type AwesomeTestResult } from "types";
|
|
4
|
+
import { type StoreSignalState } from "./types";
|
|
5
|
+
|
|
6
|
+
export type TestResultsStoreState = Record<string, AwesomeTestResult>;
|
|
7
|
+
|
|
8
|
+
export type TestResultNavStoreState = string[];
|
|
9
|
+
|
|
10
|
+
export const testResultStore = signal<StoreSignalState<TestResultsStoreState>>({
|
|
11
|
+
loading: true,
|
|
12
|
+
error: undefined,
|
|
13
|
+
data: undefined,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const testResultNavStore = signal<StoreSignalState<TestResultNavStoreState>>({
|
|
17
|
+
loading: true,
|
|
18
|
+
error: undefined,
|
|
19
|
+
data: undefined,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const fetchTestResultNav = async () => {
|
|
23
|
+
try {
|
|
24
|
+
const data = await fetchReportJsonData<string[]>("widgets/nav.json");
|
|
25
|
+
|
|
26
|
+
testResultNavStore.value = {
|
|
27
|
+
data,
|
|
28
|
+
error: undefined,
|
|
29
|
+
loading: false,
|
|
30
|
+
};
|
|
31
|
+
} catch (err) {
|
|
32
|
+
testResultNavStore.value = {
|
|
33
|
+
...testResultNavStore.value,
|
|
34
|
+
error: err.message,
|
|
35
|
+
loading: false,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const fetchTestResult = async (testResultId: string) => {
|
|
41
|
+
if (!testResultId) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
testResultStore.value = {
|
|
46
|
+
...testResultStore.value,
|
|
47
|
+
loading: true,
|
|
48
|
+
error: undefined,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const data = await fetchReportJsonData<AwesomeTestResult>(`data/test-results/${testResultId}.json`);
|
|
53
|
+
|
|
54
|
+
testResultStore.value = {
|
|
55
|
+
data: { ...testResultStore.value.data, [testResultId]: data },
|
|
56
|
+
error: undefined,
|
|
57
|
+
loading: false,
|
|
58
|
+
};
|
|
59
|
+
} catch (err) {
|
|
60
|
+
testResultStore.value = {
|
|
61
|
+
...testResultStore.value,
|
|
62
|
+
error: err.message,
|
|
63
|
+
loading: false,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getReportOptions } from "@allurereport/web-commons";
|
|
2
|
+
import { signal } from "@preact/signals";
|
|
3
|
+
import type { AwesomeReportOptions } from "../../types.js";
|
|
4
|
+
|
|
5
|
+
type Theme = "light" | "dark";
|
|
6
|
+
|
|
7
|
+
const { theme } = getReportOptions<AwesomeReportOptions>() ?? {};
|
|
8
|
+
|
|
9
|
+
export const themeStore = signal<Theme>("light");
|
|
10
|
+
|
|
11
|
+
export const setTheme = (newTheme: Theme): void => {
|
|
12
|
+
themeStore.value = newTheme;
|
|
13
|
+
document.documentElement.setAttribute("data-theme", newTheme);
|
|
14
|
+
window.localStorage.setItem("theme", newTheme);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const toggleTheme = () => {
|
|
18
|
+
setTheme(themeStore.value === "light" ? "dark" : "light");
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getTheme = () => {
|
|
22
|
+
const themeFromLS = (window.localStorage.getItem("theme") as Theme | null) || (theme as Theme);
|
|
23
|
+
|
|
24
|
+
if (themeFromLS) {
|
|
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);
|
|
33
|
+
};
|