mirror of
https://github.com/craigerl/aprsd.git
synced 2025-07-31 12:52:24 -04:00
Provide an initial datapoint on rendering index
This patch adds a single data point when rendering the initial stats for the index page.
This commit is contained in:
parent
6297ebeb67
commit
fb979eda94
@ -43,7 +43,8 @@ class APRSDFlask(flask_classful.FlaskView):
|
|||||||
|
|
||||||
@auth.login_required
|
@auth.login_required
|
||||||
def index(self):
|
def index(self):
|
||||||
return flask.render_template("index.html", message=self.stats())
|
stats = self._stats()
|
||||||
|
return flask.render_template("index.html", initial_stats=stats)
|
||||||
|
|
||||||
@auth.login_required
|
@auth.login_required
|
||||||
def messages(self):
|
def messages(self):
|
||||||
@ -69,7 +70,7 @@ class APRSDFlask(flask_classful.FlaskView):
|
|||||||
track.save()
|
track.save()
|
||||||
return json.dumps({"messages": "saved"})
|
return json.dumps({"messages": "saved"})
|
||||||
|
|
||||||
def stats(self):
|
def _stats(self):
|
||||||
stats_obj = stats.APRSDStats()
|
stats_obj = stats.APRSDStats()
|
||||||
track = messaging.MsgTrack()
|
track = messaging.MsgTrack()
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
@ -84,7 +85,11 @@ class APRSDFlask(flask_classful.FlaskView):
|
|||||||
"memory_current": current,
|
"memory_current": current,
|
||||||
"memory_peak": peak,
|
"memory_peak": peak,
|
||||||
}
|
}
|
||||||
return json.dumps(result)
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def stats(self):
|
||||||
|
return json.dumps(self._stats())
|
||||||
|
|
||||||
|
|
||||||
def init_flask(config):
|
def init_flask(config):
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
<script type="text/javascript"">
|
<script type="text/javascript"">
|
||||||
|
|
||||||
|
var initial_stats = {{ initial_stats|tojson|safe }};
|
||||||
|
|
||||||
var memory_chart = null
|
var memory_chart = null
|
||||||
var message_chart = null
|
var message_chart = null
|
||||||
var color = Chart.helpers.color;
|
var color = Chart.helpers.color;
|
||||||
@ -166,6 +168,7 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
console.log(initial_stats);
|
||||||
start_update();
|
start_update();
|
||||||
start_charts();
|
start_charts();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user