From 3de4b78a0bdd130a2755408d597121a7dfddb349 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Wed, 21 May 2025 18:41:33 +0000 Subject: [PATCH] - Some bugfixes in templates --- asset/lean-console/lean-console-bw.css | 20 ++++---- src/Cli/Console.php | 9 ++-- src/Cli/Storage.php | 11 +++-- src/Controller/Console.php | 1 + src/Lib/ConsoleControllerTrait.php | 2 + view/lean-console/base/console/main-nav.phtml | 1 + view/lean-console/page/request/route.phtml | 12 ++--- view/lean-console/page/storage/database.phtml | 2 +- view/lean-console/page/update/index.phtml | 47 ++++++++++++++++--- 9 files changed, 74 insertions(+), 31 deletions(-) diff --git a/asset/lean-console/lean-console-bw.css b/asset/lean-console/lean-console-bw.css index e084030..026697b 100644 --- a/asset/lean-console/lean-console-bw.css +++ b/asset/lean-console/lean-console-bw.css @@ -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;} /* 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: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: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:before {content:"›"; margin-right:10px;line-height:3em} +#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;} #main-nav a:hover {background:rgba(255,255,255,0.1)} /* Main content */ #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 article {border-radius:0.3rem;font-family: Courier New , Courier, monospace;font-size: 0.8em;background:#fff;padding:1.5rem;} -#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 footer {border-bottom-left:0.3rem;border-bottom-right:0.3rem;background:#f9f9f9;padding:2vh 1vw;} - +#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;border: 1px solid #00000029;} +#main-content section header + article {border-top:0;border-top-left-radius: unset;border-top-right-radius: unset} +#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} \ No newline at end of file diff --git a/src/Cli/Console.php b/src/Cli/Console.php index c5d8bff..f501ab8 100644 --- a/src/Cli/Console.php +++ b/src/Cli/Console.php @@ -2,6 +2,7 @@ namespace Lean\Console\Cli; +use Mcnd\CLI\OptionValueTypeEnum; use Notes\CLI\Attribute\{Option, Command}; 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. CLI , 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(toggle: ['-q', '--quiet'], description: "Do not output any message")] -#[Option(toggle: ['-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: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")] +#[Option(switch: ['-q', '--quiet'], description: "Do not output any message")] +#[Option(switch: ['-n', '--no-interaction'], description: "Run script without user interaction")] +#[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 { use Lib\ConsoleControllerTrait; diff --git a/src/Cli/Storage.php b/src/Cli/Storage.php index 69c08d2..c15db05 100644 --- a/src/Cli/Storage.php +++ b/src/Cli/Storage.php @@ -2,6 +2,7 @@ namespace Lean\Console\Cli; +use Mcnd\CLI\OptionValueTypeEnum; use Notes\CLI\Attribute\{Option, Command}; 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. CLI , 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(toggle: ['-q', '--quiet'], description: "Do not output any message")] -#[Option(toggle: ['-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: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")] +#[Option(switch: ['-q', '--quiet'], description: "Do not output any message")] +#[Option(switch: ['-n', '--no-interaction'], description: "Run script without user interaction")] +#[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 { use Lib\ConsoleControllerTrait; #[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 { dump($arguments); diff --git a/src/Controller/Console.php b/src/Controller/Console.php index faf8616..d7996d2 100644 --- a/src/Controller/Console.php +++ b/src/Controller/Console.php @@ -27,6 +27,7 @@ class Console { $status = iterator_to_array($git->run("/usr/bin/git status -s")); $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()); } diff --git a/src/Lib/ConsoleControllerTrait.php b/src/Lib/ConsoleControllerTrait.php index 1f31e0f..36a0a37 100644 --- a/src/Lib/ConsoleControllerTrait.php +++ b/src/Lib/ConsoleControllerTrait.php @@ -2,6 +2,7 @@ namespace Lean\Console\Lib; +use DI\Attribute\Inject; use Notes\Attribute\Ignore; use Psr\Container\ContainerInterface; @@ -20,6 +21,7 @@ trait ConsoleControllerTrait { use \Lean\ControllerTrait; + #[Inject] protected ContainerInterface $container; #[Ignore] diff --git a/view/lean-console/base/console/main-nav.phtml b/view/lean-console/base/console/main-nav.phtml index 32206e6..1997cce 100644 --- a/view/lean-console/base/console/main-nav.phtml +++ b/view/lean-console/base/console/main-nav.phtml @@ -37,3 +37,4 @@
  • {% lang "lean.nav.debugging.phpinfo" %}
  • +
    \ No newline at end of file diff --git a/view/lean-console/page/request/route.phtml b/view/lean-console/page/request/route.phtml index 8a02b64..eac7fa6 100644 --- a/view/lean-console/page/request/route.phtml +++ b/view/lean-console/page/request/route.phtml @@ -10,9 +10,9 @@ {% function routeHtml($route) %}
    - {{ $route->name }} -
    {{ $route->getRoute() }}
    -
    {{ implode(', ', (array) ( $route->method ?? $route->methods )) }}
    + {{ $route->name }} +
    {{ $route->getRoute() }}
    +
    {{ implode(', ', (array) ( $route->method ?? $route->methods )) }}
    {{ $route->class }}::{{ $route->classMethod }}
    @@ -28,9 +28,9 @@
    {% if $routes %} -
    {% _ 'route.name' %}
    -
    {% _ 'route.uri' %}
    -
    {% _ 'route.methods' %}
    +
    {% _ 'route.name' %}
    +
    {% _ 'route.uri' %}
    +
    {% _ 'route.methods' %}
    {% _ 'route.target' %}
    diff --git a/view/lean-console/page/storage/database.phtml b/view/lean-console/page/storage/database.phtml index 66cd8bf..738b95d 100644 --- a/view/lean-console/page/storage/database.phtml +++ b/view/lean-console/page/storage/database.phtml @@ -94,7 +94,7 @@ {% endif %} \ No newline at end of file