Fixed registrar name not being displayed in EPP log

Also removed useless button for registrars
This commit is contained in:
Pinga 2024-02-26 12:09:04 +02:00
parent 97343361cc
commit b46ff2286c
2 changed files with 38 additions and 7 deletions

View file

@ -20,12 +20,12 @@
<!-- Page title actions -->
<div class="col-auto ms-auto d-print-none">
<div class="btn-list">
<span class="d-none d-sm-inline">
{% if roles == 0 %}<span class="d-none d-sm-inline">
<a href="{{route('reports')}}" class="btn btn-pink">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h5.697" /><path d="M18 14v4h4" /><path d="M18 11v-4a2 2 0 0 0 -2 -2h-2" /><path d="M8 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M18 18m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" /><path d="M8 11h4" /><path d="M8 15h3" /></svg>
{{ __('View Reports') }}
</a>
</span>
</span>{% endif %}
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
<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 domain') }}
@ -170,8 +170,7 @@
<h3 class="card-title">{{ __('Recent Domains') }}</h3>
<div class="card">
<div class="table-responsive">
<table
class="table table-vcenter card-table table-striped">
<table class="table table-vcenter card-table table-striped">
<thead>
<tr>
<th>{{ __('Name') }}</th>
@ -198,8 +197,7 @@
<h3 class="card-title">{{ __('Recent Support Tickets') }}</h3>
<div class="card">
<div class="table-responsive">
<table
class="table table-vcenter card-table table-striped">
<table class="table table-vcenter card-table table-striped">
<thead>
<tr>
<th>{{ __('Subject') }}</th>

View file

@ -4,9 +4,32 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.6.0/jspdf.plugin.autotable.min.js"></script>
<script>
function fetchAndCacheRegistrars() {
fetch('/api/records/registrar')
.then(response => response.json())
.then(data => {
console.log(data);
// Assuming 'data.records' contains the array of registrars
const registrars = data.records.reduce((acc, current) => {
acc[current.id] = current.name;
return acc;
}, {});
// Cache the mapping of registrar IDs to names
localStorage.setItem('registrarsCache', JSON.stringify(registrars));
})
.catch(error => console.error("Failed to fetch registrar records:", error));
}
function getRegistrarNameById(id) {
const registrarsCache = JSON.parse(localStorage.getItem('registrarsCache') || '{}');
return registrarsCache[id] || 'Unknown';
}
var table;
document.addEventListener("DOMContentLoaded", function(){
fetchAndCacheRegistrars();
table = new Tabulator("#logTable", {
ajaxURL:"/log-api/records/transaction_identifier", // Set the URL for your JSON data
ajaxConfig:"GET",
@ -25,7 +48,17 @@
columns:[
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
{title:"{{ __('Date') }}", field:"cldate", headerSort:true, responsive:0},
{title:"{{ __('Registrar') }}", field:"registrar_id", headerSort:true, responsive:2},
{
title: "{{ __('Registrar') }}",
field: "registrar_id",
headerSort: true,
responsive: 2,
formatter: function(cell, formatterParams, onRendered) {
const registrarId = cell.getValue();
const name = getRegistrarNameById(registrarId);
return name; // Return the name directly, as it is synchronously obtained from cache
}
},
{title:"{{ __('Command') }}", field:"cmd", headerSort:true, responsive:0},
{title:"{{ __('Object Type') }}", field:"obj_type", headerSort:true, responsive:0},
{title:"{{ __('Object') }}", field:"obj_id", headerSort:true, responsive:2},