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
30478e00
Commit
30478e00
authored
5 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
client: debug prints ans version.json (v1.0.0)
parent
d9e0922d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/RoadmapClient.py
+28
-18
28 additions, 18 deletions
client/RoadmapClient.py
client/version.json
+7
-0
7 additions, 0 deletions
client/version.json
with
35 additions
and
18 deletions
client/RoadmapClient.py
+
28
−
18
View file @
30478e00
...
...
@@ -2,13 +2,17 @@ import json
from
datetime
import
datetime
import
requests
from
flask
import
Flask
,
render_template
,
redirect
from
flask
import
Flask
,
render_template
,
redirect
,
jsonify
from
gevent.pywsgi
import
WSGIServer
from
Localization
import
LOCALIZATION
from
UrlBuilder
import
UrlBuilder
from
blueprints
import
Roadmaps
,
Authentication
,
Milestones
,
Tasks
,
SubTasks
with
open
(
'
version.json
'
,
'
r
'
)
as
f
:
VERSION
=
json
.
load
(
f
)
VERSION
=
VERSION
[
'
version
'
]
with
open
(
'
settings.json
'
,
'
r
'
)
as
f
:
SETTINGS
=
json
.
load
(
f
)
...
...
@@ -26,6 +30,11 @@ app.register_blueprint(Tasks.construct_blueprint(URL_BUILDER))
app
.
register_blueprint
(
SubTasks
.
construct_blueprint
(
URL_BUILDER
))
@app.route
(
'
/version
'
,
methods
=
[
'
GET
'
])
def
version
():
return
jsonify
(
VERSION
)
@app.route
(
'
/
'
)
def
overview
():
roadmaps
=
requests
.
get
(
URL_BUILDER
.
build_url
(
'
roadmaps
'
)).
json
()
...
...
@@ -39,36 +48,36 @@ def roadmap():
@app.route
(
'
/roadmap/<roadmapID>
'
)
def
roadmap_by_id
(
roadmapID
):
try
:
roadmapID
=
int
(
roadmapID
)
except
ValueError
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
if
roadmapID
<
1
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
roadmap
=
requests
.
get
(
URL_BUILDER
.
build_url
(
'
roadmap
'
,
roadmapID
,
'
full
'
)).
json
()
if
roadmap
is
None
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_roadmap_not_existing
'
])
success
,
response
=
__check_roadmap
(
roadmapID
)
if
success
:
return
render_template
(
'
index.html
'
,
roadmap
=
response
,
localization
=
LOCALIZATION
)
return
re
nder_template
(
'
index.html
'
,
roadmap
=
roadmap
,
localization
=
LOCALIZATION
)
return
re
sponse
@app.route
(
'
/roadmap/<roadmapID>/fragment
'
)
def
roadmap_fragement_by_id
(
roadmapID
):
success
,
response
=
__check_roadmap
(
roadmapID
)
if
success
:
return
render_template
(
'
roadmapFragment.html
'
,
roadmap
=
response
,
localization
=
LOCALIZATION
)
return
response
def
__check_roadmap
(
roadmapID
):
try
:
roadmapID
=
int
(
roadmapID
)
except
ValueError
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
return
False
,
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
if
roadmapID
<
1
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
return
False
,
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_param_invalid
'
])
roadmap
=
requests
.
get
(
URL_BUILDER
.
build_url
(
'
roadmap
'
,
roadmapID
,
'
full
'
)).
json
()
if
roadmap
is
None
:
return
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_roadmap_not_existing
'
])
return
False
,
render_template
(
'
error.html
'
,
message
=
LOCALIZATION
[
'
error_roadmap_not_existing
'
])
return
render_template
(
'
roadmapFragment.html
'
,
roadmap
=
roadmap
,
localization
=
LOCALIZATION
)
return
True
,
roadmap
if
__name__
==
'
__main__
'
:
...
...
@@ -80,5 +89,6 @@ if __name__ == '__main__':
else
:
http_server
=
WSGIServer
((
SETTINGS
[
'
listen
'
],
SETTINGS
[
'
port
'
]),
app
)
print
(
'
Listening on {}:{}...
'
.
format
(
SETTINGS
[
'
listen
'
],
SETTINGS
[
'
port
'
]))
print
(
'
RoadmapClient {}({}) - Listening on {}:{}...
'
.
format
(
VERSION
[
'
name
'
],
VERSION
[
'
code
'
],
SETTINGS
[
'
listen
'
],
SETTINGS
[
'
port
'
]))
http_server
.
serve_forever
()
This diff is collapsed.
Click to expand it.
client/version.json
0 → 100644
+
7
−
0
View file @
30478e00
{
"version"
:
{
"name"
:
"v1.0.0"
,
"code"
:
1
,
"date"
:
"30.07.19"
}
}
\ No newline at end of file
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