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
604159dd
Commit
604159dd
authored
Jan 15, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#154
Изменил все запросы под текущую таблицу
parent
9021b8a9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
85 deletions
+56
-85
tasks.ts
planner-api/src/routers/tasks.ts
+1
-0
MyTaskNewTaskForm.js
...asksTableContainer/MyTaskNewTaskForm/MyTaskNewTaskForm.js
+5
-25
EditRow.js
...eContainer/MyTasksTableBody/MyTasksRow/EditRow/EditRow.js
+4
-14
MyTasksRow.js
...sTableContainer/MyTasksTableBody/MyTasksRow/MyTasksRow.js
+3
-3
MyTasksTableHead.js
...yTasksTableContainer/MyTasksTableHead/MyTasksTableHead.js
+3
-3
MyTasksTableToolbar.js
...asksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
+1
-1
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+24
-36
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+1
-1
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+1
-1
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+13
-1
No files found.
planner-api/src/routers/tasks.ts
View file @
604159dd
...
...
@@ -29,6 +29,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
router
.
post
(
'/'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
,
calendar
}
=
req
.
body
;
console
.
log
(
'dateTimeStart
\
n'
,
dateTimeStart
,
"dateTimeDue
\n
"
,
dateTimeDue
,
'dateTimeDeadLine
\
n '
,
dateTimeDeadLine
)
console
.
log
(
req
.
body
)
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeStartFinal
=
dateTimeStart
let
dateTimeDeadlineFinal
=
dateTimeDeadLine
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTaskNewTaskForm/MyTaskNewTaskForm.js
View file @
604159dd
import
{
Box
,
Divider
,
Grid
,
IconButton
,
TextField
,
Tooltip
,
Typography
,
}
from
"@mui/material"
;
import
{
styled
}
from
'@mui/material/styles'
;
import
{
memo
,
useMemo
}
from
"react"
;
import
{
memo
}
from
"react"
;
import
{
priorities
}
from
"../../../../constants"
;
import
CustomSelect
from
"../../../UI/СustomSelect/СustomSelect"
import
MaterialUIPickers
from
"../DateTimePicker/DateTimePicker"
;
...
...
@@ -18,14 +18,6 @@ const StyledTooltip = styled(({ className, ...props }) => (
function
MyTaskNewTaskForm
({
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChangeHandler
,
createNewTaskHandler
})
{
const
workers
=
useMemo
(()
=>
{
if
(
newTask
?.
project
)
{
return
newTask
?.
project
?.
members
.
map
((
member
)
=>
{
return
{
value
:
member
.
user
,
text
:
member
.
user
.
displayName
}
})
}
else
{
return
[{
value
:
''
,
text
:
'Выберите проект'
}]
}
},
[
newTask
?.
project
])
return
(
<
Box
sx
=
{{
...
...
@@ -44,11 +36,10 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
}}
>
<
Grid
container
padding
=
{
2
}
>
<
Grid
item
xs
=
{
1
}
>
Приоритеты
<
/Grid
>
<
Grid
item
xs
=
{
3.
5
}
>
Заголовок
<
/Grid
>
<
Grid
item
xs
=
{
5
}
>
Заголовок
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
Проект
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
Исполнитель
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
Дедлайн
<
/Grid
>
<
Grid
item
xs
=
{
0.5
}
><
/Grid
>
<
Grid
item
xs
=
{
1
}
><
/Grid
>
<
/Grid
>
<
Grid
container
padding
=
{
2
}
alignItems
=
'center'
>
<
Grid
item
xs
=
{
1
}
>
...
...
@@ -63,7 +54,7 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
sx
=
{{
width
:
'90%'
}}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
3.
5
}
>
<
Grid
item
xs
=
{
5
}
>
<
StyledTooltip
title
=
{
<
TextField
id
=
"task-description"
...
...
@@ -98,17 +89,6 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
sx
=
{{
width
:
'90%'
}}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
<
CustomSelect
value
=
{
newTask
.
executor
}
name
=
{
'executor'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeNewTaskHandler
}
id
=
{
'executor'
}
items
=
{
workers
}
sx
=
{{
width
:
'90%'
}}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
<
MaterialUIPickers
task
=
{
newTask
}
...
...
@@ -116,7 +96,7 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
onChange
=
{
onDateChangeHandler
}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
0.5
}
>
<
Grid
item
xs
=
{
1
}
>
<
IconButton
disabled
=
{
!
isValidate
(
newTask
.
title
,
newTask
.
description
)}
onClick
=
{
createNewTaskHandler
}
>
<
Save
/>
<
/IconButton
>
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/EditRow/EditRow.js
View file @
604159dd
import
{
TableCell
,
TextField
,
Tooltip
}
from
"@mui/material"
;
import
moment
from
"moment"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
{
memo
}
from
"react"
;
import
{
accomplishStatuses
,
priorities
}
from
"../../../../../../constants"
;
import
CustomSelect
from
"../../../../../UI/СustomSelect/СustomSelect"
import
{
styled
}
from
'@mui/material/styles'
;
...
...
@@ -15,16 +15,6 @@ const StyledTooltip = styled(({ className, ...props }) => (
`
;
function
EditRow
({
buttons
,
dateTimeTasks
,
onChangeCurrentTaskHandler
,
currentTask
,
allUserProjectsForModalTask
,
onDateChangeEditHandler
,
user
})
{
const
workers
=
useMemo
(()
=>
{
if
(
currentTask
?.
project
)
{
currentTask
.
project
=
allUserProjectsForModalTask
.
find
((
project
)
=>
project
?.
value
?.
id
===
currentTask
?.
project
?.
id
)?.
value
const
arrUsers
=
currentTask
?.
project
?.
members
.
map
((
member
)
=>
{
return
{
value
:
member
.
user
,
text
:
member
.
user
.
displayName
}
})
arrUsers
.
push
({
value
:
''
,
text
:
'Никто'
})
return
arrUsers
}
else
{
return
[{
value
:
''
,
text
:
'Выберите проект'
}]
}
},
[
allUserProjectsForModalTask
,
currentTask
])
return
(
<>
...
...
@@ -45,7 +35,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
currentTask
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
Tooltip
title
=
{
currentTask
.
description
}
>
<
TableCell
sx
=
{{
width
:
'2
5
%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
<
TableCell
sx
=
{{
width
:
'2
8
%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
<
StyledTooltip
title
=
{
<
TextField
...
...
@@ -72,7 +62,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
:
currentTask
.
title
}
<
/TableCell
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'1
0
%'
}}
>
<
TableCell
sx
=
{{
width
:
'1
2
%'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
<
CustomSelect
value
=
{
currentTask
.
project
}
...
...
@@ -85,7 +75,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
/
>
:
currentTask
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
8
%'
}}
>
{
currentTask
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
11
%'
}}
>
{
currentTask
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
{
dateTimeTasks
}
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/MyTasksRow.js
View file @
604159dd
...
...
@@ -164,12 +164,12 @@ function MyTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHandle
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
row
.
priority
?
row
.
priority
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
row
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
Tooltip
title
=
{
row
.
description
}
>
<
TableCell
sx
=
{{
width
:
'2
5
%'
}}
>
<
TableCell
sx
=
{{
width
:
'2
8
%'
}}
>
{
row
.
title
}
<
/TableCell
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'1
0
%'
}}
>
{
row
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
8
%'
}}
>
{
row
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'1
2
%'
}}
>
{
row
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
11
%'
}}
>
{
row
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
{
dateTimeTasks
}
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableHead/MyTasksTableHead.js
View file @
604159dd
...
...
@@ -24,7 +24,7 @@ const headCells = [
label
:
"Заголовок"
,
canSort
:
true
,
style
:
{
width
:
'2
5
%'
width
:
'2
8
%'
}
},
{
...
...
@@ -32,7 +32,7 @@ const headCells = [
label
:
"Проект"
,
canSort
:
true
,
style
:
{
width
:
'1
0
%'
width
:
'1
2
%'
}
},
{
...
...
@@ -40,7 +40,7 @@ const headCells = [
label
:
"Автор"
,
canSort
:
true
,
style
:
{
width
:
'
8
%'
width
:
'
11
%'
}
},
{
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
View file @
604159dd
...
...
@@ -28,7 +28,7 @@ return (
id
=
"tableTitle"
component
=
"div"
>
Задачи
сотрудников
Мои
задачи
<
/Typography
>
{
projectsFilter
}
<
CreateTaskFromButton
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
604159dd
...
...
@@ -2,17 +2,18 @@ import Paper from '@mui/material/Paper';
import
MyTasksTableToolbar
from
'../../components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar'
;
import
MyTasksTablePagination
from
'../../components/MyTasksCompoments/MyTasksTablePagination/MyTasksTablePagination'
;
import
MyTasksTableContainer
from
'../../components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableContainer'
;
import
{
activateCreateCopyTasksMode
,
addTaskToUserTasksTable
,
deleteDateTimeTaskUsers
,
deleteTaskUsers
,
editTaskUsers
,
fetchAllTasksByMembership
,
sortTaskByProjects
}
from
'../../store/actions/tasksActions'
;
import
{
activateCreateCopyTasksMode
,
fetchAllTasks
,
sortTaskByProjects
,
addTask
,
deleteTask
,
deleteDateTimeTask
,
editTask
}
from
'../../store/actions/tasksActions'
;
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useCallback
,
useEffect
,
useState
}
from
'react'
;
import
{
fetchAllUserProjects
,
fetchProjects
}
from
'../../store/actions/projectsActions'
;
import
moment
from
'moment'
;
import
{
useNavigate
}
from
'react-router-dom'
;
export
default
function
EnhancedTable
()
{
export
default
function
MyTasks
()
{
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
const
{
user
}
=
useSelector
((
state
)
=>
state
.
users
);
const
{
tasks
,
sortedTasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
const
{
allUserProjectsForModalTask
,
projects
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
...
...
@@ -21,7 +22,6 @@ export default function EnhancedTable() {
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
,
})
...
...
@@ -30,7 +30,6 @@ export default function EnhancedTable() {
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
,
})
...
...
@@ -42,11 +41,11 @@ export default function EnhancedTable() {
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
ByMembership
());
dispatch
(
fetchAllTasks
());
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchProjects
())
},
[
dispatch
]);
useEffect
(()
=>
{
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
},
[
dispatch
,
projectIdListForTaskSelect
]);
...
...
@@ -114,7 +113,6 @@ export default function EnhancedTable() {
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
})
}
...
...
@@ -122,36 +120,31 @@ export default function EnhancedTable() {
},
[
addFormStatus
])
const
createNewTaskHandler
=
useCallback
(()
=>
{
if
(
newTask
.
priority
===
''
||
newTask
.
project
===
''
||
newTask
.
executor
===
''
)
{
const
task
=
{
...
newTask
,
priority
:
newTask
.
priority
?
newTask
.
priority
:
null
,
project
:
newTask
.
project
?
newTask
.
project
:
null
,
executor
:
newTask
.
executor
?
newTask
.
executor
:
null
,
dateTimeDeadLine
:
new
Date
(
newTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
newTask
.
dateTimeDeadLine
))
?
newTask
.
dateTimeDeadLine
:
null
}
dispatch
(
addTaskToUserTasksTable
(
task
))
}
else
{
dispatch
(
addTaskToUserTasksTable
(
newTask
))
const
task
=
{
...
newTask
,
priority
:
newTask
.
priority
?
newTask
.
priority
:
null
,
project
:
newTask
.
project
?
newTask
.
project
:
null
,
executor
:
user
,
dateTimeDeadLine
:
new
Date
(
newTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
newTask
.
dateTimeDeadLine
))
?
newTask
.
dateTimeDeadLine
:
null
}
dispatch
(
addTask
(
task
))
setNewTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
})
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
dispatch
,
newTask
])
},
[
dispatch
,
newTask
,
user
])
console
.
log
(
currentTask
)
const
deleteTaskHandler
=
useCallback
((
id
)
=>
{
dispatch
(
deleteTask
Users
(
id
))
dispatch
(
deleteTask
(
id
))
},
[
dispatch
])
const
deleteCopyTaskHandler
=
useCallback
((
id
)
=>
{
dispatch
(
deleteDateTimeTask
Users
(
id
))
dispatch
(
deleteDateTimeTask
(
id
))
},
[
dispatch
])
const
calendarOpen
=
useCallback
((
task
)
=>
{
...
...
@@ -159,27 +152,22 @@ export default function EnhancedTable() {
},
[
dispatch
,
navigate
])
const
editCurrentTaskHandler
=
useCallback
(()
=>
{
if
(
currentTask
.
priority
===
''
||
currentTask
.
project
===
''
||
currentTask
.
executor
===
''
||
!
Object
.
keys
(
currentTask
.
executor
).
length
)
{
const
task
=
{
...
currentTask
,
priority
:
currentTask
.
priority
?
currentTask
.
priority
:
null
,
project
:
currentTask
.
project
?
currentTask
.
project
:
null
,
executor
:
currentTask
.
executor
&&
currentTask
.
executor
?.
id
?
currentTask
.
executor
:
null
,
dateTimeDeadLine
:
new
Date
(
currentTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
currentTask
.
dateTimeDeadLine
))
?
currentTask
.
dateTimeDeadLine
:
null
}
dispatch
(
editTaskUsers
(
task
))
}
else
{
dispatch
(
editTaskUsers
(
currentTask
))
const
task
=
{
...
currentTask
,
priority
:
currentTask
.
priority
?
currentTask
.
priority
:
null
,
project
:
currentTask
.
project
?
currentTask
.
project
:
null
,
executor
:
user
,
dateTimeDeadLine
:
new
Date
(
currentTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
currentTask
.
dateTimeDeadLine
))
?
currentTask
.
dateTimeDeadLine
:
null
}
dispatch
(
editTask
(
task
))
setCurrentTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
})
},
[
dispatch
,
currentTask
])
},
[
dispatch
,
currentTask
,
user
])
const
onCloseFilterByProjects
=
useCallback
((
listProjectIds
)
=>
{
setProjectIdListForTaskSelect
(
listProjectIds
)
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
604159dd
...
...
@@ -9,7 +9,7 @@ import { fetchAllUserProjects, fetchProjects } from '../../store/actions/project
import
moment
from
'moment'
;
import
{
useNavigate
}
from
'react-router-dom'
;
export
default
function
EnhancedTable
()
{
export
default
function
UsersTasks
()
{
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
...
...
planner-front/src/store/actions/tasksActions.js
View file @
604159dd
...
...
@@ -135,7 +135,7 @@ export const addTask = (task) => {
return
async
(
dispatch
)
=>
{
dispatch
(
addTaskRequest
());
try
{
await
axios
.
post
(
"/tasks"
,
task
);
const
response
=
await
axios
.
post
(
"/tasks"
,
task
);
dispatch
(
addTaskSuccess
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
604159dd
...
...
@@ -91,7 +91,19 @@ const tasksReduсer = (state = initialState, action) => {
})
return
{
...
state
,
loading
:
false
,
calendarTasks
:
newTasksWithInfoForCell
};
case
FETCH_ALL_TASKS_SUCCESS
:
return
{
...
state
,
loading
:
false
,
tasks
:
action
.
tasks
,
projects
:
action
.
projects
};
const
newArrTasks
=
action
.
tasks
.
map
((
task
)
=>
{
return
{
...
task
,
authorName
:
task
.
author
.
displayName
,
projectTitle
:
task
.
project
.
title
,
accomplishTranslate
:
accomplishStatuses
.
find
((
status
)
=>
{
if
(
status
.
value
===
task
.
accomplish
)
{
return
status
}
return
null
}).
text
}})
return
{
...
state
,
loading
:
false
,
tasks
:
newArrTasks
,
projects
:
action
.
projects
};
case
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
:
const
newArr
=
action
.
tasks
.
map
((
task
)
=>
{
return
{
...
...
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