Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Merge requests
!251
Database improvements
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Database improvements
database_improvements
into
1.4.x
Overview
1
Commits
4
Pipelines
3
Changes
4
Merged
Samuel GAIST
requested to merge
database_improvements
into
1.4.x
6 years ago
Overview
1
Commits
4
Pipelines
3
Changes
1
Expand
This patch series fixes bugs in the database API and improve the tools to set them up.
0
0
Merge request reports
Compare
version 1
version 2
c33532f6
6 years ago
version 1
764daf90
6 years ago
1.4.x (base)
and
version 2
latest version
4fc2a0a6
4 commits,
6 years ago
version 2
c33532f6
4 commits,
6 years ago
version 1
764daf90
4 commits,
6 years ago
Show latest version
1 file
+
3
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
beat/web/databases/api.py
+
3
−
2
Options
@@ -97,16 +97,17 @@ def database_to_json(database, request_user, fields_to_return,
def
clean_paths
(
declaration
):
pseudo_path
=
"
/path_to_db_folder
"
json_data
=
json
.
loads
(
declaration
)
root_folder
=
json_data
[
'
root_folder
'
]
cleaned_folder
=
os
.
path
.
basename
(
os
.
path
.
normpath
(
root_folder
))
json_data
[
'
root_folder
'
]
=
os
.
path
.
join
(
"
{{ path_to_db_folder }}
"
,
cleaned_folder
)
json_data
[
'
root_folder
'
]
=
os
.
path
.
join
(
pseudo_path
,
cleaned_folder
)
for
protocol
in
json_data
[
'
protocols
'
]:
for
set_
in
protocol
[
'
sets
'
]:
if
'
parameters
'
in
set_
and
'
annotations
'
in
set_
[
'
parameters
'
]:
annotations_folder
=
set_
[
'
parameters
'
][
'
annotations
'
]
cleaned_folder
=
annotations_folder
.
split
(
'
/
'
)[
-
2
:]
set_
[
'
parameters
'
][
'
annotations
'
]
=
os
.
path
.
join
(
"
{{ path_to_db_folder }}
"
,
*
cleaned_folder
)
set_
[
'
parameters
'
][
'
annotations
'
]
=
os
.
path
.
join
(
pseudo_path
,
*
cleaned_folder
)
return
json
.
dumps
(
json_data
)
#----------------------------------------------------------
Loading