Commit 34d44fc3 authored by Vincent Mazenod's avatar Vincent Mazenod
Browse files

add a max lines to show

parent 2467c753
......@@ -12,6 +12,8 @@ BASE_MERCURE_USER_TOPIC_IRI=https://mobipaleo
MERCURE_JWT_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.NFCEbEEiI7zUxDU2Hj0YB71fQVT8YiQBGQWEyxWG0po"
# JWT_KEY=aVerySecretKey
MAX_LINES_TO_SHOW=10000
CONSTRAINT_MINING_DISTANT_PATH=bin/paraminer_graduals
CONSTRAINT_MINING_DISTANT_TIMEOUT=60
CONSTRAINT_MINING_DISTANT_IDLE_TIMEOUT=60
......
......@@ -10,6 +10,8 @@ BASE_MERCURE_USER_TOPIC_IRI=https://mobipaleo
# be careful on payload https://thedevopsguide.com/real-time-notifications-with-mercure/
MERCURE_JWT_TOKEN="jwt_token"
MAX_LINES_TO_SHOW=1000
CONSTRAINT_MINING_DISTANT_PATH=bin/paraminer_graduals
CONSTRAINT_MINING_DISTANT_TIMEOUT=60
CONSTRAINT_MINING_DISTANT_IDLE_TIMEOUT=60
......
......@@ -12,6 +12,8 @@ BASE_MERCURE_USER_TOPIC_IRI=https://mobipaleo
MERCURE_JWT_SECRET="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.NFCEbEEiI7zUxDU2Hj0YB71fQVT8YiQBGQWEyxWG0po"
# JWT_KEY=aVerySecretKey
MAX_LINES_TO_SHOW=10000
CONSTRAINT_MINING_DISTANT_PATH=bin/paraminer_graduals
CONSTRAINT_MINING_DISTANT_TIMEOUT=60
CONSTRAINT_MINING_DISTANT_IDLE_TIMEOUT=60
......
......@@ -98,6 +98,7 @@ $(document).ready(function() {
}
}
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
// disable reload page on submit new job
......
......@@ -14,6 +14,8 @@ parameters:
mercure_publish_url: '%env(MERCURE_PUBLISH_URL)%'
mercure_jwt_token: '%env(MERCURE_JWT_TOKEN)%'
max_lines_to_show: '%env(MAX_LINES_TO_SHOW)'
constraint_mining_consecutive_path: '%kernel.project_dir%/%env(CONSTRAINT_MINING_CONSECUTIVE_PATH)%'
constraint_mining_consecutive_timeout: '%env(CONSTRAINT_MINING_CONSECUTIVE_TIMEOUT)%'
constraint_mining_consecutive_idle_timeout: '%env(CONSTRAINT_MINING_CONSECUTIVE_IDLE_TIMEOUT)%'
......
......@@ -12,6 +12,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
......@@ -26,7 +27,12 @@ class JobController extends AbstractController
* @Route("/{id<\d+>}", name="home", defaults={"id"=0})
* @IsGranted("ROLE_USER")
*/
public function list(Request $request, ProducerInterface $producer, $id, AuthorizationCheckerInterface $authChecker)
public function list(
Request $request,
ProducerInterface $producer,
$id,
AuthorizationCheckerInterface $authChecker,
ParameterBagInterface $params)
{
// job submision
$job = new Job();
......@@ -65,6 +71,7 @@ class JobController extends AbstractController
return $this->render('job/inc/card.html.twig', [
'job' => $job,
'constraintMiningChoices' => array_flip(ConstraintMining::$constraintMiningChoices),
'maxLinesToShow' => $params->get('max_lines_to_show'),
]);
}
......@@ -102,7 +109,8 @@ class JobController extends AbstractController
return $this->render('job/list.html.twig', [
'form' => $form->createView(),
'jobs' => $jobs,
'constraintMiningChoices' => array_flip(ConstraintMining::$constraintMiningChoices)
'constraintMiningChoices' => array_flip(ConstraintMining::$constraintMiningChoices),
'maxLinesToShow' => $params->get('max_lines_to_show'),
]);
}
......@@ -114,7 +122,7 @@ class JobController extends AbstractController
* )
* @IsGranted("ROLE_USER")
*/
public function show($id, AuthorizationCheckerInterface $authChecker)
public function show($id, AuthorizationCheckerInterface $authChecker, ParameterBagInterface $params)
{
// display user job
if(false === $authChecker->isGranted('ROLE_ADMIN'))
......@@ -147,7 +155,8 @@ class JobController extends AbstractController
return $this->render('job/show.html.twig', [
'job' => $job,
'constraintMiningChoices' => array_flip(ConstraintMining::$constraintMiningChoices)
'constraintMiningChoices' => array_flip(ConstraintMining::$constraintMiningChoices),
'maxLinesToShow' => $params->get('max_lines_to_show'),
]);
}
......
......@@ -29,10 +29,21 @@
</a>
{% endif %}
<a class="btn btn-success btn-circle btn-sm"
{% if job.nbLines >= maxLinesToShow %}
<button type="button" class="unshow btn btn-success btn-circle btn-sm"
data-toggle="tooltip"
data-placement="top"
alt="too many lines to show results, download csv ouput"
title="too many lines to show results, download csv ouput">
<i class="fas fa-eye"></i>
</button>
{% else %}
<a class="btn btn-success btn-circle btn-sm"
href="{{ path('job_show', { 'id': job.id }) }}">
<i class="fas fa-eye"></i>
</a>
{% endif %}
<a class="btn btn-danger btn-circle btn-sm"
href="{{ path('job_delete', { 'id': job.id }) }}"
......
......@@ -6,6 +6,7 @@
{% include 'job/inc/modal.html.twig' %}
{% if job.nbLines < maxLinesToShow %}
<div class="row">
<div class="col-9">
{% include 'job/inc/results.html.twig' %}
......@@ -14,4 +15,6 @@
{% include 'job/inc/columns.html.twig' %}
</div>
</div>
{% endif %}
{% endblock %}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment