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>=>{
})
// 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
;
planner-front/src/components/MyTasksCompoments/MyTaskToolBar.js
View file @
d3a253e2
...
...
@@ -8,6 +8,18 @@ import MultipleSelect from '../../components/UI/MultipleSelect/MultipleSelect';
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
(
<
Box
sx
=
{{
flexGrow
:
1
}}
>
<
AppBar
position
=
"static"
>
...
...
@@ -15,13 +27,8 @@ export default function MyTaskToolBar(props) {
<
Typography
variant
=
"h6"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
Мои
задачи
<
/Typography
>
<
MultipleSelect
projects
=
{
props
.
projects
}
onClose
=
{
props
.
onClose
}
projectName
=
{
props
.
projectName
}
setProjectName
=
{
props
.
setProjectName
}
/
>
<
Button
color
=
"inherit"
onClick
=
{
props
.
onClick
}
>
Добавить
задачу
<
/Button
>
{
projectsFilter
}
<
Button
color
=
"inherit"
onClick
=
{()
=>
(
props
.
onClick
)}
>
Добавить
задачу
<
/Button
>
<
/Toolbar
>
<
/AppBar
>
<
/Box
>
...
...
planner-front/src/components/UI/MultipleSelect/MultipleSelect.js
View file @
d3a253e2
...
...
@@ -46,9 +46,11 @@ export default function MultipleSelect(props) {
return
(
<
div
>
<
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
labelId
=
"demo-multiple-name-label"
label
=
'Choose Project'
name
=
'Choose Project'
id
=
"demo-multiple-name"
multiple
value
=
{
props
.
projectName
}
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
d3a253e2
...
...
@@ -58,18 +58,12 @@ function stableSort(array, comparator) {
export
default
function
EnhancedTable
()
{
const
dispatch
=
useDispatch
();
const
tasks
=
useSelector
((
state
)
=>
state
.
tasks
.
tasks
);
const
calendarTasks
=
useSelector
((
state
)
=>
state
.
tasks
.
tasks
);
const
tasks
=
calendarTasks
console
.
log
(
tasks
)
const
[
recievedTasks
,
setRecievedTasks
]
=
useState
([]);
const
[
projects
,
setProjects
]
=
useState
([
'1'
,
'2'
])
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
},
[
dispatch
]);
const
[
order
,
setOrder
]
=
React
.
useState
(
"asc"
);
const
[
orderBy
,
setOrderBy
]
=
React
.
useState
(
"id"
);
...
...
@@ -91,21 +85,6 @@ console.log(tasks)
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
value
=
e
.
target
.
value
;
const
name
=
e
.
target
.
name
;
...
...
@@ -220,33 +199,49 @@ console.log(tasks)
// ++++++++фильтрация по проектам+++++++++++++++
const
[
projectName
,
setProjectName
]
=
React
.
useState
([]);
const
[
filter
,
setFilter
]
=
React
.
useState
(
false
);
const
[
filterProjectTumbler
,
setFilterProjectTumbler
]
=
React
.
useState
(
false
);
const
onClose
=
(
projectName
)
=>
{
console
.
log
(
projectName
)
setFilter
(
true
)
console
.
log
(
"projectName"
,
projectName
,
'projects'
,
projects
)
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
)
{
let
currentTasks
=
[];
let
i
for
(
i
=
0
;
i
<
projectName
?.
lenght
;
i
++
)
{
currentTasks
=
tasks
?.
map
((
task
)
=>
{
if
(
task
.
project
=
projectName
)
return
{
...
task
,
};
})};
setRecievedTasks
(
currentTasks
);
const
rawProjects
=
tasks
.
map
(
task
=>
task
.
project
)
let
rawSetProjectNames
=
[]
for
(
let
project
of
rawProjects
){
if
(
project
===
null
){
}
else
{
rawSetProjectNames
.
push
(
project
.
title
)
}
}
let
uniqueTitlesProjects
=
[...
new
Set
(
rawSetProjectNames
)];
setProjects
(
uniqueTitlesProjects
)
console
.
log
(
'filterProjectsNamesFromTasks uniqueTitlesProjects'
,
uniqueTitlesProjects
)
}
},
[
filter
==
true
]);
}
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
filterProjectsNamesFromTasks
()
if
(
tasks
&&
tasks
?.
length
>
0
)
{
setRecievedTasks
(
tasks
);
}
},
[
tasks
===
undefined
]);
// ++++++++фильтрация по проектам+++++++++++++++
if
(
tasks
&&
tasks
?.
length
>
0
&&
recievedTasks
&&
recievedTasks
?.
length
>
0
recievedTasks
?.
length
>
=
0
)
{
return
(
<
Box
sx
=
{{
width
:
"fullwidth"
}}
>
...
...
@@ -255,7 +250,6 @@ console.log(tasks)
onClick
=
{()
=>
{
addTask
();
}}
projects
=
{
projects
}
onClose
=
{
onClose
}
projectName
=
{
projectName
}
...
...
@@ -268,7 +262,7 @@ console.log(tasks)
order
=
{
order
}
orderBy
=
{
orderBy
}
onRequestSort
=
{
handleRequestSort
}
rowCount
=
{
tasks
.
length
}
//
rowCount={tasks.length}
/
>
<
TableBody
>
{
/* <TableRow sx={{height:'1px',margin:0,padding:0}}>
...
...
@@ -420,6 +414,7 @@ console.log(tasks)
<
/TableBody
>
<
/Table
>
<
/TableContainer
>
<
TablePagination
rowsPerPageOptions
=
{[
5
,
10
,
25
]}
component
=
"div"
...
...
planner-front/src/containers/MyTasks/MyTasksHeader/MyTasksHeader.js
View file @
d3a253e2
...
...
@@ -119,5 +119,5 @@ EnhancedTableHead.propTypes = {
onRequestSort
:
PropTypes
.
func
.
isRequired
,
order
:
PropTypes
.
oneOf
([
'asc'
,
'desc'
]).
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