Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DGenie
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
DG
DGenie
Commits
1330423b
Commit
1330423b
authored
3 years ago
by
Florian Atteneder
Browse files
Options
Downloads
Patches
Plain Diff
fix sorting of output directories and make prev next buttons periodic
parent
db37608d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/.gitignore
+1
-0
1 addition, 0 deletions
public/.gitignore
routes.jl
+33
-23
33 additions, 23 deletions
routes.jl
with
34 additions
and
23 deletions
public/.gitignore
0 → 100644
+
1
−
0
View file @
1330423b
experiments
This diff is collapsed.
Click to expand it.
routes.jl
+
33
−
23
View file @
1330423b
...
...
@@ -115,10 +115,10 @@ function append_to(base_string, str)
end
function
header_template
(
route_name
,
id
,
dir
;
skip_prev
=
false
,
skip_next
=
false
)
function
header_template
(
route_name
,
id
,
dir
;
prev_id
=
missing
,
next_id
=
missing
)
link_prev
=
linkto
(
Symbol
(
route_name
),
sim_id
=
id
-
1
)
link_next
=
linkto
(
Symbol
(
route_name
),
sim_id
=
id
+
1
)
link_prev
=
linkto
(
Symbol
(
route_name
),
sim_id
=
prev_
id
)
link_next
=
linkto
(
Symbol
(
route_name
),
sim_id
=
next_
id
)
header_home_button
=
"""
<a class="
home
" href="
/
">Home</a>
...
...
@@ -134,9 +134,9 @@ function header_template(route_name, id, dir; skip_prev=false, skip_next=false)
"""
header
=
header_home_button
!
skip_prev
&&
(
header
=
append_to
(
header
,
header_prev_button
))
!
ismissing
(
prev_id
)
&&
(
header
=
append_to
(
header
,
header_prev_button
))
header
=
append_to
(
header
,
header_text
)
!
skip_next
&&
(
header
=
append_to
(
header
,
header_next_button
))
!
ismissing
(
next_id
)
&&
(
header
=
append_to
(
header
,
header_next_button
))
return
header
end
...
...
@@ -144,29 +144,39 @@ end
function
generate_html_sites
(
route_name
,
id
,
rootdir
)
outputdirs
=
gather_outputdirs
(
rootdir
)
filenames_plots
=
[]
all_ids
=
Int64
[]
for
dir
in
outputdirs
this_id
=
match
(
r
"_(\d)+
$
"
,
dir
)
isnothing
(
this_id
)
&&
continue
push!
(
all_ids
,
parse
(
Int64
,
first
(
this_id
.
captures
)))
files
=
glob
(
"
$
dir/*.png"
)
push!
(
filenames_plots
,
files
)
table
=
gather_parameters
(
rootdir
)
list_filenames
=
table
.
"filename"
all_ids
=
map
(
list_filenames
)
do
filename
id_match
=
match
(
r
"_(\d+).toml
$
"
,
filename
)
isnothing
(
id_match
)
&&
error
(
"Encountered filename with wrong pattern: '
$
filename'"
)
return
parse
(
Int64
,
first
(
id_match
.
captures
))
end
!
(
id
in
all_ids
)
&&
error
(
"Could not locate an output directory with number
$
id"
)
table
=
gather_parameters
(
rootdir
)
p
=
sortperm
(
all_ids
)
table
=
table
[
p
,
:
]
all_ids
=
all_ids
[
p
]
list_filenames
=
list_filenames
[
p
]
list_outputdirs
=
map
(
list_filenames
)
do
filename
basename
,
_
=
splitallext
(
filename
)
joinpath
(
rootdir
,
basename
)
end
list_plotnames
=
[
glob
(
"
$
dir/*.png"
)
for
dir
in
list_outputdirs
]
parameters
=
[
dg1d
.
to_dict
(
FlatDict
,
row
)
for
row
in
eachrow
(
table
)
]
html_tables
=
[
to_markdown_table
(
p
)
for
p
in
parameters
]
html_headers
=
[
header_template
(
route_name
,
id
,
dir
,
skip_prev
=!
((
id
-
1
)
in
all_ids
),
skip_next
=!
((
id
+
1
)
in
all_ids
)
)
for
dir
in
outputdirs
]
html_headers
=
map
(
list_outputdirs
)
do
dir
idx
=
findfirst
(
i
->
i
==
id
,
all_ids
)
n_all_ids
=
length
(
all_ids
)
prev_id
,
next_id
=
if
idx
==
1
all_ids
[
end
],
all_ids
[
2
]
elseif
idx
==
n_all_ids
all_ids
[
n_all_ids
-
1
],
all_ids
[
1
]
else
all_ids
[
idx
-
1
],
all_ids
[
idx
+
1
]
end
header_template
(
route_name
,
id
,
dir
,
prev_id
=
prev_id
,
next_id
=
next_id
)
end
html_sites
=
[
html_twocolumn_scrollable
(
header
,
tbl
,
plts
)
for
(
header
,
tbl
,
plts
)
in
zip
(
html_headers
,
html_tables
,
filenames
_plots
)
]
for
(
header
,
tbl
,
plts
)
in
zip
(
html_headers
,
html_tables
,
list
_plot
name
s
)
]
return
html_sites
end
...
...
This diff is collapsed.
Click to expand it.
Florian Atteneder
@fatteneder
mentioned in issue
#8 (closed)
·
3 years ago
mentioned in issue
#8 (closed)
mentioned in issue #8
Toggle commit list
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