mirror of
https://github.com/nidebr/as-stats-gui.git
synced 2025-02-20 11:23:18 +08:00
save
This commit is contained in:
parent
fdc24a00c2
commit
efd321a775
@ -33,7 +33,7 @@ class HistoryController extends BaseController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
return $this->redirectToRoute('history_as', [
|
||||
return $this->redirectToRoute('history.as', [
|
||||
'as' => $form->get('as')->getData(),
|
||||
]);
|
||||
}
|
||||
@ -46,7 +46,7 @@ class HistoryController extends BaseController
|
||||
|
||||
#[Route(
|
||||
path: '/{as}',
|
||||
name: 'history_as',
|
||||
name: 'history.as',
|
||||
methods: ['GET'],
|
||||
)]
|
||||
public function historyAs(
|
||||
|
@ -7,6 +7,7 @@ namespace App\Controller;
|
||||
use App\Application\ConfigApplication;
|
||||
use App\Exception\ConfigErrorException;
|
||||
use App\Exception\DbErrorException;
|
||||
use App\Form\SearchIXForm;
|
||||
use App\Form\SelectMyIXForm;
|
||||
use App\Repository\GetAsDataRepository;
|
||||
use App\Repository\KnowlinksRepository;
|
||||
@ -32,10 +33,10 @@ class IXStatsController extends BaseController
|
||||
*/
|
||||
#[Route(
|
||||
path: '/my-ix',
|
||||
name: 'my_ix',
|
||||
name: 'ix.my_ix',
|
||||
methods: ['GET|POST'],
|
||||
)]
|
||||
public function history(
|
||||
public function myIX(
|
||||
Request $request,
|
||||
PeeringDBRepository $peeringDBRepository,
|
||||
GetAsDataRepository $asDataRepository,
|
||||
@ -84,4 +85,27 @@ class IXStatsController extends BaseController
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
path: '/search',
|
||||
name: 'ix.search',
|
||||
methods: ['GET|POST'],
|
||||
)]
|
||||
public function searchIX(
|
||||
Request $request,
|
||||
): Response {
|
||||
$this->base_data['content_wrapper']['titre'] = 'Search IX Stats';
|
||||
|
||||
$form = $this->createForm(SearchIXForm::class);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$form->getData();
|
||||
}
|
||||
|
||||
return $this->render('pages/ix/search_ix/index.html.twig', [
|
||||
'base_data' => $this->base_data,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class IndexController extends BaseController
|
||||
|
||||
#[Route(
|
||||
path: '/{topinterval}',
|
||||
name: 'index_topinterval',
|
||||
name: 'index.topinterval',
|
||||
methods: ['GET|POST'],
|
||||
)]
|
||||
public function indexTopInterval(
|
||||
|
@ -17,7 +17,7 @@ class RenderController extends AbstractController
|
||||
{
|
||||
#[Route(
|
||||
path: '/graph/{as}',
|
||||
name: 'render',
|
||||
name: 'render.graph.as',
|
||||
methods: ['GET'],
|
||||
)]
|
||||
public function renderGraph(
|
||||
|
32
src/Form/SearchIXForm.php
Normal file
32
src/Form/SearchIXForm.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class SearchIXForm extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('ix', TextType::class, [
|
||||
'label' => false,
|
||||
'translation_domain' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'csrf_protection' => false,
|
||||
]);
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ class GenGraphExtension extends AbstractExtension
|
||||
$ipversion,
|
||||
$as,
|
||||
$this->router->generate(
|
||||
'render',
|
||||
'render.graph.as',
|
||||
[
|
||||
'as' => $as,
|
||||
'v' => $ipversion,
|
||||
|
@ -17,7 +17,7 @@
|
||||
Top AS - 24 hours
|
||||
</a>
|
||||
{% for key, item in base_data.top_interval %}
|
||||
<a class="dropdown-item" href="{{ path('index_topinterval', {'topinterval': key}) }}">
|
||||
<a class="dropdown-item" href="{{ path('index.topinterval', {'topinterval': key}) }}">
|
||||
Top AS - {{ item.label }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
@ -58,10 +58,13 @@
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
{% if configapplication_myasn() %}
|
||||
<a class="dropdown-item" href="{{ path('my_ix') }}">
|
||||
<a class="dropdown-item" href="{{ path('ix.my_ix') }}">
|
||||
My IX
|
||||
</a>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="{{ path('ix.search') }}">
|
||||
Search IX
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<div class="{{ col_ipv4 }}">
|
||||
{% set title = "AS#{as} - #{as_data.info.description} - IPv4" %}
|
||||
<div class="text-center">
|
||||
<a href="{{ path('history_as', {'as': as}) }}">
|
||||
<a href="{{ path('history.as', {'as': as}) }}">
|
||||
{{ gen_graph(as, 4, title, data.start, data.end, data.selectedLinks|concat_link, data.graph_size.width, data.graph_size.height, configapplication_graph('showlegendontop')) }}
|
||||
</a>
|
||||
</div>
|
||||
@ -35,7 +35,7 @@
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
{% set title = "AS#{as} - #{as_data.info.description} - IPv6" %}
|
||||
<div class="text-center">
|
||||
<a href="{{ path('history_as', {'as': as}) }}">
|
||||
<a href="{{ path('history.as', {'as': as}) }}">
|
||||
{{ gen_graph(as, 6, title, data.start, data.end, data.selectedLinks|concat_link, data.graph_size.width, data.graph_size.height, configapplication_graph('showlegendontop')) }}
|
||||
</a>
|
||||
</div>
|
||||
|
15
templates/pages/ix/search_ix/_search.html.twig
Normal file
15
templates/pages/ix/search_ix/_search.html.twig
Normal file
@ -0,0 +1,15 @@
|
||||
{{ form_start(form) }}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h3 class="card-title">Search IX</h3>
|
||||
<div class="row g2">
|
||||
<div class="col">
|
||||
{{ form_widget(form.ix) }}
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-icon">{{ icon('search', 'icon') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
23
templates/pages/ix/search_ix/index.html.twig
Normal file
23
templates/pages/ix/search_ix/index.html.twig
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends "base/_layout.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row row-cards">
|
||||
<div class="col-lg-2 col-sm-12 space-y">
|
||||
{% include 'pages/ix/search_ix/_search.html.twig' %}
|
||||
{% block legend %}{% endblock %}
|
||||
</div>
|
||||
<div class="col">
|
||||
{% block graph %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ parent() }}
|
||||
|
||||
<script type="text/javascript">
|
||||
var input = document.querySelector('#{{ form.ix.vars.id }}');
|
||||
|
||||
console.log(input);
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user