Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
959d2099
Commit
959d2099
authored
Dec 12, 2022
by
Ibadullina Inabat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
на доработке кнопка удаления участника
parent
8f1aa7fe
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
8 deletions
+18
-8
projects.ts
planner-api/src/routers/projects.ts
+2
-1
MemberForm.js
planner-front/src/components/MemberForm/MemberForm.js
+1
-1
ProjectMembersItem.js
...rojectComponents/ProjectMembersItem/ProjectMembersItem.js
+11
-4
ProjectMembersList.js
...rojectComponents/ProjectMembersList/ProjectMembersList.js
+1
-0
projectsActions.js
planner-front/src/store/actions/projectsActions.js
+3
-2
No files found.
planner-api/src/routers/projects.ts
View file @
959d2099
...
@@ -143,7 +143,8 @@ router.post('/add-user/', authAdminProject, async (req: Request, res: Response):
...
@@ -143,7 +143,8 @@ router.post('/add-user/', authAdminProject, async (req: Request, res: Response):
/** Remove user from specific project by userId */
/** Remove user from specific project by userId */
router
.
delete
(
'/remove-user/:userId'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
delete
(
'/remove-user/:userId'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
projectId
}
=
req
.
body
;
console
.
log
(
'req '
,
req
)
const
{
projectId
}
=
req
.
body
.
data
;
const
{
userId
}
=
req
.
params
;
const
{
userId
}
=
req
.
params
;
try
{
try
{
await
dataSource
await
dataSource
...
...
planner-front/src/components/MemberForm/MemberForm.js
View file @
959d2099
...
@@ -52,7 +52,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -52,7 +52,7 @@ const MemberForm = ({ onSubmit, members }) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProject
(
params
.
id
))
dispatch
(
fetchProject
(
params
.
id
))
},
[
members
,
dispatch
,
params
]);
},
[]);
// console.log(user)
// console.log(user)
// const onChange = (e) => {
// const onChange = (e) => {
// const value = e.target.value;
// const value = e.target.value;
...
...
planner-front/src/components/ProjectComponents/ProjectMembersItem/ProjectMembersItem.js
View file @
959d2099
import
{
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
,
Tooltip
}
from
"@mui/material"
;
import
{
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
,
Tooltip
}
from
"@mui/material"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
,
useParams
}
from
"react-router-dom"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
deleteMember
}
from
"../../../store/actions/projectsActions"
;
const
ProjectMembersItem
=
({
displayName
,
roleProject
,
id
,
roleProjectOfAuthor
})
=>
{
const
ProjectMembersItem
=
({
displayName
,
roleProject
,
id
,
roleProjectOfAuthor
,
userId
})
=>
{
console
.
log
(
displayName
)
console
.
log
(
displayName
)
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
user
=
useSelector
(
state
=>
state
.
users
)
const
user
=
useSelector
(
state
=>
state
.
users
)
console
.
log
(
user
)
let
params
=
useParams
()
console
.
log
(
params
)
console
.
log
(
userId
)
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
deleteHandle
=
(
userId
,
projectId
)
=>
{
dispatch
(
deleteMember
(
userId
,
params
.
id
));
};
return
<>
return
<>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
lg
=
{
4
}
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
6
}
lg
=
{
4
}
>
<
Card
>
<
Card
>
...
@@ -30,7 +37,7 @@ const ProjectMembersItem = ({ displayName, roleProject, id, roleProjectOfAuthor
...
@@ -30,7 +37,7 @@ const ProjectMembersItem = ({ displayName, roleProject, id, roleProjectOfAuthor
<
Tooltip
title
=
"Удалить"
>
<
Tooltip
title
=
"Удалить"
>
<
IconButton
<
IconButton
onClick
=
{(
id
)
=>
{
onClick
=
{(
id
)
=>
{
// deleteHandle(task.i
d);
deleteHandle
(
userI
d
);
}}
}}
>
>
<
DeleteIcon
style
=
{{
marginTop
:
"-5px"
}}
/
>
<
DeleteIcon
style
=
{{
marginTop
:
"-5px"
}}
/
>
...
...
planner-front/src/components/ProjectComponents/ProjectMembersList/ProjectMembersList.js
View file @
959d2099
...
@@ -12,6 +12,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
...
@@ -12,6 +12,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
id
=
{
member
.
id
}
id
=
{
member
.
id
}
key
=
{
member
.
id
}
key
=
{
member
.
id
}
roleProjectOfAuthor
=
{
roleProjectOfAuthor
}
roleProjectOfAuthor
=
{
roleProjectOfAuthor
}
userId
=
{
member
.
user
.
id
}
/
>
/
>
})}
})}
<
/Grid
>
<
/Grid
>
...
...
planner-front/src/store/actions/projectsActions.js
View file @
959d2099
...
@@ -35,11 +35,12 @@ const deleteMemberRequest = () => {
...
@@ -35,11 +35,12 @@ const deleteMemberRequest = () => {
return
{
type
:
DELETE_MEMBER_FAILURE
,
error
}
return
{
type
:
DELETE_MEMBER_FAILURE
,
error
}
};
};
export
const
deleteMember
=
(
memberId
)
=>
{
export
const
deleteMember
=
(
memberId
,
projectId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteMemberRequest
());
dispatch
(
deleteMemberRequest
());
try
{
try
{
await
axios
.
delete
(
`/tasks/
${
memberId
}
`
);
const
response
=
await
axios
.
delete
(
`/projects/remove-user/
${
memberId
}
`
,
{
data
:
{
projectId
:
projectId
}});
console
.
log
(
response
.
data
)
dispatch
(
deleteMemberSuccess
())
dispatch
(
deleteMemberSuccess
())
dispatch
(
fetchProject
())
dispatch
(
fetchProject
())
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment