Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vimazeno
mobipaleo
Commits
34d44fc3
Commit
34d44fc3
authored
Dec 15, 2020
by
Vincent Mazenod
Browse files
add a max lines to show
parent
2467c753
Changes
8
Hide whitespace changes
Inline
Side-by-side
.env.dev.sample
View file @
34d44fc3
...
...
@@ -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
...
...
.env.prod.sample
View file @
34d44fc3
...
...
@@ -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
...
...
.env.test
View file @
34d44fc3
...
...
@@ -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
...
...
assets/js/app.js
View file @
34d44fc3
...
...
@@ -98,6 +98,7 @@ $(document).ready(function() {
}
}
$
(
'
[data-toggle="tooltip"]
'
).
tooltip
();
$
(
'
[data-toggle="popover"]
'
).
popover
();
// disable reload page on submit new job
...
...
config/services.yaml
View file @
34d44fc3
...
...
@@ -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)%'
...
...
src/Controller/JobController.php
View file @
34d44fc3
...
...
@@ -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'
),
]);
}
...
...
templates/job/inc/card.html.twig
View file @
34d44fc3
...
...
@@ -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
}
)
}}
"
...
...
templates/job/show.html.twig
View file @
34d44fc3
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment