fixes #4 - adds modular analyses system using plugins
This commit is contained in:
@@ -1,16 +1,100 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="container-fluid d-flex justify-content-center">
|
||||
<div class="container-md my-5 mx-2 shadow-lg p-4 ">
|
||||
<div class="container-sm">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h2>Analyze</h2>
|
||||
</div>
|
||||
<div class="col">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="container-fluid d-flex justify-content-center">
|
||||
<div class="container-md my-5 mb-3 mx-2 shadow-lg p-4">
|
||||
<div class="container-sm">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h2>User Activity Distribution</h2>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<form method="POST" action="{{ url_for('views.analyze') }}">
|
||||
<!-- Dropdown for selecting data file -->
|
||||
<label for="data_file" class="form-label">Choose Data File:</label>
|
||||
<select name="data_file" id="data_file" class="form-select">
|
||||
{% if data_files %}
|
||||
{% for file in data_files %}
|
||||
{{ file }}
|
||||
{{ selected_file }}
|
||||
<option value="{{ file }}" {% if file == selected_file %}selected{% endif %}>{{ file.split('/')[-1] }}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<option disabled>No CSV files found</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
|
||||
<!-- Analysis Selection Table -->
|
||||
<label for="analyses" class="form-label">Select Analyses:</label>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Analysis Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if analyses %}
|
||||
{% for analysis in analyses %}
|
||||
<tr>
|
||||
<td>
|
||||
<input class="form-check-input" type="checkbox" name="analyses" value="{{ analysis.name }}"
|
||||
{% if analysis.name in selected_analyses %}checked{% endif %}>
|
||||
</td>
|
||||
<td>{{ analysis.name }}</td>
|
||||
<td>{{ analysis.description }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">No analyses available</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary mt-3">Run Analyses</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'includes/error.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% if plot_url %}
|
||||
<section class="container-fluid d-flex justify-content-center">
|
||||
<div class="container-md my-1 mx-2 shadow-lg p-4">
|
||||
<div class="container-sm">
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<h4>Selected File: {{ selected_file.split('/')[-1] }}</h4>
|
||||
<img src="{{ plot_url }}" class="img-fluid rounded shadow" alt="User Activity Distribution">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if results %}
|
||||
{% for analysis_name, result in results.items() %}
|
||||
<section class="container-fluid d-flex justify-content-center">
|
||||
<div class="container-md my-2 mx-2 shadow p-4 pt-0">
|
||||
<div class="container-sm">
|
||||
<div class="results mt-4">
|
||||
<h3>{{ analysis_name }}</h3>
|
||||
<div class="analysis-output">
|
||||
{{ result | safe }} <!-- This allows HTML output -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="container-fluid d-flex justify-content-center">
|
||||
<div class="container-md my-5 mx-2 shadow-lg p-4 ">
|
||||
<div class="container-sm">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h2>User Activity Distribution</h2>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<!-- Dropdown for selecting data file -->
|
||||
<form method="POST" action="{{ url_for('views.data_visualization') }}">
|
||||
<label for="data_file" class="form-label">Choose Data File:</label>
|
||||
<select name="data_file" id="data_file" class="form-select" onchange="this.form.submit()">
|
||||
{% for file in data_files %}
|
||||
<option value="{{ file }}" {% if file == selected_file %}selected{% endif %}>
|
||||
{{ file.split('/')[-1] }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-danger mt-3" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if plot_url %}
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<h4>Selected File: {{ selected_file.split('/')[-1] }}</h4>
|
||||
<img src="{{ plot_url }}" class="img-fluid rounded shadow" alt="User Activity Distribution">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if statistics %}
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<h2>Activity Statistics</h2>
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Hour</th>
|
||||
<th>Activity Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for hour, count in statistics.items() %}
|
||||
<tr>
|
||||
<td>{{ hour }}</td>
|
||||
<td>{{ count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
6
app/templates/includes/error.html
Normal file
6
app/templates/includes/error.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% if error %}
|
||||
<div class="alert alert-danger alert-dismissible fade show mt-3" role="alert">
|
||||
<strong>Error:</strong> {{ error }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Torn User Activity Scraper</a>
|
||||
{% from 'bootstrap4/nav.html' import render_nav_item %}
|
||||
{{ render_nav_item('views.data_visualization', 'Data Visualization') }}
|
||||
{{ render_nav_item('views.analyze', 'Data Visualization') }}
|
||||
{{ render_nav_item('download_results', 'Files') }}
|
||||
{{ render_nav_item('log_viewer', 'Logs') }}
|
||||
<div class="d-flex" id="color-mode-toggle">
|
||||
|
||||
Reference in New Issue
Block a user