@allurereport/web-dashboard 3.0.0-beta.12

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 (93) hide show
  1. package/.babelrc.js +22 -0
  2. package/.eslintrc.cjs +18 -0
  3. package/CONTRIBUTING.md +33 -0
  4. package/README.md +27 -0
  5. package/dist/multi/173.app-1ef294bc.js +1 -0
  6. package/dist/multi/174.app-1ef294bc.js +1 -0
  7. package/dist/multi/252.app-1ef294bc.js +1 -0
  8. package/dist/multi/282.app-1ef294bc.js +1 -0
  9. package/dist/multi/29.app-1ef294bc.js +1 -0
  10. package/dist/multi/416.app-1ef294bc.js +1 -0
  11. package/dist/multi/527.app-1ef294bc.js +1 -0
  12. package/dist/multi/600.app-1ef294bc.js +1 -0
  13. package/dist/multi/605.app-1ef294bc.js +1 -0
  14. package/dist/multi/638.app-1ef294bc.js +1 -0
  15. package/dist/multi/672.app-1ef294bc.js +1 -0
  16. package/dist/multi/686.app-1ef294bc.js +1 -0
  17. package/dist/multi/725.app-1ef294bc.js +1 -0
  18. package/dist/multi/741.app-1ef294bc.js +1 -0
  19. package/dist/multi/755.app-1ef294bc.js +1 -0
  20. package/dist/multi/894.app-1ef294bc.js +1 -0
  21. package/dist/multi/943.app-1ef294bc.js +1 -0
  22. package/dist/multi/980.app-1ef294bc.js +1 -0
  23. package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
  24. package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
  25. package/dist/multi/app-1ef294bc.js +2 -0
  26. package/dist/multi/app-1ef294bc.js.LICENSE.txt +15 -0
  27. package/dist/multi/manifest.json +26 -0
  28. package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
  29. package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
  30. package/dist/multi/styles-1ef294bc.css +8 -0
  31. package/dist/single/app-4b8d700b.js +2 -0
  32. package/dist/single/app-4b8d700b.js.LICENSE.txt +15 -0
  33. package/dist/single/manifest.json +3 -0
  34. package/package.json +98 -0
  35. package/postcss.config.js +5 -0
  36. package/src/assets/scss/_common.scss +143 -0
  37. package/src/assets/scss/day.scss +51 -0
  38. package/src/assets/scss/fonts.scss +3 -0
  39. package/src/assets/scss/index.scss +7 -0
  40. package/src/assets/scss/night.scss +61 -0
  41. package/src/assets/scss/palette.scss +393 -0
  42. package/src/assets/scss/theme.scss +119 -0
  43. package/src/assets/scss/vars.scss +8 -0
  44. package/src/assets/svg/line-alerts-alert-circle.svg +12 -0
  45. package/src/assets/svg/line-general-eye.svg +7 -0
  46. package/src/assets/svg/line-icon-bomb-2.svg +12 -0
  47. package/src/components/BaseLayout/index.tsx +17 -0
  48. package/src/components/BaseLayout/styles.scss +59 -0
  49. package/src/components/Dashboard/components/TrendChartWidget/index.tsx +69 -0
  50. package/src/components/Dashboard/components/Widget/index.tsx +19 -0
  51. package/src/components/Dashboard/components/Widget/styles.scss +31 -0
  52. package/src/components/Dashboard/index.tsx +75 -0
  53. package/src/components/Dashboard/styles.scss +29 -0
  54. package/src/components/Footer/FooterLogo.tsx +15 -0
  55. package/src/components/Footer/FooterVersion.tsx +37 -0
  56. package/src/components/Footer/index.tsx +13 -0
  57. package/src/components/Footer/styles.scss +14 -0
  58. package/src/components/Header/index.tsx +21 -0
  59. package/src/components/Header/styles.scss +33 -0
  60. package/src/components/MainReport/index.tsx +12 -0
  61. package/src/components/MainReport/styles.scss +6 -0
  62. package/src/index.html +39 -0
  63. package/src/index.tsx +34 -0
  64. package/src/locales/az.json +32 -0
  65. package/src/locales/de.json +32 -0
  66. package/src/locales/en.json +32 -0
  67. package/src/locales/es.json +32 -0
  68. package/src/locales/fr.json +32 -0
  69. package/src/locales/he.json +32 -0
  70. package/src/locales/hy.json +32 -0
  71. package/src/locales/it.json +32 -0
  72. package/src/locales/ja.json +32 -0
  73. package/src/locales/ka.json +32 -0
  74. package/src/locales/kr.json +32 -0
  75. package/src/locales/nl.json +32 -0
  76. package/src/locales/pl.json +32 -0
  77. package/src/locales/pt.json +32 -0
  78. package/src/locales/ru.json +32 -0
  79. package/src/locales/sv.json +32 -0
  80. package/src/locales/tr.json +32 -0
  81. package/src/locales/zh.json +32 -0
  82. package/src/stores/dashboard.ts +206 -0
  83. package/src/stores/locale.ts +75 -0
  84. package/src/stores/theme.ts +32 -0
  85. package/src/stores/types.ts +5 -0
  86. package/src/styles.scss +45 -0
  87. package/src/types/globals.d.ts +13 -0
  88. package/src/types/window.d.ts +8 -0
  89. package/src/utils/isMac.ts +8 -0
  90. package/tsconfig.json +27 -0
  91. package/types.d.ts +21 -0
  92. package/vitest.config.ts +19 -0
  93. package/webpack.config.js +112 -0
