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
e695f2d7
Commit
e695f2d7
authored
Dec 07, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#90
set up task reducer & types & actions
parent
51db4527
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
17 deletions
+58
-17
TableRowTask.js
...components/MyTasksCompoments/TableRowTask/TableRowTask.js
+7
-5
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+6
-6
tasksTypes.js
planner-front/src/store/actionTypes/tasksTypes.js
+3
-3
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+32
-2
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+10
-1
No files found.
planner-front/src/components/MyTasksCompoments/TableRowTask/TableRowTask.js
View file @
e695f2d7
...
@@ -339,8 +339,10 @@ const TableRowTask= ({
...
@@ -339,8 +339,10 @@ const TableRowTask= ({
<
/TableCell
>
<
/TableCell
>
{
/* Edit option datetimeTask */
}
{
/* Edit option datetimeTask */
}
{
/* <TableCell style={{width:'0%'}}>
<
TableCell
<Tooltip title="Редактировать Копию">
// style={{width:'0%'}}
>
{
/* <Tooltip title="Редактировать Копию">
{task.isEditMode ? (
{task.isEditMode ? (
<IconButton
<IconButton
aria-label="done"
aria-label="done"
...
@@ -359,8 +361,8 @@ const TableRowTask= ({
...
@@ -359,8 +361,8 @@ const TableRowTask= ({
<Edit />
<Edit />
</IconButton>
</IconButton>
)}
)}
</Tooltip>
</Tooltip>
*/
}
</TableCell >
*/
}
<
/TableCell
>
{
/* delete option datetimeTask */
}
{
/* delete option datetimeTask */
}
{
task
.
author
.
id
===
user
.
id
?
{
task
.
author
.
id
===
user
.
id
?
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
e695f2d7
...
@@ -13,7 +13,7 @@ import TaskModal from "../../components/MyTasksCompoments/TaskModal/TaskModal";
...
@@ -13,7 +13,7 @@ import TaskModal from "../../components/MyTasksCompoments/TaskModal/TaskModal";
import
EnhancedTableHead
from
"./MyTasksHeader/MyTasksHeader"
;
import
EnhancedTableHead
from
"./MyTasksHeader/MyTasksHeader"
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
MyTaskToolBar
from
"../../components/MyTasksCompoments/MyTaskToolBar"
;
import
MyTaskToolBar
from
"../../components/MyTasksCompoments/MyTaskToolBar"
;
import
{
fetchAllTasks
,
deleteTask
,
editTask
}
from
"../../store/actions/tasksActions"
;
import
{
fetchAllTasks
,
deleteTask
,
editTask
,
deleteDateTimeTask
}
from
"../../store/actions/tasksActions"
;
import
NewTaskForm
from
"../../components/MyTasksCompoments/NewTaskForm"
;
import
NewTaskForm
from
"../../components/MyTasksCompoments/NewTaskForm"
;
import
TableRowTask
from
"../../components/MyTasksCompoments/TableRowTask/TableRowTask"
;
import
TableRowTask
from
"../../components/MyTasksCompoments/TableRowTask/TableRowTask"
;
...
@@ -44,7 +44,7 @@ export default function EnhancedTable() {
...
@@ -44,7 +44,7 @@ export default function EnhancedTable() {
if
(
tasks
&&
tasks
?.
length
>
0
)
{
if
(
tasks
&&
tasks
?.
length
>
0
)
{
setRecievedTasks
(
tasks
);
setRecievedTasks
(
tasks
);
}
}
},
[
tasks
?.
length
]);
},
[
dispatch
,
tasks
?.
length
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
dispatch
(
fetchAllTasks
());
...
@@ -162,9 +162,9 @@ useEffect(() => {
...
@@ -162,9 +162,9 @@ useEffect(() => {
dispatch
(
deleteTask
(
id
));
dispatch
(
deleteTask
(
id
));
};
};
const
deleteDateTimeTask
=
(
dateTI
meTaskId
)
=>
{
const
deleteDateTimeTask
Handle
=
(
dateTi
meTaskId
)
=>
{
console
.
log
(
'delete by dateT
ImeTaskId'
)
console
.
log
(
'delete by dateT
imeTaskId '
,
dateTimeTaskId
)
// dispatch(deleteDateTimeTask(dateTI
meTaskId))
dispatch
(
deleteDateTimeTask
(
dateTi
meTaskId
))
}
}
const
handleEditDateTimeTask
=
(
dateTimeTask
)
=>
{
const
handleEditDateTimeTask
=
(
dateTimeTask
)
=>
{
...
@@ -272,7 +272,7 @@ console.log('tasks', tasks)
...
@@ -272,7 +272,7 @@ console.log('tasks', tasks)
deleteHandle
=
{
deleteHandle
}
deleteHandle
=
{
deleteHandle
}
handleEditTask
=
{
handleEditTask
}
handleEditTask
=
{
handleEditTask
}
handleEditDateTimeTask
=
{
handleEditDateTimeTask
}
handleEditDateTimeTask
=
{
handleEditDateTimeTask
}
deleteDateTimeTask
=
{
deleteDateTimeTask
}
deleteDateTimeTask
=
{
deleteDateTimeTask
Handle
}
onChange
=
{
onChange
}
onChange
=
{
onChange
}
onModalOpen
=
{
onModalOpen
}
onModalOpen
=
{
onModalOpen
}
onProjectChange
=
{
onProjectChange
}
onProjectChange
=
{
onProjectChange
}
...
...
planner-front/src/store/actionTypes/tasksTypes.js
View file @
e695f2d7
...
@@ -22,6 +22,6 @@ export const DELETE_TASK_FAILURE = "DELETE_TASK_FAILURE";
...
@@ -22,6 +22,6 @@ export const DELETE_TASK_FAILURE = "DELETE_TASK_FAILURE";
export
const
EDIT_CALENDAR_TASK
=
"EDIT_CALENDAR_TASK"
;
export
const
EDIT_CALENDAR_TASK
=
"EDIT_CALENDAR_TASK"
;
export
const
DELETE_COPYTASK_REQUEST
=
"DELETE_TASK_REQUEST"
;
export
const
DELETE_DATETIMETASK_REQUEST
=
"DELETE_TASK_REQUEST"
;
export
const
DELETE_COPYTASK_SUCCESS
=
"DELETE_TASK_SUCCESS"
;
export
const
DELETE_DATETIMETASK_SUCCESS
=
"DELETE_TASK_SUCCESS"
;
export
const
DELETE_COPYTASK_FAILURE
=
"DELETE_TASK_FAILURE"
;
export
const
DELETE_DATETIMETASK_FAILURE
=
"DELETE_TASK_FAILURE"
;
\ No newline at end of file
\ No newline at end of file
planner-front/src/store/actions/tasksActions.js
View file @
e695f2d7
...
@@ -14,7 +14,10 @@ import {
...
@@ -14,7 +14,10 @@ import {
FETCH_ALL_TASKS_SUCCESS
,
FETCH_ALL_TASKS_SUCCESS
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
FETCH_TASKS_BY_PROJECT_FAILURE
,
FETCH_TASKS_BY_PROJECT_FAILURE
,
FETCH_TASKS_BY_PROJECT_REQUEST
FETCH_TASKS_BY_PROJECT_REQUEST
,
DELETE_DATETIMETASK_FAILURE
,
DELETE_DATETIMETASK_SUCCESS
,
DELETE_DATETIMETASK_REQUEST
,
}
from
"../actionTypes/tasksTypes"
;
}
from
"../actionTypes/tasksTypes"
;
import
axios
from
'../../axiosPlanner'
import
axios
from
'../../axiosPlanner'
...
@@ -210,3 +213,30 @@ export const fetchTasksByProject = (projects) => {
...
@@ -210,3 +213,30 @@ export const fetchTasksByProject = (projects) => {
}
}
}
}
}
}
const
deleteDateTimeTaskRequest
=
()
=>
{
return
{
type
:
DELETE_DATETIMETASK_REQUEST
}
};
const
deleteDateTimeTaskSuccess
=
()
=>
{
return
{
type
:
DELETE_DATETIMETASK_SUCCESS
}
};
const
deleteDateTimeTaskFailure
=
(
error
)
=>
{
return
{
type
:
DELETE_DATETIMETASK_FAILURE
,
error
}
};
export
const
deleteDateTimeTask
=
(
dateTimeTaskId
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteDateTimeTaskRequest
());
try
{
await
axios
.
delete
(
`/copy-tasks/
${
dateTimeTaskId
}
`
);
dispatch
(
deleteDateTimeTaskSuccess
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
dispatch
(
deleteDateTimeTaskFailure
(
error
.
response
.
data
));
}
}
}
planner-front/src/store/reducers/tasksReducer.js
View file @
e695f2d7
...
@@ -15,7 +15,10 @@ import {
...
@@ -15,7 +15,10 @@ import {
EDIT_CALENDAR_TASK
,
EDIT_CALENDAR_TASK
,
FETCH_TASKS_BY_PROJECT_REQUEST
,
FETCH_TASKS_BY_PROJECT_REQUEST
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
FETCH_TASKS_BY_PROJECT_FAILURE
FETCH_TASKS_BY_PROJECT_FAILURE
,
DELETE_DATETIMETASK_FAILURE
,
DELETE_DATETIMETASK_SUCCESS
,
DELETE_DATETIMETASK_REQUEST
}
from
"../actionTypes/tasksTypes"
;
}
from
"../actionTypes/tasksTypes"
;
const
initialState
=
{
const
initialState
=
{
...
@@ -102,6 +105,12 @@ const tasksReduсer = (state = initialState, action) => {
...
@@ -102,6 +105,12 @@ const tasksReduсer = (state = initialState, action) => {
return
{...
state
,
loading
:
true
};
return
{...
state
,
loading
:
true
};
case
DELETE_TASK_FAILURE
:
case
DELETE_TASK_FAILURE
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
case
DELETE_DATETIMETASK_SUCCESS
:
return
{...
state
,
loading
:
false
};
case
DELETE_DATETIMETASK_REQUEST
:
return
{...
state
,
loading
:
true
};
case
DELETE_DATETIMETASK_FAILURE
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
default
:
default
:
return
state
;
return
state
;
}
}
...
...
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