fix + test api with resl client
This commit is contained in:
@@ -1,17 +1,45 @@
|
||||
{% load static %}
|
||||
{% load django_htmx %}
|
||||
{% load static %} {% load django_htmx %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Django Template">
|
||||
<title>Project Title</title>
|
||||
<link rel="icon" type="image/x-icon" href="{% static 'favicon.ico' %}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Django Template" />
|
||||
<title>MQTT Ase User Management</title>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/x-icon"
|
||||
href="{% static 'images/favicon.ico' %}"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="{% static 'images/apple-touch-icon.png' %}"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="{% static 'images/favicon-32x32.png' %}"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="{% static 'images/favicon-16x16.png' %}"
|
||||
/>
|
||||
<link rel="icon" href="{% static 'images/favicon.ico' %}" />
|
||||
<link rel="manifest" href="{% static 'images/site.webmanifest' %}" />
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" defer></script>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"
|
||||
defer
|
||||
></script>
|
||||
|
||||
<!-- HTMX -->
|
||||
<script src="https://unpkg.com/htmx.org@2.0.4" defer></script>
|
||||
@@ -19,18 +47,13 @@
|
||||
|
||||
<!-- Custom Styles -->
|
||||
<style>
|
||||
.dropdown-menu { min-width: 200px; }
|
||||
.dropdown-menu {
|
||||
min-width: 200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
|
||||
|
||||
{% include 'includes/header.html' %}
|
||||
|
||||
{% include 'includes/messages.html' %}
|
||||
|
||||
{% block layout %}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
</head>
|
||||
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
|
||||
{% include 'includes/header.html' %} {% include 'includes/messages.html' %}
|
||||
{% block layout %} {% endblock %} {% block javascript %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{% extends 'base.html' %} {% block layout %}
|
||||
<div class="container" style="margin-top: 20px;">
|
||||
<div class="container" style="margin-top: 20px">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-md-8 col-lg-6">
|
||||
<div class="bg-white rounded-3 p-4 p-md-5 shadow-lg">
|
||||
{% block content %} {% endblock %}
|
||||
<div class="col-md-10 col-lg-8">
|
||||
<div class="card rounded-2xl shadow">
|
||||
<div class="card-body p-4">{% block content %} {% endblock %}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
{% extends 'layouts/blank.html' %} {% block content %}
|
||||
|
||||
<h1>Add User</h1>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label for="site" class="form-label">Site</label>
|
||||
<input type="text" class="form-control" id="site" name="site" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="username"
|
||||
name="username"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="clientId" class="form-label">Client ID</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="clientId"
|
||||
name="clientId"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="topic" class="form-label">Topic</label>
|
||||
<input type="text" class="form-control" id="topic" name="topic" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
name="password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
<h1>Add User</h1>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label for="site" class="form-label">Site</label>
|
||||
<input type="text" class="form-control" id="site" name="site" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="username"
|
||||
name="username"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="clientId" class="form-label">Client ID</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="clientId"
|
||||
name="clientId"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="topic" class="form-label">Topic</label>
|
||||
<input type="text" class="form-control" id="topic" name="topic" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
name="password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
|
||||
<!-- Risultato della creazione -->
|
||||
<div id="result"></div>
|
||||
<!-- Risultato della creazione -->
|
||||
<div id="result"></div>
|
||||
{% endblock content%}
|
||||
|
||||
@@ -48,5 +48,7 @@
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
<a href="{% url 'list_users' %}">
|
||||
<button type="button" class="btn btn-secondary">Cancel</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
<th>Username</th>
|
||||
<th>Client ID</th>
|
||||
<th>Topic</th>
|
||||
<th>Action</th>
|
||||
{% if ase_adm_group %}
|
||||
<th>Actions</th>
|
||||
<th> </th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -28,31 +31,22 @@
|
||||
</td>
|
||||
<td>{{user.client_id}}</td>
|
||||
<td>{{user.topic}}</td>
|
||||
<td id="user-status">
|
||||
{% if ase_adm_group %}
|
||||
<td>
|
||||
{% if user.status == "enabled" %}
|
||||
<a
|
||||
{% if ase_adm_group %}
|
||||
href="{% url 'disable_user' user.slug %}"
|
||||
{% endif %}>
|
||||
<button class="btn btn-danger btn-sm"
|
||||
{% if not ase_adm_group %}
|
||||
disabled
|
||||
{% endif %}
|
||||
>Disable</button>
|
||||
</a>
|
||||
<a href="{% url 'disable_user' user.slug %}"
|
||||
<button class="btn btn-warning btn-sm" >Disable</button>
|
||||
</a>
|
||||
{% else %}
|
||||
<a
|
||||
{% if ase_adm_group %}
|
||||
href="{% url 'enable_user' user.slug %}"
|
||||
{% endif %}>
|
||||
<button class="btn btn-warning btn-sm"
|
||||
{% if not ase_adm_group %}
|
||||
disabled
|
||||
{% endif %}
|
||||
>Enable</button>
|
||||
</a>
|
||||
<a href="{% url 'enable_user' user.slug %}"
|
||||
<button class="btn btn-info btn-sm" >Enable</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
<td><a href="{% url 'delete_user' user.slug %}">
|
||||
<button class="btn btn-danger btn-sm">Delete</button>
|
||||
</a></td>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user