@syngrisi/syngrisi 2.2.1
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/.nvmrc +1 -0
- package/LICENSE.md +9 -0
- package/README.md +139 -0
- package/config.js +17 -0
- package/dist/config.js +16 -0
- package/dist/src/server/models/index.js +508 -0
- package/dist/src/server/models/plugins/index.js +4 -0
- package/dist/src/server/models/plugins/paginate.plugin.js +76 -0
- package/dist/src/server/models/plugins/paginateDistinct.plugin.js +76 -0
- package/dist/src/server/models/plugins/toJSON.plugin.js +39 -0
- package/dist/src/server/schemas/createCheck.shema.js +17 -0
- package/dist/src/server/schemas/getBaseline.shema.js +12 -0
- package/dist/src/server/utils/paramsGuard.js +18 -0
- package/dist/src/tasks/backup.js +68 -0
- package/dist/src/tasks/lib/common.js +14 -0
- package/dist/src/tasks/lib/utils.js +14 -0
- package/dist/src/tasks/migrations/2.0.migration.js +86 -0
- package/dist/src/tasks/migrations/2.0.migration_mql.js +57 -0
- package/dist/src/tasks/reindex.js +28 -0
- package/dist/src/tasks/restore.js +86 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docker-compose.yml +70 -0
- package/mvc/views/react/admin/index.html +22 -0
- package/mvc/views/react/assets/LogicalGroup.95929360.js +15993 -0
- package/mvc/views/react/assets/PasswordInput.8a73fdd2.js +299 -0
- package/mvc/views/react/assets/admin.94703bdc.js +14448 -0
- package/mvc/views/react/assets/auth.748478ef.js +673 -0
- package/mvc/views/react/assets/bg_2_0_dark_L2.3a31edc0.png +0 -0
- package/mvc/views/react/assets/favicon.bf5828d5.svg +7 -0
- package/mvc/views/react/assets/index.a5606313.css +23 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.0f303f31.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.34e9582c.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.9ce7f3ac.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.b0195382.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.e0fd57c0.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.f5aebdfe.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f2abf7fb.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f6734f81.woff2 +0 -0
- package/mvc/views/react/assets/root.136e0ea3.js +25451 -0
- package/mvc/views/react/assets/use-form.57ebe175.js +24472 -0
- package/mvc/views/react/assets/use-form.ecb4391b.css +36 -0
- package/mvc/views/react/auth/index.html +22 -0
- package/mvc/views/react/index.html +19 -0
- package/mvc/views/react/index2/index.html +21 -0
- package/package.json +144 -0
- package/server.js +166 -0
- package/src/server/controllers/app.controller.js +21 -0
- package/src/server/controllers/auth.controller.js +156 -0
- package/src/server/controllers/baseline.controller.js +24 -0
- package/src/server/controllers/check.controller.js +56 -0
- package/src/server/controllers/client.controller.js +173 -0
- package/src/server/controllers/index.js +12 -0
- package/src/server/controllers/logs.controller.js +30 -0
- package/src/server/controllers/runs.controller.js +25 -0
- package/src/server/controllers/settings.controller.js +23 -0
- package/src/server/controllers/snapshots.controller.js +17 -0
- package/src/server/controllers/suite.controller.js +24 -0
- package/src/server/controllers/tasks.controller.js +47 -0
- package/src/server/controllers/test.controller.js +70 -0
- package/src/server/controllers/users.controller.js +79 -0
- package/src/server/data/custom_devices.json +8 -0
- package/src/server/data/devices.json +773 -0
- package/src/server/data/get_devices.sh +2 -0
- package/src/server/lib/AppSettings.js +56 -0
- package/src/server/lib/admin.json +9 -0
- package/src/server/lib/comparator.js +147 -0
- package/src/server/lib/compareImagesNode.js +60 -0
- package/src/server/lib/dbItems.js +215 -0
- package/src/server/lib/ensureLogin/ensureLoggedIn.js +223 -0
- package/src/server/lib/ensureLogin/ensureLoggedOut.js +44 -0
- package/src/server/lib/getElementsByPixPositionsFromDump.js +72 -0
- package/src/server/lib/guest.json +9 -0
- package/src/server/lib/initialAppSettings.json +18 -0
- package/src/server/lib/logger.js +95 -0
- package/src/server/lib/onStart.js +53 -0
- package/src/server/lib/parseDiff.js.bak +72 -0
- package/src/server/lib/testAdmin.json +9 -0
- package/src/server/lib/testUsers.json +41 -0
- package/src/server/middlewares/authorization.js +50 -0
- package/src/server/middlewares/disableCors.js +19 -0
- package/src/server/models/index.js +534 -0
- package/src/server/models/plugins/index.js +3 -0
- package/src/server/models/plugins/paginate.plugin.js +83 -0
- package/src/server/models/plugins/paginateDistinct.plugin.js +80 -0
- package/src/server/models/plugins/toJSON.plugin.js +44 -0
- package/src/server/routes/ui/admin.js +20 -0
- package/src/server/routes/ui/auth.js +15 -0
- package/src/server/routes/ui/index.js +19 -0
- package/src/server/routes/v1/app.route.js +9 -0
- package/src/server/routes/v1/auth.route.js +12 -0
- package/src/server/routes/v1/baselines.route.js +14 -0
- package/src/server/routes/v1/checks.route.js +25 -0
- package/src/server/routes/v1/client.route.js +39 -0
- package/src/server/routes/v1/index.js +82 -0
- package/src/server/routes/v1/logs.route.js +16 -0
- package/src/server/routes/v1/runs.route.js +15 -0
- package/src/server/routes/v1/settings.route.js +23 -0
- package/src/server/routes/v1/snapshots.route.js +11 -0
- package/src/server/routes/v1/suites.route.js +15 -0
- package/src/server/routes/v1/tasks.route.js +59 -0
- package/src/server/routes/v1/test.route.js +20 -0
- package/src/server/routes/v1/test_distinct.route.js +14 -0
- package/src/server/routes/v1/users.route.js +36 -0
- package/src/server/schemas/createCheck.shema.ts +17 -0
- package/src/server/schemas/getBaseline.shema.ts +12 -0
- package/src/server/services/app.service.js +23 -0
- package/src/server/services/check.service.js +178 -0
- package/src/server/services/client.service.js +648 -0
- package/src/server/services/generic.service.js +51 -0
- package/src/server/services/index.js +12 -0
- package/src/server/services/logs.service.js +38 -0
- package/src/server/services/run.service.js +40 -0
- package/src/server/services/suite.service.js +39 -0
- package/src/server/services/tasks.service.js +536 -0
- package/src/server/services/test.service.js +72 -0
- package/src/server/services/user.service.js +128 -0
- package/src/server/utils/ApiError.js +14 -0
- package/src/server/utils/catchAsync.js +8 -0
- package/src/server/utils/check.js +58 -0
- package/src/server/utils/dateToISO8601.js +2 -0
- package/src/server/utils/deserializeIfJSON.js +9 -0
- package/src/server/utils/formatISOToDateTime.js +6 -0
- package/src/server/utils/index.js +10 -0
- package/src/server/utils/isJSON.js +6 -0
- package/src/server/utils/paramsGuard.ts +15 -0
- package/src/server/utils/pick.js +15 -0
- package/src/server/utils/prettyCheckParams.js +13 -0
- package/src/server/utils/snapshots.js +73 -0
- package/src/server/utils/subDays.js +7 -0
- package/src/server/utils/tests.js +36 -0
- package/src/server/utils/utils.js +146 -0
- package/src/tasks/backup.js.bak +84 -0
- package/src/tasks/backup.ts +53 -0
- package/src/tasks/lib/common.js +24 -0
- package/src/tasks/lib/utils.js +15 -0
- package/src/tasks/migrations/2.0.migration.js +86 -0
- package/src/tasks/migrations/2.0.migration.ts +95 -0
- package/src/tasks/migrations/2.0.migration_mql.js +63 -0
- package/src/tasks/reindex.js +36 -0
- package/src/tasks/restore.js.bak +100 -0
- package/src/tasks/restore.ts +75 -0
- package/src/ui-app/.eslintrc.json +119 -0
- package/src/ui-app/README.md +15 -0
- package/src/ui-app/admin/AdminLayout.tsx +38 -0
- package/src/ui-app/admin/App.tsx +108 -0
- package/src/ui-app/admin/AppContext.ts +3 -0
- package/src/ui-app/admin/components/Header/AdminHeader.tsx +148 -0
- package/src/ui-app/admin/components/Logs/AdminLogs.tsx +142 -0
- package/src/ui-app/admin/components/Logs/RefreshActionIcon.tsx +60 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTable.tsx +81 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableFilter.tsx +170 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableHeads.tsx +50 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableRows.tsx +207 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableSettings.tsx +95 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeleton.tsx +77 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeletonFIller.tsx +57 -0
- package/src/ui-app/admin/components/Logs/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsCreateStyle.tsx +36 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsTableColumns.ts +52 -0
- package/src/ui-app/admin/components/Logs/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/admin/components/Navbar/AdminNavbar.tsx +50 -0
- package/src/ui-app/admin/components/Navbar/NavbarLinksGroup.tsx +104 -0
- package/src/ui-app/admin/components/Settings/AdminSettings.tsx +51 -0
- package/src/ui-app/admin/components/Settings/Forms/Boolean.tsx +59 -0
- package/src/ui-app/admin/components/Settings/Forms/FormWrapper.tsx +45 -0
- package/src/ui-app/admin/components/Settings/Forms/index.tsx +5 -0
- package/src/ui-app/admin/components/Settings/Forms/interfaces.tsx +17 -0
- package/src/ui-app/admin/components/Tasks/Task.tsx +138 -0
- package/src/ui-app/admin/components/Tasks/TaskWrapper.tsx +11 -0
- package/src/ui-app/admin/components/Tasks/tasksList.ts +59 -0
- package/src/ui-app/admin/components/Users/AdminUsers.tsx +182 -0
- package/src/ui-app/admin/components/Users/UserAddForm.tsx +137 -0
- package/src/ui-app/admin/components/Users/UserForm.tsx +196 -0
- package/src/ui-app/admin/hooks/useParams.tsx +18 -0
- package/src/ui-app/admin/index.html +17 -0
- package/src/ui-app/admin/main.tsx +24 -0
- package/src/ui-app/asserts/css/auth/index.css +23 -0
- package/src/ui-app/asserts/css/styles.css +36 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.svg +313 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.svg +305 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.svg +309 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.svg +308 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff2 +0 -0
- package/src/ui-app/asserts/images/background.jpg +0 -0
- package/src/ui-app/asserts/images/bg_2_0_dark_L2.png +0 -0
- package/src/ui-app/asserts/images/favicon.svg +7 -0
- package/src/ui-app/auth/App.tsx +82 -0
- package/src/ui-app/auth/commonStyles.tsx +26 -0
- package/src/ui-app/auth/components/AuthFooter.tsx +51 -0
- package/src/ui-app/auth/components/AuthLogo.tsx +58 -0
- package/src/ui-app/auth/components/ChangePasswordForm.tsx +216 -0
- package/src/ui-app/auth/components/ChangePasswordSuccessForm.tsx +38 -0
- package/src/ui-app/auth/components/LoginForm.tsx +148 -0
- package/src/ui-app/auth/components/LogoutForm.tsx +89 -0
- package/src/ui-app/auth/components/ToggleThemeButton.tsx +41 -0
- package/src/ui-app/auth/components/change-password/Bars.tsx +45 -0
- package/src/ui-app/auth/components/change-password/PasswordRequirement.tsx +14 -0
- package/src/ui-app/auth/components/change-password/requirements.tsx +6 -0
- package/src/ui-app/auth/index.html +17 -0
- package/src/ui-app/auth/main.tsx +12 -0
- package/src/ui-app/auth/routes.tsx +26 -0
- package/src/ui-app/config.ts +15 -0
- package/src/ui-app/index.html +12 -0
- package/src/ui-app/index2/App.tsx +162 -0
- package/src/ui-app/index2/AppContext.ts +3 -0
- package/src/ui-app/index2/IndexLayout.tsx +34 -0
- package/src/ui-app/index2/components/Header/HeaderIndex.tsx +248 -0
- package/src/ui-app/index2/components/Header/QuickFilter.tsx +312 -0
- package/src/ui-app/index2/components/Navbar/Items/AcceptStatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/BaseItemWrapper.tsx +94 -0
- package/src/ui-app/index2/components/Navbar/Items/BrowserItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/PlatformItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemModalAsk.tsx +71 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemPopover.tsx +58 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveSuiteModalAsk.tsx +61 -0
- package/src/ui-app/index2/components/Navbar/Items/RunItem.tsx +149 -0
- package/src/ui-app/index2/components/Navbar/Items/StatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/SuiteItem.tsx +109 -0
- package/src/ui-app/index2/components/Navbar/Items/index.tsx +6 -0
- package/src/ui-app/index2/components/Navbar/NavbarFilter.tsx +93 -0
- package/src/ui-app/index2/components/Navbar/NavbarGroupBySelect.tsx +83 -0
- package/src/ui-app/index2/components/Navbar/NavbarIndex.tsx +247 -0
- package/src/ui-app/index2/components/Navbar/NavbarItems.tsx +38 -0
- package/src/ui-app/index2/components/Navbar/NavbarSort.tsx +105 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/RunsDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SimpleDummySkeleton.tsx +23 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SkeletonWrapper.tsx +45 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SuitesDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestModalAsk.tsx +68 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestsButton.tsx +44 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Branch.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserName.tsx +33 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserVersion.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/CellWrapper.tsx +49 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Os.tsx +32 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/StartDate.tsx +34 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Status.tsx +50 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/ViewPort.tsx +46 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/AcceptButton.tsx +142 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Check.tsx +281 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/Canvas.tsx +36 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/helpers.ts +72 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts +495 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/sideToSideView.ts +398 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/simpleView.ts +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx +237 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Header.tsx +221 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckItem.tsx +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckSort.tsx +81 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecks.tsx +197 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksItems.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksSkeleton.tsx +37 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/HighlightButton.tsx +56 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/RegionsToolbar.tsx +150 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ScreenshotDetails.tsx +137 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/Toolbar.tsx +101 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ViewSegmentedControl.tsx +159 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ZoomToolbar.tsx +326 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/highlightDiff.ts +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/hooks/useRelatedChecks.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckModal.tsx +119 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Checks.tsx +91 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ChecksSkeleton.tsx +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/PreviewCheckTooltipLabel.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/RemoveButton.tsx +63 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ViewPortLabel.tsx +94 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/checkSizes.ts +27 -0
- package/src/ui-app/index2/components/Tests/Table/Filter.tsx +179 -0
- package/src/ui-app/index2/components/Tests/Table/Heads.tsx +54 -0
- package/src/ui-app/index2/components/Tests/Table/InfinityScrollSkeleton.tsx +71 -0
- package/src/ui-app/index2/components/Tests/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/index2/components/Tests/Table/RefreshActionIcon.tsx +65 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestModalAsk.tsx +66 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestsButton.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Row.tsx +128 -0
- package/src/ui-app/index2/components/Tests/Table/Rows.tsx +87 -0
- package/src/ui-app/index2/components/Tests/Table/Settings.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/TestsTable.tsx +140 -0
- package/src/ui-app/index2/components/Tests/Table/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/index2/components/Tests/Table/tableColumns.ts +80 -0
- package/src/ui-app/index2/components/Tests/Table/testsCreateStyle.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Tests.tsx +157 -0
- package/src/ui-app/index2/hooks/useIndexSubpageEffect.tsx +14 -0
- package/src/ui-app/index2/hooks/useNavbarActiveItems.tsx +66 -0
- package/src/ui-app/index2/hooks/useParams.tsx +25 -0
- package/src/ui-app/index2/index.html +17 -0
- package/src/ui-app/index2/main.tsx +33 -0
- package/src/ui-app/package-lock.json +6150 -0
- package/src/ui-app/package.json +58 -0
- package/src/ui-app/shared/components/ActionPopoverIcon.tsx +116 -0
- package/src/ui-app/shared/components/Check/AcceptedStatusIcon.tsx +51 -0
- package/src/ui-app/shared/components/Check/BrowserIcon.tsx +50 -0
- package/src/ui-app/shared/components/Check/OsIcon.tsx +73 -0
- package/src/ui-app/shared/components/Check/Status.tsx +37 -0
- package/src/ui-app/shared/components/Check/StatusIcon.tsx +66 -0
- package/src/ui-app/shared/components/Email.tsx +83 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalAsk.tsx +31 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalResult.tsx +89 -0
- package/src/ui-app/shared/components/Header/HeaderLogo.tsx +82 -0
- package/src/ui-app/shared/components/Header/UserInfoModal.tsx +92 -0
- package/src/ui-app/shared/components/Header/UserMenu.tsx +151 -0
- package/src/ui-app/shared/components/Password.tsx +95 -0
- package/src/ui-app/shared/components/RelativeDrawer.tsx +43 -0
- package/src/ui-app/shared/components/SafeSelect.tsx +95 -0
- package/src/ui-app/shared/components/Tests/StatusesRing.tsx +66 -0
- package/src/ui-app/shared/components/ToggleThemeButton.tsx +33 -0
- package/src/ui-app/shared/components/Users/LabelUser.tsx +60 -0
- package/src/ui-app/shared/components/errors/ErrorFallback.tsx +66 -0
- package/src/ui-app/shared/components/filter/AcceptedFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/BrowserNameFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/CommonDistinctFilter.tsx +104 -0
- package/src/ui-app/shared/components/filter/DateFilter.tsx +54 -0
- package/src/ui-app/shared/components/filter/FilterWrapper.tsx +80 -0
- package/src/ui-app/shared/components/filter/IdFilter.tsx +60 -0
- package/src/ui-app/shared/components/filter/LogLevelFilter.tsx +77 -0
- package/src/ui-app/shared/components/filter/LogicalGroup.tsx +179 -0
- package/src/ui-app/shared/components/filter/OsFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StatusFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StringFilter.tsx +55 -0
- package/src/ui-app/shared/components/filter/index.ts +19 -0
- package/src/ui-app/shared/components/heaserLinks.tsx +4 -0
- package/src/ui-app/shared/hooks/index.ts +3 -0
- package/src/ui-app/shared/hooks/useColorSheme.ts +22 -0
- package/src/ui-app/shared/hooks/useDistinctLogQuery.tsx +33 -0
- package/src/ui-app/shared/hooks/useDistinctQuery.tsx +37 -0
- package/src/ui-app/shared/hooks/useInfinityScroll.tsx +163 -0
- package/src/ui-app/shared/hooks/useInfinityScrollRelatedChecks.tsx +60 -0
- package/src/ui-app/shared/hooks/useNavProgressFetchEffect.tsx +17 -0
- package/src/ui-app/shared/hooks/useSubpageEffect.tsx +28 -0
- package/src/ui-app/shared/hooks/user.hooks.ts +49 -0
- package/src/ui-app/shared/interfaces/ILog.tsx +13 -0
- package/src/ui-app/shared/interfaces/IUser.tsx +13 -0
- package/src/ui-app/shared/interfaces/logQueries.tsx +31 -0
- package/src/ui-app/shared/navigation/interfaces.tsx +7 -0
- package/src/ui-app/shared/navigation/navigationData.tsx +191 -0
- package/src/ui-app/shared/services/checks.service.ts +39 -0
- package/src/ui-app/shared/services/generic.service.ts +115 -0
- package/src/ui-app/shared/services/index.ts +6 -0
- package/src/ui-app/shared/services/runs.service.ts +20 -0
- package/src/ui-app/shared/services/suites.service.ts +20 -0
- package/src/ui-app/shared/services/tests.service.ts +39 -0
- package/src/ui-app/shared/services/users.service.ts +29 -0
- package/src/ui-app/shared/utils/Logger.ts +12 -0
- package/src/ui-app/shared/utils/SearchParams.ts +17 -0
- package/src/ui-app/shared/utils/filters.tsx +14 -0
- package/src/ui-app/shared/utils/index.ts +5 -0
- package/src/ui-app/shared/utils/utils.tsx +70 -0
- package/src/ui-app/stub.html +12 -0
- package/src/ui-app/stub.tsx +58 -0
- package/src/ui-app/stubDemoColors.tsx +47 -0
- package/src/ui-app/stubDemoNav.tsx +41 -0
- package/src/ui-app/tsconfig.json +21 -0
- package/src/ui-app/tsconfig.node.json +12 -0
- package/static/A.png +0 -0
- package/static/B.png +0 -0
- package/static/affected.html +39 -0
- package/static/affected_2.html +40 -0
- package/static/data/custom_devices.json +14 -0
- package/static/grids/desktop-higher.html +72 -0
- package/static/grids/desktop-wider.html +72 -0
- package/static/grids/desktop.html +61 -0
- package/static/grids/fit-in-view.html +62 -0
- package/static/js/canvasjs.min.js.bak +957 -0
- package/static/js/chart.js.bak +92 -0
- package/static/js/jquery-3.3.1.slim.js.bak +8269 -0
- package/static/js/jquery-3.3.1.slim.min.js.bak +2 -0
- package/static/js/moment.min.js.bak +2 -0
- package/static/low_diff_0.png +0 -0
- package/static/low_diff_1.png +0 -0
- package/static/vShift.png +0 -0
- package/static/vShift_bottom.png +0 -0
- package/static/vShift_top.png +0 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
import { fabric } from 'fabric';
|
|
3
|
+
|
|
4
|
+
// patching fabric Object transformation
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
// fabric.Object.prototype.ignoreZoom = false;
|
|
7
|
+
// fabric.Object.prototype.transform = function (ctx) {
|
|
8
|
+
//
|
|
9
|
+
// const needFullTransform = (this.group && !this.group._transformDone)
|
|
10
|
+
// || (this.group && this.canvas && ctx === this.canvas.contextTop);
|
|
11
|
+
// const m = this.calcTransformMatrix(!needFullTransform);
|
|
12
|
+
// ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
13
|
+
// // // ignore zoom start
|
|
14
|
+
// // if (this.ignoreZoom && !this.group && this.canvas) {
|
|
15
|
+
// // console.log('111')
|
|
16
|
+
// // const zoom = 1 / this.canvas.getZoom();
|
|
17
|
+
// // ctx.scale(zoom, zoom);
|
|
18
|
+
// // }
|
|
19
|
+
// // // ignore zoom end
|
|
20
|
+
// };
|
|
21
|
+
|
|
22
|
+
export class SideToSideView {
|
|
23
|
+
private mainView: any;
|
|
24
|
+
|
|
25
|
+
canvas: any;
|
|
26
|
+
|
|
27
|
+
private dividerLine: any;
|
|
28
|
+
|
|
29
|
+
private dividerSlider: any;
|
|
30
|
+
|
|
31
|
+
constructor({ mainView }: any) {
|
|
32
|
+
this.mainView = mainView;
|
|
33
|
+
this.canvas = mainView.canvas;
|
|
34
|
+
|
|
35
|
+
// event handlers, here - because need arrow function to overstate this and bind problem
|
|
36
|
+
this.zoomEventHandler = () => {
|
|
37
|
+
this.dividerLine.scaleX = (1 / this.canvas.getZoom());
|
|
38
|
+
this.dividerSlider.scaleX = (1 / this.canvas.getZoom());
|
|
39
|
+
this.dividerSlider.scaleY = (1 / this.canvas.getZoom());
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
this.canvasMouseCLickHandler = (e) => {
|
|
43
|
+
const $this = this;
|
|
44
|
+
$this.folowMouse = !$this.folowMouse;
|
|
45
|
+
$this.followCursor(e);
|
|
46
|
+
$this.divider.set({
|
|
47
|
+
hoverCursor: $this.folowMouse ? 'grab' : 'pointer',
|
|
48
|
+
});
|
|
49
|
+
if ($this.folowMouse) {
|
|
50
|
+
$this.removeLabels();
|
|
51
|
+
} else {
|
|
52
|
+
$this.renderLabels();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
this.canvasMouseMoveHandler = (e) => {
|
|
57
|
+
const $this = this;
|
|
58
|
+
if (!$this.folowMouse) return;
|
|
59
|
+
$this.followCursor(e);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
this.canvasPanHandler = (e) => {
|
|
63
|
+
const $this = this;
|
|
64
|
+
if (!$this.folowMouse) return;
|
|
65
|
+
$this.followCursor(e);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static lockCommon(object) {
|
|
70
|
+
object.set({
|
|
71
|
+
lockMovementY: true,
|
|
72
|
+
lockMovementX: true,
|
|
73
|
+
selectable: false,
|
|
74
|
+
hasControls: false,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
addZoomEvents() {
|
|
79
|
+
document.addEventListener('zoom', this.zoomEventHandler, false);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
removeZoomEvents() {
|
|
83
|
+
document.removeEventListener('zoom', this.zoomEventHandler, false);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
followCursor(e: any) {
|
|
87
|
+
const newLeft = (
|
|
88
|
+
((e.e.clientX - (this.canvasLeft + this.canvasOffsetX()))
|
|
89
|
+
/ this.canvas.getZoom())
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const newTop = (
|
|
93
|
+
e.e.clientY / this.canvas.getZoom()
|
|
94
|
+
- this.canvasOffsetY() / this.canvas.getZoom()
|
|
95
|
+
- this.canvasTop / this.canvas.getZoom()
|
|
96
|
+
- this.dividerSlider.width / 2
|
|
97
|
+
// + (48 / this.canvas.getZoom())
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// moving the object along with mouse cursor
|
|
101
|
+
this.divider.left = newLeft - (this.divider.width) / 2 + (this.dividerSlider.width / 2);
|
|
102
|
+
// (this.expectedRectClip.width * -1) + this.actualImg.getScaledWidth() / 2;
|
|
103
|
+
this.actualRectClip.left = newLeft;
|
|
104
|
+
this.expectedRectClip.left = newLeft - this.expectedRectClip.width;
|
|
105
|
+
this.divider.top = newTop - (this.dividerSlider.height / this.canvas.getZoom()) / 2;
|
|
106
|
+
this.divider.setCoords();
|
|
107
|
+
this.canvas.renderAll();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
addDividerFollowMouseEvents() {
|
|
111
|
+
this.canvas.on(
|
|
112
|
+
{
|
|
113
|
+
'mouse:down': this.canvasMouseCLickHandler,
|
|
114
|
+
'mouse:move': this.canvasMouseMoveHandler,
|
|
115
|
+
pan: this.canvasPanHandler,
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
removeDividerFollowMouseEvents() {
|
|
121
|
+
this.canvas.off('mouse:down', this.canvasMouseCLickHandler);
|
|
122
|
+
this.canvas.off('mouse:move', this.canvasMouseMoveHandler);
|
|
123
|
+
this.canvas.off('pan', this.canvasPanHandler);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
canvasOffsetX() {
|
|
127
|
+
return this.canvas.viewportTransform[4];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
canvasOffsetY() {
|
|
131
|
+
return this.canvas.viewportTransform[5];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
divider() {
|
|
135
|
+
const $this = this;
|
|
136
|
+
const dividerFillColor = '#FFFFFF';
|
|
137
|
+
const dividerStrokeColor = '#878a8c';
|
|
138
|
+
this.dividerOffset = 500000;
|
|
139
|
+
this.dividerLine = new fabric.Rect({
|
|
140
|
+
originX: 'center',
|
|
141
|
+
originY: 'top',
|
|
142
|
+
left: this.canvas.getWidth() / 2,
|
|
143
|
+
top: 0,
|
|
144
|
+
lockMovementY: true,
|
|
145
|
+
lockMovementX: true,
|
|
146
|
+
hasControls: false,
|
|
147
|
+
hasBorders: false,
|
|
148
|
+
stroke: dividerStrokeColor,
|
|
149
|
+
fill: dividerFillColor,
|
|
150
|
+
strokeWidth: 1,
|
|
151
|
+
strokeUniform: false,
|
|
152
|
+
width: 3,
|
|
153
|
+
height: this.canvas.getHeight() + this.dividerOffset,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
this.dividerSliderCircle = new fabric.Circle({
|
|
157
|
+
originX: 'center',
|
|
158
|
+
originY: 'top',
|
|
159
|
+
moveCursor: 'none',
|
|
160
|
+
hasControls: false,
|
|
161
|
+
hasBorders: false,
|
|
162
|
+
left: (this.canvas.getWidth() / 2),
|
|
163
|
+
// top: 200,
|
|
164
|
+
top: (this.canvas.getHeight() / 2) + this.dividerOffset / 2 + 24,
|
|
165
|
+
radius: 24,
|
|
166
|
+
fill: 'white',
|
|
167
|
+
stroke: dividerStrokeColor,
|
|
168
|
+
strokeUniform: false,
|
|
169
|
+
strokeWidth: 1,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
this.dividerSliderText = new fabric.Text('❮ ❯', {
|
|
173
|
+
top: (this.canvas.getHeight() / 2) + this.dividerOffset / 2 + 48,
|
|
174
|
+
left: (this.canvas.getWidth() / 2),
|
|
175
|
+
textAlign: 'left',
|
|
176
|
+
originX: 'center',
|
|
177
|
+
originY: 'center',
|
|
178
|
+
hoverCursor: 'default',
|
|
179
|
+
fill: dividerStrokeColor,
|
|
180
|
+
fontSize: 17,
|
|
181
|
+
lockMovementY: true,
|
|
182
|
+
lockMovementX: true,
|
|
183
|
+
lockScalingX: true,
|
|
184
|
+
lockScalingY: true,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
this.dividerSlider = new fabric.Group(
|
|
188
|
+
[
|
|
189
|
+
this.dividerSliderCircle,
|
|
190
|
+
this.dividerSliderText,
|
|
191
|
+
],
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
this.dividerSlider.set(
|
|
195
|
+
{
|
|
196
|
+
top: (this.canvas.getHeight() / 2) + this.dividerOffset / 2 + 48,
|
|
197
|
+
left: (this.canvas.getWidth() / 2),
|
|
198
|
+
textAlign: 'left',
|
|
199
|
+
originX: 'center',
|
|
200
|
+
originY: 'center',
|
|
201
|
+
hoverCursor: 'default',
|
|
202
|
+
fill: dividerStrokeColor,
|
|
203
|
+
fontSize: 17,
|
|
204
|
+
lockMovementY: true,
|
|
205
|
+
lockMovementX: true,
|
|
206
|
+
lockScalingX: true,
|
|
207
|
+
lockScalingY: true,
|
|
208
|
+
},
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
const divider = new fabric.Group(
|
|
212
|
+
[
|
|
213
|
+
this.dividerLine,
|
|
214
|
+
this.dividerSlider,
|
|
215
|
+
],
|
|
216
|
+
);
|
|
217
|
+
divider.set({
|
|
218
|
+
originX: 'center',
|
|
219
|
+
originY: 'center',
|
|
220
|
+
top: ((this.canvas.getHeight() / 2) / this.canvas.getZoom()) - this.canvasOffsetY() - 48,
|
|
221
|
+
name: 'divider',
|
|
222
|
+
hoverCursor: $this.folowMouse ? 'grab' : 'pointer',
|
|
223
|
+
borderColor: 'transparent',
|
|
224
|
+
hasControls: false,
|
|
225
|
+
lockScalingX: true,
|
|
226
|
+
lockScalingY: true,
|
|
227
|
+
lockMovementY: true,
|
|
228
|
+
lockMovementX: true,
|
|
229
|
+
opacity: 1,
|
|
230
|
+
});
|
|
231
|
+
return divider;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
actualRectClip() {
|
|
235
|
+
return new fabric.Rect({
|
|
236
|
+
top: this.actualImg.height * -1,
|
|
237
|
+
originX: 'left',
|
|
238
|
+
originY: 'top',
|
|
239
|
+
absolutePositioned: true,
|
|
240
|
+
lockMovementY: true,
|
|
241
|
+
lockMovementX: true,
|
|
242
|
+
objectCaching: false,
|
|
243
|
+
// opacity: 0.00001,
|
|
244
|
+
// width: 70,
|
|
245
|
+
height: this.actualImg.height * 3,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
expectedRectClip() {
|
|
250
|
+
return new fabric.Rect({
|
|
251
|
+
top: this.expectedImg.height * -1,
|
|
252
|
+
// opacity: 0.00001,
|
|
253
|
+
originX: 'left',
|
|
254
|
+
originY: 'top',
|
|
255
|
+
absolutePositioned: true,
|
|
256
|
+
lockMovementY: true,
|
|
257
|
+
lockMovementX: true,
|
|
258
|
+
objectCaching: false,
|
|
259
|
+
// width: 70,
|
|
260
|
+
height: this.expectedImg.height * 3,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
renderLabels() {
|
|
265
|
+
const style = document.createElement('style');
|
|
266
|
+
style.innerHTML = `
|
|
267
|
+
@keyframes fadeIn {
|
|
268
|
+
from {
|
|
269
|
+
opacity: 0;
|
|
270
|
+
}
|
|
271
|
+
to {
|
|
272
|
+
opacity: 0.8;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
document.head.appendChild(style);
|
|
277
|
+
|
|
278
|
+
const renderCanvasLabel = (label: string) => {
|
|
279
|
+
const canvasEl = document.getElementById('snapshoot')!;
|
|
280
|
+
const labelEl = document.createElement('div');
|
|
281
|
+
labelEl.id = `label_${label}`;
|
|
282
|
+
labelEl.style.position = 'absolute';
|
|
283
|
+
labelEl.style.fontSize = '28px';
|
|
284
|
+
labelEl.style.zIndex = '100000';
|
|
285
|
+
labelEl.style.padding = '15px';
|
|
286
|
+
labelEl.style.textAlign = 'center';
|
|
287
|
+
// labelEl.style.animation = 'fadeIn 0.5s ease-in-out forwards';
|
|
288
|
+
// labelEl.style.transition = 'opacity 0.5s ease-out';
|
|
289
|
+
labelEl.style.transition = '';
|
|
290
|
+
labelEl.style.opacity = '0.8';
|
|
291
|
+
labelEl.style.top = `${canvasEl.clientHeight / 2 - 34}px`;
|
|
292
|
+
labelEl.style.left = `${
|
|
293
|
+
(label === 'expected'
|
|
294
|
+
? canvasEl.clientWidth / 4
|
|
295
|
+
: (canvasEl.clientWidth / 4) * 3 - 50)
|
|
296
|
+
}px`;
|
|
297
|
+
labelEl.style.backgroundColor = '#373A40';
|
|
298
|
+
labelEl.style.color = 'white';
|
|
299
|
+
labelEl.innerText = label;
|
|
300
|
+
|
|
301
|
+
canvasEl.append(labelEl);
|
|
302
|
+
};
|
|
303
|
+
renderCanvasLabel('expected');
|
|
304
|
+
renderCanvasLabel('actual');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
removeLabels() {
|
|
308
|
+
const removeLabel = (label: string) => {
|
|
309
|
+
const labelEl = document.getElementById(`label_${label}`)!;
|
|
310
|
+
if (!labelEl) return;
|
|
311
|
+
// labelEl.style.animation = '';
|
|
312
|
+
labelEl.style.transition = 'opacity 0.5s ease-out';
|
|
313
|
+
labelEl.style.opacity = '0';
|
|
314
|
+
setTimeout(() => labelEl.remove(), 700);
|
|
315
|
+
};
|
|
316
|
+
removeLabel('expected');
|
|
317
|
+
removeLabel('actual');
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async render() {
|
|
321
|
+
// IMAGES
|
|
322
|
+
this.expectedImg = this.mainView.expectedImage;
|
|
323
|
+
this.expectedImg.evented = false;
|
|
324
|
+
SideToSideView.lockCommon(this.expectedImg);
|
|
325
|
+
|
|
326
|
+
// this.actualImg = await imageFromUrl(this.uriActual);
|
|
327
|
+
this.actualImg = this.mainView.actualImage;
|
|
328
|
+
this.actualImg.evented = false;
|
|
329
|
+
SideToSideView.lockCommon(this.actualImg);
|
|
330
|
+
|
|
331
|
+
this.divider = this.divider();
|
|
332
|
+
// CLIPS
|
|
333
|
+
this.actualRectClip = this.actualRectClip();
|
|
334
|
+
SideToSideView.lockCommon(this.actualRectClip);
|
|
335
|
+
this.actualImg.clipPath = this.actualRectClip;
|
|
336
|
+
|
|
337
|
+
this.expectedRectClip = this.expectedRectClip();
|
|
338
|
+
SideToSideView.lockCommon(this.expectedRectClip);
|
|
339
|
+
this.expectedImg.clipPath = this.expectedRectClip;
|
|
340
|
+
|
|
341
|
+
this.actualRectClip.width = (this.canvas.getWidth() / this.canvas.getZoom()) * 5;
|
|
342
|
+
// this.expectedRectClip.width = 500;
|
|
343
|
+
this.expectedRectClip.width = (this.canvas.getWidth() / this.canvas.getZoom()) * 5;
|
|
344
|
+
|
|
345
|
+
this.actualRectClip.left = Math.max(this.mainView.expectedImage.width, this.mainView.expectedImage.width) / 2;
|
|
346
|
+
this.expectedRectClip.left = Math.max(this.mainView.expectedImage.width, this.mainView.expectedImage.width) / 2
|
|
347
|
+
- this.expectedRectClip.width;
|
|
348
|
+
|
|
349
|
+
this.divider.left = Math.max(this.mainView.expectedImage.width, this.mainView.expectedImage.width) / 2;
|
|
350
|
+
// RENDER
|
|
351
|
+
await this.canvas.add(this.expectedImg);
|
|
352
|
+
await this.canvas.add(this.actualImg);
|
|
353
|
+
await this.canvas.add(this.divider);
|
|
354
|
+
|
|
355
|
+
this.canvasLeft = document.getElementById('snapshoot')
|
|
356
|
+
.getBoundingClientRect().x;
|
|
357
|
+
|
|
358
|
+
this.canvasTop = document.getElementById('snapshoot')
|
|
359
|
+
.getBoundingClientRect().y;
|
|
360
|
+
|
|
361
|
+
this.addZoomEvents();
|
|
362
|
+
this.addDividerFollowMouseEvents();
|
|
363
|
+
|
|
364
|
+
// workaround for not draggable (and also without the col-resize cursor) divider
|
|
365
|
+
setTimeout(() => {
|
|
366
|
+
const delta = new fabric.Point(0, 0);
|
|
367
|
+
this.canvas.relativePan(delta);
|
|
368
|
+
}, 0);
|
|
369
|
+
|
|
370
|
+
// workaround ro rescale divider
|
|
371
|
+
setTimeout(() => {
|
|
372
|
+
this.mainView.sliderView.zoomEventHandler();
|
|
373
|
+
this.mainView.canvas.renderAll();
|
|
374
|
+
}, 100);
|
|
375
|
+
this.renderLabels();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
async destroy() {
|
|
379
|
+
delete this.actualImg?.clipPath;
|
|
380
|
+
delete this.expectedImg?.clipPath;
|
|
381
|
+
|
|
382
|
+
[
|
|
383
|
+
this.actualImg,
|
|
384
|
+
this.expectedImg,
|
|
385
|
+
this.divider,
|
|
386
|
+
this.actualLabel,
|
|
387
|
+
this.expectedLabel,
|
|
388
|
+
this.actualRectClip,
|
|
389
|
+
this.expectedRectClip,
|
|
390
|
+
].forEach((item) => {
|
|
391
|
+
this.canvas.remove(item);
|
|
392
|
+
});
|
|
393
|
+
delete this.canvas.backgroundImage;
|
|
394
|
+
this.removeDividerFollowMouseEvents();
|
|
395
|
+
this.removeZoomEvents();
|
|
396
|
+
this.removeLabels();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class SimpleView {
|
|
2
|
+
constructor(mainView, type) {
|
|
3
|
+
this.mainView = mainView;
|
|
4
|
+
this.type = type;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async render() {
|
|
8
|
+
this.mainView.currentView = this.type;
|
|
9
|
+
this.mainView.canvas.add(this.mainView[`${this.type}Image`]);
|
|
10
|
+
|
|
11
|
+
this.mainView[`${this.type}Image`].sendToBack();
|
|
12
|
+
|
|
13
|
+
// await initResize(this.mainView[`${this.type}Image`], this.mainView.canvas);
|
|
14
|
+
|
|
15
|
+
// await this.mainView.panToCenter(this.mainView[`${this.type}Image`]);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
destroy() {
|
|
19
|
+
this.mainView.canvas.remove(this.mainView[`${this.type}Image`]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle,react/jsx-one-expression-per-line,prefer-arrow-callback,max-len,react/jsx-indent */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { fabric } from 'fabric';
|
|
5
|
+
import { createStyles, Group, Loader, Stack } from '@mantine/core';
|
|
6
|
+
import { useDisclosure, useDocumentTitle } from '@mantine/hooks';
|
|
7
|
+
import { useQuery } from '@tanstack/react-query';
|
|
8
|
+
import { MainView } from './Canvas/mainView';
|
|
9
|
+
import { createImageAndWaitForLoad, imageFromUrl } from './Canvas/helpers';
|
|
10
|
+
import { errorMsg } from '../../../../../../shared/utils';
|
|
11
|
+
import { GenericService } from '../../../../../../shared/services';
|
|
12
|
+
import config from '../../../../../../config';
|
|
13
|
+
import { RelatedChecks } from './RelatedChecks/RelatedChecks';
|
|
14
|
+
import { useRelatedChecks } from './hooks/useRelatedChecks';
|
|
15
|
+
import { useParams } from '../../../../../hooks/useParams';
|
|
16
|
+
import { Toolbar } from './Toolbar/Toolbar';
|
|
17
|
+
import { Header } from './Header';
|
|
18
|
+
import { Canvas } from './Canvas/Canvas';
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
const useStyles = createStyles((theme) => ({
|
|
22
|
+
zoomButtonsWrapper: {
|
|
23
|
+
'@media (max-width: 1070px)': {
|
|
24
|
+
display: 'none',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
checkPathFragment: {
|
|
28
|
+
textOverflow: 'ellipsis',
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
whiteSpace: 'nowrap',
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
interface Props {
|
|
35
|
+
initCheckData: any, // initially open check by clicking from table (not from related panel)
|
|
36
|
+
checkQuery: any,
|
|
37
|
+
closeHandler: any,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function CheckDetails({ initCheckData, checkQuery, closeHandler }: Props) {
|
|
41
|
+
useDocumentTitle(initCheckData?.name);
|
|
42
|
+
const canvasElementRef = useRef(null);
|
|
43
|
+
const { query } = useParams();
|
|
44
|
+
const { classes } = useStyles();
|
|
45
|
+
const [mainView, setMainView] = useState<MainView | null>(null);
|
|
46
|
+
|
|
47
|
+
const [relatedActiveCheckId, setRelatedActiveCheckId] = useState<string>(initCheckData._id);
|
|
48
|
+
|
|
49
|
+
const [relatedChecksOpened, relatedChecksHandler] = useDisclosure(true);
|
|
50
|
+
const related: any = useRelatedChecks(initCheckData);
|
|
51
|
+
related.opened = relatedChecksOpened;
|
|
52
|
+
related.handler = relatedChecksHandler;
|
|
53
|
+
|
|
54
|
+
related.relatedActiveCheckId = relatedActiveCheckId;
|
|
55
|
+
related.setRelatedActiveCheckId = setRelatedActiveCheckId;
|
|
56
|
+
|
|
57
|
+
const currentCheck = related.relatedFlatChecksData.find((x: any) => x._id === relatedActiveCheckId) || initCheckData;
|
|
58
|
+
|
|
59
|
+
const textLoader = <Loader size="xs" color="blue" variant="dots" />;
|
|
60
|
+
const currentCheckSafe = {
|
|
61
|
+
_id: currentCheck?._id,
|
|
62
|
+
name: currentCheck?.name || '',
|
|
63
|
+
status: currentCheck?.status || '',
|
|
64
|
+
viewport: currentCheck?.viewport || '',
|
|
65
|
+
os: currentCheck?.os || currentCheck?.os || '',
|
|
66
|
+
browserFullVersion: currentCheck?.browserFullVersion || '',
|
|
67
|
+
browserVersion: currentCheck?.browserVersion || '',
|
|
68
|
+
browserName: currentCheck?.browserName || '',
|
|
69
|
+
failReasons: currentCheck?.failReasons || '',
|
|
70
|
+
result: currentCheck?.result || '{}',
|
|
71
|
+
markedAs: currentCheck?.markedAs,
|
|
72
|
+
markedByUsername: currentCheck?.markedByUsername,
|
|
73
|
+
markedDate: currentCheck?.markedDate,
|
|
74
|
+
app: { name: currentCheck?.app?.name || textLoader },
|
|
75
|
+
suite: { name: currentCheck?.suite?.name || textLoader },
|
|
76
|
+
test: {
|
|
77
|
+
_id: currentCheck?.test?._id,
|
|
78
|
+
name: currentCheck?.test?.name || textLoader,
|
|
79
|
+
},
|
|
80
|
+
actualSnapshotId: {
|
|
81
|
+
createdDate: currentCheck?.actualSnapshotId?.createdDate,
|
|
82
|
+
_id: currentCheck?.actualSnapshotId?._id,
|
|
83
|
+
},
|
|
84
|
+
baselineId: {
|
|
85
|
+
createdDate: currentCheck?.baselineId?.createdDate,
|
|
86
|
+
_id: currentCheck?.baselineId?._id,
|
|
87
|
+
},
|
|
88
|
+
diffId: { filename: currentCheck?.diffId?.filename },
|
|
89
|
+
|
|
90
|
+
parsedResult: currentCheck?.result ? JSON.parse(currentCheck?.result) : null,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const baselineQuery = useQuery(
|
|
94
|
+
[
|
|
95
|
+
'baseline_by_snapshot_id',
|
|
96
|
+
currentCheck?.baselineId._id,
|
|
97
|
+
],
|
|
98
|
+
() => GenericService.get(
|
|
99
|
+
'baselines',
|
|
100
|
+
{ snapshootId: currentCheck?.baselineId._id },
|
|
101
|
+
{
|
|
102
|
+
populate: 'app',
|
|
103
|
+
limit: '1',
|
|
104
|
+
},
|
|
105
|
+
'baseline_by_snapshot_id',
|
|
106
|
+
),
|
|
107
|
+
{
|
|
108
|
+
enabled: true,
|
|
109
|
+
refetchOnWindowFocus: false,
|
|
110
|
+
onError: (e) => {
|
|
111
|
+
errorMsg({ error: e });
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const baselineId = useMemo<string>(() => {
|
|
117
|
+
if (baselineQuery.data?.results && baselineQuery.data?.results.length > 0) {
|
|
118
|
+
return baselineQuery.data?.results[0]._id as string;
|
|
119
|
+
}
|
|
120
|
+
return '';
|
|
121
|
+
}, [baselineQuery.data?.timestamp]);
|
|
122
|
+
|
|
123
|
+
// init mainView
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const destroyMV = async () => {
|
|
126
|
+
if (mainView) {
|
|
127
|
+
await mainView.destroyAllViews();
|
|
128
|
+
mainView.canvas.clear();
|
|
129
|
+
mainView.canvas.dispose();
|
|
130
|
+
setMainView(() => null);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const initMV = async () => {
|
|
135
|
+
// init
|
|
136
|
+
fabric.Object.prototype.objectCaching = false;
|
|
137
|
+
const expectedImgSrc = `${config.baseUri}/snapshoots/${currentCheck?.baselineId?.filename}?expectedImg`;
|
|
138
|
+
const expectedImg = await createImageAndWaitForLoad(expectedImgSrc);
|
|
139
|
+
|
|
140
|
+
const actual = currentCheck.actualSnapshotId || null;
|
|
141
|
+
const actualImgSrc = `${config.baseUri}/snapshoots/${currentCheck?.actualSnapshotId?.filename}?actualImg`;
|
|
142
|
+
const actualImg = await createImageAndWaitForLoad(actualImgSrc);
|
|
143
|
+
|
|
144
|
+
// eslint-disable-next-line max-len
|
|
145
|
+
// document.getElementById('snapshoot').style.height = `${MainView.calculateExpectedCanvasViewportAreaSize().height - 10}px`;
|
|
146
|
+
canvasElementRef.current.style.height = `${MainView.calculateExpectedCanvasViewportAreaSize().height - 10}px`;
|
|
147
|
+
|
|
148
|
+
const expectedImage = await imageFromUrl(expectedImg.src);
|
|
149
|
+
const actualImage = await imageFromUrl((actualImg).src);
|
|
150
|
+
|
|
151
|
+
const diffImgSrc = `${config.baseUri}/snapshoots/${currentCheck?.diffId?.filename}?diffImg`;
|
|
152
|
+
const diffImage = currentCheck?.diffId?.filename ? await imageFromUrl(diffImgSrc) : null;
|
|
153
|
+
|
|
154
|
+
setMainView((prev) => {
|
|
155
|
+
if (prev) return prev; // for dev mode, when components render twice
|
|
156
|
+
const MV = new MainView(
|
|
157
|
+
{
|
|
158
|
+
canvasId: '2d',
|
|
159
|
+
// canvasElementWidth: document.getElementById('snapshoot')!.clientWidth,
|
|
160
|
+
// canvasElementHeight: document.getElementById('snapshoot')!.clientHeight,
|
|
161
|
+
canvasElementWidth: canvasElementRef.current?.clientWidth,
|
|
162
|
+
canvasElementHeight: canvasElementRef.current?.clientHeight,
|
|
163
|
+
expectedImage,
|
|
164
|
+
actualImage,
|
|
165
|
+
diffImage,
|
|
166
|
+
actual,
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
window.mainView = MV;
|
|
171
|
+
return MV;
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
// set view
|
|
175
|
+
destroyMV().then(() => initMV());
|
|
176
|
+
}, [
|
|
177
|
+
relatedActiveCheckId,
|
|
178
|
+
relatedChecksOpened,
|
|
179
|
+
query.checkId,
|
|
180
|
+
]);
|
|
181
|
+
|
|
182
|
+
useEffect(function afterMainViewCreatedHandleRegions() {
|
|
183
|
+
if (!baselineId) return;
|
|
184
|
+
if (mainView) {
|
|
185
|
+
mainView.getSnapshotIgnoreRegionsDataAndDrawRegions(baselineId);
|
|
186
|
+
}
|
|
187
|
+
}, [
|
|
188
|
+
// baselineQuery.data?.timestamp,
|
|
189
|
+
mainView?.toString(),
|
|
190
|
+
// query.checkId,
|
|
191
|
+
]);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<Group style={{ width: '96vw' }} spacing={4}>
|
|
195
|
+
|
|
196
|
+
<Stack sx={{ width: '100%' }}>
|
|
197
|
+
|
|
198
|
+
{/* Header */}
|
|
199
|
+
<Header
|
|
200
|
+
classes={classes}
|
|
201
|
+
currentCheck={currentCheckSafe}
|
|
202
|
+
/>
|
|
203
|
+
{/* Toolbar */}
|
|
204
|
+
<Toolbar
|
|
205
|
+
mainView={mainView}
|
|
206
|
+
checkQuery={checkQuery}
|
|
207
|
+
curCheck={currentCheckSafe}
|
|
208
|
+
initCheckData={initCheckData}
|
|
209
|
+
classes={classes}
|
|
210
|
+
baselineId={baselineId}
|
|
211
|
+
closeHandler={closeHandler}
|
|
212
|
+
/>
|
|
213
|
+
|
|
214
|
+
<Group
|
|
215
|
+
spacing={4}
|
|
216
|
+
align="start"
|
|
217
|
+
sx={{ width: '100%' }}
|
|
218
|
+
noWrap
|
|
219
|
+
>
|
|
220
|
+
{/* Related checks */}
|
|
221
|
+
<Group
|
|
222
|
+
align="start"
|
|
223
|
+
noWrap
|
|
224
|
+
>
|
|
225
|
+
<RelatedChecks
|
|
226
|
+
currentCheck={initCheckData}
|
|
227
|
+
related={related}
|
|
228
|
+
/>
|
|
229
|
+
</Group>
|
|
230
|
+
|
|
231
|
+
{/* Canvas container */}
|
|
232
|
+
<Canvas related={related} canvasElementRef={canvasElementRef} />
|
|
233
|
+
</Group>
|
|
234
|
+
</Stack>
|
|
235
|
+
</Group>
|
|
236
|
+
);
|
|
237
|
+
}
|