Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visualizer-embed
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
Container 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Owen Graham
visualizer-embed
Commits
645e267d
Verified
Commit
645e267d
authored
Jun 28, 2022
by
Owen Graham
Browse files
Options
Downloads
Patches
Plain Diff
Stop fetching source links, use redirects instead
parent
15412d46
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
visualizer/__init__.py
+5
-5
5 additions, 5 deletions
visualizer/__init__.py
visualizer/static/visualizer.js
+2
-6
2 additions, 6 deletions
visualizer/static/visualizer.js
with
7 additions
and
11 deletions
visualizer/__init__.py
+
5
−
5
View file @
645e267d
from
flask
import
abort
,
Flask
,
g
,
jsonify
,
render_template
from
flask
import
abort
,
Flask
,
g
,
jsonify
,
redirect
,
render_template
from
.parameters
import
get_param
,
year_type
from
.plotting
import
plotters
...
...
@@ -47,12 +47,12 @@ def render_plotter(name, embedded):
plot_view
=
f
'
plot-views/
{
view_name
}
.html
'
)
@app.route
(
'
/
record/link
'
)
def
record_link
():
"""
Re
turn the source link for
the selected dataset.
"""
@app.route
(
'
/
source
'
)
def
source_redirect
():
"""
Re
direct to
the selected dataset.
"""
station
=
get_station
(
get_param
(
'
station
'
))
year
=
get_param
(
'
year
'
,
to
=
year_type
)
return
jsonify
(
get_link
(
station
,
year
)
)
return
redirect
(
get_link
(
station
,
year
)
,
code
=
307
)
# Temporary Redirect
@app.route
(
'
/plot/<name>.png
'
)
...
...
This diff is collapsed.
Click to expand it.
visualizer/static/visualizer.js
+
2
−
6
View file @
645e267d
...
...
@@ -101,13 +101,9 @@ function sourceLink(station, year, n) {
if
(
EMBEDDED
)
{
a
.
target
=
'
_blank
'
;
}
div
.
appendChild
(
a
);
const
params
=
new
URLSearchParams
({
station
,
year
});
fetch
(
`
${
SCRIPT_ROOT
}
/record/link?
${
params
}
`
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
{
a
.
href
=
response
;
});
a
.
href
=
`
${
SCRIPT_ROOT
}
/source?
${
params
}
`
;
div
.
appendChild
(
a
);
return
div
;
}
...
...
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