1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-07-05 19:38:44 -05:00

update projects to .NET Core 2.0.7

added instance and client count to api page
removed vestigial ConfigGenerator
This commit is contained in:
RaidMax
2018-04-23 16:03:50 -05:00
parent 5ef9b98a5c
commit 3918985406
18 changed files with 98 additions and 85 deletions

View File

@ -21,10 +21,6 @@ class HistoryGraph(Resource):
)
graph = pygal.StackedLine(
interpolate='cubic',
interpolation_precision=3,
#x_labels_major_every=100,
#x_labels_major_count=500,
stroke_style={'width': 0.4},
show_dots=False,
show_legend=False,
@ -37,10 +33,15 @@ class HistoryGraph(Resource):
if len(instance_count) > 0:
graph.x_labels = [ timeago.format(instance_count[0])]
graph.add('Instance Count', [history['count'] for history in ctx.history.instance_history][-history_count:])
graph.add('Client Count', [history['count'] for history in ctx.history.client_history][-history_count:])
instance_counts = [history['count'] for history in ctx.history.instance_history][-history_count:]
client_counts = [history['count'] for history in ctx.history.client_history][-history_count:]
graph.add('Instance Count', instance_counts)
graph.add('Client Count', client_counts)
return { 'message' : graph.render(),
'data_points' : len(instance_count)
'data_points' : len(instance_count),
'instance_count' : 0 if len(instance_counts) is 0 else instance_counts[-1],
'client_count' : 0 if len(client_counts) is 0 else client_counts[-1]
}, 200
except Exception as e:
return { 'message' : str(e) }, 500

View File

@ -5,12 +5,19 @@
<div class="col-12">
<figure>
<div id="history_graph">{{history_graph|safe}}</div>
<figcaption class="float-right pr-3 mr-4">
<figcaption class="float-right">
<span id="history_graph_zoom_out" class="h4 oi oi-zoom-out text-muted" style="cursor:pointer;"></span>
<span id="history_graph_zoom_in" class="h4 oi oi-zoom-in text-muted" style="cursor:pointer;"></span>
</figcaption>
<figcaption class="float-left">
<span class="h4 text-muted">{{instance_count}} instances</span>
<span class="h4 text-muted">&mdash; {{client_count}} clients</span>
</figcaption>
</figure>
</div>
<div class="col-12">
</div>
</div>
{% endblock %}
@ -20,6 +27,7 @@
<script>
let dataPoints = {{data_points}};
let zoomLevel = Math.ceil(dataPoints / 2);
let maxPoints = {{max_data_points}}
//console.log(dataPoints);
function updateHistoryGraph() {
@ -33,7 +41,7 @@
$('#history_graph_zoom_out').click(function () {
// console.log(zoomLevel);
zoomLevel = zoomLevel * 2 <= 1440 ? Math.ceil(zoomLevel * 2) : dataPoints;
zoomLevel = zoomLevel * 2 <= maxPoints ? Math.ceil(zoomLevel * 2) : dataPoints;
updateHistoryGraph();
});

View File

@ -14,5 +14,8 @@ def home():
'index.html',
title='API Overview',
history_graph = _history_graph[0]['message'],
data_points = _history_graph[0]['data_points']
data_points = _history_graph[0]['data_points'],
instance_count = _history_graph[0]['instance_count'],
client_count = _history_graph[0]['client_count'],
max_data_points = 1440
)