- Some bugfixes in templates

This commit is contained in:
Dave Mc Nicoll 2025-05-21 18:41:33 +00:00
parent 5b68bb191b
commit 3de4b78a0b
9 changed files with 74 additions and 31 deletions

View File

@ -36,19 +36,23 @@ summary {cursor:pointer;}
#body-footer {background: #fff;color: #333;height: 30px;line-height: 30px;font-size: 0.8rem;padding: 0 0.5rem;text-align: right;border-top:1px solid #ebedee;} #body-footer {background: #fff;color: #333;height: 30px;line-height: 30px;font-size: 0.8rem;padding: 0 0.5rem;text-align: right;border-top:1px solid #ebedee;}
/* Sidebar */ /* Sidebar */
#main-nav {background:#242528;width:240px;color:#fff;font-family:consolas, courier new, monospace;font-size:0.9rem;position:fixed;top:0;bottom:0;overflow-y:scroll;padding-bottom:2rem;border-right: 2px solid #333;} #main-nav {background:#373737;width:240px;color:#fff;font-family:consolas, courier new, monospace;font-size:0.9rem;position:fixed;top:0;bottom:0;overflow-y:scroll;padding-bottom:2rem;border-right: 2px solid #333;}
#main-nav .app-title {font-size:1.3rem; text-align:center;padding:1.8rem 0} #main-nav .app-title {font-size:1.3rem; text-align:center;padding:1.8rem 0}
#main-nav .app-title:before {content:"🔳"; margin-right:10px} #main-nav .app-title:before {content:"🔳"; margin-right:10px}
#main-nav label {color: #a4a4a4;text-transform:uppercase ; display:block;padding:0.8rem 1rem;font-size:1.15em;} #main-nav label {color: #a4a4a4;text-transform:uppercase ; display:block;padding:0.8rem 1rem;font-size:1.15em;}
#main-nav label:before {content:"⊙"; margin-right:10px} #main-nav label:before {content:"⊙"; margin-right:10px}
#main-nav a {color: #efecec;text-decoration:none;display:block;padding:0 1rem 0 2rem;transition:all 0.3s ease;line-height:3em;font-size:0.9em} #main-nav a {color: #efecec;text-decoration:none;display:block;padding:0 1rem 0 2rem;transition:all 0.3s ease;line-height:2.5em;font-size:0.9em}
#main-nav a:before {content:""; margin-right:10px;line-height:3em} #main-nav a:before {content:""; margin-right:10px;}
#main-nav a:hover {background:rgba(255,255,255,0.1)} #main-nav a:hover {background:rgba(255,255,255,0.1)}
/* Main content */ /* Main content */
#main-content {padding:4vh 2vw;width:100%;margin-left:auto;} #main-content {padding:4vh 2vw;width:100%;margin-left:auto;}
#main-content section {border-radius:0.3rem;box-shadow: 0 1px 2px rgba(56,65,74,.15)} #main-content section {border-radius:0.3rem;box-shadow: 0 1px 2px rgba(56,65,74,.15);display: flex;flex-direction: column;}
#main-content section article {border-radius:0.3rem;font-family: Courier New , Courier, monospace;font-size: 0.8em;background:#fff;padding:1.5rem;} #main-content section article {border-radius:0.3rem;font-family: Courier New , Courier, monospace;font-size: 0.8em;background:#fff;padding:1.5rem;border: 1px solid #00000029;}
#main-content section header {border-top-left:0.3rem;border-top-right:4px;background:#fff;padding:1rem 1rem;font-size:1.2em;color: #4b4848;border-bottom:1px solid #e9ebec;display:flex;align-items:center} #main-content section header + article {border-top:0;border-top-left-radius: unset;border-top-right-radius: unset}
#main-content section footer {border-bottom-left:0.3rem;border-bottom-right:0.3rem;background:#f9f9f9;padding:2vh 1vw;} #main-content section header:has(+ article) {border: 1px solid #00000029;border-bottom:0}
#main-content section header {border-top-left-radius:0.3rem;border-top-right-radius:0.3rem;background:#373737;padding:1rem 1rem;font-size:1.2em;color: #fff;border-bottom:1px solid #7b7b7b;display:flex;align-items:center}
#main-content section article:has(+ footer) {border-bottom-left-radius:unset;border-bottom-right-radius:unset;border-bottom:0}
#main-content section footer {border-bottom-left-radius:0.3rem;border-bottom-right-radius:0.3rem;background:#f9f9f9;padding:1.5vh 1vw;line-height:1.5vh}
#main-content section article + footer {border: 1px solid #00000029;border-top:0}
#main-content section article [class*="col-"] {overflow-x:auto}

