Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Roadmap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
Roadmap
Commits
284e381f
Commit
284e381f
authored
Jul 29, 2019
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
client:
#24
- blueprints for tasks
parent
6d601559
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/blueprints/Tasks.py
+70
-0
70 additions, 0 deletions
client/blueprints/Tasks.py
with
70 additions
and
0 deletions
client/blueprints/Tasks.py
0 → 100644
+
70
−
0
View file @
284e381f
import
requests
from
flask
import
Blueprint
,
render_template
,
redirect
,
url_for
,
request
from
ApiRequest
import
ApiRequest
from
Localization
import
LOCALIZATION
def
construct_blueprint
(
urlBuilder
):
tasks
=
Blueprint
(
'
admin_tasks
'
,
__name__
)
@tasks.route
(
'
/admin/tasks/overview
'
,
methods
=
[
'
GET
'
])
def
overview
():
roadmap_ID
=
request
.
args
.
get
(
'
milestone_ID
'
)
if
not
roadmap_ID
or
int
(
roadmap_ID
)
<
0
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
tasks
=
requests
.
get
(
urlBuilder
.
build_url
(
'
tasks
'
,
roadmap_ID
)).
json
()
return
render_template
(
'
admin/tasks/overview.html
'
,
tasks
=
tasks
,
roadmap_ID
=
roadmap_ID
)
@tasks.route
(
'
/admin/tasks/add
'
,
methods
=
[
'
GET
'
])
def
add
():
return
render_template
(
'
admin/tasks/edit.html
'
,
title
=
'
New Task
'
,
roadmap_ID
=
request
.
args
.
get
(
'
roadmap_ID
'
),
form_url
=
url_for
(
'
admin_tasks.add_post
'
))
@tasks.route
(
'
/admin/tasks/add
'
,
methods
=
[
'
POST
'
])
def
add_post
():
success
,
response
=
ApiRequest
.
send_api_request
(
urlBuilder
.
build_url
(
'
task
'
),
requests
.
post
,
request
.
form
,
[
'
MilestoneID
'
,
'
Title
'
,
'
Description
'
,
'
Status
'
])
if
not
success
:
return
response
return
redirect
(
url_for
(
'
admin_tasks.overview
'
,
roadmap_ID
=
request
.
form
.
get
(
'
MilestoneID
'
)))
@tasks.route
(
'
/admin/tasks/edit
'
,
methods
=
[
'
GET
'
])
def
edit
():
ID
=
request
.
args
.
get
(
'
ID
'
)
if
not
ID
or
int
(
ID
)
<
0
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
task
=
requests
.
get
(
urlBuilder
.
build_url
(
'
milestone
'
,
ID
)).
json
()
return
render_template
(
'
admin/tasks/edit.html
'
,
title
=
'
Edit Task
'
,
task
=
task
,
form_url
=
url_for
(
'
admin_tasks.edit_post
'
))
@tasks.route
(
'
/admin/tasks/edit
'
,
methods
=
[
'
POST
'
])
def
edit_post
():
success
,
response
=
ApiRequest
.
send_api_request
(
urlBuilder
.
build_url
(
'
task
'
),
requests
.
put
,
request
.
form
,
[
'
ID
'
,
'
MilestoneID
'
,
'
Title
'
,
'
Description
'
,
'
Status
'
])
if
not
success
:
return
response
return
redirect
(
url_for
(
'
admin_tasks.overview
'
,
roadmap_ID
=
request
.
args
.
get
(
'
milestone_ID
'
)))
@tasks.route
(
'
/admin/tasks/delete
'
,
methods
=
[
'
GET
'
])
def
delete
():
ID
=
request
.
args
.
get
(
'
ID
'
)
if
not
ID
or
int
(
ID
)
<
0
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
success
,
response
=
ApiRequest
.
send_api_request
(
urlBuilder
.
build_url
(
'
task
'
,
ID
),
requests
.
delete
,
{},
[])
if
not
success
:
return
response
return
redirect
(
url_for
(
'
admin_tasks.overview
'
,
roadmap_ID
=
request
.
args
.
get
(
'
milestone_ID
'
)))
return
tasks
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment