@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,326 @@
|
|
|
1
|
+
/* eslint-disable prefer-arrow-callback,react/jsx-one-expression-per-line */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { ActionIcon, Button, Group, Kbd, Popover, Stack, Text, Tooltip } from '@mantine/core';
|
|
5
|
+
import { IconChevronDown, IconZoomIn, IconZoomOut } from '@tabler/icons';
|
|
6
|
+
import { useDisclosure, useHotkeys } from '@mantine/hooks';
|
|
7
|
+
import { fabric } from 'fabric';
|
|
8
|
+
import { MainView } from '../Canvas/mainView';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
view: string
|
|
12
|
+
mainView: MainView
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function ZoomToolbar(
|
|
16
|
+
{
|
|
17
|
+
view,
|
|
18
|
+
mainView,
|
|
19
|
+
}: Props,
|
|
20
|
+
) {
|
|
21
|
+
const [zoomPercent, setZoomPercent] = useState(100);
|
|
22
|
+
const [openedZoomPopover, zoomPopoverHandler] = useDisclosure(false);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Calculates the biggest expected or actual image dimension
|
|
26
|
+
* for example: expectedImage {width: 100, height: 200}, actualImage: {width: 200, height: 300}
|
|
27
|
+
* the function will return ['actualImage', 'height' ]
|
|
28
|
+
*/
|
|
29
|
+
const calculateMaxImagesDimensions = (): { imageName: string, dimension: string, value: number } => {
|
|
30
|
+
const data: any = [
|
|
31
|
+
{ imageName: 'expectedImage', dimension: 'width', value: mainView.expectedImage.width },
|
|
32
|
+
{ imageName: 'expectedImage', dimension: 'height', value: mainView.expectedImage.height },
|
|
33
|
+
{ imageName: 'actualImage', dimension: 'width', value: mainView.actualImage.width },
|
|
34
|
+
{ imageName: 'actualImage', dimension: 'height', value: mainView.actualImage.height },
|
|
35
|
+
];
|
|
36
|
+
const biggestDimensionValue = Math.max(...data.map((x: any) => x.value));
|
|
37
|
+
return data.find((x: any) => x.value === biggestDimensionValue);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const zoomByPercent = (percent: number) => {
|
|
41
|
+
if (!mainView?.canvas) return;
|
|
42
|
+
// mainView.canvas.zoomToPoint(new fabric.Point(mainView.canvas.width / 2,
|
|
43
|
+
// 30), percent / 100);
|
|
44
|
+
//
|
|
45
|
+
mainView.canvas.zoomToPoint(
|
|
46
|
+
new fabric.Point(
|
|
47
|
+
// mainView.canvas.viewportTransform[4],
|
|
48
|
+
mainView.canvas.width / 2,
|
|
49
|
+
mainView.canvas.viewportTransform[5],
|
|
50
|
+
),
|
|
51
|
+
percent / 100,
|
|
52
|
+
);
|
|
53
|
+
document.dispatchEvent(new Event('zoom'));
|
|
54
|
+
// mainView.canvas.renderAll(); console.log('render!!!');
|
|
55
|
+
setZoomPercent(() => percent);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const zoomByDelta = (delta: number) => {
|
|
59
|
+
document.dispatchEvent(new Event('zoom'));
|
|
60
|
+
let newPercent = Math.round(mainView.canvas.getZoom() * 100) + delta;
|
|
61
|
+
newPercent = newPercent < 2 ? 2 : newPercent;
|
|
62
|
+
newPercent = newPercent > 1000 ? 1000 : newPercent;
|
|
63
|
+
zoomByPercent(newPercent);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const zoomTo = (image: any, dimension: string) => {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
const ratio = mainView.canvas[dimension] / image[dimension];
|
|
69
|
+
const percent = ratio > 9 ? 900 : ratio * 100;
|
|
70
|
+
zoomByPercent(percent);
|
|
71
|
+
// mainView.canvas.renderAll(); console.log('render!!!');
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const fitImageToCanvasIfNeeded = (imageName: string) => {
|
|
75
|
+
const image = mainView[imageName as keyof MainView];
|
|
76
|
+
const greatestDimension = (image.height > image.width) ? 'height' : 'width';
|
|
77
|
+
|
|
78
|
+
const anotherDimension = (greatestDimension === 'height') ? 'width' : 'height';
|
|
79
|
+
|
|
80
|
+
zoomTo(image, greatestDimension);
|
|
81
|
+
|
|
82
|
+
if (
|
|
83
|
+
mainView[imageName as keyof MainView][anotherDimension] * mainView.canvas.getZoom()
|
|
84
|
+
> mainView.canvas[anotherDimension]!
|
|
85
|
+
) {
|
|
86
|
+
zoomTo(mainView[imageName as keyof MainView], anotherDimension);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
mainView.panToCanvasWidthCenter(imageName);
|
|
91
|
+
}, 10);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const fitImageByWith = (imageName: string) => {
|
|
95
|
+
const image = mainView[imageName as keyof MainView];
|
|
96
|
+
zoomTo(image, 'width');
|
|
97
|
+
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
mainView.panToCanvasWidthCenter(imageName);
|
|
100
|
+
}, 10);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const resizeImageIfNeeded = () => {
|
|
104
|
+
const initPan = (imageName: string) => {
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
mainView.panToCanvasWidthCenter(imageName);
|
|
107
|
+
}, 10);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const greatestImage = calculateMaxImagesDimensions();
|
|
111
|
+
// small images
|
|
112
|
+
if (mainView.canvas[greatestImage.dimension] / greatestImage.value > 7) {
|
|
113
|
+
zoomByPercent(350);
|
|
114
|
+
initPan(greatestImage.imageName);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// normal images (less than canvas)
|
|
118
|
+
if (greatestImage.value < mainView.canvas[greatestImage.dimension]) {
|
|
119
|
+
initPan(greatestImage.imageName);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// large images
|
|
124
|
+
zoomTo(mainView[greatestImage.imageName as keyof MainView], greatestImage.dimension);
|
|
125
|
+
|
|
126
|
+
const anotherDimension = (greatestImage.dimension === 'height') ? 'width' : 'height';
|
|
127
|
+
|
|
128
|
+
if (
|
|
129
|
+
(mainView[greatestImage.imageName as keyof MainView][anotherDimension] * mainView.canvas.getZoom())
|
|
130
|
+
> mainView.canvas[anotherDimension]!
|
|
131
|
+
) {
|
|
132
|
+
zoomTo(mainView[greatestImage.imageName as keyof MainView], anotherDimension);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
initPan(greatestImage.imageName);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
useEffect(function oneTime() {
|
|
139
|
+
const zoomEventHandler = () => setZoomPercent(window.mainView.canvas.getZoom() * 100);
|
|
140
|
+
document.addEventListener('zoom', zoomEventHandler, false);
|
|
141
|
+
return () => document.removeEventListener('zoom', zoomEventHandler, false);
|
|
142
|
+
}, []);
|
|
143
|
+
|
|
144
|
+
useEffect(
|
|
145
|
+
function initZoom() {
|
|
146
|
+
if (mainView) {
|
|
147
|
+
// zoomEvents();
|
|
148
|
+
resizeImageIfNeeded();
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
[mainView?.toString()],
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
useHotkeys([
|
|
155
|
+
// Zoom
|
|
156
|
+
['Equal', () => zoomByDelta(15)],
|
|
157
|
+
['NumpadAdd', () => zoomByDelta(15)],
|
|
158
|
+
['Minus', () => zoomByDelta(-15)],
|
|
159
|
+
['NumpadSubtract', () => zoomByDelta(-15)],
|
|
160
|
+
['Digit9', () => fitImageByWith(`${view}Image`)],
|
|
161
|
+
['Digit0', () => {
|
|
162
|
+
if (view === 'slider') {
|
|
163
|
+
fitImageToCanvasIfNeeded('actualImage');
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
fitImageToCanvasIfNeeded(`${view}Image`);
|
|
167
|
+
}],
|
|
168
|
+
]);
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<>
|
|
172
|
+
|
|
173
|
+
<Tooltip
|
|
174
|
+
label={
|
|
175
|
+
(
|
|
176
|
+
<Group noWrap>
|
|
177
|
+
<Text>Zoom In</Text>
|
|
178
|
+
<Kbd sx={{ fontSize: 11, borderBottomWidth: 1 }}>+</Kbd>
|
|
179
|
+
</Group>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
>
|
|
183
|
+
<ActionIcon
|
|
184
|
+
data-check="zoom-in"
|
|
185
|
+
onClick={() => zoomByDelta(15)}
|
|
186
|
+
>
|
|
187
|
+
<IconZoomIn size={24} stroke={1} />
|
|
188
|
+
</ActionIcon>
|
|
189
|
+
</Tooltip>
|
|
190
|
+
|
|
191
|
+
<Popover position="bottom" withArrow shadow="md" opened={openedZoomPopover}>
|
|
192
|
+
<Popover.Target>
|
|
193
|
+
<Group spacing={0} position="center" onClick={zoomPopoverHandler.toggle} noWrap>
|
|
194
|
+
<Text
|
|
195
|
+
size="lg"
|
|
196
|
+
weight={400}
|
|
197
|
+
sx={{ minWidth: '3em' }}
|
|
198
|
+
>
|
|
199
|
+
{Math.round(zoomPercent)}%
|
|
200
|
+
</Text>
|
|
201
|
+
<ActionIcon ml={-10} data-check="open-zoom-dropdown">
|
|
202
|
+
<IconChevronDown />
|
|
203
|
+
</ActionIcon>
|
|
204
|
+
</Group>
|
|
205
|
+
</Popover.Target>
|
|
206
|
+
<Popover.Dropdown p={0}>
|
|
207
|
+
<Stack spacing={0} data-check="zoom-dropdown">
|
|
208
|
+
<Button
|
|
209
|
+
pl={8}
|
|
210
|
+
pr={8}
|
|
211
|
+
variant="subtle"
|
|
212
|
+
onClick={() => {
|
|
213
|
+
zoomByPercent(50);
|
|
214
|
+
if (view === 'slider') {
|
|
215
|
+
mainView.panToCanvasWidthCenter('actualImage');
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
mainView.panToCanvasWidthCenter(`${view}Image`);
|
|
219
|
+
zoomPopoverHandler.close();
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
<Group position="apart" noWrap>50%</Group>
|
|
223
|
+
</Button>
|
|
224
|
+
<Button
|
|
225
|
+
pl={8}
|
|
226
|
+
pr={8}
|
|
227
|
+
variant="subtle"
|
|
228
|
+
onClick={() => {
|
|
229
|
+
zoomByPercent(100);
|
|
230
|
+
if (view === 'slider') {
|
|
231
|
+
mainView.panToCanvasWidthCenter('actualImage');
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
mainView.panToCanvasWidthCenter(`${view}Image`);
|
|
235
|
+
zoomPopoverHandler.close();
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
<Group position="apart" noWrap>100%</Group>
|
|
239
|
+
</Button>
|
|
240
|
+
<Button
|
|
241
|
+
pl={8}
|
|
242
|
+
pr={8}
|
|
243
|
+
variant="subtle"
|
|
244
|
+
onClick={() => {
|
|
245
|
+
zoomByPercent(200);
|
|
246
|
+
if (view === 'slider') {
|
|
247
|
+
mainView.panToCanvasWidthCenter('actualImage');
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
mainView.panToCanvasWidthCenter(`${view}Image`);
|
|
251
|
+
zoomPopoverHandler.close();
|
|
252
|
+
}}
|
|
253
|
+
>
|
|
254
|
+
<Group position="apart" noWrap>200%</Group>
|
|
255
|
+
</Button>
|
|
256
|
+
<Button
|
|
257
|
+
styles={{
|
|
258
|
+
label: {
|
|
259
|
+
width: '100%',
|
|
260
|
+
},
|
|
261
|
+
}}
|
|
262
|
+
// sx={{ width: '100%' }}
|
|
263
|
+
pl={8}
|
|
264
|
+
pr={8}
|
|
265
|
+
variant="subtle"
|
|
266
|
+
onClick={() => {
|
|
267
|
+
zoomPopoverHandler.close();
|
|
268
|
+
if (view === 'slider') {
|
|
269
|
+
fitImageByWith('actualImage');
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
fitImageByWith(`${view}Image`);
|
|
273
|
+
}}
|
|
274
|
+
>
|
|
275
|
+
<Group sx={{ width: '100%' }} position="apart" noWrap>
|
|
276
|
+
Fit by width <Kbd sx={{ fontSize: 11, borderBottomWidth: 1 }}>9</Kbd>
|
|
277
|
+
</Group>
|
|
278
|
+
</Button>
|
|
279
|
+
|
|
280
|
+
<Button
|
|
281
|
+
styles={{
|
|
282
|
+
label: {
|
|
283
|
+
width: '100%',
|
|
284
|
+
},
|
|
285
|
+
}}
|
|
286
|
+
pl={8}
|
|
287
|
+
pr={8}
|
|
288
|
+
variant="subtle"
|
|
289
|
+
onClick={() => {
|
|
290
|
+
zoomPopoverHandler.close();
|
|
291
|
+
|
|
292
|
+
if (view === 'slider') {
|
|
293
|
+
fitImageToCanvasIfNeeded('actualImage');
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
fitImageToCanvasIfNeeded(`${view}Image`);
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
<Group sx={{ width: '100%' }} position="apart" noWrap>
|
|
300
|
+
Fit to canvas <Kbd sx={{ fontSize: 11, borderBottomWidth: 1 }}>0</Kbd>
|
|
301
|
+
</Group>
|
|
302
|
+
</Button>
|
|
303
|
+
</Stack>
|
|
304
|
+
</Popover.Dropdown>
|
|
305
|
+
</Popover>
|
|
306
|
+
|
|
307
|
+
<Tooltip
|
|
308
|
+
label={
|
|
309
|
+
(
|
|
310
|
+
<Group noWrap>
|
|
311
|
+
<Text>Zoom out</Text>
|
|
312
|
+
<Kbd sx={{ fontSize: 11, borderBottomWidth: 1 }}>-</Kbd>
|
|
313
|
+
</Group>
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
>
|
|
317
|
+
<ActionIcon
|
|
318
|
+
data-check="zoom-out"
|
|
319
|
+
onClick={() => zoomByDelta(-15)}
|
|
320
|
+
>
|
|
321
|
+
<IconZoomOut size={24} stroke={1} />
|
|
322
|
+
</ActionIcon>
|
|
323
|
+
</Tooltip>
|
|
324
|
+
</>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { fabric } from 'fabric';
|
|
3
|
+
import { MainView } from '../Canvas/mainView';
|
|
4
|
+
|
|
5
|
+
export interface IGroup {
|
|
6
|
+
minX: number
|
|
7
|
+
maxX: number
|
|
8
|
+
minY: number
|
|
9
|
+
maxY: number
|
|
10
|
+
imageData: any,
|
|
11
|
+
members: { x: number, y: number }[],
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function getDiffImageData(image: any) {
|
|
15
|
+
const canvas = document.createElement('canvas');
|
|
16
|
+
canvas.width = image.width;
|
|
17
|
+
canvas.height = image.height;
|
|
18
|
+
|
|
19
|
+
const ctx = canvas.getContext('2d');
|
|
20
|
+
|
|
21
|
+
ctx!.drawImage(image, 0, 0);
|
|
22
|
+
|
|
23
|
+
const imgData = ctx!.getImageData(0, 0, image.width, image.height);
|
|
24
|
+
return imgData;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function highlightDiff(mainView: MainView, highlightsGroups: IGroup[] | null, imageData: any)
|
|
28
|
+
: Promise<{ groups: IGroup[], diffImageData: any }> {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
// remove highlights
|
|
31
|
+
mainView.canvas.getObjects()
|
|
32
|
+
.filter((x) => x.name === 'highlight')
|
|
33
|
+
.forEach((x) => mainView.canvas.remove(x));
|
|
34
|
+
|
|
35
|
+
// get image data
|
|
36
|
+
const urlData = mainView.diffImage.toDataURL({});
|
|
37
|
+
const img = new Image();
|
|
38
|
+
img.src = urlData;
|
|
39
|
+
|
|
40
|
+
img.onload = () => {
|
|
41
|
+
console.time('get_image_data');
|
|
42
|
+
const diffImageData = imageData || getDiffImageData(img);
|
|
43
|
+
console.timeEnd('get_image_data');
|
|
44
|
+
|
|
45
|
+
console.time('process_data');
|
|
46
|
+
|
|
47
|
+
const createNewGroup = (x: number, y: number) => ({
|
|
48
|
+
minX: x,
|
|
49
|
+
maxX: x,
|
|
50
|
+
minY: y,
|
|
51
|
+
maxY: y,
|
|
52
|
+
members: [{ x, y }],
|
|
53
|
+
});
|
|
54
|
+
// get pixel color string from flat array of image data e.g.: '255,0,255,255'(rgba)
|
|
55
|
+
// eslint-disable-next-line max-len
|
|
56
|
+
const getPixel = (x: number, y: number, curCount: number): string => diffImageData.data.slice(curCount, curCount + 4).join();
|
|
57
|
+
|
|
58
|
+
const diffColor = '255,0,255,255';
|
|
59
|
+
const groups: IGroup[] = highlightsGroups || [];
|
|
60
|
+
|
|
61
|
+
console.time('group formation');
|
|
62
|
+
if (groups.length < 1) {
|
|
63
|
+
let cursorCount = 0;
|
|
64
|
+
for (let y = 0; y < diffImageData.height; y += 1) {
|
|
65
|
+
for (let x = 0; x < diffImageData.width; x += 1) {
|
|
66
|
+
// console.log(getPixel(x, y, cursorCount), diffColor);
|
|
67
|
+
if (getPixel(x, y, cursorCount) === diffColor) {
|
|
68
|
+
const suitableGroup = groups.find((group) => x >= group.minX - 1
|
|
69
|
+
&& x <= group.maxX + 1
|
|
70
|
+
&& y >= group.minY
|
|
71
|
+
&& y <= group.maxY + 1);
|
|
72
|
+
|
|
73
|
+
if (!suitableGroup) {
|
|
74
|
+
groups.push(createNewGroup(x, y));
|
|
75
|
+
} else if (
|
|
76
|
+
getPixel(x - 1, y, cursorCount) === diffColor // left
|
|
77
|
+
|| getPixel(x - 1, y - 1, cursorCount) === diffColor // top left
|
|
78
|
+
|| getPixel(x, y - 1, cursorCount) === diffColor // top
|
|
79
|
+
|| getPixel(x + 1, y - 1, cursorCount) === diffColor // top right
|
|
80
|
+
|| getPixel(x + 1, y, cursorCount) === diffColor // right
|
|
81
|
+
|| getPixel(x + 1, y + 1, cursorCount) === diffColor // bottom right
|
|
82
|
+
|| getPixel(x, y + 1, cursorCount) === diffColor // bottom
|
|
83
|
+
|| getPixel(x - 1, y + 1, cursorCount) === diffColor // bottom left
|
|
84
|
+
) {
|
|
85
|
+
suitableGroup.members.push({ x, y });
|
|
86
|
+
if (x < suitableGroup.minX) suitableGroup.minX = x;
|
|
87
|
+
if (x > suitableGroup.maxX) suitableGroup.maxX = x;
|
|
88
|
+
if (y > suitableGroup.maxY) suitableGroup.maxY = y;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
cursorCount += 4;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
console.timeEnd('group formation');
|
|
97
|
+
|
|
98
|
+
console.time('group handling');
|
|
99
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
100
|
+
for (const group of groups) {
|
|
101
|
+
// console.log(group);
|
|
102
|
+
const top = group.minY + (group.maxY - group.minY) / 2;
|
|
103
|
+
const left = group.minX + (group.maxX - group.minX) / 2;
|
|
104
|
+
const circle = new fabric.Circle({
|
|
105
|
+
name: 'highlight',
|
|
106
|
+
originX: 'center',
|
|
107
|
+
originY: 'center',
|
|
108
|
+
left,
|
|
109
|
+
top,
|
|
110
|
+
// radius: 5,
|
|
111
|
+
data: { group },
|
|
112
|
+
fill: '#D6336C',
|
|
113
|
+
opacity: 0.3,
|
|
114
|
+
strokeWidth: 0,
|
|
115
|
+
selectable: false,
|
|
116
|
+
});
|
|
117
|
+
mainView.canvas.add(circle);
|
|
118
|
+
}
|
|
119
|
+
console.timeEnd('group handling');
|
|
120
|
+
console.timeEnd('process_data');
|
|
121
|
+
|
|
122
|
+
const highlightRemoving = () => {
|
|
123
|
+
mainView.canvas.getObjects()
|
|
124
|
+
.filter((x) => x.name === 'highlight')
|
|
125
|
+
.forEach((x) => mainView.canvas.remove(x));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// highlights animation
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
mainView.canvas.getObjects()
|
|
131
|
+
.filter((x) => x.name === 'highlight')
|
|
132
|
+
.forEach((circle) => {
|
|
133
|
+
const suitableRadius = Math.max(
|
|
134
|
+
circle.data.group.maxX - circle.data.group.minX,
|
|
135
|
+
circle.data.group.maxY - circle.data.group.minY,
|
|
136
|
+
);
|
|
137
|
+
const radius = ((suitableRadius > 25 ? suitableRadius : 25) + Math.floor(Math.random() * 10))
|
|
138
|
+
/ mainView.canvas.getZoom();
|
|
139
|
+
|
|
140
|
+
circle.animate('opacity', '0.5', {
|
|
141
|
+
onChange: mainView.canvas.renderAll.bind(mainView.canvas),
|
|
142
|
+
duration: 500,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
circle.animate('radius', String(radius), {
|
|
146
|
+
onChange: mainView.canvas.renderAll.bind(mainView.canvas),
|
|
147
|
+
duration: 500,
|
|
148
|
+
onComplete: () => {
|
|
149
|
+
circle.animate('radius', '0.00', {
|
|
150
|
+
onChange: mainView.canvas.renderAll.bind(mainView.canvas),
|
|
151
|
+
// slowHighlight - for testing purposes
|
|
152
|
+
duration: window?.slowHighlight ? 15000 : 700,
|
|
153
|
+
onComplete: highlightRemoving,
|
|
154
|
+
});
|
|
155
|
+
circle.animate('opacity', '0.30', {
|
|
156
|
+
onChange: mainView.canvas.renderAll.bind(mainView.canvas),
|
|
157
|
+
duration: window?.slowHighlight ? 3000 : 700,
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
mainView.canvas.renderAll();
|
|
163
|
+
}, 0);
|
|
164
|
+
return resolve({ groups, diffImageData });
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
}
|
package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/hooks/useRelatedChecks.tsx
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import useInfinityScrollRelatedChecks from '../../../../../../../shared/hooks/useInfinityScrollRelatedChecks';
|
|
4
|
+
import { useParams } from '../../../../../../hooks/useParams';
|
|
5
|
+
|
|
6
|
+
export function useRelatedChecks(checkData: any) {
|
|
7
|
+
const { query } = useParams();
|
|
8
|
+
const [sortBy, setSortBy] = useState('createdDate');
|
|
9
|
+
const [sortOrder, setSortOrder] = useState('desc');
|
|
10
|
+
const [relatedFilter, setRelatedFilter] = useState({});
|
|
11
|
+
|
|
12
|
+
const filterObj: any = relatedFilter;
|
|
13
|
+
|
|
14
|
+
const relatedChecksQuery = useInfinityScrollRelatedChecks(
|
|
15
|
+
{
|
|
16
|
+
resourceName: 'checks',
|
|
17
|
+
filterObj,
|
|
18
|
+
infinityScrollLimit: 10,
|
|
19
|
+
sortBy: `${sortBy}:${sortOrder}`,
|
|
20
|
+
infinityUniqueKey: [checkData._id],
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line prefer-arrow-callback
|
|
25
|
+
useEffect(function onFilterOrSortChange() {
|
|
26
|
+
if (query.app) filterObj.app = { $oid: query?.app || '' };
|
|
27
|
+
if (Object.keys(filterObj).length < 1) return;
|
|
28
|
+
relatedChecksQuery.infinityQuery.refetch();
|
|
29
|
+
}, [relatedFilter, sortBy, sortOrder, query.app]);
|
|
30
|
+
const { data } = relatedChecksQuery.infinityQuery;
|
|
31
|
+
|
|
32
|
+
const relatedFlatChecksData = data ? data.pages.flat().map((x: any) => x.results).flat() : [];
|
|
33
|
+
return {
|
|
34
|
+
sortBy,
|
|
35
|
+
setSortBy,
|
|
36
|
+
sortOrder,
|
|
37
|
+
setSortOrder,
|
|
38
|
+
relatedFlatChecksData,
|
|
39
|
+
relatedChecksQuery,
|
|
40
|
+
relatedFilter,
|
|
41
|
+
setRelatedFilter,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* eslint-disable prefer-arrow-callback,no-nested-ternary,no-underscore-dangle,react/jsx-one-expression-per-line,max-len */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
ActionIcon,
|
|
5
|
+
Group,
|
|
6
|
+
LoadingOverlay,
|
|
7
|
+
Modal,
|
|
8
|
+
Stack,
|
|
9
|
+
Text,
|
|
10
|
+
} from '@mantine/core';
|
|
11
|
+
import { useDisclosure } from '@mantine/hooks';
|
|
12
|
+
import { useEffect, useState } from 'react';
|
|
13
|
+
import { useQuery } from '@tanstack/react-query';
|
|
14
|
+
import { IconX } from '@tabler/icons';
|
|
15
|
+
import { useParams } from '../../../../hooks/useParams';
|
|
16
|
+
import { GenericService } from '../../../../../shared/services';
|
|
17
|
+
import { errorMsg } from '../../../../../shared/utils';
|
|
18
|
+
import { CheckDetails } from './CheckDetails/CheckDetails';
|
|
19
|
+
|
|
20
|
+
export function CheckModal() {
|
|
21
|
+
const { query, setQuery } = useParams();
|
|
22
|
+
const [checkModalOpened, checkModalHandlers] = useDisclosure(false);
|
|
23
|
+
|
|
24
|
+
const [initCheckId, setInitCheckId] = useState<string>('');
|
|
25
|
+
useEffect(function onCheckIdChange() {
|
|
26
|
+
if (query.checkId && query.modalIsOpen === 'true') {
|
|
27
|
+
setInitCheckId(query.checkId);
|
|
28
|
+
checkModalHandlers.open();
|
|
29
|
+
}
|
|
30
|
+
}, [query.modalIsOpen]);
|
|
31
|
+
|
|
32
|
+
const closeHandler = () => {
|
|
33
|
+
checkModalHandlers.close();
|
|
34
|
+
setQuery({ checkId: undefined });
|
|
35
|
+
setQuery({ modalIsOpen: undefined });
|
|
36
|
+
setInitCheckId('');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const checkQuery = useQuery(
|
|
40
|
+
{
|
|
41
|
+
queryKey: [
|
|
42
|
+
'check_for_modal',
|
|
43
|
+
initCheckId,
|
|
44
|
+
],
|
|
45
|
+
queryFn: () => GenericService.get(
|
|
46
|
+
'checks',
|
|
47
|
+
{ _id: initCheckId },
|
|
48
|
+
{
|
|
49
|
+
populate: 'baselineId,actualSnapshotId,diffId,test,suite,app',
|
|
50
|
+
limit: '1',
|
|
51
|
+
},
|
|
52
|
+
'initial_check_for_check_details_modal',
|
|
53
|
+
),
|
|
54
|
+
enabled: checkModalOpened,
|
|
55
|
+
refetchOnWindowFocus: false,
|
|
56
|
+
onError: (e) => {
|
|
57
|
+
errorMsg({ error: e });
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const checkData = checkQuery?.data?.results[0]!;
|
|
63
|
+
return (
|
|
64
|
+
<Modal
|
|
65
|
+
className="modal"
|
|
66
|
+
opened={checkModalOpened}
|
|
67
|
+
centered
|
|
68
|
+
size="auto"
|
|
69
|
+
onClose={closeHandler}
|
|
70
|
+
sx={{ marginTop: -25 }}
|
|
71
|
+
styles={{ title: { width: '100%', paddingRight: 35 } }}
|
|
72
|
+
withCloseButton={false}
|
|
73
|
+
>
|
|
74
|
+
{/* Close Button */}
|
|
75
|
+
<ActionIcon
|
|
76
|
+
data-test="close-check-detail-icon"
|
|
77
|
+
style={{ position: 'fixed', right: 10, top: 10 }}
|
|
78
|
+
onClick={
|
|
79
|
+
() => {
|
|
80
|
+
closeHandler();
|
|
81
|
+
checkModalHandlers.close();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
<IconX size={32} />
|
|
86
|
+
</ActionIcon>
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
checkQuery.isLoading && !checkData
|
|
90
|
+
? (
|
|
91
|
+
<Stack mt={60}>
|
|
92
|
+
<LoadingOverlay visible />
|
|
93
|
+
<Text>Loading the data</Text>
|
|
94
|
+
</Stack>
|
|
95
|
+
)
|
|
96
|
+
: checkQuery.isError
|
|
97
|
+
? (
|
|
98
|
+
<Stack mt={40}>
|
|
99
|
+
<Text color="red">Error load the check data</Text>
|
|
100
|
+
</Stack>
|
|
101
|
+
)
|
|
102
|
+
: checkData
|
|
103
|
+
? (
|
|
104
|
+
<CheckDetails
|
|
105
|
+
initCheckData={checkData}
|
|
106
|
+
checkQuery={checkQuery}
|
|
107
|
+
closeHandler={closeHandler}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
110
|
+
: (
|
|
111
|
+
<Group mt={60}>
|
|
112
|
+
Empty check data
|
|
113
|
+
</Group>
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
</Modal>
|
|
118
|
+
);
|
|
119
|
+
}
|