View File

@ -2,6 +2,7 @@
namespace Lean\Console\Cli; namespace Lean\Console\Cli;
use Mcnd\CLI\OptionValueTypeEnum;
use Notes\CLI\Attribute\{Option, Command}; use Notes\CLI\Attribute\{Option, Command};
use Psr\Http\Message\{ServerRequestInterface, ResponseInterface}; use Psr\Http\Message\{ServerRequestInterface, ResponseInterface};
@ -21,10 +22,10 @@ use Lean\Console\{Lib, };
Try #[color:gray, bg: black]'lean console --help'[#] for more information. Try #[color:gray, bg: black]'lean console --help'[#] for more information.
CLI CLI
, command: 'console')] , command: 'console')]
#[Option(toggle: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")] #[Option(switch: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")]
#[Option(toggle: ['-q', '--quiet'], description: "Do not output any message")] #[Option(switch: ['-q', '--quiet'], description: "Do not output any message")]
#[Option(toggle: ['-n', '--no-interaction'], description: "Run script without user interaction")] #[Option(switch: ['-n', '--no-interaction'], description: "Run script without user interaction")]
#[Option(toggle: ['-v', '-vv', '-vvv', '--verbose'], description: "Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug", argument: Option::ARGUMENT_OPTIONAL)] #[Option(switch: ['-v', '-vv', '-vvv', '--verbose'], description: "Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug", value: OptionValueTypeEnum::OptionalValue)]
class Console class Console
{ {
use Lib\ConsoleControllerTrait; use Lib\ConsoleControllerTrait;

View File

@ -2,6 +2,7 @@
namespace Lean\Console\Cli; namespace Lean\Console\Cli;
use Mcnd\CLI\OptionValueTypeEnum;
use Notes\CLI\Attribute\{Option, Command}; use Notes\CLI\Attribute\{Option, Command};
use Psr\Http\Message\{ServerRequestInterface, ResponseInterface}; use Psr\Http\Message\{ServerRequestInterface, ResponseInterface};
@ -22,16 +23,16 @@ use Lean\Console\{Lib, };
Try #[color:gray, bg: black]'lean console storage --help'[#] for more information. Try #[color:gray, bg: black]'lean console storage --help'[#] for more information.
CLI CLI
, command: 'console storage')] , command: 'console storage')]
#[Option(toggle: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")] #[Option(switch: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")]
#[Option(toggle: ['-q', '--quiet'], description: "Do not output any message")] #[Option(switch: ['-q', '--quiet'], description: "Do not output any message")]
#[Option(toggle: ['-n', '--no-interaction'], description: "Run script without user interaction")] #[Option(switch: ['-n', '--no-interaction'], description: "Run script without user interaction")]
#[Option(toggle: ['-v', '-vv', '-vvv', '--verbose'], description: "Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug", argument: Option::ARGUMENT_OPTIONAL)] #[Option(switch: ['-v', '-vv', '-vvv', '--verbose'], description: "Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug", value: OptionValueTypeEnum::OptionalValue)]
class Storage class Storage
{ {
use Lib\ConsoleControllerTrait; use Lib\ConsoleControllerTrait;
#[Command(description: "Generate entities based on an existing connection", command: "entity:generate")] #[Command(description: "Generate entities based on an existing connection", command: "entity:generate")]
#[Option(toggle: ['-l', '--list'], description: "")] #[Option(switch: ['-l', '--list'], description: "")]
public function generate_entity(ServerRequestInterface $request, array $arguments): ResponseInterface public function generate_entity(ServerRequestInterface $request, array $arguments): ResponseInterface
{ {
dump($arguments); dump($arguments);

View File

@ -27,6 +27,7 @@ class Console {
$status = iterator_to_array($git->run("/usr/bin/git status -s")); $status = iterator_to_array($git->run("/usr/bin/git status -s"));
$diff = iterator_to_array($git->run("/usr/bin/git diff")); $diff = iterator_to_array($git->run("/usr/bin/git diff"));
$lastUpdate = iterator_to_array($git->run("/usr/bin/git show --no-patch --format=%ci"))[0] ?? null;
return $this->renderView("lean-console/page/update/index", get_defined_vars()); return $this->renderView("lean-console/page/update/index", get_defined_vars());
} }

View File

@ -2,6 +2,7 @@
namespace Lean\Console\Lib; namespace Lean\Console\Lib;
use DI\Attribute\Inject;
use Notes\Attribute\Ignore; use Notes\Attribute\Ignore;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
@ -20,6 +21,7 @@ trait ConsoleControllerTrait
{ {
use \Lean\ControllerTrait; use \Lean\ControllerTrait;
#[Inject]
protected ContainerInterface $container; protected ContainerInterface $container;
#[Ignore] #[Ignore]

View File

@ -37,3 +37,4 @@
<li><a href="{% route 'lean.console:debugging-phpinfo' %}">{% lang "lean.nav.debugging.phpinfo" %}</a></li> <li><a href="{% route 'lean.console:debugging-phpinfo' %}">{% lang "lean.nav.debugging.phpinfo" %}</a></li>
</ul> </ul>
</nav> </nav>
<hr>

View File

@ -10,9 +10,9 @@
{% function routeHtml($route) %} {% function routeHtml($route) %}
<div class="grid"> <div class="grid">
<strong class="col route-name">{{ $route->name }}</strong> <strong class="col-2 route-name">{{ $route->name }}</strong>
<div class="col route-uri">{{ $route->getRoute() }}</div> <div class="col-3 route-uri">{{ $route->getRoute() }}</div>
<div class="col route-methods">{{ implode(', ', (array) ( $route->method ?? $route->methods )) }}</div> <div class="col-2 route-methods">{{ implode(', ', (array) ( $route->method ?? $route->methods )) }}</div>
<div class="col controller-method"> <div class="col controller-method">
<span class="class">{{ $route->class }}</span>::<span>{{ $route->classMethod }}</span> <span class="class">{{ $route->class }}</span>::<span>{{ $route->classMethod }}</span>
</div> </div>
@ -28,9 +28,9 @@
<article class="routes"> <article class="routes">
{% if $routes %} {% if $routes %}
<strong class="grid"> <strong class="grid">
<div class="col route-name">{% _ 'route.name' %}</div> <div class="col-2 route-name">{% _ 'route.name' %}</div>
<div class="col route-uri">{% _ 'route.uri' %}</div> <div class="col-3 route-uri">{% _ 'route.uri' %}</div>
<div class="col route-methods">{% _ 'route.methods' %}</div> <div class="col-2 route-methods">{% _ 'route.methods' %}</div>
<div class="col controller-method">{% _ 'route.target' %}</div> <div class="col controller-method">{% _ 'route.target' %}</div>
</strong> </strong>

View File

@ -94,7 +94,7 @@
{% endif %} {% endif %}
<style> <style>
.databases strong.grid {background: #242528;color:#fff} .databases strong.grid {background: #888a91;color:#fff}
.databases .db-grid {padding:0.66rem 0.3rem} .databases .db-grid {padding:0.66rem 0.3rem}
.databases .db-grid strong {color:#444} .databases .db-grid strong {color:#444}

View File

@ -4,6 +4,30 @@
{% title _("title") %} {% title _("title") %}
{% function setStatusModifierClass($line) : string %}
{% return match(substr($line, 0, 2)) {
'??' => "action-add",
default => false,
} ?: match(substr($line, 0, 1)) {
'M' => "action-delete",
default => "",
}%}
{% endfunction %}
{% function setDiffModifierClass($line) : string %}
{% return match(substr($line, 0, 2)) {
'--' => "action-delete",
'++' => "action-add",
'@@' => "action-group",
default => false,
} ?: match(substr($line, 0, 1)) {
'-' => "action-delete",
'+' => "action-add",
default => "",
}%}
{% endfunction %}
{% section "content" %} {% section "content" %}
<section> <section>
<header> <header>
@ -16,11 +40,11 @@
<code style="white-space:normal;font-size:120%"> <code style="white-space:normal;font-size:120%">
{% foreach $status as $line %} {% foreach $status as $line %}
<div> <div class="{{ setStatusModifierClass($line) }}">
{% if $line %} {% if $line %}
{{ $line }} {{ $line }}
{% endif %} {% endif %}
</div> </div>
{% endforeach %} {% endforeach %}
</code> </code>
</div> </div>
@ -30,7 +54,7 @@
<code style="white-space:normal;font-size:120%"> <code style="white-space:normal;font-size:120%">
{% foreach $diff as $line %} {% foreach $diff as $line %}
<div> <div class="{{ setDiffModifierClass($line) }}">
{% if $line %} {% if $line %}
{{ $line }} {{ $line }}
{% endif %} {% endif %}
@ -39,5 +63,14 @@
</code> </code>
</div> </div>
</article> </article>
<footer>
{{ $lastUpdate }}
</footer>
</section> </section>
{% endsection %} {% endsection %}
<style>
.action-delete {color:#f88}
.action-add {color: #88ff8a}
.action-group {color:#88bcff}
</style>