@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,216 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
PasswordInput,
|
|
4
|
+
Paper,
|
|
5
|
+
Title,
|
|
6
|
+
Container,
|
|
7
|
+
Button,
|
|
8
|
+
Text,
|
|
9
|
+
LoadingOverlay,
|
|
10
|
+
} from '@mantine/core';
|
|
11
|
+
import { useForm, UseFormReturnType } from '@mantine/form';
|
|
12
|
+
import ky from 'ky';
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import { useSearchParams } from 'react-router-dom';
|
|
15
|
+
import { useDocumentTitle } from '@mantine/hooks';
|
|
16
|
+
import { log } from '../../shared/utils';
|
|
17
|
+
import config from '../../config';
|
|
18
|
+
import Bars from './change-password/Bars';
|
|
19
|
+
import PasswordRequirement from './change-password/PasswordRequirement';
|
|
20
|
+
import requirements from './change-password/requirements';
|
|
21
|
+
|
|
22
|
+
export default function ChangePasswordForm() {
|
|
23
|
+
useDocumentTitle('Change Password Page');
|
|
24
|
+
|
|
25
|
+
const [searchParams] = useSearchParams();
|
|
26
|
+
const isFirstRun: boolean = !!searchParams.get('first_run');
|
|
27
|
+
|
|
28
|
+
let validatedRequirements: { key: string, id: string, label: string, meets: boolean }[];
|
|
29
|
+
|
|
30
|
+
interface Form {
|
|
31
|
+
newPasswordConfirmation: string;
|
|
32
|
+
newPassword: string;
|
|
33
|
+
currentPassword: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const form: UseFormReturnType<Form> = useForm({
|
|
37
|
+
initialValues: {
|
|
38
|
+
currentPassword: '',
|
|
39
|
+
newPassword: '',
|
|
40
|
+
newPasswordConfirmation: '',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
validate: {
|
|
44
|
+
currentPassword: (val) => {
|
|
45
|
+
if (isFirstRun) return null;
|
|
46
|
+
return val !== '' ? null : 'Old password is Empty';
|
|
47
|
+
},
|
|
48
|
+
// eslint-disable-next-line no-unused-vars
|
|
49
|
+
newPassword: (val) => {
|
|
50
|
+
if (validatedRequirements.some((x) => !x.meets)) {
|
|
51
|
+
return 'The password doesn\'t meet the requirements';
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
},
|
|
55
|
+
newPasswordConfirmation: (val) => (val === form.values.newPassword
|
|
56
|
+
? null
|
|
57
|
+
: 'New password and password confirmation must be match'),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const [errorMessage, setErrorMessage] = useState('');
|
|
62
|
+
|
|
63
|
+
const [loader, setLoader] = useState(false);
|
|
64
|
+
|
|
65
|
+
validatedRequirements = requirements.map((requirement) => (
|
|
66
|
+
{
|
|
67
|
+
key: requirement.id,
|
|
68
|
+
id: requirement.id,
|
|
69
|
+
label: requirement.label,
|
|
70
|
+
meets: requirement.re.test(form.values.newPassword),
|
|
71
|
+
}
|
|
72
|
+
));
|
|
73
|
+
|
|
74
|
+
const checks = validatedRequirements.map((requirement) => (
|
|
75
|
+
<PasswordRequirement
|
|
76
|
+
key={requirement.id}
|
|
77
|
+
id={requirement.id}
|
|
78
|
+
label={requirement.label}
|
|
79
|
+
meets={requirement.meets}
|
|
80
|
+
/>
|
|
81
|
+
));
|
|
82
|
+
|
|
83
|
+
function handleNewPasswordFields(event: React.ChangeEvent<HTMLInputElement>, path: string) {
|
|
84
|
+
form.setFieldValue(path, event.currentTarget.value);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface LoginFormData {
|
|
88
|
+
currentPassword: string,
|
|
89
|
+
newPassword: string,
|
|
90
|
+
newPasswordConfirmation: string,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line consistent-return
|
|
94
|
+
async function handleFormSubmissions(values: LoginFormData) {
|
|
95
|
+
try {
|
|
96
|
+
setErrorMessage('');
|
|
97
|
+
setLoader(true);
|
|
98
|
+
const url = isFirstRun ? `${config.baseUri}/v1/auth/change_first_run` : `${config.baseUri}/v1/auth/change`;
|
|
99
|
+
const resp = await ky(
|
|
100
|
+
url,
|
|
101
|
+
{
|
|
102
|
+
throwHttpErrors: false,
|
|
103
|
+
method: 'POST',
|
|
104
|
+
credentials: 'include',
|
|
105
|
+
body: JSON.stringify({
|
|
106
|
+
currentPassword: isFirstRun ? '' : values.currentPassword,
|
|
107
|
+
newPassword: values.newPassword,
|
|
108
|
+
isFirstRun,
|
|
109
|
+
}),
|
|
110
|
+
headers: {
|
|
111
|
+
'content-type': 'application/json',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
);
|
|
115
|
+
const result: { message: string } = await resp.json();
|
|
116
|
+
setLoader(false);
|
|
117
|
+
|
|
118
|
+
if (result.message === 'success') {
|
|
119
|
+
return window.location.assign('/auth/changeSuccess');
|
|
120
|
+
}
|
|
121
|
+
if (result.message) {
|
|
122
|
+
log.error(((typeof result) === 'object') ? JSON.stringify(result) : result.toString());
|
|
123
|
+
return setErrorMessage(result.message);
|
|
124
|
+
}
|
|
125
|
+
log.error(((typeof result) === 'object') ? JSON.stringify(result) : result.toString());
|
|
126
|
+
return setErrorMessage(result.message);
|
|
127
|
+
} catch (e: any) {
|
|
128
|
+
log.error(e.stack || e.toString());
|
|
129
|
+
setErrorMessage('Connection error');
|
|
130
|
+
} finally {
|
|
131
|
+
setLoader(false);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface FormValues {
|
|
136
|
+
newPasswordConfirmation: string;
|
|
137
|
+
newPassword: string;
|
|
138
|
+
currentPassword: string
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Container size={420} my={40}>
|
|
143
|
+
|
|
144
|
+
<Paper withBorder shadow="md" p={30} mt={30} radius="md">
|
|
145
|
+
<form
|
|
146
|
+
onSubmit={form.onSubmit(
|
|
147
|
+
(values: FormValues) => handleFormSubmissions(values),
|
|
148
|
+
)}
|
|
149
|
+
>
|
|
150
|
+
<Title order={isFirstRun ? 3 : 2} id="title">
|
|
151
|
+
{isFirstRun ? 'Change Password for default Administrator' : 'Change Password'}
|
|
152
|
+
</Title>
|
|
153
|
+
<PasswordInput
|
|
154
|
+
label="Current Password"
|
|
155
|
+
placeholder="Enter current password"
|
|
156
|
+
id="current-password"
|
|
157
|
+
value={isFirstRun ? '---------------' : form.values.currentPassword}
|
|
158
|
+
onChange={(event) => form.setFieldValue('currentPassword', event.currentTarget.value)}
|
|
159
|
+
error={form.errors.currentPassword && 'Invalid password'}
|
|
160
|
+
disabled={isFirstRun || false}
|
|
161
|
+
required
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<PasswordInput
|
|
165
|
+
// value={newPassword}
|
|
166
|
+
// onChange={setNewPassword}
|
|
167
|
+
value={form.values.newPassword}
|
|
168
|
+
onChange={(event) => handleNewPasswordFields(event, 'newPassword')}
|
|
169
|
+
placeholder="New Password"
|
|
170
|
+
id="new-password"
|
|
171
|
+
label="New Password"
|
|
172
|
+
error={form.errors.newPassword}
|
|
173
|
+
required
|
|
174
|
+
/>
|
|
175
|
+
<PasswordInput
|
|
176
|
+
value={form.values.newPasswordConfirmation}
|
|
177
|
+
onChange={(event) => handleNewPasswordFields(event, 'newPasswordConfirmation')}
|
|
178
|
+
placeholder="New Password"
|
|
179
|
+
id="new-password-confirmation"
|
|
180
|
+
label="New Password Confirmation"
|
|
181
|
+
error={form.errors.newPasswordConfirmation}
|
|
182
|
+
required
|
|
183
|
+
/>
|
|
184
|
+
|
|
185
|
+
<Bars value={form.values.newPassword} />
|
|
186
|
+
|
|
187
|
+
<PasswordRequirement
|
|
188
|
+
label="Has at least 6 characters"
|
|
189
|
+
id="include-six-chars"
|
|
190
|
+
meets={form.values.newPassword.length > 5}
|
|
191
|
+
/>
|
|
192
|
+
{checks}
|
|
193
|
+
|
|
194
|
+
{errorMessage
|
|
195
|
+
&& <Text size="sm" color="red" mt="md" id="error-message" hidden={false}>{errorMessage}</Text>}
|
|
196
|
+
|
|
197
|
+
<Button
|
|
198
|
+
fullWidth
|
|
199
|
+
id="change-password"
|
|
200
|
+
mt="xl"
|
|
201
|
+
color="green"
|
|
202
|
+
type="submit"
|
|
203
|
+
>
|
|
204
|
+
Update password
|
|
205
|
+
</Button>
|
|
206
|
+
<LoadingOverlay
|
|
207
|
+
visible={loader}
|
|
208
|
+
transitionDuration={300}
|
|
209
|
+
overlayBlur={1}
|
|
210
|
+
loaderProps={{ color: 'green' }}
|
|
211
|
+
/>
|
|
212
|
+
</form>
|
|
213
|
+
</Paper>
|
|
214
|
+
</Container>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Paper,
|
|
4
|
+
Title,
|
|
5
|
+
Container,
|
|
6
|
+
Button,
|
|
7
|
+
Text,
|
|
8
|
+
} from '@mantine/core';
|
|
9
|
+
import { IconCircleCheck } from '@tabler/icons';
|
|
10
|
+
import { useDocumentTitle } from '@mantine/hooks';
|
|
11
|
+
|
|
12
|
+
export default function ChangePasswordSuccessForm() {
|
|
13
|
+
useDocumentTitle('Success');
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Container size={420} my={40}>
|
|
17
|
+
|
|
18
|
+
<Paper withBorder shadow="md" p={30} mt={30} radius="md">
|
|
19
|
+
<Text align="center" color="green"><IconCircleCheck size="6rem" /></Text>
|
|
20
|
+
<Title align="center">Success!</Title>
|
|
21
|
+
<Text align="center" size={16} mt="md">
|
|
22
|
+
Your Password has been changed. Please use your new password to login!
|
|
23
|
+
</Text>
|
|
24
|
+
<Button
|
|
25
|
+
fullWidth
|
|
26
|
+
id="submit"
|
|
27
|
+
mt="xl"
|
|
28
|
+
color="green"
|
|
29
|
+
type="submit"
|
|
30
|
+
component="a"
|
|
31
|
+
href="/auth/"
|
|
32
|
+
>
|
|
33
|
+
Sign In
|
|
34
|
+
</Button>
|
|
35
|
+
</Paper>
|
|
36
|
+
</Container>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TextInput,
|
|
4
|
+
PasswordInput,
|
|
5
|
+
Checkbox,
|
|
6
|
+
Paper,
|
|
7
|
+
Title,
|
|
8
|
+
Container,
|
|
9
|
+
Group,
|
|
10
|
+
Button,
|
|
11
|
+
Text,
|
|
12
|
+
LoadingOverlay,
|
|
13
|
+
} from '@mantine/core';
|
|
14
|
+
import { useSearchParams } from 'react-router-dom';
|
|
15
|
+
import { useForm } from '@mantine/form';
|
|
16
|
+
import ky from 'ky';
|
|
17
|
+
import { useState } from 'react';
|
|
18
|
+
import { useDocumentTitle } from '@mantine/hooks';
|
|
19
|
+
import { log } from '../../shared/utils';
|
|
20
|
+
import config from '../../config';
|
|
21
|
+
|
|
22
|
+
export default function LoginForm() {
|
|
23
|
+
useDocumentTitle('Login Page');
|
|
24
|
+
const form = useForm({
|
|
25
|
+
initialValues: {
|
|
26
|
+
email: '',
|
|
27
|
+
password: '',
|
|
28
|
+
rememberMe: true,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
validate: {
|
|
32
|
+
email: (val) => {
|
|
33
|
+
if ((val === 'Test') || (val === 'Administrator')) return null;
|
|
34
|
+
return (/^\S+@\S+$/.test(val) ? null : 'Invalid email');
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const [errorMessage, setErrorMessage] = useState('');
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line no-unused-vars
|
|
42
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
43
|
+
const [loader, setLoader] = useState(false);
|
|
44
|
+
const successRedirectUrl: string = searchParams.get('origin') || '/';
|
|
45
|
+
|
|
46
|
+
interface LoginFormData {
|
|
47
|
+
email: string,
|
|
48
|
+
password: string,
|
|
49
|
+
rememberMe: boolean,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// eslint-disable-next-line consistent-return
|
|
53
|
+
async function handleFormSubmissions(values: LoginFormData) {
|
|
54
|
+
try {
|
|
55
|
+
setErrorMessage('');
|
|
56
|
+
setLoader(true);
|
|
57
|
+
const resp = await ky(
|
|
58
|
+
`${config.baseUri}/v1/auth/login`,
|
|
59
|
+
{
|
|
60
|
+
throwHttpErrors: false,
|
|
61
|
+
method: 'POST',
|
|
62
|
+
credentials: 'include',
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
username: values.email,
|
|
65
|
+
password: values.password,
|
|
66
|
+
rememberMe: values.rememberMe,
|
|
67
|
+
}),
|
|
68
|
+
headers: {
|
|
69
|
+
'content-type': 'application/json',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
const result: { message: string } = await resp.json();
|
|
74
|
+
setLoader(false);
|
|
75
|
+
|
|
76
|
+
if (result.message === 'success') {
|
|
77
|
+
return window.location.assign(successRedirectUrl);
|
|
78
|
+
}
|
|
79
|
+
if (result.message) {
|
|
80
|
+
log.error(((typeof result) === 'object') ? JSON.stringify(result) : result.toString());
|
|
81
|
+
return setErrorMessage(result.message);
|
|
82
|
+
}
|
|
83
|
+
log.error(((typeof result) === 'object') ? JSON.stringify(result) : result.toString());
|
|
84
|
+
setErrorMessage('Connection error');
|
|
85
|
+
} catch (e: any) {
|
|
86
|
+
log.error(e.stack || e.toString());
|
|
87
|
+
setErrorMessage('Connection error');
|
|
88
|
+
} finally {
|
|
89
|
+
setLoader(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Container size={420} my={40}>
|
|
95
|
+
|
|
96
|
+
<Paper withBorder shadow="md" p={30} mt={30} radius="md">
|
|
97
|
+
<form
|
|
98
|
+
onSubmit={form.onSubmit((values) => handleFormSubmissions(values))}
|
|
99
|
+
>
|
|
100
|
+
<Title>Sign in</Title>
|
|
101
|
+
<TextInput
|
|
102
|
+
label="Email"
|
|
103
|
+
id="email"
|
|
104
|
+
placeholder="username@domain.com"
|
|
105
|
+
value={form.values.email}
|
|
106
|
+
onChange={(event) => form.setFieldValue('email', event.currentTarget.value)}
|
|
107
|
+
error={form.errors.email && 'Invalid email'}
|
|
108
|
+
required
|
|
109
|
+
/>
|
|
110
|
+
<PasswordInput
|
|
111
|
+
label="Password"
|
|
112
|
+
id="password"
|
|
113
|
+
placeholder="Your password"
|
|
114
|
+
value={form.values.password}
|
|
115
|
+
onChange={(event) => form.setFieldValue('password', event.currentTarget.value)}
|
|
116
|
+
required
|
|
117
|
+
mt="md"
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<Group position="apart" mt="md">
|
|
121
|
+
<Checkbox
|
|
122
|
+
label="Remember me"
|
|
123
|
+
onChange={(event) => form.setFieldValue('rememberMe', event.currentTarget.checked)}
|
|
124
|
+
/>
|
|
125
|
+
</Group>
|
|
126
|
+
{errorMessage
|
|
127
|
+
&& <Text size="sm" color="red" mt="md" id="error-message" hidden={false}>{errorMessage}</Text>}
|
|
128
|
+
|
|
129
|
+
<Button
|
|
130
|
+
fullWidth
|
|
131
|
+
id="submit"
|
|
132
|
+
mt="xl"
|
|
133
|
+
color="green"
|
|
134
|
+
type="submit"
|
|
135
|
+
>
|
|
136
|
+
Sign in
|
|
137
|
+
</Button>
|
|
138
|
+
<LoadingOverlay
|
|
139
|
+
visible={loader}
|
|
140
|
+
transitionDuration={300}
|
|
141
|
+
overlayBlur={1}
|
|
142
|
+
loaderProps={{ color: 'green' }}
|
|
143
|
+
/>
|
|
144
|
+
</form>
|
|
145
|
+
</Paper>
|
|
146
|
+
</Container>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useDocumentTitle } from '@mantine/hooks';
|
|
3
|
+
|
|
4
|
+
import ky from 'ky';
|
|
5
|
+
import {
|
|
6
|
+
Button, Container, LoadingOverlay, Paper, Text, Title,
|
|
7
|
+
} from '@mantine/core';
|
|
8
|
+
import { IconCircleCheck, IconCircleX } from '@tabler/icons';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
import { log } from '../../shared/utils';
|
|
12
|
+
import config from '../../config';
|
|
13
|
+
|
|
14
|
+
function LogoutForm() {
|
|
15
|
+
interface Query {
|
|
16
|
+
isLoading: boolean,
|
|
17
|
+
isError: boolean,
|
|
18
|
+
data: any,
|
|
19
|
+
error: any
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
useDocumentTitle('Logout page');
|
|
23
|
+
// const { classes } = useStyle();
|
|
24
|
+
useEffect(
|
|
25
|
+
() => {
|
|
26
|
+
ky(`${config.baseUri}/v1/auth/logout`);
|
|
27
|
+
},
|
|
28
|
+
[],
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const logoutInfo: Query = useQuery(
|
|
32
|
+
['logout'],
|
|
33
|
+
() => ky(`${config.baseUri}/v1/auth/logout`).then((res) => res.json()),
|
|
34
|
+
{
|
|
35
|
+
refetchOnWindowFocus: false,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
const userInfo: Query = useQuery(
|
|
39
|
+
['current_user', logoutInfo],
|
|
40
|
+
() => ky(`${config.baseUri}/v1/users/current`).then((res) => res.json()),
|
|
41
|
+
{
|
|
42
|
+
refetchOnWindowFocus: false,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (userInfo.isError) {
|
|
47
|
+
log.error(userInfo.error);
|
|
48
|
+
}
|
|
49
|
+
const success = !userInfo.isLoading && Object.keys(userInfo.data).length === 0;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Container size={420} my={40}>
|
|
53
|
+
|
|
54
|
+
<LoadingOverlay
|
|
55
|
+
visible={userInfo.isLoading}
|
|
56
|
+
transitionDuration={300}
|
|
57
|
+
overlayBlur={1}
|
|
58
|
+
loaderProps={{ color: 'green' }}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<Paper withBorder shadow="md" p={30} mt={30} radius="md" hidden={userInfo.isLoading}>
|
|
62
|
+
{
|
|
63
|
+
success
|
|
64
|
+
? <Text align="center" color="green"><IconCircleCheck size="6rem" /></Text>
|
|
65
|
+
: <Text align="center" color="red"><IconCircleX size="6rem" /></Text>
|
|
66
|
+
}
|
|
67
|
+
<Title align="center">{success ? 'Success!' : 'Failed'}</Title>
|
|
68
|
+
<Text align="center" size={16} mt="md">
|
|
69
|
+
{success
|
|
70
|
+
? 'You have been successfully logged out. Click Sign In to login again.'
|
|
71
|
+
: 'Something went wrong'}
|
|
72
|
+
</Text>
|
|
73
|
+
<Button
|
|
74
|
+
fullWidth
|
|
75
|
+
id="submit"
|
|
76
|
+
mt="xl"
|
|
77
|
+
color="green"
|
|
78
|
+
type="submit"
|
|
79
|
+
component="a"
|
|
80
|
+
href="/auth/"
|
|
81
|
+
>
|
|
82
|
+
Sign In
|
|
83
|
+
</Button>
|
|
84
|
+
</Paper>
|
|
85
|
+
</Container>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default LogoutForm;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Group, Switch, useMantineTheme } from '@mantine/core';
|
|
2
|
+
import { IconSun, IconMoonStars } from '@tabler/icons';
|
|
3
|
+
|
|
4
|
+
import React, { ReactElement } from 'react';
|
|
5
|
+
|
|
6
|
+
function ToggleThemeButton({ colorScheme, toggleColorScheme }: any): ReactElement {
|
|
7
|
+
const dark = colorScheme === 'dark';
|
|
8
|
+
const theme = useMantineTheme();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Group
|
|
12
|
+
mr={28}
|
|
13
|
+
position="right"
|
|
14
|
+
title={`Switch to ${dark ? 'light' : 'dark'} theme`}
|
|
15
|
+
>
|
|
16
|
+
<Switch
|
|
17
|
+
data-test="theme-button"
|
|
18
|
+
size="md"
|
|
19
|
+
styles={
|
|
20
|
+
() => (
|
|
21
|
+
{
|
|
22
|
+
track: {
|
|
23
|
+
backgroundColor: theme.colors.gray[8],
|
|
24
|
+
borderColor: theme.colors.gray[8],
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
color="gray.8"
|
|
30
|
+
checked={colorScheme === 'light'}
|
|
31
|
+
onChange={() => {
|
|
32
|
+
toggleColorScheme();
|
|
33
|
+
}}
|
|
34
|
+
onLabel={<IconSun size={16} stroke={2.5} color={theme.colors.yellow[4]} />}
|
|
35
|
+
offLabel={<IconMoonStars size={16} stroke={2.5} color={theme.colors.blue[6]} />}
|
|
36
|
+
/>
|
|
37
|
+
</Group>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default ToggleThemeButton;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
import { Group, Progress } from '@mantine/core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import requirements from './requirements';
|
|
5
|
+
|
|
6
|
+
export default function Bars({ value }: { value: string }) {
|
|
7
|
+
function getStrength(password: string): number {
|
|
8
|
+
let multiplier = password.length > 5 ? 0 : 1;
|
|
9
|
+
|
|
10
|
+
requirements.forEach((requirement) => {
|
|
11
|
+
if (!requirement.re.test(password)) {
|
|
12
|
+
multiplier += 1;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return Math.max(100 - (100 / (requirements.length + 1)) * multiplier, 0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const strength = getStrength(value);
|
|
20
|
+
|
|
21
|
+
const bars = Array(4)
|
|
22
|
+
.fill(0)
|
|
23
|
+
.map((_, index) => (
|
|
24
|
+
<Progress
|
|
25
|
+
styles={{ bar: { transitionDuration: '0ms' } }}
|
|
26
|
+
value={
|
|
27
|
+
(value.length > 0 && index === 0)
|
|
28
|
+
? 100
|
|
29
|
+
: strength >= ((index + 1) / 4) * 100 ? 100 : 0
|
|
30
|
+
}
|
|
31
|
+
color={
|
|
32
|
+
strength > 80
|
|
33
|
+
? 'teal'
|
|
34
|
+
: (strength > 50 ? 'yellow' : 'red')
|
|
35
|
+
}
|
|
36
|
+
key={index}
|
|
37
|
+
size={4}
|
|
38
|
+
/>
|
|
39
|
+
));
|
|
40
|
+
return (
|
|
41
|
+
<Group spacing={5} grow mt="xs" mb="md">
|
|
42
|
+
{bars}
|
|
43
|
+
</Group>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, Text, Center } from '@mantine/core';
|
|
3
|
+
import { IconCheck, IconX } from '@tabler/icons';
|
|
4
|
+
|
|
5
|
+
export default function PasswordRequirement({ meets, label, id }: { meets: boolean; label: string, id: string }) {
|
|
6
|
+
return (
|
|
7
|
+
<Text color={meets ? 'teal' : 'red'} mt={5} size="sm" id={id}>
|
|
8
|
+
<Center inline>
|
|
9
|
+
{meets ? <IconCheck size={14} stroke={1.5} /> : <IconX size={14} stroke={1.5} />}
|
|
10
|
+
<Box ml={7}>{label}</Box>
|
|
11
|
+
</Center>
|
|
12
|
+
</Text>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{ re: /[0-9]/, label: 'Includes number', id: 'include-numbers' },
|
|
3
|
+
{ re: /[a-z]/, label: 'Includes lowercase letter', id: 'include-lowercase' },
|
|
4
|
+
{ re: /[A-Z]/, label: 'Includes uppercase letter', id: 'include-uppercase' },
|
|
5
|
+
{ re: /[$&+,:;=?@#|'<>.^*()%!-]/, label: 'Includes special symbol', id: 'include-special' },
|
|
6
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" style="height: 100%">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport"
|
|
6
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
<link rel="stylesheet" href="../asserts/css/styles.css">
|
|
9
|
+
<link rel="icon" href="../asserts/images/favicon.svg">
|
|
10
|
+
<title>Syngrisi</title>
|
|
11
|
+
</head>
|
|
12
|
+
<div></div>
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root" style="position: relative; overflow-y: scroll; height: 100%"></div>
|
|
15
|
+
<script type="module" src="./main.tsx"></script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
4
|
+
import App from './App';
|
|
5
|
+
|
|
6
|
+
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
|
7
|
+
<React.StrictMode>
|
|
8
|
+
<BrowserRouter>
|
|
9
|
+
<App />
|
|
10
|
+
</BrowserRouter>
|
|
11
|
+
</React.StrictMode>,
|
|
12
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LogoutForm from './components/LogoutForm';
|
|
3
|
+
import ChangePasswordForm from './components/ChangePasswordForm';
|
|
4
|
+
import LoginForm from './components/LoginForm';
|
|
5
|
+
import ChangePasswordSuccessForm from './components/ChangePasswordSuccessForm';
|
|
6
|
+
|
|
7
|
+
const routesItems = [
|
|
8
|
+
{
|
|
9
|
+
path: '/auth/logout',
|
|
10
|
+
element: <LogoutForm />,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: '/auth/change',
|
|
14
|
+
element: <ChangePasswordForm />,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
path: '/auth/changeSuccess',
|
|
18
|
+
element: <ChangePasswordSuccessForm />,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
path: '/auth/',
|
|
22
|
+
element: <LoginForm />,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export default routesItems;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable import/no-relative-packages */
|
|
2
|
+
import ky from 'ky';
|
|
3
|
+
import * as devices from '../server/data/devices.json';
|
|
4
|
+
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const baseUrl: any = import.meta.env.VITE_SYNGRISI_BASED_URL || '';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const indexRoute: any = import.meta.env.VITE_INDEX_ROUTE || '/';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
baseUri: baseUrl,
|
|
12
|
+
devices: devices.default,
|
|
13
|
+
customDevicesProm: ky(`${baseUrl}/static/data/custom_devices.json`).json(),
|
|
14
|
+
indexRoute,
|
|
15
|
+
};
|