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
d3a253e2
Commit
d3a253e2
authored
Nov 20, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ticket 51 filter tasks by projects added
parent
0fd7c5eb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
52 deletions
+77
-52
tasks.ts
planner-api/src/routers/tasks.ts
+21
-0
MyTaskToolBar.js
...r-front/src/components/MyTasksCompoments/MyTaskToolBar.js
+14
-7
MultipleSelect.js
...-front/src/components/UI/MultipleSelect/MultipleSelect.js
+3
-1
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+38
-43
MyTasksHeader.js
...ont/src/containers/MyTasks/MyTasksHeader/MyTasksHeader.js
+1
-1
No files found.
planner-api/src/routers/tasks.ts
View file @
d3a253e2
...
@@ -140,4 +140,25 @@ router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
...
@@ -140,4 +140,25 @@ router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
})
})
// router.post('/projects',async (req: Request, res: Response):Promise<Response>=>{
// let projectArray :string[]= req.body;
// console.log('projectArray ', projectArray)
// if (projectArray.length===0) {
// const tasks = await
// dataSource
// .getRepository(Task)
// .createQueryBuilder('task')
// // .innerJoinAndSelect('task.executors', 'user')
// .innerJoinAndSelect('task.executors AND task.author', 'user')
// .where('task.project IS NULL')
// .getMany()
// return res.send({tasks})
// }
// ///ssome code
// return res.send({message:"some other staff"})
// })
export
default
router
;
export
default
router
;
planner-front/src/components/MyTasksCompoments/MyTaskToolBar.js
View file @
d3a253e2
...
@@ -8,6 +8,18 @@ import MultipleSelect from '../../components/UI/MultipleSelect/MultipleSelect';
...
@@ -8,6 +8,18 @@ import MultipleSelect from '../../components/UI/MultipleSelect/MultipleSelect';
export
default
function
MyTaskToolBar
(
props
)
{
export
default
function
MyTaskToolBar
(
props
)
{
let
projectsFilter
=
<><
/
>
if
(
props
.
projects
)
{
projectsFilter
=
<
MultipleSelect
projects
=
{
props
.
projects
}
onClose
=
{
props
.
onClose
}
projectName
=
{
props
.
projectName
}
setProjectName
=
{
props
.
setProjectName
}
/
>
}
return
(
return
(
<
Box
sx
=
{{
flexGrow
:
1
}}
>
<
Box
sx
=
{{
flexGrow
:
1
}}
>
<
AppBar
position
=
"static"
>
<
AppBar
position
=
"static"
>
...
@@ -15,13 +27,8 @@ export default function MyTaskToolBar(props) {
...
@@ -15,13 +27,8 @@ export default function MyTaskToolBar(props) {
<
Typography
variant
=
"h6"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
<
Typography
variant
=
"h6"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
Мои
задачи
Мои
задачи
<
/Typography
>
<
/Typography
>
<
MultipleSelect
{
projectsFilter
}
projects
=
{
props
.
projects
}
<
Button
color
=
"inherit"
onClick
=
{()
=>
(
props
.
onClick
)}
>
Добавить
задачу
<
/Button
>
onClose
=
{
props
.
onClose
}
projectName
=
{
props
.
projectName
}
setProjectName
=
{
props
.
setProjectName
}
/
>
<
Button
color
=
"inherit"
onClick
=
{
props
.
onClick
}
>
Добавить
задачу
<
/Button
>
<
/Toolbar
>
<
/Toolbar
>
<
/AppBar
>
<
/AppBar
>
<
/Box
>
<
/Box
>
...
...
planner-front/src/components/UI/MultipleSelect/MultipleSelect.js
View file @
d3a253e2
...
@@ -46,9 +46,11 @@ export default function MultipleSelect(props) {
...
@@ -46,9 +46,11 @@ export default function MultipleSelect(props) {
return
(
return
(
<
div
>
<
div
>
<
FormControl
sx
=
{{
m
:
1
,
width
:
250
,
borderColor
:
'white'
}}
>
<
FormControl
sx
=
{{
m
:
1
,
width
:
250
,
borderColor
:
'white'
}}
>
<
InputLabel
id
=
"demo-multiple-name-label"
sx
=
{{
color
:
'white
'
}}
>
Project
<
/InputLabel
>
<
InputLabel
placeholder
=
'Choose Project'
label
=
'I am a really really long green TextField label'
id
=
"demo-multiple-name-label"
sx
=
{{
color
:
'white'
,
padding
:
'1
'
}}
>
Project
<
/InputLabel
>
<
Select
<
Select
labelId
=
"demo-multiple-name-label"
labelId
=
"demo-multiple-name-label"
label
=
'Choose Project'
name
=
'Choose Project'
id
=
"demo-multiple-name"
id
=
"demo-multiple-name"
multiple
multiple
value
=
{
props
.
projectName
}
value
=
{
props
.
projectName
}
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
d3a253e2
...
@@ -58,18 +58,12 @@ function stableSort(array, comparator) {
...
@@ -58,18 +58,12 @@ function stableSort(array, comparator) {
export
default
function
EnhancedTable
()
{
export
default
function
EnhancedTable
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
calendarTasks
=
useSelector
((
state
)
=>
state
.
tasks
.
tasks
);
const
tasks
=
calendarTasks
const
tasks
=
useSelector
((
state
)
=>
state
.
tasks
.
tasks
);
console
.
log
(
tasks
)
console
.
log
(
tasks
)
const
[
recievedTasks
,
setRecievedTasks
]
=
useState
([]);
const
[
recievedTasks
,
setRecievedTasks
]
=
useState
([]);
const
[
projects
,
setProjects
]
=
useState
([
'1'
,
'2'
])
const
[
projects
,
setProjects
]
=
useState
([
'1'
,
'2'
])
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
},
[
dispatch
]);
const
[
order
,
setOrder
]
=
React
.
useState
(
"asc"
);
const
[
order
,
setOrder
]
=
React
.
useState
(
"asc"
);
const
[
orderBy
,
setOrderBy
]
=
React
.
useState
(
"id"
);
const
[
orderBy
,
setOrderBy
]
=
React
.
useState
(
"id"
);
...
@@ -91,21 +85,6 @@ console.log(tasks)
...
@@ -91,21 +85,6 @@ console.log(tasks)
setPage
(
0
);
setPage
(
0
);
};
};
useEffect
(()
=>
{
if
(
tasks
&&
tasks
?.
length
>
0
)
{
let
currentTasks
=
[];
currentTasks
=
tasks
?.
map
((
task
)
=>
{
return
{
...
task
,
isEditMode
:
false
,
readOnly
:
true
,
authorDisplayName
:
task
.
author
.
displayName
,
};
});
setRecievedTasks
(
currentTasks
);
}
},
[
tasks
]);
const
onChange
=
(
e
,
task
)
=>
{
const
onChange
=
(
e
,
task
)
=>
{
const
value
=
e
.
target
.
value
;
const
value
=
e
.
target
.
value
;
const
name
=
e
.
target
.
name
;
const
name
=
e
.
target
.
name
;
...
@@ -220,33 +199,49 @@ console.log(tasks)
...
@@ -220,33 +199,49 @@ console.log(tasks)
// ++++++++фильтрация по проектам+++++++++++++++
// ++++++++фильтрация по проектам+++++++++++++++
const
[
projectName
,
setProjectName
]
=
React
.
useState
([]);
const
[
projectName
,
setProjectName
]
=
React
.
useState
([]);
const
[
filter
,
setFilter
]
=
React
.
useState
(
false
);
const
[
filterProjectTumbler
,
setFilterProjectTumbler
]
=
React
.
useState
(
false
);
const
onClose
=
(
projectName
)
=>
{
const
onClose
=
(
projectName
)
=>
{
console
.
log
(
projectName
)
console
.
log
(
"projectName"
,
projectName
,
'projects'
,
projects
)
setFilter
(
true
)
let
tasksFilteredByProject
=
tasks
if
(
projectName
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectName
.
includes
(
task
.
project
?.
title
))
}
setRecievedTasks
(
tasksFilteredByProject
)
setFilterProjectTumbler
(
true
)
}
}
useEffect
(()
=>
{
const
filterProjectsNamesFromTasks
=
()
=>
{
if
(
tasks
&&
tasks
?.
length
>
0
)
{
if
(
tasks
&&
tasks
?.
length
>
0
)
{
let
currentTasks
=
[];
const
rawProjects
=
tasks
.
map
(
task
=>
task
.
project
)
let
i
let
rawSetProjectNames
=
[]
for
(
i
=
0
;
i
<
projectName
?.
lenght
;
i
++
)
for
(
let
project
of
rawProjects
){
{
currentTasks
=
tasks
?.
map
((
task
)
=>
{
if
(
project
===
null
){
if
(
task
.
project
=
projectName
)
}
else
{
return
{
rawSetProjectNames
.
push
(
project
.
title
)
...
task
,
}
};
}
})};
let
uniqueTitlesProjects
=
[...
new
Set
(
rawSetProjectNames
)];
setRecievedTasks
(
currentTasks
);
setProjects
(
uniqueTitlesProjects
)
console
.
log
(
'filterProjectsNamesFromTasks uniqueTitlesProjects'
,
uniqueTitlesProjects
)
}
}
},
[
filter
==
true
]);
}
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
filterProjectsNamesFromTasks
()
if
(
tasks
&&
tasks
?.
length
>
0
)
{
setRecievedTasks
(
tasks
);
}
},
[
tasks
===
undefined
]);
// ++++++++фильтрация по проектам+++++++++++++++
if
(
if
(
tasks
&&
tasks
&&
tasks
?.
length
>
0
&&
tasks
?.
length
>
0
&&
recievedTasks
&&
recievedTasks
&&
recievedTasks
?.
length
>
0
recievedTasks
?.
length
>
=
0
)
{
)
{
return
(
return
(
<
Box
sx
=
{{
width
:
"fullwidth"
}}
>
<
Box
sx
=
{{
width
:
"fullwidth"
}}
>
...
@@ -255,7 +250,6 @@ console.log(tasks)
...
@@ -255,7 +250,6 @@ console.log(tasks)
onClick
=
{()
=>
{
onClick
=
{()
=>
{
addTask
();
addTask
();
}}
}}
projects
=
{
projects
}
projects
=
{
projects
}
onClose
=
{
onClose
}
onClose
=
{
onClose
}
projectName
=
{
projectName
}
projectName
=
{
projectName
}
...
@@ -268,7 +262,7 @@ console.log(tasks)
...
@@ -268,7 +262,7 @@ console.log(tasks)
order
=
{
order
}
order
=
{
order
}
orderBy
=
{
orderBy
}
orderBy
=
{
orderBy
}
onRequestSort
=
{
handleRequestSort
}
onRequestSort
=
{
handleRequestSort
}
rowCount
=
{
tasks
.
length
}
//
rowCount={tasks.length}
/
>
/
>
<
TableBody
>
<
TableBody
>
{
/* <TableRow sx={{height:'1px',margin:0,padding:0}}>
{
/* <TableRow sx={{height:'1px',margin:0,padding:0}}>
...
@@ -420,6 +414,7 @@ console.log(tasks)
...
@@ -420,6 +414,7 @@ console.log(tasks)
<
/TableBody
>
<
/TableBody
>
<
/Table
>
<
/Table
>
<
/TableContainer
>
<
/TableContainer
>
<
TablePagination
<
TablePagination
rowsPerPageOptions
=
{[
5
,
10
,
25
]}
rowsPerPageOptions
=
{[
5
,
10
,
25
]}
component
=
"div"
component
=
"div"
...
...
planner-front/src/containers/MyTasks/MyTasksHeader/MyTasksHeader.js
View file @
d3a253e2
...
@@ -119,5 +119,5 @@ EnhancedTableHead.propTypes = {
...
@@ -119,5 +119,5 @@ EnhancedTableHead.propTypes = {
onRequestSort
:
PropTypes
.
func
.
isRequired
,
onRequestSort
:
PropTypes
.
func
.
isRequired
,
order
:
PropTypes
.
oneOf
([
'asc'
,
'desc'
]).
isRequired
,
order
:
PropTypes
.
oneOf
([
'asc'
,
'desc'
]).
isRequired
,
orderBy
:
PropTypes
.
string
.
isRequired
,
orderBy
:
PropTypes
.
string
.
isRequired
,
rowCount
:
PropTypes
.
number
.
isRequired
,
//
rowCount: PropTypes.number.isRequired,
};
};
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