command check - fix subscriber
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
</head>
|
||||
<body>
|
||||
{% block container %}
|
||||
<main role="main" class="container">
|
||||
<main role="main" class="container mt-4">
|
||||
{% block content %} {% endblock content %}
|
||||
</main>
|
||||
{% endblock container %} {% block footer %} {% endblock footer %}
|
||||
|
||||
<!-- Bootstrap Javascript -->
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js"
|
||||
integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
|
||||
48
wallet_api/templates/wallet_api/add_user.html
Normal file
48
wallet_api/templates/wallet_api/add_user.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends "base.html" %} {% load static %} {% block content %}
|
||||
<h1>Add User</h1>
|
||||
<form hx-post="/create_user" hx-target="#content">
|
||||
<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="role" class="form-label">Role</label>
|
||||
<input type="text" class="form-control" id="role" name="role" 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>
|
||||
{% endblock content %}
|
||||
62
wallet_api/templates/wallet_api/edit_user.html
Normal file
62
wallet_api/templates/wallet_api/edit_user.html
Normal file
@@ -0,0 +1,62 @@
|
||||
{% extends "base.html" %} {% load static %} {% block content %}
|
||||
<h1>Edit User</h1>
|
||||
<form hx-post="/update_user" hx-target="#content">
|
||||
<input type="hidden" name="id" value="{{ user.id }}" />
|
||||
<div class="mb-3">
|
||||
<label for="site" class="form-label">Site</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="site"
|
||||
name="site"
|
||||
value="{{ user.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"
|
||||
value="{{ user.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"
|
||||
value="{{ user.client_id }}"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="topic" class="form-label">Topic</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="topic"
|
||||
name="topic"
|
||||
value="{{ user.topic }}"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label">Role</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="role"
|
||||
name="role"
|
||||
value="{{ user.role }}"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
@@ -1,23 +1,60 @@
|
||||
{% extends "base.html" %} {% load static %} {% block content %}
|
||||
<h1>List Mosquitto Users</h1>
|
||||
<table class="table">
|
||||
<button class="btn btn-primary mb-3" hx-get="/add_user" hx-target="#content">
|
||||
Add User
|
||||
</button>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Site</th>
|
||||
<th scope="col">Username</th>
|
||||
<th scope="col">Client ID</th>
|
||||
<th scope="col">Topic</th>
|
||||
<th>Site</th>
|
||||
<th>Username</th>
|
||||
<th>Client ID</th>
|
||||
<th>Topic</th>
|
||||
<th>Role</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<th scope="row">{{ user.id }}</th>
|
||||
<td>{{ user.site }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>{{ user.client_id }}</td>
|
||||
<td>{{ user.topic }}</td>
|
||||
<td>{{user.site}}</td>
|
||||
<td>
|
||||
<a
|
||||
href="/wallet/user/edit/{{user.id}}"
|
||||
hx-get="/wallet/user/edit/{{user.id}}"
|
||||
hx-target="#content"
|
||||
>{{user.username}}</a
|
||||
>
|
||||
</td>
|
||||
<td>{{user.client_id}}</td>
|
||||
<td>{{user.topic}}</td>
|
||||
<td>
|
||||
<a
|
||||
href="/wallet/user/role/{{user.role}}"
|
||||
hx-get="/wallet/user/role/{{user.role}}"
|
||||
hx-target="#content"
|
||||
>{{user.role}}</a
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
{% if user.status == "enabled" %}
|
||||
<button
|
||||
class="btn btn-danger btn-sm"
|
||||
hx-post="/wallet/user/disable/{{user.id}}"
|
||||
hx-target="#user-list"
|
||||
>
|
||||
Disable
|
||||
</button>
|
||||
{% else %}
|
||||
<button
|
||||
class="btn btn-warning btn-sm"
|
||||
hx-post="/wallet/user/enable/{{user.id}}"
|
||||
hx-target="#user-list"
|
||||
>
|
||||
Enable
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<i> No users </i>
|
||||
|
||||
20
wallet_api/templates/wallet_api/role_info.html
Normal file
20
wallet_api/templates/wallet_api/role_info.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %} {% load static %} {% block content %}
|
||||
<h1>Role Permissions</h1>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Permission</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Role permissions will be dynamically loaded here -->
|
||||
{{#each permissions}}
|
||||
<tr>
|
||||
<td>{{ this.permission }}</td>
|
||||
<td>{{ this.description }}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user