Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kafka message sidebar panel #109

Merged
merged 10 commits into from
Sep 27, 2024
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ repos:
hooks:
- id: codespell
args: [-L, .codespell_ignore.txt]
- repo: https://github.com/djlint/djLint
rev: v1.35.2
hooks:
- id: djlint-reformat-django
- id: djlint-django
43 changes: 25 additions & 18 deletions main/templates/main/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@
{% load django_bootstrap5 %}
<!DOCTYPE html>
<html lang="en">

<head>
<title>{% block title %}SITE NAME{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% bootstrap_css %}
{% bootstrap_javascript %}
</head>

<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="{% url 'main:index' %}">DUNE Process Manager</a>
</div>
</nav>
<div class="container py-3">
{% block content %}{% endblock %}
</div>
</body>
<head>
<title>
{% block title %}
SITE NAME
{% endblock title %}
</title>
<meta name="description" content="DUNE Process Manager">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% bootstrap_css %}
{% bootstrap_javascript %}
{% block extra_css %}
{% endblock extra_css %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="{% url 'main:index' %}">DUNE Process Manager</a>
</div>
</nav>
<div class="container py-3">
{% block content %}
{% endblock content %}
</div>
</body>
</html>
18 changes: 8 additions & 10 deletions main/templates/main/boot_process.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% extends "main/base.html" %}
{% load crispy_forms_tags %}
{% load django_bootstrap5 %}

{% block title %}Boot Process{% endblock title %}

{% block title %}
Boot Process
{% endblock title %}
{% block content %}

<form action="{% url 'main:boot_process' %}" method="post">
{% csrf_token %}
{{ form|crispy }}
{% bootstrap_button button_type="submit" content="Submit" %}
</form>

<form action="{% url 'main:boot_process' %}" method="post">
{% csrf_token %}
{{ form|crispy }}
{% bootstrap_button button_type="submit" content="Submit" %}
</form>
{% endblock content %}
77 changes: 49 additions & 28 deletions main/templates/main/index.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,53 @@
{% extends "main/base.html" %}
{% load render_table from django_tables2 %}

{% block title %}Home{% endblock title %}

{% block title %}
Home
{% endblock title %}
{% block extra_css %}
<style>
.card-body {
max-height: 85vh;
overflow-y: auto;
}
</style>
{% endblock extra_css %}
{% block content %}

<div class="col">

{% if messages %}
<h2>Messages</h2>
<div style="white-space: pre-wrap;">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
<hr class="solid">
{% endif %}

<form method="post", action="{% url 'main:process_action' %}">
{% csrf_token %}
<a href="{% url 'main:boot_process' %}" class="btn btn-primary">Boot</a>
<input type="submit" value="Restart" class="btn btn-success", name="action", onclick="return confirm('Restart selected processes?')">
<input type="submit" value="Flush" class="btn btn-warning", name="action", onclick="return confirm('Flush selected processes?')">
<input type="submit" value="Kill" class="btn btn-danger", name="action", onclick="return confirm('Kill selected processes?')">
{% render_table table %}
</form>

</div>


<div class="row">
<div class="col">
<!-- djlint:off H025 -->
<form method="post", action="{% url 'main:process_action' %}">
{% csrf_token %}
<a href="{% url 'main:boot_process' %}" class="btn btn-primary">Boot</a>
<input type="submit"
value="Restart"
class="btn btn-success"
name="action"
onclick="return confirm('Restart selected processes?')">
<input type="submit"
value="Flush"
class="btn btn-warning"
name="action"
onclick="return confirm('Flush selected processes?')">
<input type="submit"
value="Kill"
class="btn btn-danger"
name="action"
onclick="return confirm('Kill selected processes?')">
</form>
<!-- djlint:on -->
{% render_table table %}
</div>
<div class="col">
<div class="card">
<div class="card-header">Messages</div>
<div class="card-body">
<ul class="list-group">
{% if messages %}
{% for message in messages %}<li class="list-group-item">{{ message }}</li>{% endfor %}
{% endif %}
</ul>
</div>
</div>
</div>
</div>
{% endblock content %}
17 changes: 7 additions & 10 deletions main/templates/main/logs.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{% extends "main/base.html" %}

{% block title %}Logs{% endblock title %}

{% block title %}
Logs
{% endblock title %}
{% block content %}

<div style="white-space: pre-wrap;">
{{ log_text }}
</div>

<a href="{% url 'main:index' %}">Return to table</a>

<!-- djlint:off H021 -->
<div style="white-space: pre-wrap;">{{ log_text }}</div>
<!-- djlint:on -->
<a href="{% url 'main:index' %}">Return to table</a>
{% endblock content %}
46 changes: 21 additions & 25 deletions main/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
{% extends "../main/base.html" %}
{% load crispy_forms_tags %}
{% load django_bootstrap5 %}

{% block content %}

{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}

{% if next %}
{% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
<p>Please login to see this page.</p>
{% if form.errors %}<p>Your username and password didn't match. Please try again.</p>{% endif %}
{% if next %}
{% if user.is_authenticated %}
<p>
Your account doesn't have access to this page. To proceed,
please login with an account that has access.
</p>
{% else %}
<p>Please login to see this page.</p>
{% endif %}
{% endif %}
{% endif %}

<form method="post" action="{% url 'main:login' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
{{ form|crispy }}
{% bootstrap_button button_type="submit" content="Login" %}
</form>

{# Assumes you set up the password_reset view in your URLconf #}
<p><a href="{% url 'main:password_reset' %}">Lost password?</a></p>

{% endblock %}
<form method="post" action="{% url 'main:login' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
{{ form|crispy }}
{% bootstrap_button button_type="submit" content="Login" %}
</form>
{# Assumes you set up the password_reset view in your URLconf #}
<p>
<a href="{% url 'main:password_reset' %}">Lost password?</a>
</p>
{% endblock content %}