Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kacprzak, Izabella
DRP-InAGlobe-Platform
Commits
07a8101b
Commit
07a8101b
authored
Jun 17, 2021
by
ethan
Browse files
Added welcome message; filtering pending project tasks in the Dashboard [BG, EW]
parent
6882e79a
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/blueprints/assigned_task.py
View file @
07a8101b
...
...
@@ -28,6 +28,16 @@ def get_tasks_for_user(username):
return
jsonify
(
task_list
)
@
assigned_task
.
route
(
'/assigned_task/pending/username/<username>'
,
methods
=
[
'GET'
])
def
get_pending_tasks_for_user
(
username
):
entries
=
AssignedTask
.
query
.
filter_by
(
username
=
username
)
task_list
=
[{
"description"
:
task
.
description
,
"priority"
:
task
.
priority
,
"due_date"
:
task
.
due_date
}
for
task
in
(
Task
.
query
.
get
(
x
.
task_id
)
for
x
in
entries
)
if
not
task
.
completed
]
return
jsonify
(
task_list
)
@
assigned_task
.
route
(
'/assigned_task'
,
methods
=
[
'POST'
])
def
assign_task_to_user
():
username
,
task_id
=
(
request
.
json
[
'username'
],
request
.
json
[
'task_id'
])
...
...
backend/blueprints/user.py
View file @
07a8101b
...
...
@@ -45,6 +45,13 @@ def get_id(username):
interests
=
user
.
interests
)
@
user
.
route
(
'/users/name/<username>'
,
methods
=
[
'GET'
])
def
get_name
(
username
):
user
=
User
.
query
.
get
(
username
)
return
jsonify
(
firstname
=
user
.
firstname
,
surname
=
user
.
surname
)
@
user
.
route
(
'/users'
,
methods
=
[
'POST'
])
def
add_user
():
...
...
frontend/src/Home.js
View file @
07a8101b
...
...
@@ -11,6 +11,10 @@ const Home = () => {
const
{
setToken
,
token
}
=
useToken
();
const
{
data
:
projects
,
errorRProjects
,
isPendingRProjects
}
=
useFetch
(
"
/user_project/username/
"
+
token
);
const
{
data
:
{
firstname
,
surname
}}
=
useFetch
(
"
/users/name/
"
+
token
);
const
{
data
:
project_tasks
,
errorProjectTasks
,
isPendingProjectTasks
}
=
useFetch
(
"
/assigned_task/pending/username/
"
+
token
);
const
myTodos
=
todos
.
filter
(
todo
=>
todo
.
username
===
token
);
// const project_tasks = [
// {
// "description": "This is example 1",
...
...
@@ -38,22 +42,25 @@ const Home = () => {
// }
// ]
const
{
data
:
project_tasks
,
errorProjectTasks
,
isPendingProjectTasks
}
=
useFetch
(
"
/assigned_task/username/
"
+
token
)
return
(
<
div
className
=
"
home
"
>
<
h1
>
Dashboard
<
/h1
>
<
h1
>
Welcome
to
your
Dashboard
,
{
firstname
}
<
/h1
>
{
console
.
log
(
"
Firstname:
"
)}
<
div
className
=
"
home-projects
"
style
=
{{
float
:
"
left
"
,
width
:
"
600px
"
}}
>
{
isPendingRProjects
&&
<
h2
>
Loading
...
<
/h2>
}
{
projects
&&
<
ProjectList
projects
=
{
projects
}
title
=
"
My Projects
"
/>
}
{
projects
&&
(
Object
.
keys
(
projects
).
length
===
0
)
&&
<
h2
>
You
are
not
currently
part
of
any
projects
<
/h2>
}
<
/div
>
<
div
className
=
"
homeTodos
"
>
<
div
className
=
"
homeTodos
"
style
=
{{
float
:
"
right
"
,
width
:
"
300px
"
}}
>
{
isPendingTodos
&&
<
h2
>
Loading
...
<
/h2>
}
{
todos
&&
<
PersonalToDo
todos
=
{
todos
.
filter
(
todo
=>
todo
.
username
===
token
)}
title
=
"
Personal ToDo items
"
/>
}
{
todos
&&
<
PersonalToDo
todos
=
{
myTodos
}
title
=
"
Personal ToDo items
"
/>
}
{
todos
&&
(
Object
.
keys
(
myTodos
).
length
===
0
)
&&
<
h2
>
Well
done
you
have
no
ToDo
items
<
/h2>
}
<
/div
>
<
div
className
=
"
home-project-tasks
"
style
=
{{
float
:
"
left
"
,
width
:
"
600px
"
}}
>
{
isPendingRProjects
&&
<
h2
>
Loading
...
<
/h2>
}
{
projects
&&
<
MyProjectTasks
tasks
=
{
project_tasks
}
title
=
"
My tasks from all projects
"
/>
}
{
projects
&&
(
Object
.
keys
(
project_tasks
).
length
===
0
)
&&
<
h2
>
Well
done
you
have
no
project
tasks
<
/h2>
}
<
/div
>
<
/div
>
...
...
frontend/src/MyProjectTasks.js
View file @
07a8101b
...
...
@@ -11,6 +11,7 @@ const MyProjectTasks = ({ tasks, title }) => {
<
div
className
=
"
task-preview
"
key
=
{
task
.
id
}
>
<
h2
>
{
task
.
description
}
<
/h2
>
<
h3
><
strong
>
Priority
level
:
<
/strong> {task.priority}</
h3
>
<
h3
><
strong
><
/strong> {task.priority}</
h3
>
<
h3
><
strong
>
To
be
done
by
:
<
/strong> {task.due_date}</
h3
>
<
/div
>
))}
...
...
Write
Preview
Supports
Markdown
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