@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,71 @@
|
|
|
1
|
+
/* eslint-disable indent,react/jsx-indent */
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { useInView } from 'react-intersection-observer';
|
|
4
|
+
import { Skeleton } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
import { tableColumns } from './tableColumns';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
infinityQuery: any,
|
|
10
|
+
visibleFields: any,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function InfinityScrollSkeleton({ infinityQuery, visibleFields }: Props) {
|
|
14
|
+
const { ref, inView } = useInView();
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (infinityQuery === null) return;
|
|
18
|
+
if (inView) {
|
|
19
|
+
infinityQuery.fetchNextPage();
|
|
20
|
+
}
|
|
21
|
+
}, [inView]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<tfoot ref={ref} style={{ marginBottom: -100 }}>
|
|
25
|
+
{
|
|
26
|
+
(infinityQuery === null || infinityQuery.hasNextPage) && (
|
|
27
|
+
Object.keys(new Array(6).fill('')).map(
|
|
28
|
+
(x) => (
|
|
29
|
+
<tr key={x} style={{ height: 72 }}>
|
|
30
|
+
<td style={{ width: 40, padding: 10 }}>
|
|
31
|
+
<Skeleton height={20} radius="sm" />
|
|
32
|
+
</td>
|
|
33
|
+
{
|
|
34
|
+
Object.keys(tableColumns).map((column) => {
|
|
35
|
+
if (!visibleFields.includes(column)) return undefined;
|
|
36
|
+
|
|
37
|
+
if (column === 'level') {
|
|
38
|
+
return (
|
|
39
|
+
<td
|
|
40
|
+
key={column}
|
|
41
|
+
style={{ ...tableColumns[column].cellStyle, paddingLeft: '8px' }}
|
|
42
|
+
>
|
|
43
|
+
<Skeleton height={34} circle radius="xl" />
|
|
44
|
+
</td>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<td
|
|
50
|
+
key={column}
|
|
51
|
+
style={{
|
|
52
|
+
...tableColumns[column].cellStyle,
|
|
53
|
+
paddingLeft: 5,
|
|
54
|
+
paddingRight: 25,
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<Skeleton height={16} radius="md" />
|
|
58
|
+
</td>
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
</tr>
|
|
63
|
+
),
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
</tfoot>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default InfinityScrollSkeleton;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Affix, Button, Text, Transition } from '@mantine/core';
|
|
3
|
+
import { IconArrowUp } from '@tabler/icons';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
loaded: string
|
|
7
|
+
total: string
|
|
8
|
+
scrollAreaRef: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function PagesCountAffix({ loaded, total, scrollAreaRef }: Props) {
|
|
12
|
+
const isMounted = !!scrollAreaRef?.current?.querySelector('.mantine-ScrollArea-viewport')?.scrollTop;
|
|
13
|
+
return (
|
|
14
|
+
<Affix position={{ bottom: 20, right: 20 }}>
|
|
15
|
+
<Transition
|
|
16
|
+
transition="slide-up"
|
|
17
|
+
mounted={isMounted}
|
|
18
|
+
>
|
|
19
|
+
{(transitionStyles) => (
|
|
20
|
+
<Button
|
|
21
|
+
data-test="infinity-scroll-affix"
|
|
22
|
+
size="lg"
|
|
23
|
+
color="dark"
|
|
24
|
+
style={transitionStyles}
|
|
25
|
+
title="Scroll to top"
|
|
26
|
+
rightIcon={<IconArrowUp size={16} />}
|
|
27
|
+
onClick={
|
|
28
|
+
() => scrollAreaRef?.current?.querySelector('.mantine-ScrollArea-viewport').scroll(0, 0)
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
<Text
|
|
32
|
+
size="sm"
|
|
33
|
+
data-test="infinity-scroll-affix-loaded-count"
|
|
34
|
+
p={3}
|
|
35
|
+
title="Loaded"
|
|
36
|
+
>
|
|
37
|
+
{loaded}
|
|
38
|
+
</Text>
|
|
39
|
+
<Text
|
|
40
|
+
size="sm"
|
|
41
|
+
p={3}
|
|
42
|
+
>
|
|
43
|
+
{' / '}
|
|
44
|
+
</Text>
|
|
45
|
+
<Text
|
|
46
|
+
size="sm"
|
|
47
|
+
data-test="infinity-scroll-affix-total-count"
|
|
48
|
+
p={3}
|
|
49
|
+
title="Total"
|
|
50
|
+
>
|
|
51
|
+
{total}
|
|
52
|
+
</Text>
|
|
53
|
+
|
|
54
|
+
</Button>
|
|
55
|
+
)}
|
|
56
|
+
</Transition>
|
|
57
|
+
</Affix>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default PagesCountAffix;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import React, { FunctionComponent } from 'react';
|
|
3
|
+
import { ActionIcon, Badge, useMantineTheme } from '@mantine/core';
|
|
4
|
+
import { IconRefresh } from '@tabler/icons';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
newestItemsQuery: any,
|
|
8
|
+
firstPageQuery: any,
|
|
9
|
+
infinityQuery?: any,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const RefreshActionIcon: FunctionComponent<Props> = ({ newestItemsQuery, firstPageQuery, infinityQuery }) => {
|
|
13
|
+
const theme = useMantineTheme();
|
|
14
|
+
const newestItems = newestItemsQuery?.data?.results.length > 50 ? '50+' : newestItemsQuery?.data?.results.length;
|
|
15
|
+
const pluralCharset = newestItems > 1 ? 's' : '';
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<ActionIcon
|
|
19
|
+
title="Refresh"
|
|
20
|
+
color={theme.colorScheme === 'dark' ? 'green.8' : 'green.6'}
|
|
21
|
+
data-test="table-refresh-icon"
|
|
22
|
+
variant="subtle"
|
|
23
|
+
onClick={() => firstPageQuery.refetch()}
|
|
24
|
+
>
|
|
25
|
+
<IconRefresh size={24} stroke={1} />
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
newestItemsQuery?.data?.results?.length !== undefined && newestItemsQuery?.data?.results?.length > 0
|
|
29
|
+
&& (
|
|
30
|
+
<Badge
|
|
31
|
+
component="div"
|
|
32
|
+
title={` You have ${newestItems} new item${pluralCharset}, refresh the page to see them`}
|
|
33
|
+
pl={4}
|
|
34
|
+
pr={4}
|
|
35
|
+
pt={6}
|
|
36
|
+
pb={6}
|
|
37
|
+
color="red"
|
|
38
|
+
variant="filled"
|
|
39
|
+
radius="xl"
|
|
40
|
+
data-test="table-refresh-icon-badge"
|
|
41
|
+
sx={{
|
|
42
|
+
fontSize: '12px',
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
bottom: 11,
|
|
45
|
+
left: 14,
|
|
46
|
+
lineHeight: '16px',
|
|
47
|
+
fontWeight: 400,
|
|
48
|
+
fontFamily: '"Roboto","Arial",sans-serif',
|
|
49
|
+
border: `2px`,
|
|
50
|
+
borderStyle: 'solid',
|
|
51
|
+
borderColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : 'white',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{
|
|
55
|
+
newestItems
|
|
56
|
+
}
|
|
57
|
+
</Badge>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
</ActionIcon>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default RefreshActionIcon;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Button, Group, Modal, Text } from '@mantine/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useMutation } from '@tanstack/react-query';
|
|
4
|
+
import { TestsService } from '../../../../shared/services';
|
|
5
|
+
import { errorMsg, successMsg } from '../../../../shared/utils/utils';
|
|
6
|
+
import { log } from '../../../../shared/utils/Logger';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
opened: boolean,
|
|
10
|
+
setOpened: any,
|
|
11
|
+
selection: any
|
|
12
|
+
infinityQuery: any
|
|
13
|
+
setSelection: any
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function RemoveTestModalAsk({ opened, setOpened, selection, setSelection, infinityQuery }: Props) {
|
|
17
|
+
const mutationRemoveTest = useMutation(
|
|
18
|
+
(data: { id: string }) => TestsService.removeTest(data),
|
|
19
|
+
{
|
|
20
|
+
onSuccess: async () => {
|
|
21
|
+
successMsg({ message: 'Test has been successfully removed' });
|
|
22
|
+
},
|
|
23
|
+
onError: (e: any) => {
|
|
24
|
+
errorMsg({ error: 'Cannot remove the Test' });
|
|
25
|
+
log.error(e);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
// const [foldMode, toggleFoldMode] = useToggle([true, false]);
|
|
30
|
+
const asyncMutations: Promise<any>[] = [];
|
|
31
|
+
const handleRemoveButtonClick = async () => {
|
|
32
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
33
|
+
for (const id of selection) {
|
|
34
|
+
asyncMutations.push(mutationRemoveTest.mutateAsync({ id }));
|
|
35
|
+
}
|
|
36
|
+
await Promise.all(asyncMutations);
|
|
37
|
+
setSelection(() => []);
|
|
38
|
+
infinityQuery.refetch();
|
|
39
|
+
setOpened(false);
|
|
40
|
+
};
|
|
41
|
+
return (
|
|
42
|
+
<Modal
|
|
43
|
+
opened={opened}
|
|
44
|
+
onClose={() => setOpened(false)}
|
|
45
|
+
title="Remove selected tests?"
|
|
46
|
+
>
|
|
47
|
+
<Text size="sm">
|
|
48
|
+
Are you sure you want to permanently delete the selected tests?
|
|
49
|
+
</Text>
|
|
50
|
+
<Group position="right">
|
|
51
|
+
<Button
|
|
52
|
+
data-test="confirm-remove-test-icon"
|
|
53
|
+
color="red"
|
|
54
|
+
onClick={
|
|
55
|
+
async () => {
|
|
56
|
+
await handleRemoveButtonClick();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
Remove
|
|
61
|
+
</Button>
|
|
62
|
+
<Button variant="outline" onClick={() => setOpened(false)}>Cancel</Button>
|
|
63
|
+
</Group>
|
|
64
|
+
</Modal>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ActionIcon, Transition, useMantineTheme } from '@mantine/core';
|
|
2
|
+
import { IconTrash } from '@tabler/icons';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import RemoveTestModalAsk from './RemoveTestModalAsk';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
selection: any
|
|
8
|
+
infinityQuery: any
|
|
9
|
+
setSelection: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function RemoveTestsButton({ selection, setSelection, infinityQuery }: Props) {
|
|
13
|
+
const theme = useMantineTheme();
|
|
14
|
+
const [opened, setOpened] = useState(false);
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Transition mounted={selection.length > 0} transition="fade" duration={400} timingFunction="ease">
|
|
18
|
+
{
|
|
19
|
+
(styles) => (
|
|
20
|
+
<ActionIcon
|
|
21
|
+
color={theme.colorScheme === 'dark' ? 'green.8' : 'green.6'}
|
|
22
|
+
data-test="table-remove-tests"
|
|
23
|
+
variant="subtle"
|
|
24
|
+
onClick={async () => {
|
|
25
|
+
setOpened(true);
|
|
26
|
+
}}
|
|
27
|
+
style={styles}
|
|
28
|
+
>
|
|
29
|
+
<IconTrash size={24} stroke={1} />
|
|
30
|
+
</ActionIcon>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
</Transition>
|
|
34
|
+
<RemoveTestModalAsk
|
|
35
|
+
opened={opened}
|
|
36
|
+
setOpened={setOpened}
|
|
37
|
+
selection={selection}
|
|
38
|
+
infinityQuery={infinityQuery}
|
|
39
|
+
setSelection={setSelection}
|
|
40
|
+
/>
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Checkbox, Collapse, createStyles } from '@mantine/core';
|
|
4
|
+
import { useQuery } from '@tanstack/react-query';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { tableColumns } from './tableColumns';
|
|
7
|
+
import { Checks } from './Checks/Checks';
|
|
8
|
+
import { testsCreateStyle } from './testsCreateStyle';
|
|
9
|
+
import { GenericService } from '../../../../shared/services';
|
|
10
|
+
import { errorMsg } from '../../../../shared/utils';
|
|
11
|
+
import { CellWrapper } from './Cells/CellWrapper';
|
|
12
|
+
|
|
13
|
+
const useStyles = createStyles(testsCreateStyle as any);
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
item: any
|
|
17
|
+
toggleRow: any
|
|
18
|
+
toggleCollapse: any
|
|
19
|
+
index: number
|
|
20
|
+
visibleFields: any
|
|
21
|
+
selection: any
|
|
22
|
+
collapse: any
|
|
23
|
+
infinityQuery: any,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function Row(
|
|
27
|
+
{
|
|
28
|
+
item,
|
|
29
|
+
toggleRow,
|
|
30
|
+
toggleCollapse,
|
|
31
|
+
index,
|
|
32
|
+
visibleFields,
|
|
33
|
+
selection,
|
|
34
|
+
collapse,
|
|
35
|
+
infinityQuery,
|
|
36
|
+
}: Props,
|
|
37
|
+
) {
|
|
38
|
+
const { classes, cx } = useStyles();
|
|
39
|
+
const selected = selection.includes(item.id!);
|
|
40
|
+
|
|
41
|
+
const testUpdateQuery = useQuery(
|
|
42
|
+
[
|
|
43
|
+
'testUpdateQuery',
|
|
44
|
+
item._id,
|
|
45
|
+
],
|
|
46
|
+
() => GenericService.get(
|
|
47
|
+
'tests',
|
|
48
|
+
{ _id: item._id },
|
|
49
|
+
{
|
|
50
|
+
populate: 'checks',
|
|
51
|
+
limit: '0',
|
|
52
|
+
},
|
|
53
|
+
'testUpdateQuery',
|
|
54
|
+
),
|
|
55
|
+
{
|
|
56
|
+
enabled: false,
|
|
57
|
+
refetchOnWindowFocus: false,
|
|
58
|
+
refetchOnReconnect: false,
|
|
59
|
+
onError: (e) => {
|
|
60
|
+
errorMsg({ error: e });
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const test = useMemo(() => {
|
|
66
|
+
if (testUpdateQuery.data?.results?.length) return testUpdateQuery.data?.results[0];
|
|
67
|
+
return item;
|
|
68
|
+
}, [JSON.stringify(item), JSON.stringify(testUpdateQuery.data?.results)]);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<tr
|
|
73
|
+
data-test={`table_row_${index}`}
|
|
74
|
+
data-row-name={test.name}
|
|
75
|
+
className={cx({ [classes.rowSelected]: selected })}
|
|
76
|
+
style={{ cursor: 'pointer' }}
|
|
77
|
+
onClick={() => toggleCollapse(test.id!)}
|
|
78
|
+
>
|
|
79
|
+
|
|
80
|
+
<td>
|
|
81
|
+
<Checkbox
|
|
82
|
+
data-test="table-item-checkbox"
|
|
83
|
+
data-test-checkbox-name={test.name}
|
|
84
|
+
checked={selected}
|
|
85
|
+
onChange={(event) => {
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
toggleRow(test.id!);
|
|
88
|
+
}}
|
|
89
|
+
onClick={
|
|
90
|
+
(event) => {
|
|
91
|
+
event.stopPropagation();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/>
|
|
95
|
+
</td>
|
|
96
|
+
{
|
|
97
|
+
Object.keys(tableColumns).map((column: string) => {
|
|
98
|
+
if (!visibleFields.includes(column)) return undefined;
|
|
99
|
+
const itemValue = column.includes('.')
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
? test[column?.split('.')[0]][column?.split('.')[1]]
|
|
102
|
+
: test[column];
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<CellWrapper test={test} type={column} itemValue={itemValue} key={column} />
|
|
106
|
+
);
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
</tr>
|
|
110
|
+
|
|
111
|
+
<tr>
|
|
112
|
+
<td style={{ padding: 0, border: 0, width: 'auto' }} colSpan={1000}>
|
|
113
|
+
<Collapse
|
|
114
|
+
in={collapse.includes(test.id!)}
|
|
115
|
+
pl={10}
|
|
116
|
+
pr={10}
|
|
117
|
+
pt={10}
|
|
118
|
+
pb={10}
|
|
119
|
+
data-test="table-test-collapsed-row"
|
|
120
|
+
>
|
|
121
|
+
<Checks item={test} testUpdateQuery={testUpdateQuery} infinityQuery={infinityQuery} />
|
|
122
|
+
</Collapse>
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
125
|
+
|
|
126
|
+
</>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-one-expression-per-line */
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import UnfoldActionIcon from './UnfoldActionIcon';
|
|
4
|
+
import { Row } from './Row';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
infinityQuery: any
|
|
8
|
+
selection: any
|
|
9
|
+
setSelection: any
|
|
10
|
+
updateToolbar: any
|
|
11
|
+
visibleFields: string[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Rows = ({ infinityQuery, selection, setSelection, visibleFields, updateToolbar }: Props) => {
|
|
15
|
+
const [collapse, setCollapse]: [string[], any] = useState([]);
|
|
16
|
+
const { data } = infinityQuery;
|
|
17
|
+
|
|
18
|
+
const toggleCollapse = (id: string) => {
|
|
19
|
+
setCollapse(
|
|
20
|
+
(current: any) => (current.includes(id) ? current.filter((item: string) => item !== id) : [...current, id]),
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const expand = (id: string) => {
|
|
25
|
+
setCollapse(
|
|
26
|
+
(current: any) => {
|
|
27
|
+
if (!current.includes(id)) {
|
|
28
|
+
return [...current, id];
|
|
29
|
+
}
|
|
30
|
+
return current;
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
const fold = (id: string) => {
|
|
35
|
+
setCollapse(
|
|
36
|
+
(current: any) => {
|
|
37
|
+
if (current.includes(id)) {
|
|
38
|
+
return current.filter((item: string) => item !== id);
|
|
39
|
+
}
|
|
40
|
+
return current;
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const expandSelected = () => {
|
|
46
|
+
selection.forEach((item: string) => expand(item));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const collapseSelected = () => {
|
|
50
|
+
selection.forEach((item: string) => fold(item));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
updateToolbar(
|
|
55
|
+
<UnfoldActionIcon
|
|
56
|
+
mounted={selection.length > 0}
|
|
57
|
+
expandSelected={expandSelected}
|
|
58
|
+
collapseSelected={collapseSelected}
|
|
59
|
+
/>,
|
|
60
|
+
30,
|
|
61
|
+
);
|
|
62
|
+
}, [selection.length]);
|
|
63
|
+
|
|
64
|
+
const toggleRow = (id: string) => setSelection(
|
|
65
|
+
(current: any) => (current.includes(id) ? current.filter((item: string) => item !== id) : [...current, id]),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return data.pages.map((page: any) => (
|
|
69
|
+
page.results.map(
|
|
70
|
+
(item: any, index: number) => (
|
|
71
|
+
<Row
|
|
72
|
+
key={item.id}
|
|
73
|
+
item={item}
|
|
74
|
+
infinityQuery={infinityQuery}
|
|
75
|
+
toggleRow={toggleRow}
|
|
76
|
+
toggleCollapse={toggleCollapse}
|
|
77
|
+
index={index}
|
|
78
|
+
visibleFields={visibleFields}
|
|
79
|
+
selection={selection}
|
|
80
|
+
collapse={collapse}
|
|
81
|
+
/>
|
|
82
|
+
),
|
|
83
|
+
)
|
|
84
|
+
));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default Rows;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ActionIcon,
|
|
4
|
+
Chip,
|
|
5
|
+
Group,
|
|
6
|
+
SegmentedControl,
|
|
7
|
+
Text,
|
|
8
|
+
} from '@mantine/core';
|
|
9
|
+
import { IconSortAscending, IconSortDescending } from '@tabler/icons';
|
|
10
|
+
import { useEffect, useState } from 'react';
|
|
11
|
+
import { useInputState, useToggle, useLocalStorage } from '@mantine/hooks';
|
|
12
|
+
import { tableColumns } from './tableColumns';
|
|
13
|
+
import RelativeDrawer from '../../../../shared/components/RelativeDrawer';
|
|
14
|
+
import SafeSelect from '../../../../shared/components/SafeSelect';
|
|
15
|
+
import { SearchParams } from '../../../../shared/utils';
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
open: boolean
|
|
19
|
+
setSortOpen: any,
|
|
20
|
+
visibleFields: any
|
|
21
|
+
setVisibleFields: any
|
|
22
|
+
searchParams: any
|
|
23
|
+
setSearchParams: any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function Settings(
|
|
27
|
+
{
|
|
28
|
+
open,
|
|
29
|
+
setSortOpen,
|
|
30
|
+
visibleFields,
|
|
31
|
+
setVisibleFields,
|
|
32
|
+
searchParams,
|
|
33
|
+
setSearchParams,
|
|
34
|
+
}: Props,
|
|
35
|
+
) {
|
|
36
|
+
const [checksViewMode, setChecksViewMode] = useLocalStorage({ key: 'check-view-mode', defaultValue: 'bounded' });
|
|
37
|
+
const [checksViewSize, setChecksViewSize] = useLocalStorage({ key: 'check-view-size', defaultValue: 'medium' });
|
|
38
|
+
|
|
39
|
+
const [sortOrder, toggleSortOrder] = useToggle(['desc', 'asc']);
|
|
40
|
+
const [selectOptionsData] = useState(() => Object.keys(tableColumns)
|
|
41
|
+
.map((column) => ({ value: column, label: tableColumns[column].label })));
|
|
42
|
+
|
|
43
|
+
const [sortItemValue, setSortItemValue] = useInputState('startDate');
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
SearchParams.changeSorting(searchParams, setSearchParams, sortItemValue, sortOrder);
|
|
47
|
+
}, [sortItemValue, sortOrder]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<RelativeDrawer
|
|
51
|
+
open={open}
|
|
52
|
+
setOpen={setSortOpen}
|
|
53
|
+
title="Settings"
|
|
54
|
+
width={260}
|
|
55
|
+
>
|
|
56
|
+
<Group align="end" spacing="sm" noWrap>
|
|
57
|
+
<SafeSelect
|
|
58
|
+
label="Sort by"
|
|
59
|
+
data-test="table-sort-by-select"
|
|
60
|
+
optionsData={selectOptionsData}
|
|
61
|
+
required={false}
|
|
62
|
+
value={sortItemValue}
|
|
63
|
+
onChange={setSortItemValue}
|
|
64
|
+
/>
|
|
65
|
+
<ActionIcon
|
|
66
|
+
size={36}
|
|
67
|
+
data-test="table-sort-order"
|
|
68
|
+
title={`sort order is ${sortOrder === 'desc' ? 'descendant' : 'ascendant'}`}
|
|
69
|
+
onClick={() => {
|
|
70
|
+
toggleSortOrder();
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{sortOrder === 'desc' ? <IconSortDescending stroke={1} /> : <IconSortAscending stroke={1} />}
|
|
74
|
+
</ActionIcon>
|
|
75
|
+
</Group>
|
|
76
|
+
|
|
77
|
+
<Text pt="xl" weight={500}>Visible fields</Text>
|
|
78
|
+
<Chip.Group
|
|
79
|
+
align="self-start"
|
|
80
|
+
p={8}
|
|
81
|
+
value={visibleFields}
|
|
82
|
+
onChange={setVisibleFields}
|
|
83
|
+
multiple
|
|
84
|
+
>
|
|
85
|
+
{
|
|
86
|
+
Object.keys(tableColumns).map((column) => (
|
|
87
|
+
<Chip
|
|
88
|
+
key={column}
|
|
89
|
+
value={column}
|
|
90
|
+
data-test={`settings-visible-columns-${tableColumns[column].label}`}
|
|
91
|
+
|
|
92
|
+
>
|
|
93
|
+
{tableColumns[column].label}
|
|
94
|
+
</Chip>
|
|
95
|
+
))
|
|
96
|
+
}
|
|
97
|
+
</Chip.Group>
|
|
98
|
+
|
|
99
|
+
<Text mt="md" weight={500} pb="xs">Appearance of Checks</Text>
|
|
100
|
+
<Group position="center">
|
|
101
|
+
<SegmentedControl
|
|
102
|
+
data-test="preview-mode-segment-control"
|
|
103
|
+
data={['bounded', 'normal', 'list']}
|
|
104
|
+
value={checksViewMode}
|
|
105
|
+
onChange={setChecksViewMode}
|
|
106
|
+
/>
|
|
107
|
+
</Group>
|
|
108
|
+
<Group position="center" mt="md">
|
|
109
|
+
<SegmentedControl
|
|
110
|
+
data-test="preview-size-segment-control"
|
|
111
|
+
data={['small', 'medium', 'large', 'xlarge']}
|
|
112
|
+
value={checksViewSize}
|
|
113
|
+
onChange={setChecksViewSize}
|
|
114
|
+
/>
|
|
115
|
+
</Group>
|
|
116
|
+
|
|
117
|
+
</RelativeDrawer>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default Settings;
|