From df947537e45010c579cb63e40088b70c141045a7 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 11:18:14 +0330 Subject: [PATCH 01/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78ca1fd..61ebb05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,24 +1,26 @@ image: node:latest stages: - - build - - test - -before_script: - - npm install + - build + - test build: - stage: build - script: - - echo "Run build project" - - npm run build - only: - - merge_requests + stage: build + script: + - npm install + - npm run build + only: + - merge_requests + artifacts: + paths: + - node_modules test: - stage: test - script: - - echo "Run test project" - - npm run test - only: - - merge_requests \ No newline at end of file + stage: test + script: + - npm run test + only: + - merge_requests + artifacts: + paths: + - node_modules \ No newline at end of file From 9c10d5b249c8ddf768bb14935af82d91b3652151 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 07:57:37 +0000 Subject: [PATCH 02/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 59 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61ebb05..cd22071 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,47 @@ image: node:latest stages: - - build - - test + - build + - test + +merge:build: + stage: build + script: + - echo "Run build project" + - npm install + - npm run build + only: + - merge_requests + artifacts: + paths: + - node_modules + +merge:test: + stage: test + script: + - echo "Run test project" + - npm run test + only: + - merge_requests + artifacts: + paths: + - node_modules build: - stage: build - script: - - npm install - - npm run build - only: - - merge_requests - artifacts: - paths: - - node_modules + stage: build + script: + - echo "Run build project" + - npm install + - npm run build + artifacts: + paths: + - node_modules test: - stage: test - script: - - npm run test - only: - - merge_requests - artifacts: - paths: - - node_modules \ No newline at end of file + stage: test + script: + - echo "Run test project" + - npm run test + artifacts: + paths: + - node_modules \ No newline at end of file From 2a2be7615c166df50766bfe6b35427c9946108e4 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 08:12:14 +0000 Subject: [PATCH 03/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cd22071..4d5868d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: node:latest stages: - build - test + - deploy merge:build: stage: build @@ -33,6 +34,9 @@ build: - echo "Run build project" - npm install - npm run build + only: + - develop + - main artifacts: paths: - node_modules @@ -42,6 +46,16 @@ test: script: - echo "Run test project" - npm run test + only: + - develop + - main artifacts: paths: - - node_modules \ No newline at end of file + - node_modules + +deploy: + stage: deploy + script: + - echo "Run deploy project" + only: + - main \ No newline at end of file From 99782ad72dff8c2c58ec42888ec9f18623446eba Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 08:35:59 +0000 Subject: [PATCH 04/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 53 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d5868d..29b710d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,24 +3,22 @@ image: node:latest stages: - build - test + - test:build - deploy merge:build: stage: build script: - - echo "Run build project" - npm install - - npm run build only: - merge_requests artifacts: paths: - node_modules -merge:test: +merge:test:jest: stage: test script: - - echo "Run test project" - npm run test only: - merge_requests @@ -28,12 +26,30 @@ merge:test: paths: - node_modules +merge:test:lint: + stage: test + script: + - npm run lint + only: + - merge_requests + artifacts: + paths: + - node_modules + +merge:test:build: + stage: test:build + script: + - npm run build + only: + - merge_requests + artifacts: + paths: + - node_modules + build: stage: build script: - - echo "Run build project" - npm install - - npm run build only: - develop - main @@ -41,10 +57,9 @@ build: paths: - node_modules -test: +test:jest: stage: test script: - - echo "Run test project" - npm run test only: - develop @@ -53,6 +68,28 @@ test: paths: - node_modules +test:lint: + stage: test + script: + - npm run lint + only: + - develop + - main + artifacts: + paths: + - node_modules + +test:build: + stage: test:build + script: + - npm run build + only: + - develop + - main + artifacts: + paths: + - node_modules + deploy: stage: deploy script: From 45f4aa0c3152c1c66297075c2d196e9209a4c813 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 08:49:12 +0000 Subject: [PATCH 05/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 29b710d..d06637a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,8 @@ merge:build: stage: build script: - npm install + - cp example.env.local .env.local + - cp example.env.local .env.test only: - merge_requests artifacts: @@ -50,6 +52,8 @@ build: stage: build script: - npm install + - cp example.env.local .env.local + - cp example.env.local .env.test only: - develop - main From f0a2a9383fd000c29383e92a1e8aebf8c4c1ffd6 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 08:54:37 +0000 Subject: [PATCH 06/10] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d06637a..d06af2b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,8 @@ merge:build: artifacts: paths: - node_modules + - .env.local + - .env.test merge:test:jest: stage: test @@ -27,6 +29,8 @@ merge:test:jest: artifacts: paths: - node_modules + - .env.local + - .env.test merge:test:lint: stage: test @@ -37,6 +41,8 @@ merge:test:lint: artifacts: paths: - node_modules + - .env.local + - .env.test merge:test:build: stage: test:build @@ -47,6 +53,8 @@ merge:test:build: artifacts: paths: - node_modules + - .env.local + - .env.test build: stage: build @@ -60,6 +68,8 @@ build: artifacts: paths: - node_modules + - .env.local + - .env.test test:jest: stage: test @@ -71,6 +81,8 @@ test:jest: artifacts: paths: - node_modules + - .env.local + - .env.test test:lint: stage: test @@ -82,6 +94,8 @@ test:lint: artifacts: paths: - node_modules + - .env.local + - .env.test test:build: stage: test:build @@ -93,6 +107,8 @@ test:build: artifacts: paths: - node_modules + - .env.local + - .env.test deploy: stage: deploy From 4700ea2d20aafaea0c3b159ad6358d0da058f910 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 13:11:37 +0330 Subject: [PATCH 07/10] Update .eslintrc.json file --- .eslintrc.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c4f29da..cb6d4e4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,5 @@ { "extends": [ - "next/core-web-vitals", - "plugin:testing-library/react", - "plugin:jest-dom/recommended" + "next/core-web-vitals" ] } From e6914bb8ad77f2ab255d4ad5e91fa06e5d25fd99 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 13:54:19 +0330 Subject: [PATCH 08/10] CFE-27 fixed mui bugs --- .../CallWidget/CallWidgetDialog/CallTabs/index.jsx | 2 +- src/components/layouts/Dashboard/Header/index.jsx | 4 +++- src/core/components/LoadingHardPage.jsx | 3 ++- src/core/components/StyledForm.jsx | 2 +- src/core/components/svgs/Svg403.jsx | 2 +- src/core/components/svgs/Svg404.jsx | 2 +- src/core/components/svgs/SvgChangePassword.jsx | 2 +- src/core/components/svgs/SvgDashboard.jsx | 4 ++-- src/core/components/svgs/SvgLoading.jsx | 2 +- src/core/components/svgs/SvgLogin.jsx | 2 +- src/core/data/apiRoutes.js | 6 ++++++ 11 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx index 4e1d2f1..9fd0111 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx @@ -1,6 +1,6 @@ -import CallTabsList from "src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList"; import CallTabPanel from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel"; import useAnswers from "@/lib/callWidget/hooks/useAnswers"; +import CallTabsList from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/callTabsList"; const CallTabs = () => { const {answersList} = useAnswers() diff --git a/src/components/layouts/Dashboard/Header/index.jsx b/src/components/layouts/Dashboard/Header/index.jsx index 8760960..e8af065 100644 --- a/src/components/layouts/Dashboard/Header/index.jsx +++ b/src/components/layouts/Dashboard/Header/index.jsx @@ -1,6 +1,8 @@ import MenuIcon from "@mui/icons-material/Menu"; -import {AppBar, Box, Container, CssBaseline, IconButton, Stack, Toolbar, useTheme} from "@mui/material"; import ProfileMenu from "./ProfileMenu"; +import {useTheme} from "@mui/material/styles"; +import CssBaseline from "@mui/material/CssBaseline"; +import {AppBar, Box, Container, IconButton, Stack, Toolbar} from "@mui/material"; function Header({drawerWidth, handleDrawerToggle}) { const theme = useTheme(); diff --git a/src/core/components/LoadingHardPage.jsx b/src/core/components/LoadingHardPage.jsx index 4bbdbf4..5d00cd0 100644 --- a/src/core/components/LoadingHardPage.jsx +++ b/src/core/components/LoadingHardPage.jsx @@ -1,5 +1,6 @@ -import {Backdrop, Box, styled} from "@mui/material"; import SvgLoading from "@/core/components/svgs/SvgLoading"; +import {Backdrop, Box} from "@mui/material"; +import {styled} from "@mui/material/styles"; const LoadingImage = styled(Box)({ "@keyframes load": { diff --git a/src/core/components/StyledForm.jsx b/src/core/components/StyledForm.jsx index 41eeabc..253fc12 100644 --- a/src/core/components/StyledForm.jsx +++ b/src/core/components/StyledForm.jsx @@ -1,5 +1,5 @@ -import {styled} from "@mui/material"; import {Form} from "formik"; +import {styled} from "@mui/material/styles"; const StyledForm = styled(Form)``; diff --git a/src/core/components/svgs/Svg403.jsx b/src/core/components/svgs/Svg403.jsx index 720828c..d706ed0 100644 --- a/src/core/components/svgs/Svg403.jsx +++ b/src/core/components/svgs/Svg403.jsx @@ -1,4 +1,4 @@ -import {useTheme} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; const Svg403 = ({width, height}) => { const theme = useTheme() diff --git a/src/core/components/svgs/Svg404.jsx b/src/core/components/svgs/Svg404.jsx index e46ab12..159d7c6 100644 --- a/src/core/components/svgs/Svg404.jsx +++ b/src/core/components/svgs/Svg404.jsx @@ -1,4 +1,4 @@ -import {useTheme} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; const Svg404 = ({width, height}) => { const theme = useTheme() diff --git a/src/core/components/svgs/SvgChangePassword.jsx b/src/core/components/svgs/SvgChangePassword.jsx index a7ee82f..1221d28 100644 --- a/src/core/components/svgs/SvgChangePassword.jsx +++ b/src/core/components/svgs/SvgChangePassword.jsx @@ -1,4 +1,4 @@ -import {useTheme} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; const SvgChangePassword = ({width, height}) => { const theme = useTheme() diff --git a/src/core/components/svgs/SvgDashboard.jsx b/src/core/components/svgs/SvgDashboard.jsx index a5b40e0..a636bf4 100644 --- a/src/core/components/svgs/SvgDashboard.jsx +++ b/src/core/components/svgs/SvgDashboard.jsx @@ -1,9 +1,9 @@ -import {useTheme} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; const SvgDashboard = ({width, height}) => { const theme = useTheme() const fillColor = theme.palette.primary.main - + return ( diff --git a/src/core/components/svgs/SvgLoading.jsx b/src/core/components/svgs/SvgLoading.jsx index f9cea4a..9ff61ff 100644 --- a/src/core/components/svgs/SvgLoading.jsx +++ b/src/core/components/svgs/SvgLoading.jsx @@ -1,4 +1,4 @@ -import {useTheme} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; const SvgLoading = ({width, height}) => { const theme = useTheme() diff --git a/src/core/components/svgs/SvgLogin.jsx b/src/core/components/svgs/SvgLogin.jsx index 643c195..edf3b51 100644 --- a/src/core/components/svgs/SvgLogin.jsx +++ b/src/core/components/svgs/SvgLogin.jsx @@ -1,4 +1,4 @@ -import {useTheme} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; const SvgLogin = ({width, height}) => { const theme = useTheme() diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 4d0231f..66e839d 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -4,6 +4,10 @@ const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL; export const GET_USER_TOKEN = BASE_URL + "/api/auth/login"; //end login +//edit profile +export const UPDATE_AVATAR = BASE_URL + ""; +//end edit profile + //change password export const SET_USER_PASSWORD = BASE_URL + "/api/profile/change_password"; //end change password @@ -12,6 +16,8 @@ export const SET_USER_PASSWORD = BASE_URL + "/api/profile/change_password"; export const GET_USER_ROUTE = BASE_URL + "/api/profile/info"; //user data +export const GET_SIDEBAR_NOTIFICATION = BASE_URL + ""; + // role management export const GET_ROLE_MANAGEMENT = BASE_URL + "/api/roles" From b7d60d687f9c52d855221463789d84cf8f2947ec Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 14:04:08 +0330 Subject: [PATCH 09/10] CFE-27 fixed mui bugs --- .../CallTabs/{callTabsList => CallTabsList}/CallTabLabel.jsx | 0 .../CallTabs/{callTabsList => CallTabsList}/index.jsx | 0 .../Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/{callTabsList => CallTabsList}/CallTabLabel.jsx (100%) rename src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/{callTabsList => CallTabsList}/index.jsx (100%) diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/callTabsList/CallTabLabel.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabLabel.jsx similarity index 100% rename from src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/callTabsList/CallTabLabel.jsx rename to src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabLabel.jsx diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/callTabsList/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/index.jsx similarity index 100% rename from src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/callTabsList/index.jsx rename to src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/index.jsx diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx index 9fd0111..8a96506 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/index.jsx @@ -1,6 +1,6 @@ import CallTabPanel from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel"; import useAnswers from "@/lib/callWidget/hooks/useAnswers"; -import CallTabsList from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/callTabsList"; +import CallTabsList from "src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList"; const CallTabs = () => { const {answersList} = useAnswers() From 4ba0e92e8e9597704eea4056a4f1ef063782a2fd Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 15 Oct 2023 14:17:29 +0330 Subject: [PATCH 10/10] CFE-27 fixed mocks bug --- mocks/handler.js | 27 +++++++++++++++++++-------- src/core/data/apiRoutes.js | 5 ++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/mocks/handler.js b/mocks/handler.js index 8d22664..b9ae85f 100644 --- a/mocks/handler.js +++ b/mocks/handler.js @@ -1,17 +1,28 @@ -import {GET_PERMISSIONS_LIST, GET_ROLE_MANAGEMENT, GET_USER_ROUTE, SET_USER_PASSWORD} from "@/core/data/apiRoutes"; +import { + GET_PERMISSIONS_LIST, + GET_ROLE_MANAGEMENT, + GET_SIDEBAR_NOTIFICATION, + GET_USER_ROUTE, + SET_USER_PASSWORD +} from "@/core/data/apiRoutes"; import {rest} from "msw"; export const handler = [ rest.get(GET_USER_ROUTE, (req, res, ctx) => { return res(ctx.json({ - data:{ + data: { id: 10, - permissions:[ + permissions: [ "manage_users" ], } })) }), + rest.get(GET_SIDEBAR_NOTIFICATION, (req, res, ctx) => { + return res(ctx.json({ + data: [] + })) + }), rest.post(SET_USER_PASSWORD, (req, res, ctx) => { return res( ctx.status(200), @@ -20,7 +31,7 @@ export const handler = [ rest.get(GET_PERMISSIONS_LIST, (req, res, ctx) => { return res(ctx.json( { - data:[ + data: [ { id: 1, name: "manage_passenger_office_navgan", @@ -29,7 +40,7 @@ export const handler = [ { id: 2, name: "manage_province_working_group_navgan", - name_fa:"مدیریت کارتابل کارگروه استانی" + name_fa: "مدیریت کارتابل کارگروه استانی" } ] } @@ -39,7 +50,7 @@ export const handler = [ return res( ctx.json( { - data : [ + data: [ { created_at: "2023-10-01T07:20:07.000000Z", guard_name: "api", @@ -77,8 +88,8 @@ export const handler = [ updated_at: "2023-10-10T07:38:12.000000Z" } ], - meta : { - totalRowCount : 2 + meta: { + totalRowCount: 2 } } ), diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 66e839d..1a6e89c 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -16,7 +16,10 @@ export const SET_USER_PASSWORD = BASE_URL + "/api/profile/change_password"; export const GET_USER_ROUTE = BASE_URL + "/api/profile/info"; //user data -export const GET_SIDEBAR_NOTIFICATION = BASE_URL + ""; +//sidebar notification +export const GET_SIDEBAR_NOTIFICATION = BASE_URL + "/dashboard/notification" +//sidebar notification + // role management export const GET_ROLE_MANAGEMENT =