Commit bba04ca1 authored by André Espaze's avatar André Espaze
Browse files

Start with correct homeurl and Elm urlPrefix

parent 7b6c72fdc996
module Common exposing
( classes
( checkUrlPrefix
, classes
, decodeJsonMessage
, decodeResponse
, expectJsonMessage
......@@ -100,3 +101,12 @@ expectStringResponse toMsg readErr decoder =
expectJsonMessage : ToMsg a msg -> D.Decoder a -> Http.Expect msg
expectJsonMessage toMsg =
expectStringResponse toMsg readErrorMessage
checkUrlPrefix : String -> String
checkUrlPrefix x =
if x == "/" then
""
else
x
......@@ -187,7 +187,11 @@ main =
}
init urlPrefix =
( Model urlPrefix [] "" [] [] Nothing, initialGet urlPrefix )
let
p =
Common.checkUrlPrefix urlPrefix
in
( Model p [] "" [] [] Nothing, initialGet p )
sub model =
Time.every 1000 (always MakeSearch)
......
......@@ -346,10 +346,13 @@ main =
init urlPrefix =
let
p =
Common.checkUrlPrefix urlPrefix
c =
LruCache.empty 100
in
( Model urlPrefix [] "" [] [] True c, initialGet urlPrefix )
( Model p [] "" [] [] True c, initialGet p )
sub model =
if model.activeSelection then
......
......@@ -315,9 +315,11 @@ main : Program String Model Msg
main =
let
init urlPrefix =
( Model urlPrefix Select [] "" [] Nothing "" Nothing
, getCatalog urlPrefix
)
let
p =
Common.checkUrlPrefix urlPrefix
in
( Model p Select [] "" [] Nothing "" Nothing, getCatalog p )
sub model =
if model.state == Select then
......
import pandas as pd
from flask import Blueprint, request, render_template
from flask import Blueprint, request, render_template, url_for
from dash import _utils
......@@ -37,6 +37,11 @@ def maxrev(engine):
return engine.execute(sql).scalar()
def homeurl():
homeurl = url_for('tsview.home')
return homeurl[:homeurl.rindex('/')] + '/'
def tsview(engine, tshclass=timeseries, serie_names=serie_names):
class viewargs(_argsdict):
......@@ -53,7 +58,9 @@ def tsview(engine, tshclass=timeseries, serie_names=serie_names):
@bp.route('/tsview')
def home():
args = viewargs(request.args)
return render_template('tsview.html', **args)
return render_template('tsview.html',
homeurl=homeurl(),
**args)
@bp.route('/tsplot')
def tsplot():
......@@ -100,11 +107,13 @@ def tsview(engine, tshclass=timeseries, serie_names=serie_names):
@bp.route('/tsdelete')
def tsdelete():
return render_template('tsedit.html',
edit_kind="Delete", urlprefix="")
edit_kind="Delete",
homeurl=homeurl())
@bp.route('/tsrename')
def tsrename():
return render_template('tsedit.html',
edit_kind="Rename", urlprefix="")
edit_kind="Rename",
homeurl=homeurl())
return bp
......@@ -11,7 +11,7 @@
<script>
var app = Elm.{{ edit_kind }}.init({
node: document.getElementById("app"),
flags: "{{ urlprefix }}"
flags: "{{ homeurl }}"
});
</script>
</body>
......
......@@ -6,9 +6,10 @@
<div id="series_selector"></div>
<script src="./tsview_static/plot_elm.js"></script>
<script>
const baseurl = "{{ homeurl }}"
var app = Elm.Plot.init({
node: document.getElementById("series_selector"),
flags: ""
flags: baseurl
});
app.ports.renderPlot.subscribe(function(args) {
Plotly.newPlot(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment