@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.
Files changed (241) hide show
  1. package/.babelrc--old.cjs +18 -0
  2. package/.babelrc.js +46 -0
  3. package/.eslintrc--old.cjs +125 -0
  4. package/.eslintrc.cjs +22 -0
  5. package/README.md +27 -0
  6. package/dist/multi/10.app-970f027d.js +1 -0
  7. package/dist/multi/222.app-970f027d.js +1 -0
  8. package/dist/multi/26.app-970f027d.js +1 -0
  9. package/dist/multi/302.app-970f027d.js +1 -0
  10. package/dist/multi/304.app-970f027d.js +1 -0
  11. package/dist/multi/369.app-970f027d.js +1 -0
  12. package/dist/multi/389.app-970f027d.js +1 -0
  13. package/dist/multi/498.app-970f027d.js +1 -0
  14. package/dist/multi/60.app-970f027d.js +1 -0
  15. package/dist/multi/643.app-970f027d.js +1 -0
  16. package/dist/multi/671.app-970f027d.js +1 -0
  17. package/dist/multi/725.app-970f027d.js +1 -0
  18. package/dist/multi/770.app-970f027d.js +1 -0
  19. package/dist/multi/848.app-970f027d.js +1 -0
  20. package/dist/multi/853.app-970f027d.js +1 -0
  21. package/dist/multi/872.app-970f027d.js +1 -0
  22. package/dist/multi/895.app-970f027d.js +1 -0
  23. package/dist/multi/920.app-970f027d.js +1 -0
  24. package/dist/multi/979.app-970f027d.js +1 -0
  25. package/dist/multi/991.app-970f027d.js +1 -0
  26. package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
  27. package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
  28. package/dist/multi/app-970f027d.js +2 -0
  29. package/dist/multi/app-970f027d.js.LICENSE.txt +25 -0
  30. package/dist/multi/manifest.json +28 -0
  31. package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
  32. package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
  33. package/dist/multi/styles-970f027d.css +283 -0
  34. package/dist/single/app-2babff54.js +2 -0
  35. package/dist/single/app-2babff54.js.LICENSE.txt +25 -0
  36. package/dist/single/manifest.json +3 -0
  37. package/package--old.json +106 -0
  38. package/package.json +107 -0
  39. package/postcss.config.js +5 -0
  40. package/src/assets/scss/_common.scss +142 -0
  41. package/src/assets/scss/code.scss +71 -0
  42. package/src/assets/scss/day.scss +51 -0
  43. package/src/assets/scss/fonts.scss +3 -0
  44. package/src/assets/scss/index.scss +9 -0
  45. package/src/assets/scss/night.scss +61 -0
  46. package/src/assets/scss/palette.scss +393 -0
  47. package/src/assets/scss/theme.scss +117 -0
  48. package/src/assets/scss/typography.scss +218 -0
  49. package/src/assets/scss/vars.scss +8 -0
  50. package/src/components/ArrowButton/index.tsx +36 -0
  51. package/src/components/ArrowButton/styles.scss +35 -0
  52. package/src/components/BaseLayout/index.tsx +23 -0
  53. package/src/components/BaseLayout/styles.scss +63 -0
  54. package/src/components/Behaviors/BehaviorsList.tsx +67 -0
  55. package/src/components/Behaviors/index.tsx +60 -0
  56. package/src/components/Behaviors/styles.scss +196 -0
  57. package/src/components/Categories/CategoriesList.tsx +67 -0
  58. package/src/components/Categories/index.tsx +60 -0
  59. package/src/components/Categories/styles.scss +196 -0
  60. package/src/components/Footer/FooterLogo.tsx +16 -0
  61. package/src/components/Footer/FooterVersion.tsx +33 -0
  62. package/src/components/Footer/index.tsx +13 -0
  63. package/src/components/Footer/styles.scss +14 -0
  64. package/src/components/Graphs/index.tsx +2 -0
  65. package/src/components/Header/index.tsx +14 -0
  66. package/src/components/Header/styles.scss +26 -0
  67. package/src/components/HeaderActions/Filters.tsx +90 -0
  68. package/src/components/HeaderActions/HeaderActions.tsx +59 -0
  69. package/src/components/HeaderActions/SortBy.tsx +128 -0
  70. package/src/components/HeaderActions/styles.scss +82 -0
  71. package/src/components/LanguagePicker/index.tsx +41 -0
  72. package/src/components/LanguagePicker/styles.scss +3 -0
  73. package/src/components/MainReport/index.tsx +19 -0
  74. package/src/components/Metadata/index.tsx +121 -0
  75. package/src/components/Metadata/styles.scss +146 -0
  76. package/src/components/MetadataButton/index.tsx +32 -0
  77. package/src/components/MetadataButton/styles.scss +53 -0
  78. package/src/components/Modal/ModalView.hbs +13 -0
  79. package/src/components/Modal/ModalView.js +43 -0
  80. package/src/components/Modal/index.tsx +174 -0
  81. package/src/components/Modal/styles.scss +126 -0
  82. package/src/components/Overview/index.tsx +9 -0
  83. package/src/components/Packages/PackagesList.tsx +67 -0
  84. package/src/components/Packages/index.tsx +59 -0
  85. package/src/components/Packages/styles.scss +196 -0
  86. package/src/components/ReportBody/Filters.tsx +92 -0
  87. package/src/components/ReportBody/HeaderActions.tsx +21 -0
  88. package/src/components/ReportBody/SortBy.tsx +132 -0
  89. package/src/components/ReportBody/context.tsx +106 -0
  90. package/src/components/ReportBody/index.tsx +71 -0
  91. package/src/components/ReportBody/styles.scss +64 -0
  92. package/src/components/ReportHeader/ReportHeaderLabelList.tsx +12 -0
  93. package/src/components/ReportHeader/ReportHeaderLogo.tsx +10 -0
  94. package/src/components/ReportHeader/ReportHeaderPie.tsx +14 -0
  95. package/src/components/ReportHeader/index.tsx +33 -0
  96. package/src/components/ReportHeader/styles.scss +49 -0
  97. package/src/components/ReportLogo/index.tsx +16 -0
  98. package/src/components/ReportLogo/styles.scss +20 -0
  99. package/src/components/ReportLogoFull/index.tsx +20 -0
  100. package/src/components/ReportLogoFull/styles.scss +7 -0
  101. package/src/components/ReportMetadata/MetadataItem.tsx +45 -0
  102. package/src/components/ReportMetadata/MetadataSummary.tsx +81 -0
  103. package/src/components/ReportMetadata/MetadataTestType.tsx +16 -0
  104. package/src/components/ReportMetadata/MetadataWithIcon.tsx +21 -0
  105. package/src/components/ReportMetadata/index.tsx +46 -0
  106. package/src/components/ReportMetadata/styles.scss +99 -0
  107. package/src/components/SideBySide/index.tsx +54 -0
  108. package/src/components/SideBySide/styles.scss +59 -0
  109. package/src/components/SideNav/SideNav.tsx +78 -0
  110. package/src/components/SideNav/SideNavView.hbs +39 -0
  111. package/src/components/SideNav/SideNavView.js +81 -0
  112. package/src/components/SideNav/styles.scss +126 -0
  113. package/src/components/Suites/index.tsx +62 -0
  114. package/src/components/Suites/styles.scss +10 -0
  115. package/src/components/Tabs/index.tsx +33 -0
  116. package/src/components/Tabs/styles.scss +56 -0
  117. package/src/components/TestResult/TestResultAttachmentsView/index.tsx +27 -0
  118. package/src/components/TestResult/TestResultAttachmentsView/styles.scss +12 -0
  119. package/src/components/TestResult/TestResultDescription/index.tsx +27 -0
  120. package/src/components/TestResult/TestResultDescription/styles.scss +12 -0
  121. package/src/components/TestResult/TestResultDropdown/index.tsx +23 -0
  122. package/src/components/TestResult/TestResultDropdown/styles.scss +34 -0
  123. package/src/components/TestResult/TestResultEmpty/index.tsx +33 -0
  124. package/src/components/TestResult/TestResultEmpty/styles.scss +25 -0
  125. package/src/components/TestResult/TestResultError/index.tsx +48 -0
  126. package/src/components/TestResult/TestResultError/styles.scss +51 -0
  127. package/src/components/TestResult/TestResultHeader/index.tsx +53 -0
  128. package/src/components/TestResult/TestResultHeader/styles.scss +43 -0
  129. package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +67 -0
  130. package/src/components/TestResult/TestResultHistory/index.tsx +26 -0
  131. package/src/components/TestResult/TestResultHistory/styles.scss +63 -0
  132. package/src/components/TestResult/TestResultInfo/TestResultInfoStatuses.tsx +30 -0
  133. package/src/components/TestResult/TestResultInfo/index.tsx +79 -0
  134. package/src/components/TestResult/TestResultInfo/styles.scss +50 -0
  135. package/src/components/TestResult/TestResultLinks/index.tsx +56 -0
  136. package/src/components/TestResult/TestResultLinks/styles.scss +30 -0
  137. package/src/components/TestResult/TestResultMetadata/index.tsx +27 -0
  138. package/src/components/TestResult/TestResultMetadata/styles.scss +8 -0
  139. package/src/components/TestResult/TestResultNavigation/index.tsx +80 -0
  140. package/src/components/TestResult/TestResultNavigation/styles.scss +48 -0
  141. package/src/components/TestResult/TestResultOverview.tsx +40 -0
  142. package/src/components/TestResult/TestResultParameters/index.tsx +30 -0
  143. package/src/components/TestResult/TestResultParameters/styles.scss +8 -0
  144. package/src/components/TestResult/TestResultPrevStatuses/index.tsx +49 -0
  145. package/src/components/TestResult/TestResultPrevStatuses/styles.scss +57 -0
  146. package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +49 -0
  147. package/src/components/TestResult/TestResultRetriesView/index.tsx +20 -0
  148. package/src/components/TestResult/TestResultRetriesView/styles.scss +69 -0
  149. package/src/components/TestResult/TestResultSetup/index.tsx +49 -0
  150. package/src/components/TestResult/TestResultSeverity/index.tsx +27 -0
  151. package/src/components/TestResult/TestResultSeverity/styles.scss +29 -0
  152. package/src/components/TestResult/TestResultStatus/index.tsx +26 -0
  153. package/src/components/TestResult/TestResultStatus/styles.scss +36 -0
  154. package/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +12 -0
  155. package/src/components/TestResult/TestResultSteps/attachment.tsx +68 -0
  156. package/src/components/TestResult/TestResultSteps/attachmentCode.tsx +20 -0
  157. package/src/components/TestResult/TestResultSteps/attachmentImage.tsx +32 -0
  158. package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +15 -0
  159. package/src/components/TestResult/TestResultSteps/index.tsx +49 -0
  160. package/src/components/TestResult/TestResultSteps/styles.scss +225 -0
  161. package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +77 -0
  162. package/src/components/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +83 -0
  163. package/src/components/TestResult/TestResultSteps/testResultStep.tsx +78 -0
  164. package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +30 -0
  165. package/src/components/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
  166. package/src/components/TestResult/TestResultTabs/index.tsx +59 -0
  167. package/src/components/TestResult/TestResultTabs/styles.scss +76 -0
  168. package/src/components/TestResult/TestResultTeardown/index.tsx +49 -0
  169. package/src/components/TestResult/TestResultView.hbs +32 -0
  170. package/src/components/TestResult/TestResultView.js +90 -0
  171. package/src/components/TestResult/index.tsx +54 -0
  172. package/src/components/TestResult/styles.scss +29 -0
  173. package/src/components/TestResultView/index.tsx +31 -0
  174. package/src/components/ThemeButton/ThemeButton.tsx +20 -0
  175. package/src/components/Timeline/index.tsx +2 -0
  176. package/src/components/Tree/Tree.tsx +76 -0
  177. package/src/components/Tree/TreeHeader.tsx +82 -0
  178. package/src/components/Tree/TreeItem.tsx +49 -0
  179. package/src/components/Tree/TreeItemIcon.tsx +32 -0
  180. package/src/components/Tree/index.tsx +60 -0
  181. package/src/components/Tree/styles.scss +185 -0
  182. package/src/favicon.ico +0 -0
  183. package/src/index.html +40 -0
  184. package/src/index.js +52 -0
  185. package/src/index.tsx +60 -0
  186. package/src/mixins.scss +128 -0
  187. package/src/rtl.scss +19 -0
  188. package/src/stores/behaviors.ts +127 -0
  189. package/src/stores/categories.ts +127 -0
  190. package/src/stores/chart.ts +32 -0
  191. package/src/stores/envInfo.ts +34 -0
  192. package/src/stores/index.ts +4 -0
  193. package/src/stores/locale.ts +83 -0
  194. package/src/stores/packages.ts +127 -0
  195. package/src/stores/router.ts +55 -0
  196. package/src/stores/stats.ts +36 -0
  197. package/src/stores/tabs.ts +7 -0
  198. package/src/stores/testResults.ts +66 -0
  199. package/src/stores/theme.ts +33 -0
  200. package/src/stores/tree.ts +127 -0
  201. package/src/stores/types.ts +5 -0
  202. package/src/styles.scss +91 -0
  203. package/src/translations/am.json +127 -0
  204. package/src/translations/az.json +127 -0
  205. package/src/translations/br.json +214 -0
  206. package/src/translations/constants.ts +124 -0
  207. package/src/translations/de.json +127 -0
  208. package/src/translations/en.json +128 -0
  209. package/src/translations/es.json +118 -0
  210. package/src/translations/fr.json +118 -0
  211. package/src/translations/he.json +118 -0
  212. package/src/translations/isv.json +216 -0
  213. package/src/translations/it.json +118 -0
  214. package/src/translations/ja.json +118 -0
  215. package/src/translations/ka.json +118 -0
  216. package/src/translations/kr.json +118 -0
  217. package/src/translations/nl.json +118 -0
  218. package/src/translations/pl.json +116 -0
  219. package/src/translations/pt.json +118 -0
  220. package/src/translations/ru.json +116 -0
  221. package/src/translations/sv.json +118 -0
  222. package/src/translations/tr.json +118 -0
  223. package/src/translations/zh.json +118 -0
  224. package/src/types/globals.d.ts +13 -0
  225. package/src/types/window.d.ts +8 -0
  226. package/src/utils/attachments.ts +156 -0
  227. package/src/utils/capitalize.ts +6 -0
  228. package/src/utils/copyToClipboard.ts +16 -0
  229. package/src/utils/isMac.ts +8 -0
  230. package/src/utils/navigate.ts +7 -0
  231. package/src/utils/statuses.js +1 -0
  232. package/src/utils/statuses.ts +55 -0
  233. package/src/utils/time.ts +17 -0
  234. package/src/utils/treeFilters.ts +139 -0
  235. package/src/variables.scss +71 -0
  236. package/test/utils/treeFilters.test.ts +448 -0
  237. package/tsconfig.json +25 -0
  238. package/types.d.ts +85 -0
  239. package/vitest.config.ts +18 -0
  240. package/webpack.config--old.js +127 -0
  241. package/webpack.config.js +108 -0
