Browse Source

add ansi_to_html and update task output render

develop
Simon Vieille 3 weeks ago
parent
commit
e06ff59684
  1. 40
      assets/css/admin.scss
  2. 1
      composer.json
  3. 6
      config/packages/ansi_to_html.yaml
  4. 1
      core/Cache/SymfonyCacheManager.php
  5. 5
      core/Controller/Task/TaskAdminController.php
  6. 4
      core/Resources/views/task/task_admin/run.html.twig
  7. 12
      symfony.lock

40
assets/css/admin.scss

@ -21,10 +21,6 @@ $pagination-active-bg: #343a40;
}
}
.flag-icon-en {
background-image: url(~flag-icon-css/flags/4x3/gb.svg);
}
body {
overflow-x: hidden;
}
@ -33,6 +29,10 @@ body {
width: 30px;
}
.flag-icon-en {
background-image: url(~flag-icon-css/flags/4x3/gb.svg);
}
.choices__list--dropdown {
display: none;
}
@ -109,6 +109,19 @@ tr.table-primary-light {
white-space: nowrap;
}
.table tr {
td {
transition: border 500ms ease-out;
border-bottom: 1px solid #dee2e6;
}
&:hover {
td {
border-bottom: 1px solid #a8aaac;
}
}
}
.bg-dark-blue {
background: #242b3b;
color: #fff;
@ -129,6 +142,7 @@ tr.table-primary-light {
}
}
.sidebar {
width: 260px;
display: inline-block;
@ -257,13 +271,6 @@ th {
}
}
.bg-tiles {
background-color: #c1c1c1;
background-image: linear-gradient(45deg, #646464 25%, transparent 25%, transparent 75%, #646464 75%), linear-gradient(45deg, #646464 25%, transparent 25%, transparent 75%, #646464 75%);
background-size: 20px 20px;
background-position: 0 0, 10px 10px;
}
.tab-form {
padding: 15px;
}
@ -459,3 +466,14 @@ fieldset.form-group {
clear: both;
}
}
.modal-dialog-large {
max-width: 80%;
}
.output {
&-console {
background: #073642;
line-height: normal;
}
}

1
composer.json

@ -20,6 +20,7 @@
"scheb/2fa-google-authenticator": "^5.7",
"scheb/2fa-qr-code": "^5.7",
"sensio/framework-extra-bundle": "^6.1",
"sensiolabs/ansi-to-html": "^1.2",
"stof/doctrine-extensions-bundle": "^1.6",
"symfony/apache-pack": "^1.0",
"symfony/asset": "5.2.*",

6
config/packages/ansi_to_html.yaml

@ -0,0 +1,6 @@
services:
_defaults:
autowire: true
autoconfigure: true
SensioLabs\AnsiConverter\Bridge\Twig\AnsiExtension: null

1
core/Cache/SymfonyCacheManager.php

@ -65,6 +65,7 @@ class SymfonyCacheManager
'command' => 'cache:clear',
'-e' => $this->kernel->getEnvironment(),
'--no-warmup' => null,
'--ansi' => null,
]);
$application->run($input, $output);

5
core/Controller/Task/TaskAdminController.php

@ -10,6 +10,8 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use SensioLabs\AnsiConverter\AnsiToHtmlConverter;
use SensioLabs\AnsiConverter\Theme\SolarizedTheme;
/**
* @Route("/admin/task")
@ -45,7 +47,8 @@ class TaskAdminController extends AdminController
$event = new TaskRunRequestedEvent($task, $request->query, $output);
$eventDispatcher->dispatch($event, TaskRunRequestedEvent::RUN_REQUEST_EVENT);
$content = $output->fetch();
$converter = new AnsiToHtmlConverter(new SolarizedTheme());
$content = $converter->convert($output->fetch());
return $this->render('@Core/task/task_admin/run.html.twig', [
'output' => $content,

4
core/Resources/views/task/task_admin/run.html.twig

@ -1,4 +1,4 @@
<div class="modal-dialog">
<div class="modal-dialog modal-dialog-large">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
@ -9,7 +9,7 @@
</button>
</div>
<div class="modal-body">
<pre>{{ output|trim }}</pre>
<pre class="output-console">{{ output|raw }}</pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'Close'|trans }}</button>

12
symfony.lock

@ -208,6 +208,18 @@
"config/packages/sensio_framework_extra.yaml"
]
},
"sensiolabs/ansi-to-html": {
"version": "1.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.2",
"ref": "d58d11d5b998f39260d387d3a0b50adc342db7e4"
},
"files": [
"config/packages/ansi_to_html.yaml"
]
},
"spomky-labs/otphp": {
"version": "v10.0.1"
},

Loading…
Cancel
Save