mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 07:03:28 +02:00
Added logs page to the panel
This commit is contained in:
parent
4abca19ba3
commit
361ccb3a7e
8 changed files with 163 additions and 42 deletions
18
cp/app/Controllers/LogsController.php
Normal file
18
cp/app/Controllers/LogsController.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\RegistryTransaction;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class LogsController extends Controller
|
||||
{
|
||||
public function view(Request $request, Response $response)
|
||||
{
|
||||
$logModel = new RegistryTransaction($this->container->get('db'));
|
||||
$logs = $logModel->getAllRegistryTransaction();
|
||||
return view($response,'admin/logs/index.twig', compact('logs'));
|
||||
}
|
||||
}
|
25
cp/app/Models/RegistryTransaction.php
Normal file
25
cp/app/Models/RegistryTransaction.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Pinga\Db\PdoDatabase;
|
||||
|
||||
class RegistryTransaction
|
||||
{
|
||||
private PdoDatabase $db;
|
||||
|
||||
public function __construct(PdoDatabase $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function getAllRegistryTransaction()
|
||||
{
|
||||
return $this->db->select('SELECT * FROM registryTransaction.transaction_identifier ORDER BY cldate DESC');
|
||||
}
|
||||
|
||||
public function getRegistryTransactionById($id)
|
||||
{
|
||||
return $this->db->select('SELECT * FROM registryTransaction.transaction_identifier WHERE id = ?', [$id])->fetch();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="bootstrap/app.php"
|
||||
colors="true"
|
||||
verbose="true"
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="Test suite">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">app/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
109
cp/resources/views/admin/logs/index.twig
Normal file
109
cp/resources/views/admin/logs/index.twig
Normal file
|
@ -0,0 +1,109 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}Log History{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-wrapper">
|
||||
<!-- Page header -->
|
||||
<div class="page-header d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col">
|
||||
<!-- Page pre-title -->
|
||||
<div class="page-pretitle">
|
||||
Overview
|
||||
</div>
|
||||
<h2 class="page-title">
|
||||
Log History
|
||||
</h2>
|
||||
</div>
|
||||
<!-- Page title actions -->
|
||||
<div class="col-auto ms-auto d-print-none">
|
||||
<div class="btn-list">
|
||||
<span class="d-none d-sm-inline">
|
||||
<a href="#" class="btn">
|
||||
New view
|
||||
</a>
|
||||
</span>
|
||||
<a href="#" class="btn btn-primary d-none d-sm-inline-block" data-bs-toggle="modal" data-bs-target="#modal-report">
|
||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||
Create new report
|
||||
</a>
|
||||
<a href="#" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" data-bs-target="#modal-report" aria-label="Create new report">
|
||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Page body -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div id="table-default" class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><button class="table-sort" data-sort="sort-id">Date</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-name">Registrar</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-name">Command</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-crdate">Object</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-status">Result</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-id">Message</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-name">Miliseconds</button></th>
|
||||
<th><button class="table-sort" data-sort="sort-name">clTRID</button></th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-tbody">
|
||||
{% for log in logs %}
|
||||
<tr>
|
||||
<td>{{ log.cldate }}</td>
|
||||
<td>{{ log.registrar_id }}</td>
|
||||
<td>{{ log.cmd }}</td>
|
||||
<td>{{ log.obj_id }}</td>
|
||||
<td>{{ log.code }}</td>
|
||||
<td>{{ log.msg }}</td>
|
||||
<td>{{ log.clmicrosecond }}</td>
|
||||
<td>{{ log.clTRID }}</td>
|
||||
<td class="text-end">
|
||||
<span class="dropdown">
|
||||
<button class="btn dropdown-toggle align-text-top" data-bs-boundary="viewport" data-bs-toggle="dropdown">Actions</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item" href="#">
|
||||
Action
|
||||
</a>
|
||||
<a class="dropdown-item" href="#">
|
||||
Another action
|
||||
</a>
|
||||
</div>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer footer-transparent d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||
<ul class="list-inline list-inline-dots mb-0">
|
||||
<li class="list-inline-item">
|
||||
Copyright © 2023
|
||||
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -189,6 +189,15 @@
|
|||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {{ is_current_url('logs') ? 'class="nav-item active"' : 'class="nav-item"' }}>
|
||||
<a class="nav-link" href="{{route('logs')}}">
|
||||
<span class="nav-link-icon d-md-none d-lg-inline-block"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-database" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0"></path><path d="M4 6v6a8 3 0 0 0 16 0v-6"></path><path d="M4 12v6a8 3 0 0 0 16 0v-6"></path></svg>
|
||||
</span>
|
||||
<span class="nav-link-title">
|
||||
Logs
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,6 +5,7 @@ use App\Controllers\HomeController;
|
|||
use App\Controllers\DomainsController;
|
||||
use App\Controllers\ContactsController;
|
||||
use App\Controllers\HostsController;
|
||||
use App\Controllers\LogsController;
|
||||
use App\Controllers\ProfileController;
|
||||
use App\Middleware\AuthMiddleware;
|
||||
use App\Middleware\GuestMiddleware;
|
||||
|
@ -37,6 +38,7 @@ $app->group('', function ($route) {
|
|||
$route->get('/domains', DomainsController::class .':view')->setName('domains');
|
||||
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
|
||||
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
|
||||
$route->get('/logs', LogsController::class .':view')->setName('logs');
|
||||
$route->get('/profile', ProfileController::class .':profile')->setName('profile');
|
||||
$route->get('/profile/notifications', ProfileController::class .':notifications')->setName('notifications');
|
||||
$route->get('/profile/security', ProfileController::class .':security')->setName('security');
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
class SampleTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testTrueAssertsToTrue()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
class UserTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->user = new \App\Models\User;
|
||||
}
|
||||
|
||||
public function testEmailVariablesContainCorrectValues()
|
||||
{
|
||||
$user = new \App\Models\User;
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue