From 687de6fd6d489752c3e6353be5f652f98c6c4835 Mon Sep 17 00:00:00 2001 From: keerthi Date: Thu, 8 May 2025 15:51:32 +0530 Subject: [PATCH] Add auto-refresh functionality to Attacks page --- web/web/blueprints/attacks/__init__.py | 4 ++ .../templates/attacks/attacks_table.html | 29 ++++++++ .../attacks/templates/attacks/index.html | 66 ++++++++++--------- 3 files changed, 69 insertions(+), 30 deletions(-) create mode 100644 web/web/blueprints/attacks/templates/attacks/attacks_table.html diff --git a/web/web/blueprints/attacks/__init__.py b/web/web/blueprints/attacks/__init__.py index a6cc1d2..4fe3931 100644 --- a/web/web/blueprints/attacks/__init__.py +++ b/web/web/blueprints/attacks/__init__.py @@ -86,6 +86,10 @@ def download(attack_id): def create(): return render_template('attacks/create.html') +@attacks.route('/table') +def table(): + return render_template('attacks/attacks_table.html', attacks=Attack.query.all()) + @attacks.errorhandler(NotFound) def handle_not_found_error(e): if (request.referrer is None): diff --git a/web/web/blueprints/attacks/templates/attacks/attacks_table.html b/web/web/blueprints/attacks/templates/attacks/attacks_table.html new file mode 100644 index 0000000..345b170 --- /dev/null +++ b/web/web/blueprints/attacks/templates/attacks/attacks_table.html @@ -0,0 +1,29 @@ + + + + + + + + + + + {% for attack in attacks %} + + + + + + + {% endfor %} + + +
NameCreated ByCreated AtTeams currently passing
{{ attack.name }}{{ attack.team.name if attack.team else "" }}{{ attack.created_at | formatdatetime }}{{ attack.passing | length }}
\ No newline at end of file diff --git a/web/web/blueprints/attacks/templates/attacks/index.html b/web/web/blueprints/attacks/templates/attacks/index.html index 79ebb68..7a602b3 100644 --- a/web/web/blueprints/attacks/templates/attacks/index.html +++ b/web/web/blueprints/attacks/templates/attacks/index.html @@ -3,36 +3,42 @@ {% block title %}Attacks{% endblock %} {% block content %} - + +
+ + +
Submit an attack - - - - - - - - - - - {% for attack in attacks %} - - - - - - - {% endfor %} - - -
NameCreated ByCreated AtTeams currently passing
{{ attack.name }}{{ attack.team.name if attack.team else "" }}{{ attack.created_at | formatdatetime }}{{ attack.passing | length }}
+
+ {% include "attacks/attacks_table.html" %} +
+{% endblock %} + +{% block scripts %} + {% endblock %}