@@ -0,0 +1,92 @@
1
+ import { Button, allureIcons } from "@allurereport/web-components";
2
+ import { Menu } from "@allurereport/web-components";
3
+ import { Toggle } from "@allurereport/web-components";
4
+ import { useI18n } from "@/stores/locale";
5
+ import { setTreeFilter, treeFiltersStore } from "@/stores/tree";
6
+ import * as styles from "./styles.scss";
7
+
8
+ export const Filters = () => {
9
+ const { t } = useI18n("filters");
10
+ const { flaky, retry, new: isNew } = treeFiltersStore.value.filter;
11
+ const hasFilter = flaky || retry || isNew;
12
+
13
+ return (
14
+ <Menu
15
+ menuTrigger={({ isOpened, onClick }) => (
16
+ <div className={hasFilter && styles.filtersBtnWithFilters}>
17
+ <Button
18
+ icon={allureIcons.lineGeneralSettings1}
19
+ text={t("more-filters")}
20
+ size="m"
21
+ style="outline"
22
+ isActive={isOpened}
23
+ data-testid="filters-button"
24
+ onClick={onClick}
25
+ />
26
+ </div>
27
+ )}
28
+ >
29
+ <Menu.Section>
30
+ <Menu.Item
31
+ closeMenuOnClick={false}
32
+ ariaLabel={t("enable-filter", { filter: t("flaky") })}
33
+ onClick={() => {
34
+ setTreeFilter("flaky", !flaky);
35
+ }}
36
+ leadingIcon={allureIcons.lineGeneralZap}
37
+ rightSlot={
38
+ <div className={styles.filterToggle}>
39
+ <Toggle
40
+ focusable={false}
41
+ value={flaky}
42
+ label={t("enable-filter", { filter: t("flaky") })}
43
+ data-testid="flaky-filter"
44
+ onChange={(value) => setTreeFilter("flaky", value)}
45
+ />
46
+ </div>
47
+ }
48
+ >
49
+ {t("flaky")}
50
+ </Menu.Item>
51
+ <Menu.Item
52
+ closeMenuOnClick={false}
53
+ ariaLabel={t("enable-filter", { filter: t("retry") })}
54
+ onClick={() => setTreeFilter("retry", !retry)}
55
+ leadingIcon={allureIcons.lineArrowsRefreshCcw1}
56
+ rightSlot={
57
+ <div className={styles.filterToggle}>
58
+ <Toggle
59
+ focusable={false}
60
+ value={retry}
61
+ label={t("enable-filter", { filter: t("retry") })}
62
+ data-testid="retry-filter"
63
+ onChange={(value) => setTreeFilter("retry", value)}
64
+ />
65
+ </div>
66
+ }
67
+ >
68
+ {t("retry")}
69
+ </Menu.Item>
70
+ <Menu.Item
71
+ closeMenuOnClick={false}
72
+ ariaLabel={t("enable-filter", { filter: t("new") })}
73
+ onClick={() => setTreeFilter("new", !isNew)}
74
+ leadingIcon={allureIcons.lineAlertsNotificationBox}
75
+ rightSlot={
76
+ <div className={styles.filterToggle}>
77
+ <Toggle
78
+ focusable={false}
79
+ value={isNew}
80
+ label={t("enable-filter", { filter: t("new") })}
81
+ data-testid="new-filter"
82
+ onChange={(value) => setTreeFilter("new", value)}
83
+ />
84
+ </div>
85
+ }
86
+ >
87
+ {t("new")}
88
+ </Menu.Item>
89
+ </Menu.Section>
90
+ </Menu>
91
+ );
92
+ };
@@ -0,0 +1,21 @@
1
+ import { SearchBox } from "@allurereport/web-components";
2
+ import { useI18n } from "@/stores/locale";
3
+ import { setTreeQuery, treeFiltersStore } from "@/stores/tree";
4
+ import { Filters } from "./Filters";
5
+ import * as styles from "./styles.scss";
6
+
7
+ const Search = () => {
8
+ const { query } = treeFiltersStore.value;
9
+ const { t } = useI18n("search");
10
+
11
+ return <SearchBox placeholder={t("search-placeholder")} value={query} onChange={setTreeQuery} />;
12
+ };
13
+
14
+ export const HeaderActions = () => {
15
+ return (
16
+ <div className={styles.headerActions}>
17
+ <Search />
18
+ <Filters />
19
+ </div>
20
+ );
21
+ };
@@ -0,0 +1,132 @@
1
+ import { DropdownButton, allureIcons } from "@allurereport/web-components";
2
+ import { Link } from "@allurereport/web-components";
3
+ import { Menu } from "@allurereport/web-components";
4
+ import { SvgIcon } from "@allurereport/web-components";
5
+ import { Text } from "@allurereport/web-components";
6
+ import clsx from "clsx";
7
+ import type { ComponentChildren } from "preact";
8
+ import { useI18n } from "@/stores/locale";
9
+ import { setTreeDirection, setTreeSortBy, treeFiltersStore } from "@/stores/tree";
10
+ import * as styles from "./styles.scss";
11
+
12
+ const BtnWrapper = ({ children }: { children: ComponentChildren }) => {
13
+ return <div className={styles.sortByBtnWrap}>{children}</div>;
14
+ };
15
+
16
+ export const SortBy = () => {
17
+ const { t: sortByLocale } = useI18n("sort-by");
18
+ const { t: sortByValuesLocale } = useI18n("sort-by.values");
19
+ const { t: sortByDirectionsLocale } = useI18n("sort-by.directions");
20
+ const { sortBy, direction } = treeFiltersStore.value;
21
+
22
+ const displayedSortByValue = sortByValuesLocale(sortBy);
23
+ const displayedDirection = sortByDirectionsLocale(`${sortBy}-${direction}-short`);
24
+
25
+ return (
26
+ <div>
27
+ <Text type="paragraph" size="m" className={styles.sortByText}>
28
+ {sortByLocale("sort-by-text")}
29
+ &nbsp;
30
+ <Menu
31
+ size="l"
32
+ menuTriggerWrapper="span"
33
+ menuTrigger={({ onClick, isOpened }) => (
34
+ <Text type="paragraph" size="m">
35
+ <Link onClick={onClick}>
36
+ {displayedSortByValue} {displayedDirection}
37
+ <SvgIcon
38
+ size="s"
39
+ id={allureIcons.lineArrowsChevronDown}
40
+ className={clsx(styles.sortByIcon, isOpened && styles.sortByIconReversed)}
41
+ />
42
+ </Link>
43
+ </Text>
44
+ )}
45
+ >
46
+ <Menu.Section>
47
+ <Menu
48
+ size="s"
49
+ menuTrigger={({ onClick, isOpened }) => (
50
+ <Menu.Item
51
+ closeMenuOnClick={false}
52
+ onClick={onClick}
53
+ leadingIcon={allureIcons.lineArrowsSwitchVertical1}
54
+ rightSlot={
55
+ <BtnWrapper>
56
+ <DropdownButton
57
+ style="outline"
58
+ size="s"
59
+ isExpanded={isOpened}
60
+ text={displayedSortByValue}
61
+ focusable={false}
62
+ />
63
+ </BtnWrapper>
64
+ }
65
+ >
66
+ {sortByLocale("sort-by-category")}
67
+ </Menu.Item>
68
+ )}
69
+ >
70
+ <Menu.Section>
71
+ <Menu.ItemWithCheckmark onClick={() => setTreeSortBy("order")} isChecked={sortBy === "order"}>
72
+ {sortByValuesLocale("order")}
73
+ </Menu.ItemWithCheckmark>
74
+ <Menu.ItemWithCheckmark onClick={() => setTreeSortBy("duration")} isChecked={sortBy === "duration"}>
75
+ {sortByValuesLocale("duration")}
76
+ </Menu.ItemWithCheckmark>
77
+ <Menu.ItemWithCheckmark onClick={() => setTreeSortBy("status")} isChecked={sortBy === "status"}>
78
+ {sortByValuesLocale("status")}
79
+ </Menu.ItemWithCheckmark>
80
+ <Menu.ItemWithCheckmark onClick={() => setTreeSortBy("alphabet")} isChecked={sortBy === "alphabet"}>
81
+ {sortByValuesLocale("alphabet")}
82
+ </Menu.ItemWithCheckmark>
83
+ </Menu.Section>
84
+ </Menu>
85
+ <Menu
86
+ size="m"
87
+ menuTrigger={({ onClick, isOpened }) => (
88
+ <Menu.Item
89
+ closeMenuOnClick={false}
90
+ onClick={onClick}
91
+ leadingIcon={
92
+ direction === "asc" ? allureIcons.lineArrowsSortLineAsc : allureIcons.lineArrowsSortLineDesc
93
+ }
94
+ rightSlot={
95
+ <BtnWrapper>
96
+ <DropdownButton
97
+ style="outline"
98
+ size="s"
99
+ isExpanded={isOpened}
100
+ text={displayedDirection}
101
+ focusable={false}
102
+ />
103
+ </BtnWrapper>
104
+ }
105
+ >
106
+ {sortByLocale("direction-category")}
107
+ </Menu.Item>
108
+ )}
109
+ >
110
+ <Menu.Section>
111
+ <Menu.ItemWithCheckmark
112
+ onClick={() => setTreeDirection("asc")}
113
+ leadingIcon={allureIcons.lineArrowsSortLineAsc}
114
+ isChecked={direction === "asc"}
115
+ >
116
+ {sortByDirectionsLocale(`${sortBy}-asc`)}
117
+ </Menu.ItemWithCheckmark>
118
+ <Menu.ItemWithCheckmark
119
+ onClick={() => setTreeDirection("desc")}
120
+ leadingIcon={allureIcons.lineArrowsSortLineDesc}
121
+ isChecked={direction === "desc"}
122
+ >
123
+ {sortByDirectionsLocale(`${sortBy}-desc`)}
124
+ </Menu.ItemWithCheckmark>
125
+ </Menu.Section>
126
+ </Menu>
127
+ </Menu.Section>
128
+ </Menu>
129
+ </Text>
130
+ </div>
131
+ );
132
+ };
@@ -0,0 +1,106 @@
1
+ import { type ComponentChildren, createContext } from "preact";
2
+ import { useCallback, useContext, useReducer } from "preact/hooks";
3
+
4
+ export type SortBy = "order" | "duration" | "status" | "alphabet";
5
+ export type Direction = "asc" | "desc";
6
+ export type Filters = "flaky" | "retry" | "new";
7
+
8
+ export type ReportContentContextValue = {
9
+ query: string;
10
+ filter: Record<Filters, boolean>;
11
+ sortBy: SortBy;
12
+ direction: Direction;
13
+ setQuery: (query: string) => void;
14
+ setSortBy: (sortBy: SortBy) => void;
15
+ setDirection: (direction: Direction) => void;
16
+ setFilter: (filterKey: Filters, value: boolean) => void;
17
+ };
18
+
19
+ export const ReportContentContext = createContext<ReportContentContextValue | null>(null);
20
+
21
+ export const useReportContentContext = () => {
22
+ const context = useContext(ReportContentContext);
23
+
24
+ if (!context) {
25
+ throw new Error("useReportContentContext must be used within a ReportContentProvider");
26
+ }
27
+
28
+ return context;
29
+ };
30
+
31
+ type Actions =
32
+ | {
33
+ type: "setSortBy";
34
+ payload: SortBy;
35
+ }
36
+ | {
37
+ type: "setDirection";
38
+ payload: Direction;
39
+ }
40
+ | {
41
+ type: "setFilter";
42
+ payload: { filterKey: Filters; value: boolean };
43
+ }
44
+ | {
45
+ type: "setQuery";
46
+ payload: string;
47
+ };
48
+
49
+ type State = Omit<ReportContentContextValue, "setSortBy" | "setDirection" | "setFilter" | "setQuery">;
50
+
51
+ export const ReportContentProvider = ({ children }: { children: ComponentChildren }) => {
52
+ const [state, dispatch] = useReducer<State, Actions>(
53
+ (state, action): State => {
54
+ switch (action.type) {
55
+ case "setDirection":
56
+ return { ...state, direction: action.payload };
57
+ case "setSortBy":
58
+ return { ...state, sortBy: action.payload };
59
+ case "setFilter":
60
+ return { ...state, filter: { ...state.filter, [action.payload.filterKey]: action.payload.value } };
61
+ case "setQuery":
62
+ return { ...state, query: action.payload };
63
+ default:
64
+ return state;
65
+ }
66
+ },
67
+ {
68
+ query: "",
69
+ direction: "asc",
70
+ filter: {
71
+ flaky: false,
72
+ new: false,
73
+ retry: false,
74
+ },
75
+ sortBy: "alphabet",
76
+ },
77
+ );
78
+
79
+ const setSortBy = useCallback((sortBy: SortBy) => dispatch({ type: "setSortBy", payload: sortBy }), []);
80
+
81
+ const setDirection = useCallback(
82
+ (direction: Direction) => dispatch({ type: "setDirection", payload: direction }),
83
+ [],
84
+ );
85
+
86
+ const setFilter = useCallback(
87
+ (filterKey: Filters, value: boolean) => dispatch({ type: "setFilter", payload: { filterKey, value } }),
88
+ [],
89
+ );
90
+
91
+ const setQuery = useCallback((query: string) => dispatch({ type: "setQuery", payload: query }), []);
92
+
93
+ return (
94
+ <ReportContentContext.Provider
95
+ value={{
96
+ ...state,
97
+ setSortBy,
98
+ setDirection,
99
+ setFilter,
100
+ setQuery,
101
+ }}
102
+ >
103
+ {children}
104
+ </ReportContentContext.Provider>
105
+ );
106
+ };
@@ -0,0 +1,71 @@
1
+ import { statusesList } from "@allurereport/core-api";
2
+ import { Loadable } from "@allurereport/web-components";
3
+ import { Counter } from "@allurereport/web-components";
4
+ import { statsStore } from "@/stores";
5
+ import { useI18n } from "@/stores/locale";
6
+ import { capitalize } from "@/utils/capitalize";
7
+ import { Tab, Tabs, TabsList } from "../Tabs";
8
+ import { TreeList } from "../Tree";
9
+ import { HeaderActions } from "./HeaderActions";
10
+ import { SortBy } from "./SortBy";
11
+ import { ReportContentProvider } from "./context";
12
+ import * as styles from "./styles.scss";
13
+
14
+ const ALL_TAB = "total";
15
+
16
+ const Header = () => {
17
+ const { t } = useI18n("statuses");
18
+ return (
19
+ <header className={styles.header}>
20
+ <HeaderActions />
21
+ <div className={styles.headerRow}>
22
+ <TabsList>
23
+ <Loadable
24
+ source={statsStore}
25
+ renderData={(stats) => {
26
+ const allStatuses = statusesList
27
+ .map((status) => ({ status, value: stats[status] }))
28
+ .filter(({ value }) => value)
29
+ .map(({ status, value }) => (
30
+ <Tab data-testid={`tab-${status}`} key={status} id={status}>
31
+ {capitalize(t(status) ?? status)} <Counter count={value} size="s" status={status} />
32
+ </Tab>
33
+ ));
34
+
35
+ return (
36
+ <>
37
+ <Tab data-testid="tab-all" id={ALL_TAB}>
38
+ {capitalize(t("total"))} <Counter count={stats?.total ?? 0} size="s" />
39
+ </Tab>
40
+ {allStatuses}
41
+ </>
42
+ );
43
+ }}
44
+ />
45
+ </TabsList>
46
+ <SortBy />
47
+ </div>
48
+ </header>
49
+ );
50
+ };
51
+
52
+ const Body = () => {
53
+ return (
54
+ <div className={styles.body}>
55
+ <TreeList />
56
+ </div>
57
+ );
58
+ };
59
+
60
+ export const ReportBody = () => {
61
+ return (
62
+ <ReportContentProvider>
63
+ <section>
64
+ <Tabs initialTab="total">
65
+ <Header />
66
+ <Body />
67
+ </Tabs>
68
+ </section>
69
+ </ReportContentProvider>
70
+ );
71
+ };
@@ -0,0 +1,64 @@
1
+ .header {
2
+ padding: 24px;
3
+ padding-bottom: 0;
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: 12px;
7
+ }
8
+
9
+ .headerRow {
10
+ display: flex;
11
+ flex-direction: row;
12
+ column-gap: 8px;
13
+ row-gap: 12px;
14
+ flex-wrap: wrap;
15
+ align-items: center;
16
+ justify-content: space-between;
17
+ }
18
+
19
+ .body {
20
+ padding: 16px 24px;
21
+ }
22
+
23
+ .headerActions {
24
+ display: flex;
25
+ gap: 8px;
26
+ }
27
+
28
+ /* This is a hack because button do not have this state */
29
+ .filtersBtnWithFilters > button::after {
30
+ content: "";
31
+ background-color: var(--bg-support-aldebaran);
32
+ width: 6px;
33
+ height: 6px;
34
+ border-radius: 100px;
35
+ position: absolute;
36
+ top: 7px;
37
+ right: 3px;
38
+ }
39
+
40
+ .filterToggle {
41
+ padding-top: 2px;
42
+ }
43
+
44
+ .sortByText {
45
+ color: var(--on-text-secondary);
46
+ }
47
+
48
+ .sortByBtnWrap {
49
+ /*
50
+ Because button is 24px height it makes
51
+ menu item to be 24px height too
52
+ But design is not that
53
+ */
54
+ margin-top: -2px;
55
+ margin-bottom: -2px;
56
+ }
57
+
58
+ .sortByIcon {
59
+ transition: transform var(--interaction-transition-duration) ease-out;
60
+
61
+ &.sortByIconReversed {
62
+ transform: rotate(180deg);
63
+ }
64
+ }
@@ -0,0 +1,12 @@
1
+ import { Label } from "@allurereport/web-components";
2
+ import * as styles from "@/components/ReportHeader/styles.scss";
3
+
4
+ export const ReportHeaderLabelList = () => {
5
+ return (
6
+ <div className={styles["report-header-label-list"]}>
7
+ {["Smoke", "regression", "nightly"].map((item, key) => {
8
+ return <Label key={key}>{item}</Label>;
9
+ })}
10
+ </div>
11
+ );
12
+ };
@@ -0,0 +1,10 @@
1
+ import * as styles from "@/components/ReportHeader/styles.scss";
2
+ import { ReportLogo } from "@/components/ReportLogo";
3
+
4
+ export const ReportHeaderLogo = () => {
5
+ return (
6
+ <div className={styles["report-header-logo"]}>
7
+ <ReportLogo />
8
+ </div>
9
+ );
10
+ };
@@ -0,0 +1,14 @@
1
+ import { Loadable } from "@allurereport/web-components";
2
+ import { SuccessRatePieChart } from "@allurereport/web-components";
3
+ import { pieChartStore } from "@/stores/chart";
4
+ import * as styles from "./styles.scss";
5
+
6
+ export const ReportHeaderPie = () => (
7
+ <div className={styles["report-header-pie"]}>
8
+ <Loadable
9
+ source={pieChartStore}
10
+ renderLoader={() => null}
11
+ renderData={(chartData) => <SuccessRatePieChart slices={chartData.slices} percentage={chartData.percentage} />}
12
+ />
13
+ </div>
14
+ );
@@ -0,0 +1,33 @@
1
+ import { getReportOptions } from "@allurereport/web-commons";
2
+ import { Heading, Text } from "@allurereport/web-components";
3
+ import type { AwesomeReportOptions } from "types";
4
+ import { ReportHeaderLogo } from "@/components/ReportHeader/ReportHeaderLogo";
5
+ import { ReportHeaderPie } from "@/components/ReportHeader/ReportHeaderPie";
6
+ import { currentLocaleIso } from "@/stores";
7
+ import * as styles from "./styles.scss";
8
+
9
+ export const ReportHeader = () => {
10
+ const { reportName, createdAt } = getReportOptions<AwesomeReportOptions>() ?? {};
11
+ const formattedCreatedAt = new Date(createdAt as number).toLocaleDateString(currentLocaleIso.value as string, {
12
+ month: "long",
13
+ day: "numeric",
14
+ year: "numeric",
15
+ });
16
+
17
+ return (
18
+ <div className={styles["report-header"]}>
19
+ <div className={styles["report-wrapper"]}>
20
+ <ReportHeaderLogo />
21
+ <div className={styles["report-wrapper-text"]}>
22
+ <Heading size={"s"} tag={"h2"} className={styles["wrapper-header"]} data-testid="report-title">
23
+ {reportName}
24
+ </Heading>
25
+ <Text type="paragraph" size="m" className={styles["report-date"]}>
26
+ {formattedCreatedAt}
27
+ </Text>
28
+ </div>
29
+ </div>
30
+ <ReportHeaderPie />
31
+ </div>
32
+ );
33
+ };
@@ -0,0 +1,49 @@
1
+ .report-header {
2
+ display: flex;
3
+ column-gap: 12px;
4
+ justify-content: space-between;
5
+ padding: 24px;
6
+ align-items: flex-start;
7
+ }
8
+
9
+ .report-wrapper {
10
+ display: flex;
11
+ flex-wrap: wrap;
12
+ flex-grow: 1;
13
+ }
14
+
15
+ .report-wrapper-text {
16
+ flex-grow: 1;
17
+ margin-bottom: 16px;
18
+ }
19
+
20
+ .report-date {
21
+ color: var(--on-text-secondary);
22
+ display: block;
23
+ }
24
+
25
+ .report-header-logo {
26
+ margin-right: 12px;
27
+ }
28
+
29
+ .report-header-labels {
30
+ display: flex;
31
+ }
32
+
33
+ .report-header-label-list {
34
+ display: flex;
35
+ width: 100%;
36
+ column-gap: 8px;
37
+ }
38
+
39
+ .wrapper-header {
40
+ margin-bottom: 2px;
41
+ }
42
+
43
+ .report-header-pie {
44
+ width: 88px;
45
+ }
46
+
47
+ .report-header-pie-chart {
48
+ width: 88px;
49
+ }
@@ -0,0 +1,16 @@
1
+ import { getReportOptions } from "@allurereport/web-commons";
2
+ import { SvgIcon, allureIcons } from "@allurereport/web-components";
3
+ import { clsx } from "clsx";
4
+ import type { AwesomeReportOptions } from "types";
5
+ import * as styles from "./styles.scss";
6
+
7
+ export const ReportLogo = (props: { className?: string; logo?: never }) => {
8
+ const { className } = props;
9
+ const { logo } = getReportOptions<AwesomeReportOptions>() ?? {};
10
+
11
+ return (
12
+ <div className={clsx(styles["report-logo"], className)}>
13
+ {logo ? <img src={logo} alt="report logo" /> : <SvgIcon id={allureIcons.reportLogo} inline />}
14
+ </div>
15
+ );
16
+ };
@@ -0,0 +1,20 @@
1
+ .report-logo {
2
+ padding: 8px;
3
+ background: var(--bg-base-secondary);
4
+ border-radius: 8px;
5
+ width: 48px;
6
+ height: 48px;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+
11
+ img {
12
+ width: 100%;
13
+ height: 100%;
14
+ object-fit: contain;
15
+ }
16
+ }
17
+
18
+ .text {
19
+ color: var(--on-text-primary);
20
+ }
@@ -0,0 +1,20 @@
1
+ import { SvgIcon, allureIcons } from "@allurereport/web-components";
2
+ import { Text } from "@allurereport/web-components";
3
+ import { clsx } from "clsx";
4
+ import * as styles from "./styles.scss";
5
+
6
+ export const ReportLogoFull = (props: {
7
+ /**
8
+ * Additional class name
9
+ */
10
+ className?: string;
11
+ }) => {
12
+ const { className } = props;
13
+
14
+ return (
15
+ <Text type="paragraph" size="m" bold className={clsx(className, styles.text)}>
16
+ <SvgIcon id={allureIcons.reportLogo} size="m" inline className={styles.logo} />
17
+ <span>Allure Report</span>
18
+ </Text>
19
+ );
20
+ };
@@ -0,0 +1,7 @@
1
+ .logo {
2
+ margin-right: 8px;
3
+ }
4
+
5
+ .text {
6
+ color: var(--on-text-primary);
7
+ }