mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
adding GUI / routing for users admin (eventually roles will be here as well)
This commit is contained in:
parent
192922159f
commit
6ea66c37f5
@ -244,6 +244,10 @@ class db_shortcuts:
|
||||
query = Host_Stats.select().order_by(Host_Stats.id.desc()).get()
|
||||
return model_to_dict(query)
|
||||
|
||||
def get_all_users(self):
|
||||
query = Users.select()
|
||||
return query
|
||||
|
||||
def get_unactioned_commands(self):
|
||||
query = Commands.select().where(Commands.executed == 0)
|
||||
return self.return_rows(query)
|
||||
|
@ -112,6 +112,10 @@ class PanelHandler(BaseHandler):
|
||||
# template = "panel/server_details.html"
|
||||
template = "panel/server_{subpage}.html".format(subpage=subpage)
|
||||
|
||||
elif page == 'panel_config':
|
||||
page_data['users'] = db_helper.get_all_users()
|
||||
# print(page_data['users'])
|
||||
template = "panel/panel_config.html"
|
||||
|
||||
self.render(
|
||||
template,
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"last_refreshed": "10/07/2020, 09:09:10",
|
||||
"last_refreshed": "12/06/2020, 13:33:10",
|
||||
"servers": {
|
||||
"nukkitx": [
|
||||
"1.14"
|
||||
@ -68,6 +68,7 @@
|
||||
"1.8"
|
||||
],
|
||||
"bukkit": [
|
||||
"1.16.4",
|
||||
"1.16.3",
|
||||
"1.16.2",
|
||||
"1.16.1",
|
||||
@ -97,6 +98,7 @@
|
||||
"1.8"
|
||||
],
|
||||
"paper": [
|
||||
"1.16.4",
|
||||
"1.16.3",
|
||||
"1.16.2",
|
||||
"1.16.1",
|
||||
@ -120,6 +122,7 @@
|
||||
"1.8.8"
|
||||
],
|
||||
"spigot": [
|
||||
"1.16.4",
|
||||
"1.16.3",
|
||||
"1.16.2",
|
||||
"1.16.1",
|
||||
@ -148,6 +151,11 @@
|
||||
"1.8.8"
|
||||
],
|
||||
"snapshot": [
|
||||
"1.1720w49a",
|
||||
"1.1720w48a",
|
||||
"1.1720w46a",
|
||||
"1.1720w45a",
|
||||
"1.17",
|
||||
"1.16pre8",
|
||||
"1.16pre7",
|
||||
"1.16pre6",
|
||||
@ -157,8 +165,10 @@
|
||||
"1.16pre2",
|
||||
"1.16pre1",
|
||||
"1.1620w30a",
|
||||
"1.1620w29a",
|
||||
"1.1620w28a",
|
||||
"1.161.16.3rc1",
|
||||
"1.1620w29a",
|
||||
"1.16rc1",
|
||||
"1.1620w27a",
|
||||
"1.1620w22a",
|
||||
"1.1620w21a",
|
||||
@ -166,29 +176,31 @@
|
||||
"1.1620w20a",
|
||||
"1.1620w19a",
|
||||
"1.1620w18a",
|
||||
"1.16.4rc1",
|
||||
"1.1620w17a",
|
||||
"1.1620w16a",
|
||||
"1.1620w10a",
|
||||
"1.16.2rc2",
|
||||
"1.1620w11a",
|
||||
"1.1620w09a",
|
||||
"1.1620w08a",
|
||||
"1.1620w07a",
|
||||
"1.16.3rc1",
|
||||
"1.16.2rc1",
|
||||
"1.1620w15a",
|
||||
"1.1620w14a",
|
||||
"1.1620w14infinite",
|
||||
"1.1620w13b",
|
||||
"1.1620w13a",
|
||||
"1.1620w12a",
|
||||
"1.161.16.3rc1",
|
||||
"1.16rc1",
|
||||
"1.1620w17a",
|
||||
"1.1620w15a",
|
||||
"1.1620w11a",
|
||||
"1.1620w10a",
|
||||
"1.1620w09a",
|
||||
"1.1620w08a",
|
||||
"1.1620w07a",
|
||||
"1.1620w06a",
|
||||
"1.16.4pre2",
|
||||
"1.16.3rc1",
|
||||
"1.16.4pre1",
|
||||
"1.16.4",
|
||||
"1.16.3",
|
||||
"1.16.2pre3",
|
||||
"1.16.2pre2",
|
||||
"1.16.2pre1",
|
||||
"1.16.2rc2",
|
||||
"1.16.2rc1",
|
||||
"1.16.2",
|
||||
"1.161.16.1",
|
||||
"1.16.1",
|
||||
@ -274,6 +286,7 @@
|
||||
"1.14.1pre1"
|
||||
],
|
||||
"vanilla": [
|
||||
"1.16.4",
|
||||
"1.16.3",
|
||||
"1.16.2",
|
||||
"1.16.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link count-indicator" id="notificationDropdown" href="#" data-toggle="dropdown">
|
||||
<a class="nav-link count-indicator">
|
||||
<i class="fas fa-broadcast-tower
|
||||
{% if data.get('update_available') %}
|
||||
text-danger
|
||||
@ -9,6 +9,13 @@
|
||||
<!-- <span class="count bg-success">3</span>-->
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link count-indicator" href="/panel/panel_config">
|
||||
<i class="fas fa-cogs"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown user-dropdown">
|
||||
<a class="nav-link dropdown-toggle" id="UserDropdown" href="#" data-toggle="dropdown" aria-expanded="false">
|
||||
<img class="img-xs rounded-circle" src="/static/assets/images/faces-clipart/pic-1.png" alt="Profile image"> </a>
|
||||
|
101
app/frontend/templates/panel/panel_config.html
Normal file
101
app/frontend/templates/panel/panel_config.html
Normal file
@ -0,0 +1,101 @@
|
||||
{% extends ../base.html %}
|
||||
|
||||
{% block meta %}
|
||||
<!-- <meta http-equiv="refresh" content="60">-->
|
||||
{% end %}
|
||||
|
||||
{% block title %}Crafty Controller - Panel Config{% end %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
||||
<!-- Page Title Header Starts-->
|
||||
<div class="row page-title-header">
|
||||
<div class="col-12">
|
||||
<div class="page-header">
|
||||
<h4 class="page-title">Panel Config</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Page Title Header Ends-->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
||||
<h4 class="card-title"><i class="fas fa-server"></i> Users</h4>
|
||||
<div class="d-md-none">
|
||||
<small>Can't see everything on mobile?<br /> Try scrolling the table sideways.</small>
|
||||
</div>
|
||||
<div><a class="nav-link" href="/panel/add_user"><i class="fas fa-plus-circle"></i> Add New User</a></div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr class="rounded">
|
||||
<th>User</th>
|
||||
<th>Enabled</th>
|
||||
<th>API Token</th>
|
||||
<th>Allowed Servers</th>
|
||||
<th>Edit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in data['users'] %}
|
||||
<tr>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>
|
||||
{% if user.enabled %}
|
||||
<span class="text-success">
|
||||
<i class="fas fa-check-square"></i> Yes
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="text-danger">
|
||||
<i class="far fa-times-square"></i> No
|
||||
</span>
|
||||
|
||||
{% end %}
|
||||
|
||||
</td>
|
||||
<td>{{ user.api_token }}</td>
|
||||
<td>{{ user.allowed_servers}}</td>
|
||||
<td><a href="/panel/edit_user?id={{user.id}}"><i class="fas fa-pencil-alt"></i></a></td>
|
||||
</tr>
|
||||
{% end %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- content-wrapper ends -->
|
||||
|
||||
{% end %}
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log('ready for JS!')
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% end %}
|
Loading…
Reference in New Issue
Block a user