@@ -0,0 +1,32 @@
1
+ import { getReportOptions } from "@allurereport/web-commons";
2
+ import { signal } from "@preact/signals";
3
+ import type { DashboardReportOptions } from "../../types.js";
4
+
5
+ type Theme = "light" | "dark";
6
+
7
+ export const themeStore = signal<Theme>("light");
8
+
9
+ export const setTheme = (newTheme: Theme): void => {
10
+ themeStore.value = newTheme;
11
+ document.documentElement.setAttribute("data-theme", newTheme);
12
+ window.localStorage.setItem("theme", newTheme);
13
+ };
14
+
15
+ export const toggleTheme = () => {
16
+ setTheme(themeStore.value === "light" ? "dark" : "light");
17
+ };
18
+
19
+ export const getTheme = () => {
20
+ const { theme } = getReportOptions<DashboardReportOptions>() ?? {};
21
+ const themeFromLS = (window.localStorage.getItem("theme") as Theme | null) || (theme as Theme);
22
+
23
+ if (themeFromLS) {
24
+ setTheme(themeFromLS);
25
+ return;
26
+ }
27
+
28
+ const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
29
+ const initialTheme = prefersDarkScheme ? "dark" : "light";
30
+
31
+ setTheme(initialTheme);
32
+ };
@@ -0,0 +1,5 @@
1
+ export interface StoreSignalState<T> {
2
+ error?: string;
3
+ loading: boolean;
4
+ data?: T;
5
+ }
@@ -0,0 +1,45 @@
1
+ .main {
2
+ position: relative;
3
+ max-width: 1920px;
4
+ margin: 0 auto;
5
+
6
+ &:hover {
7
+ .split {
8
+ opacity: 1;
9
+ }
10
+ }
11
+ }
12
+
13
+ .split {
14
+ opacity: 0;
15
+ position: absolute;
16
+ left: 128px;
17
+ top: 8px;
18
+ }
19
+
20
+ .loader {
21
+ position: fixed;
22
+ width: 100%;
23
+ height: 100%;
24
+ top: 0;
25
+ left: 0;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ background: var(--bg-base-secondary);
30
+ background-blend-mode: saturation;
31
+ flex-direction: column;
32
+ gap: 16px;
33
+ transition:
34
+ opacity 100ms,
35
+ background-color 200ms;
36
+
37
+ visibility: hidden;
38
+ opacity: 0;
39
+
40
+ &.loading {
41
+ z-index: 10;
42
+ visibility: visible;
43
+ opacity: 1;
44
+ }
45
+ }
@@ -0,0 +1,13 @@
1
+ declare module "*.svg" {
2
+ const content: {
3
+ id: string;
4
+ };
5
+
6
+ export default content;
7
+ }
8
+
9
+ declare module "*.scss" {
10
+ const content: Record<string, string>;
11
+
12
+ export = content;
13
+ }
@@ -0,0 +1,8 @@
1
+ declare global {
2
+ interface Window {
3
+ reportDataReady: boolean;
4
+ reportData: Record<string, any>;
5
+ }
6
+ }
7
+
8
+ export {};
@@ -0,0 +1,8 @@
1
+ export const testPlatform = (re: RegExp) => {
2
+ // @ts-ignore
3
+ const platform: string = window?.navigator?.userAgentData?.platform ?? window?.navigator?.platform;
4
+
5
+ return platform ? re.test(platform) : false;
6
+ };
7
+
8
+ export const isMac = testPlatform(/^Mac/i);
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./",
4
+ "paths": {
5
+ "@/*": ["src/*"]
6
+ },
7
+ "jsx": "preserve",
8
+ "jsxFactory": "h",
9
+ "jsxFragmentFactory": "Fragment",
10
+ "jsxImportSource": "preact",
11
+ "target": "ESNext",
12
+ "module": "ESNext",
13
+ "moduleResolution": "node",
14
+ "allowSyntheticDefaultImports": true,
15
+ "useUnknownInCatchVariables": false,
16
+ "noEmit": true,
17
+ "noImplicitAny": true,
18
+ "resolveJsonModule": true,
19
+ "esModuleInterop": true,
20
+ "lib": ["ES2019", "dom"],
21
+ // node types should not be used in web-commons
22
+ "types": [],
23
+ "skipLibCheck": true
24
+ },
25
+ "include": ["src"],
26
+ "exclude": ["node_modules", "dist"]
27
+ }
package/types.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type {
2
+ AttachmentTestStepResult,
3
+ DefaultTreeGroup,
4
+ HistoryTestResult,
5
+ TestFixtureResult,
6
+ TestResult,
7
+ TestStatus,
8
+ TestStepResult,
9
+ TreeData,
10
+ WithChildren,
11
+ } from "@allurereport/core-api";
12
+
13
+ export type DashboardReportOptions = {
14
+ allureVersion: string;
15
+ reportName?: string;
16
+ logo?: string;
17
+ theme?: "light" | "dark";
18
+ reportLanguage?: "en" | "ru";
19
+ createdAt: number;
20
+ reportUuid: string;
21
+ };
@@ -0,0 +1,19 @@
1
+ import { createRequire } from "node:module";
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ const require = createRequire(import.meta.url);
5
+
6
+ export default defineConfig({
7
+ test: {
8
+ passWithNoTests: true,
9
+ include: ["./test/**/*.test.ts"],
10
+ setupFiles: [require.resolve("allure-vitest/setup")],
11
+ reporters: [
12
+ "default",
13
+ [
14
+ "allure-vitest/reporter",
15
+ { resultsDir: "./out/allure-results", globalLabels: [{ name: "module", value: "web-dashboard" }] },
16
+ ],
17
+ ],
18
+ },
19
+ });
@@ -0,0 +1,112 @@
1
+ import HtmlWebpackPlugin from "html-webpack-plugin";
2
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
3
+ import { dirname, join } from "node:path";
4
+ import { env } from "node:process";
5
+ import { fileURLToPath } from "node:url";
6
+ import SpriteLoaderPlugin from "svg-sprite-loader/plugin.js";
7
+ import webpack from "webpack";
8
+ import { WebpackManifestPlugin } from "webpack-manifest-plugin";
9
+ import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
10
+
11
+ const { SINGLE_FILE_MODE } = env;
12
+ const baseDir = dirname(fileURLToPath(import.meta.url));
13
+
14
+ export default (env, argv) => {
15
+ const devMode = argv?.mode === "development";
16
+ const config = {
17
+ entry: "./src/index.tsx",
18
+ output: {
19
+ path: join(baseDir, SINGLE_FILE_MODE ? "dist/single" : "dist/multi"),
20
+ filename: devMode ? "app.js" : "app-[hash:8].js",
21
+ assetModuleFilename: devMode ? `[name].[ext]` : `[name]-[hash:8].[ext]`,
22
+ },
23
+ devtool: devMode ? "inline-source-map" : false,
24
+ module: {
25
+ rules: [
26
+ {
27
+ test: /\.tsx?$/,
28
+ use: "babel-loader",
29
+ exclude: /node_modules/,
30
+ },
31
+ {
32
+ test: /\.css$/,
33
+ use: [SINGLE_FILE_MODE ? "style-loader" : MiniCssExtractPlugin.loader, "css-loader"],
34
+ },
35
+ {
36
+ test: /\.scss$/,
37
+ use: [
38
+ SINGLE_FILE_MODE ? "style-loader" : MiniCssExtractPlugin.loader,
39
+ {
40
+ loader: "css-loader",
41
+ options: {
42
+ modules: {
43
+ localIdentName: devMode ? "[path][name]__[local]" : "[hash:base64:8]",
44
+ },
45
+ },
46
+ },
47
+ "sass-loader",
48
+ ],
49
+ },
50
+ {
51
+ test: /\.svg$/,
52
+ loader: "svg-sprite-loader",
53
+ },
54
+ {
55
+ test: /\.(png|jpe?g|gif|woff2?|otf|ttf)$/i,
56
+ type: SINGLE_FILE_MODE ? "asset/inline" : "asset/resource",
57
+ },
58
+ ],
59
+ },
60
+ devServer: {
61
+ hot: true,
62
+ static: "./out/dev",
63
+ historyApiFallback: true,
64
+ watchFiles: ["./src"],
65
+ devMiddleware: {
66
+ index: true,
67
+ mimeTypes: { phtml: "text/html" },
68
+ serverSideRender: false,
69
+ },
70
+ },
71
+ plugins: [
72
+ new ForkTsCheckerPlugin(),
73
+ new webpack.DefinePlugin({
74
+ DEVELOPMENT: devMode,
75
+ }),
76
+ new MiniCssExtractPlugin({
77
+ filename: devMode ? "styles.css" : "styles-[hash:8].css",
78
+ }),
79
+ new SpriteLoaderPlugin(),
80
+ new WebpackManifestPlugin({
81
+ publicPath: "",
82
+ }),
83
+ ],
84
+ resolve: {
85
+ modules: ["node_modules"],
86
+ extensions: [".js", ".ts", ".tsx"],
87
+ alias: {
88
+ "@": join(baseDir, "src"),
89
+ "react": "@preact/compat",
90
+ "react-dom": "@preact/compat",
91
+ },
92
+ },
93
+ };
94
+
95
+ if (SINGLE_FILE_MODE) {
96
+ config.plugins.push(
97
+ new webpack.optimize.LimitChunkCountPlugin({
98
+ maxChunks: 1,
99
+ }),
100
+ );
101
+ }
102
+
103
+ if (devMode) {
104
+ config.plugins.push(
105
+ new HtmlWebpackPlugin({
106
+ template: "src/index.html",
107
+ }),
108
+ );
109
+ }
110
+
111
+ return config;
112
+ };