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
471057cc
Commit
471057cc
authored
Jan 13, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#138
fix on filtration of projects by id and active status
parent
3deb8fcb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
20 deletions
+28
-20
MyTaskToolBar.js
...r-front/src/components/MyTasksCompoments/MyTaskToolBar.js
+4
-4
MultipleSelect.js
...-front/src/components/UI/MultipleSelect/MultipleSelect.js
+6
-6
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+18
-10
No files found.
planner-front/src/components/MyTasksCompoments/MyTaskToolBar.js
View file @
471057cc
...
@@ -18,9 +18,9 @@ export default function MyTaskToolBar({projects,onClickActiveTasks,activeTasksOn
...
@@ -18,9 +18,9 @@ export default function MyTaskToolBar({projects,onClickActiveTasks,activeTasksOn
projectsFilter
=
projectsFilter
=
<
MultipleSelect
<
MultipleSelect
projects
=
{
projects
}
projects
=
{
projects
}
onClose
=
{
onCloseFilterByProjects
}
onClose
FilterByProjects
=
{
onCloseFilterByProjects
}
project
Name
=
{
projectIdListForTaskSelect
}
project
IdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProject
Name
=
{
setProjectIdListForTaskSelect
}
setProject
IdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
/
>
/
>
}
}
...
@@ -40,7 +40,7 @@ export default function MyTaskToolBar({projects,onClickActiveTasks,activeTasksOn
...
@@ -40,7 +40,7 @@ export default function MyTaskToolBar({projects,onClickActiveTasks,activeTasksOn
style
=
{{
style
=
{{
backgroundColor
:
activeTasksOn
===
true
?
"red"
:
"inherit"
,
backgroundColor
:
activeTasksOn
===
true
?
"red"
:
"inherit"
,
}}
}}
onClick
=
{
onClickActiveTasks
}
onClick
=
{
()
=>
onClickActiveTasks
()
}
>
>
Активные
задачи
Активные
задачи
<
/Button
>
<
/Button
>
...
...
planner-front/src/components/UI/MultipleSelect/MultipleSelect.js
View file @
471057cc
...
@@ -28,15 +28,15 @@ function getStyles(name, personName, theme) {
...
@@ -28,15 +28,15 @@ function getStyles(name, personName, theme) {
};
};
}
}
export
default
function
MultipleSelect
({
projects
,
projectName
,
onClose
,
setProjectName
})
{
export
default
function
MultipleSelect
({
projects
,
onCloseFilterByProjects
})
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
const
[
listProjectIds
,
setListProjectIds
]
=
React
.
useState
([])
const
handleChange
=
(
event
)
=>
{
const
handleChange
=
(
event
)
=>
{
const
{
const
{
target
:
{
value
},
target
:
{
value
},
}
=
event
;
}
=
event
;
set
ProjectName
(
set
ListProjectIds
(
// On autofill we get a stringified value.
// On autofill we get a stringified value.
typeof
value
===
'string'
?
value
.
split
(
','
)
:
value
,
typeof
value
===
'string'
?
value
.
split
(
','
)
:
value
,
);
);
...
@@ -55,18 +55,18 @@ export default function MultipleSelect({projects,projectName,onClose,setProjectN
...
@@ -55,18 +55,18 @@ export default function MultipleSelect({projects,projectName,onClose,setProjectN
name
=
'Choose Project'
name
=
'Choose Project'
id
=
"demo-multiple-name"
id
=
"demo-multiple-name"
multiple
multiple
value
=
{
projectName
}
value
=
{
listProjectIds
}
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
input
=
{
<
OutlinedInput
label
=
"Name"
/>
}
input
=
{
<
OutlinedInput
label
=
"Name"
/>
}
MenuProps
=
{
MenuProps
}
MenuProps
=
{
MenuProps
}
sx
=
{{
color
:
'white'
}}
sx
=
{{
color
:
'white'
}}
onClose
=
{(
e
)
=>
{
onClose
(
projectName
)}}
onClose
=
{(
e
)
=>
{
onClose
FilterByProjects
(
listProjectIds
)}}
>
>
{
projects
?.
map
((
project
,
index
)
=>
(
{
projects
?.
map
((
project
,
index
)
=>
(
<
MenuItem
<
MenuItem
key
=
{
index
}
key
=
{
index
}
value
=
{
project
.
id
}
value
=
{
project
.
id
}
style
=
{
getStyles
(
project
.
title
,
projectName
,
theme
)}
style
=
{
getStyles
(
project
.
title
,
listProjectIds
,
theme
)}
>
>
{
project
.
title
}
{
project
.
title
}
<
/MenuItem
>
<
/MenuItem
>
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
471057cc
...
@@ -50,11 +50,24 @@ export default function EnhancedTable() {
...
@@ -50,11 +50,24 @@ export default function EnhancedTable() {
addTaskForm
,
setAddTaskForm
,
addTaskForm
,
setAddTaskForm
,
// onClickActiveTasks,
// onClickActiveTasks,
// activeTasksOn,
// activeTasksOn,
dispatch
]);
dispatch
]);
// console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
// console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
useEffect
(()
=>
{
let
filteredTasks
=
tasks
;
if
(
activeTasksOn
)
{
filteredTasks
=
filteredTasks
.
filter
(
task
=>
task
.
accomplish
===
'opened'
||
task
.
accomplish
===
'progress'
)
}
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
filteredTasks
=
filteredTasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
setRecievedTasks
(
filteredTasks
)
},
[
activeTasksOn
,
projectIdListForTaskSelect
]);
const
handleRequestSort
=
(
property
)
=>
{
const
handleRequestSort
=
(
property
)
=>
{
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
...
@@ -186,21 +199,16 @@ export default function EnhancedTable() {
...
@@ -186,21 +199,16 @@ export default function EnhancedTable() {
const
onCloseFilterByProjects
=
(
projectIdListForTaskSelect
)
=>
{
const
onCloseFilterByProjects
=
(
listProjectIds
)
=>
{
let
tasksFilteredByProject
=
tasks
setProjectIdListForTaskSelect
(
listProjectIds
)
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
// setFilterProjectTumbler(true)
}
}
const
onClickActiveTasks
=
()
=>
{
const
onClickActiveTasks
=
()
=>
{
console
.
log
(
'active tasts before switched to '
,
activeTasksOn
)
console
.
log
(
'active tasts before switched to '
,
activeTasksOn
)
setActiveTasksOn
((
prevState
)
=>
{
return
!
prevState
})
// setActiveTasksOn((prevState)=>{return !prevState})
setActiveTasksOn
(
!
activeTasksOn
)
console
.
log
(
'active tasts after switch '
,
activeTasksOn
)
console
.
log
(
'active tasts after switch '
,
activeTasksOn
)
if
(
activeTasksOn
)
{
if
(
activeTasksOn
)
{
...
...
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