@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,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "syngrisi-ui-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ui for Syngrisi",
|
|
5
|
+
"main": "stub.html",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "Viktar Silakou",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@emotion/react": "^11.10.0",
|
|
13
|
+
"@mantine/core": "^5.9.5",
|
|
14
|
+
"@mantine/dates": "^5.9.5",
|
|
15
|
+
"@mantine/form": "^5.9.5",
|
|
16
|
+
"@mantine/hooks": "^5.9.5",
|
|
17
|
+
"@mantine/modals": "^5.9.5",
|
|
18
|
+
"@mantine/notifications": "^5.9.5",
|
|
19
|
+
"@mantine/nprogress": "^5.9.5",
|
|
20
|
+
"@mantine/spotlight": "^5.9.5",
|
|
21
|
+
"@mantine/styles": "^5.9.5",
|
|
22
|
+
"@popperjs/core": "^2.11.6",
|
|
23
|
+
"@tabler/icons": "^1.91.0",
|
|
24
|
+
"@tanstack/react-query": "^4.2.3",
|
|
25
|
+
"@tanstack/react-query-devtools": "^4.2.3",
|
|
26
|
+
"@types/bootstrap": "^5.2.3",
|
|
27
|
+
"date-fns": "^2.29.3",
|
|
28
|
+
"dayjs": "^1.11.5",
|
|
29
|
+
"fabric": "^5.2.4",
|
|
30
|
+
"jquery": "^3.6.1",
|
|
31
|
+
"ky": "^0.31.1",
|
|
32
|
+
"query-string": "^7.1.1",
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0",
|
|
35
|
+
"react-error-boundary": "^3.1.4",
|
|
36
|
+
"react-icons": "^4.4.0",
|
|
37
|
+
"react-intersection-observer": "^9.4.0",
|
|
38
|
+
"react-router-dom": "^6.3.0",
|
|
39
|
+
"use-query-params": "^2.1.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^18.7.14",
|
|
43
|
+
"@types/react": "^18.0.17",
|
|
44
|
+
"@types/react-dom": "^18.0.6",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^5.36.0",
|
|
46
|
+
"@typescript-eslint/parser": "^5.36.0",
|
|
47
|
+
"@vitejs/plugin-react": "^2.0.1",
|
|
48
|
+
"eslint": "^8.23.0",
|
|
49
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
50
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
51
|
+
"eslint-plugin-import": "^2.26.0",
|
|
52
|
+
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
53
|
+
"eslint-plugin-react": "^7.31.1",
|
|
54
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
55
|
+
"typescript": "^4.8.2",
|
|
56
|
+
"vite": "^3.0.9"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import {
|
|
3
|
+
ActionIcon,
|
|
4
|
+
Popover,
|
|
5
|
+
Button,
|
|
6
|
+
MantineNumberSize,
|
|
7
|
+
Group,
|
|
8
|
+
Text,
|
|
9
|
+
Tooltip,
|
|
10
|
+
MantineColor,
|
|
11
|
+
} from '@mantine/core';
|
|
12
|
+
import React, { ReactElement } from 'react';
|
|
13
|
+
import { useDisclosure, useClickOutside } from '@mantine/hooks';
|
|
14
|
+
|
|
15
|
+
interface IActionPopoverIcon {
|
|
16
|
+
icon: ReactElement
|
|
17
|
+
color?: MantineColor
|
|
18
|
+
iconColor?: MantineColor
|
|
19
|
+
buttonColor?: MantineColor
|
|
20
|
+
action: () => void,
|
|
21
|
+
confirmLabel: string
|
|
22
|
+
title?: string
|
|
23
|
+
testAttr: string
|
|
24
|
+
loading: boolean
|
|
25
|
+
variant?: string
|
|
26
|
+
sx?: any
|
|
27
|
+
paused?: boolean
|
|
28
|
+
size?: MantineNumberSize | undefined
|
|
29
|
+
withinPortal?: boolean
|
|
30
|
+
disabled?: boolean
|
|
31
|
+
testAttrName?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default function ActionPopoverIcon(
|
|
35
|
+
{
|
|
36
|
+
icon,
|
|
37
|
+
color,
|
|
38
|
+
iconColor,
|
|
39
|
+
action,
|
|
40
|
+
confirmLabel,
|
|
41
|
+
title,
|
|
42
|
+
testAttr,
|
|
43
|
+
testAttrName = '',
|
|
44
|
+
loading,
|
|
45
|
+
buttonColor,
|
|
46
|
+
paused,
|
|
47
|
+
disabled = false,
|
|
48
|
+
withinPortal = true,
|
|
49
|
+
size = 24,
|
|
50
|
+
...rest
|
|
51
|
+
}: IActionPopoverIcon,
|
|
52
|
+
): ReactElement {
|
|
53
|
+
const [openPopover, handlers] = useDisclosure(false);
|
|
54
|
+
|
|
55
|
+
const ref = useClickOutside(() => handlers.close());
|
|
56
|
+
return (
|
|
57
|
+
<Popover
|
|
58
|
+
opened={openPopover}
|
|
59
|
+
position="bottom"
|
|
60
|
+
withArrow
|
|
61
|
+
shadow="md"
|
|
62
|
+
closeOnClickOutside
|
|
63
|
+
closeOnEscape
|
|
64
|
+
withinPortal={withinPortal}
|
|
65
|
+
>
|
|
66
|
+
<Popover.Target>
|
|
67
|
+
<Tooltip
|
|
68
|
+
withinPortal={withinPortal}
|
|
69
|
+
label={
|
|
70
|
+
(
|
|
71
|
+
<Group noWrap>
|
|
72
|
+
<Text>{title}</Text>
|
|
73
|
+
</Group>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
<ActionIcon
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
data-test={testAttr}
|
|
80
|
+
data-popover-icon-name={testAttrName}
|
|
81
|
+
variant={'light' as any}
|
|
82
|
+
color={iconColor}
|
|
83
|
+
onClick={() => {
|
|
84
|
+
if (paused) return;
|
|
85
|
+
handlers.toggle();
|
|
86
|
+
}}
|
|
87
|
+
title={title}
|
|
88
|
+
loading={loading}
|
|
89
|
+
size={size}
|
|
90
|
+
{...rest}
|
|
91
|
+
>
|
|
92
|
+
{icon}
|
|
93
|
+
</ActionIcon>
|
|
94
|
+
</Tooltip>
|
|
95
|
+
</Popover.Target>
|
|
96
|
+
<Popover.Dropdown
|
|
97
|
+
p={4}
|
|
98
|
+
// onBlurCapture={() => handlers.close()}
|
|
99
|
+
// onBlurCapture={() => alert(123)}
|
|
100
|
+
>
|
|
101
|
+
<Button
|
|
102
|
+
ref={ref}
|
|
103
|
+
data-test={`${testAttr}-confirm`}
|
|
104
|
+
color={buttonColor || color}
|
|
105
|
+
data-confirm-button-name={testAttrName}
|
|
106
|
+
onClick={() => {
|
|
107
|
+
action();
|
|
108
|
+
handlers.close();
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
{confirmLabel}
|
|
112
|
+
</Button>
|
|
113
|
+
</Popover.Dropdown>
|
|
114
|
+
</Popover>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { RingProgress } from '@mantine/core';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
status: string
|
|
7
|
+
size: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const iconMap = ({ key, size = 44, rest }: { key: string, size: number, rest: any }) => {
|
|
11
|
+
const map = {
|
|
12
|
+
Accepted: (
|
|
13
|
+
<RingProgress
|
|
14
|
+
size={size}
|
|
15
|
+
sections={[
|
|
16
|
+
{ value: 100, color: 'green' },
|
|
17
|
+
]}
|
|
18
|
+
/>
|
|
19
|
+
),
|
|
20
|
+
Partially: (
|
|
21
|
+
<RingProgress
|
|
22
|
+
size={size}
|
|
23
|
+
sections={[
|
|
24
|
+
{ value: 100, color: 'orange' },
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
),
|
|
28
|
+
Unaccepted: (
|
|
29
|
+
<RingProgress
|
|
30
|
+
size={size}
|
|
31
|
+
sections={[
|
|
32
|
+
{ value: 100, color: 'red' },
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
),
|
|
36
|
+
} as { [key: string]: any };
|
|
37
|
+
return map[key] || (
|
|
38
|
+
<RingProgress
|
|
39
|
+
title={key}
|
|
40
|
+
size={size}
|
|
41
|
+
sections={
|
|
42
|
+
[{ value: 100, color: 'dark.4' }]
|
|
43
|
+
}
|
|
44
|
+
{...rest}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function AcceptedStatusIcon({ status, size, ...rest }: Props) {
|
|
50
|
+
return iconMap({ key: status, size, rest });
|
|
51
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
SiFirefox,
|
|
5
|
+
SiGooglechrome,
|
|
6
|
+
SiInternetexplorer,
|
|
7
|
+
SiMicrosoftedge,
|
|
8
|
+
SiSafari,
|
|
9
|
+
} from 'react-icons/si';
|
|
10
|
+
// import {PiGoogleChromeLogoThin} from 'react-icons/pi'
|
|
11
|
+
import { TbQuestionMark } from 'react-icons/tb';
|
|
12
|
+
import { FaSafari, FiChrome } from 'react-icons/all';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
browser: string
|
|
16
|
+
size: number
|
|
17
|
+
color?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const browserIconMap = (key: string) => {
|
|
21
|
+
const map = {
|
|
22
|
+
chrome: SiGooglechrome,
|
|
23
|
+
chromium: FiChrome,
|
|
24
|
+
'chrome [HEADLESS]': SiGooglechrome,
|
|
25
|
+
Chrome: SiGooglechrome,
|
|
26
|
+
firefox: SiFirefox,
|
|
27
|
+
Firefox: SiFirefox,
|
|
28
|
+
msedge: SiMicrosoftedge,
|
|
29
|
+
Msedge: SiMicrosoftedge,
|
|
30
|
+
Safari: SiSafari,
|
|
31
|
+
safari: SiSafari,
|
|
32
|
+
webkit: FaSafari,
|
|
33
|
+
'internet explorer': SiInternetexplorer,
|
|
34
|
+
} as { [key: string]: any };
|
|
35
|
+
return map[key] || TbQuestionMark;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function BrowserIcon({ browser, size = 24, color = '', ...rest }: Props) {
|
|
39
|
+
const BrowIcon = browserIconMap(browser);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<BrowIcon
|
|
43
|
+
style={{ width: size }}
|
|
44
|
+
size={size}
|
|
45
|
+
title={browser}
|
|
46
|
+
color={color}
|
|
47
|
+
{...rest}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
SiAndroid,
|
|
5
|
+
SiApple,
|
|
6
|
+
SiIos,
|
|
7
|
+
SiLinux,
|
|
8
|
+
SiWindows,
|
|
9
|
+
} from 'react-icons/si';
|
|
10
|
+
import { TbQuestionMark } from 'react-icons/tb';
|
|
11
|
+
import { useQuery } from '@tanstack/react-query';
|
|
12
|
+
import { useMemo } from 'react';
|
|
13
|
+
import config from '../../../config';
|
|
14
|
+
import { log } from '../../utils/Logger';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
os: string
|
|
18
|
+
size: number
|
|
19
|
+
color?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const osIconMap = (key: string) => {
|
|
23
|
+
const map = {
|
|
24
|
+
ios: SiIos,
|
|
25
|
+
android: SiAndroid,
|
|
26
|
+
windows: SiWindows,
|
|
27
|
+
win32: SiWindows,
|
|
28
|
+
macintel: SiApple,
|
|
29
|
+
macos: SiApple,
|
|
30
|
+
'linux x86_64': SiLinux,
|
|
31
|
+
linux: SiLinux,
|
|
32
|
+
|
|
33
|
+
// 'Linux x86_64': SiLinux,
|
|
34
|
+
// Win32: SiWindows,
|
|
35
|
+
// WINDOWS: SiWindows,
|
|
36
|
+
// MacIntel: SiApple,
|
|
37
|
+
// macOS: SiApple,
|
|
38
|
+
} as { [key: string]: any };
|
|
39
|
+
return map[key.toLowerCase()];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export function OsIcon({ os, size = 24, ...rest }: Props) {
|
|
43
|
+
const customDevicesQuery = useQuery(
|
|
44
|
+
['custom_devices'],
|
|
45
|
+
() => config.customDevicesProm,
|
|
46
|
+
{
|
|
47
|
+
cacheTime: 60 * 60 * 10,
|
|
48
|
+
staleTime: 60 * 60 * 10,
|
|
49
|
+
enabled: true,
|
|
50
|
+
refetchOnWindowFocus: false,
|
|
51
|
+
onError: (err: any) => {
|
|
52
|
+
// errorMsg({ error: err });
|
|
53
|
+
log.error(err);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const customDevices = useMemo(() => customDevicesQuery.data || [], [customDevicesQuery?.data?.length]);
|
|
59
|
+
|
|
60
|
+
const allDevices = [...config.devices, ...customDevices];
|
|
61
|
+
|
|
62
|
+
const Icon = osIconMap(os)
|
|
63
|
+
|| osIconMap(allDevices.find((x: any) => x.device === os)?.os || '')
|
|
64
|
+
|| TbQuestionMark;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Icon
|
|
68
|
+
title={os}
|
|
69
|
+
size={size}
|
|
70
|
+
{...rest}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Badge, BadgeVariant, Loader } from '@mantine/core';
|
|
4
|
+
import { useLocalStorage } from '@mantine/hooks';
|
|
5
|
+
import { sizes } from '../../../index2/components/Tests/Table/Checks/checkSizes';
|
|
6
|
+
|
|
7
|
+
const statusColor = (status: string) => {
|
|
8
|
+
const map = {
|
|
9
|
+
new: 'blue',
|
|
10
|
+
passed: 'green',
|
|
11
|
+
failed: 'red',
|
|
12
|
+
} as { [key: string]: any };
|
|
13
|
+
return map[status] || 'gray';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
check: any,
|
|
18
|
+
variant?: BadgeVariant
|
|
19
|
+
size?: number | string,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function Status({ check, size, variant = 'light', ...rest }: Props) {
|
|
23
|
+
const [checksViewSize] = useLocalStorage({ key: 'check-view-size', defaultValue: 'medium' });
|
|
24
|
+
return (
|
|
25
|
+
<Badge
|
|
26
|
+
color={statusColor(check.status)}
|
|
27
|
+
data-test="check-status"
|
|
28
|
+
data-check-status-name={check.name}
|
|
29
|
+
variant={variant}
|
|
30
|
+
size={size || sizes[checksViewSize].statusBadge}
|
|
31
|
+
title="Check status"
|
|
32
|
+
{...rest}
|
|
33
|
+
>
|
|
34
|
+
{check.status ? check.status : <Loader size="xs" color="blue" variant="dots" />}
|
|
35
|
+
</Badge>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { RingProgress } from '@mantine/core';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
status: string
|
|
7
|
+
size: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const iconMap = ({ key, size = 44, rest }: { key: string, size: number, rest: any }) => {
|
|
11
|
+
const map = {
|
|
12
|
+
new: (
|
|
13
|
+
<RingProgress
|
|
14
|
+
size={size}
|
|
15
|
+
thickness={size / 3.14}
|
|
16
|
+
sections={[
|
|
17
|
+
{ value: 100, color: 'blue' },
|
|
18
|
+
]}
|
|
19
|
+
/>
|
|
20
|
+
),
|
|
21
|
+
passed: (
|
|
22
|
+
<RingProgress
|
|
23
|
+
size={size}
|
|
24
|
+
thickness={size / 3.14}
|
|
25
|
+
sections={[
|
|
26
|
+
{ value: 100, color: 'green' },
|
|
27
|
+
]}
|
|
28
|
+
/>
|
|
29
|
+
),
|
|
30
|
+
failed: (
|
|
31
|
+
<RingProgress
|
|
32
|
+
size={size}
|
|
33
|
+
thickness={size / 3.14}
|
|
34
|
+
sections={[
|
|
35
|
+
{ value: 100, color: 'red' },
|
|
36
|
+
]}
|
|
37
|
+
/>
|
|
38
|
+
),
|
|
39
|
+
running: (
|
|
40
|
+
<RingProgress
|
|
41
|
+
size={size}
|
|
42
|
+
thickness={size / 3.14}
|
|
43
|
+
sections={[
|
|
44
|
+
{ value: 100, color: 'gray' },
|
|
45
|
+
]}
|
|
46
|
+
/>
|
|
47
|
+
),
|
|
48
|
+
|
|
49
|
+
} as { [key: string]: any };
|
|
50
|
+
|
|
51
|
+
return map[(key || '').toLowerCase()] || (
|
|
52
|
+
<RingProgress
|
|
53
|
+
title={key}
|
|
54
|
+
size={size}
|
|
55
|
+
thickness={size / 3.14}
|
|
56
|
+
sections={
|
|
57
|
+
[{ value: 100, color: 'dark.4' }]
|
|
58
|
+
}
|
|
59
|
+
{...rest}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export function StatusIcon({ status, size, ...rest }: Props) {
|
|
65
|
+
return iconMap({ key: status, size, rest });
|
|
66
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { IconAt } from '@tabler/icons';
|
|
4
|
+
import { Loader, TextInput } from '@mantine/core';
|
|
5
|
+
import { useQuery } from '@tanstack/react-query';
|
|
6
|
+
import { useEffect } from 'react';
|
|
7
|
+
import { GenericService } from '../services';
|
|
8
|
+
|
|
9
|
+
interface IDuplicationFreeEmail {
|
|
10
|
+
form: any,
|
|
11
|
+
setEmailError: any,
|
|
12
|
+
setEmailIsFetchingStatus: React.Dispatch<React.SetStateAction<boolean>>,
|
|
13
|
+
disabled?: boolean,
|
|
14
|
+
label?: string
|
|
15
|
+
setErrorOnRuntime?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Email = {
|
|
19
|
+
// eslint-disable-next-line react/require-default-props
|
|
20
|
+
DuplicationFree(
|
|
21
|
+
{
|
|
22
|
+
form,
|
|
23
|
+
setEmailError,
|
|
24
|
+
setEmailIsFetchingStatus,
|
|
25
|
+
disabled = false,
|
|
26
|
+
label = 'Email',
|
|
27
|
+
setErrorOnRuntime = true,
|
|
28
|
+
...rest
|
|
29
|
+
}: IDuplicationFreeEmail,
|
|
30
|
+
) {
|
|
31
|
+
const useEmailCheckQuery = () => useQuery(
|
|
32
|
+
['userByEmail', form.values.username],
|
|
33
|
+
// eslint-disable-next-line arrow-body-style
|
|
34
|
+
async () => {
|
|
35
|
+
return GenericService.get('users', { username: form.values.username });
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
enabled: !!form.values.username && (/^\S+@\S+$/.test(form.values.username)),
|
|
39
|
+
refetchOnWindowFocus: false,
|
|
40
|
+
onSuccess: (data) => {
|
|
41
|
+
const { results } = data;
|
|
42
|
+
if ((results.length > 0)) {
|
|
43
|
+
setEmailError('user with this email already exists');
|
|
44
|
+
if (setErrorOnRuntime) form.setFieldError('username', 'user with this email already exists');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
setEmailError(null);
|
|
48
|
+
if (setErrorOnRuntime) form.setFieldError('username', null);
|
|
49
|
+
},
|
|
50
|
+
onError: () => {
|
|
51
|
+
setEmailError('cannot check the field, connection error');
|
|
52
|
+
if (setErrorOnRuntime) form.setFieldError('username', 'cannot check the field, connection error');
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const userByEmailQuery = useEmailCheckQuery();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setEmailIsFetchingStatus(userByEmailQuery.isFetching);
|
|
60
|
+
}, [userByEmailQuery.isFetching]);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<TextInput
|
|
64
|
+
label={label}
|
|
65
|
+
placeholder="j.smith@example.com"
|
|
66
|
+
{...form.getInputProps('username')}
|
|
67
|
+
required
|
|
68
|
+
rightSection={(userByEmailQuery.isFetching)
|
|
69
|
+
&& <Loader size="xs" />}
|
|
70
|
+
icon={<IconAt size={16} />}
|
|
71
|
+
autoComplete="nope"
|
|
72
|
+
disabled={disabled}
|
|
73
|
+
id="email"
|
|
74
|
+
styles={
|
|
75
|
+
() => (
|
|
76
|
+
{ input: { paddingRight: 36 } }
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
{...rest}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Button, Group, Modal, Text } from '@mantine/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
export default function ApiKeyModalAsk({ opened, setOpened, apiKey, setResultOpened }
|
|
5
|
+
: { opened: boolean, setOpened: any, apiKey: any, setResultOpened: any }) {
|
|
6
|
+
return (
|
|
7
|
+
<Modal
|
|
8
|
+
opened={opened}
|
|
9
|
+
onClose={() => setOpened(false)}
|
|
10
|
+
title="Generate a new API key?"
|
|
11
|
+
>
|
|
12
|
+
<Text size="sm">
|
|
13
|
+
Are you sure you want to generate a new API key?
|
|
14
|
+
After generation, you must add corresponding changes in your test solution.
|
|
15
|
+
</Text>
|
|
16
|
+
<Group position="right">
|
|
17
|
+
<Button onClick={
|
|
18
|
+
() => {
|
|
19
|
+
apiKey.refetch();
|
|
20
|
+
setResultOpened(true);
|
|
21
|
+
setOpened(false);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
>
|
|
25
|
+
Generate
|
|
26
|
+
</Button>
|
|
27
|
+
<Button variant="outline" onClick={() => setOpened(false)}>Cancel</Button>
|
|
28
|
+
</Group>
|
|
29
|
+
</Modal>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { IconCheck, IconCopy, IconKey } from '@tabler/icons';
|
|
3
|
+
import { ActionIcon, Button, Group, Loader, Modal, Text, TextInput } from '@mantine/core';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { log } from '../../utils';
|
|
6
|
+
|
|
7
|
+
export function ApiKeyModalResult({ opened, setOpened, apiKey }: { opened: boolean, setOpened: any, apiKey: any }) {
|
|
8
|
+
const [successCopy, setSuccessCopy] = useState(false);
|
|
9
|
+
|
|
10
|
+
if (apiKey.isError) {
|
|
11
|
+
log.error(apiKey.error);
|
|
12
|
+
}
|
|
13
|
+
const copyHandler = () => {
|
|
14
|
+
const input: any = document.getElementById('api-key');
|
|
15
|
+
input.focus();
|
|
16
|
+
input.select();
|
|
17
|
+
// noinspection JSDeprecatedSymbols
|
|
18
|
+
const successful = document.execCommand('copy');
|
|
19
|
+
const msg = successful ? 'successful' : 'unsuccessful';
|
|
20
|
+
log.debug(`copy result: ${msg}`);
|
|
21
|
+
if (msg === 'successful') {
|
|
22
|
+
setSuccessCopy(true);
|
|
23
|
+
}
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
window.getSelection().removeAllRanges();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const CopyIcon = successCopy ? IconCheck : IconCopy;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Modal
|
|
32
|
+
opened={opened}
|
|
33
|
+
onClose={() => {
|
|
34
|
+
setSuccessCopy(false);
|
|
35
|
+
setOpened(false);
|
|
36
|
+
}}
|
|
37
|
+
title="New API key"
|
|
38
|
+
>
|
|
39
|
+
{
|
|
40
|
+
(!apiKey.isLoading && apiKey.data)
|
|
41
|
+
? (
|
|
42
|
+
<>
|
|
43
|
+
<Group ml={20} mb={20}>
|
|
44
|
+
<Text size="sm">Copy the New API key to Clipboard</Text>
|
|
45
|
+
</Group>
|
|
46
|
+
<Group position="center">
|
|
47
|
+
<TextInput
|
|
48
|
+
data-test="api-key"
|
|
49
|
+
id="api-key"
|
|
50
|
+
value={apiKey.data.apikey}
|
|
51
|
+
sx={{ width: '340px', display: 'inline' }}
|
|
52
|
+
icon={<IconKey />}
|
|
53
|
+
style={{ display: 'inline' }}
|
|
54
|
+
/>
|
|
55
|
+
<ActionIcon ml={-10} data-test="copy-api-icon">
|
|
56
|
+
<CopyIcon
|
|
57
|
+
size={18}
|
|
58
|
+
onClick={copyHandler}
|
|
59
|
+
color={successCopy ? 'green' : 'gray'}
|
|
60
|
+
/>
|
|
61
|
+
</ActionIcon>
|
|
62
|
+
</Group>
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
: (
|
|
66
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
67
|
+
<>
|
|
68
|
+
{apiKey.isError && <Text color="red" size="sm"> Error loading API key</Text>}
|
|
69
|
+
</>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
<Group position="center">
|
|
73
|
+
{((apiKey.isFetching || apiKey.isRefetching)) && <Loader />}
|
|
74
|
+
</Group>
|
|
75
|
+
<Group position="center" pt={30}>
|
|
76
|
+
<Button
|
|
77
|
+
onClick={() => {
|
|
78
|
+
setOpened(false);
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
setSuccessCopy(false);
|
|
81
|
+
}, 300);
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
Close
|
|
85
|
+
</Button>
|
|
86
|
+
</Group>
|
|
87
|
+
</Modal>
|
|
88
|
+
);
|
|
89
|
+
}
|