- Moved views into their own namespace.

This commit is contained in:
Dave M. 2020-12-18 16:01:31 +00:00
parent 5f6ce82fd2
commit 923b2be49e
16 changed files with 157 additions and 191 deletions

View File

@ -25,7 +25,7 @@ class Console {
*/
public function home(ServerRequestInterface $request, array $arguments) : ResponseInterface
{
return $this->renderView("page/dashboard/index", [
return $this->renderView("lean-console/page/dashboard/index", [
]);
}

View File

@ -34,7 +34,7 @@ class Request extends Console {
return $a <=> $b;
});
return $this->renderView("page/request/route", [
return $this->renderView("lean-console/page/request/route", [
'routes' => $routes
]);
}

View File

@ -42,7 +42,7 @@ class Storage extends Console {
$form = new FormHandler($request, new Form\Database($migrations), null);
$context = $form->context;
return $this->renderView("page/storage/database", get_defined_vars());
return $this->renderView("lean-console/page/storage/database", get_defined_vars());
}
public function createTable() : void

View File

@ -33,7 +33,7 @@ class Database implements FormInterface
#$fields = $entiy::resolveEntity()->fieldList();
foreach($table->columns as $col) {
dump( $entity::field($col->name) );
//dump( $entity::field($col->name) );
}
# if columns are different

View File

@ -15,7 +15,7 @@ use Picea;
*/
trait ConsoleControllerTrait
{
use \Lean\Console\ControllerTrait;
use \Lean\ControllerTrait;
protected ContainerInterface $container;

View File

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="LEAN console environment">
<meta name="author" content="Dave Mc Nicoll">
<meta name="msapplication-TileColor" content="#ccc">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Ctext%20x='0'%20y='14'%3E🔳%3C/text%3E%3C/svg%3E" type="image/svg+xml" />
<title>{{ title() }}</title>
<style>
{% include "lean/base/asset/lean.css" %}
</style>
{% section "head" %}{% endsection %}
</head>
<body>
<header id="body-header">
{% section "header" %}{% endsection %}
</header>
<main id="body-main">
{% section "nav" %}
{% view "lean/base/console/main-nav" %}
{% endsection %}
<section id="main-content">
{% section "content" %}{% endsection %}
</section>
</main>
<footer id="body-footer">
{% section "footer" %}
&copy; {{ date('Y') }} - LEAN
{% endsection %}
</footer>
</body>
</html>

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="LEAN console environment">
<meta name="author" content="Dave Mc Nicoll">
<meta name="msapplication-TileColor" content="#ccc">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Ctext%20x='0'%20y='14'%3E🔳%3C/text%3E%3C/svg%3E" type="image/svg+xml" />
<title>{{ title() }}</title>
<style>
{% include "lean/base/asset/lean.css" %}
</style>
{% section "head" %}{% endsection %}
</head>
<body>
<header>{% section "header" %}{% endsection %}</header>
<main>{% section "content" %}{% endsection %}</main>
<footer>{% section "footer" %}{% endsection %}</footer>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="LEAN console environment">
<meta name="author" content="Dave Mc Nicoll">
<meta name="msapplication-TileColor" content="#ccc">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Ctext%20x='0'%20y='14'%3E🔳%3C/text%3E%3C/svg%3E" type="image/svg+xml" />
<title>{{ title() }}</title>
<style>
{% include "lean-console/base/asset/lean.css" %}
</style>
{% section "head" %}{% endsection %}
</head>
<body>
<header id="body-header">
{% section "header" %}{% endsection %}
</header>
<main id="body-main">
{% section "nav" %}
{% view "lean-console/base/console/main-nav" %}
{% endsection %}
<section id="main-content">
{% section "content" %}{% endsection %}
</section>
</main>
<footer id="body-footer">
{% section "footer" %}
&copy; {{ date('Y') }} - LEAN
{% endsection %}
</footer>
</body>
</html>

View File

@ -1,4 +1,4 @@
{% extends "lean/base/console/layout" %}
{% extends "lean-console/base/layout" %}
{% language.set "lean.console" %}

View File

@ -1,4 +1,4 @@
{% extends "lean/base/console/layout" %}
{% extends "lean-console/base/layout" %}
{% language.set "lean.request" %}
@ -33,7 +33,6 @@
</div>
</div>
{% endforeach %}
{% else %}
{% _ 'routeless' %}
{% endif %}

View File

@ -0,0 +1,7 @@
{% extends "lean-console/base/layout" %}
{% section "content" %}
Welcome to Setup!
{% endsection %}

View File

@ -0,0 +1,99 @@
{% extends "lean-console/base/layout" %}
{% language.set "lean.storage" %}
{% title _("title") %}
{% section "header" %}
<div class="page-title">{% _ "page-title" %}</div>
{% endsection %}
{% section "content" %}
<section>
<header>
<h1>{% _ 'database.header' %}</h1>
</header>
<article class="databases">
{% if $connections %}
<strong class="grid db-grid">
<div class="col db-connection">{% _ 'database.connection' %}</div>
<div class="col db-adapter">{% _ 'database.adapter' %}</div>
<div class="col db-host">{% _ 'database.host' %}</div>
<div class="col db-name">{% _ 'database.name' %}</div>
<div class="col db-username">{% _ 'database.username' %}</div>
</strong>
{% foreach $connections as $connection %}
{% php $conf = $connection->getConfiguration(); %}
<div class="grid db-grid">
<div class="col db-connection">{{ $connection->name }}</div>
<div class="col db-adapter">{{ $conf['adapter'] }}</div>
<div class="col db-host">{{ $conf['host'] }}:{{ $conf['port'] }}</div>
<div class="col db-name">{{ $conf['database'] }}</div>
<div class="col db-username">{{ $conf['username'] }}</div>
</div>
<div class="tables">
<strong class="grid table-item">
<div class="col">{% _ 'database.table.name' %}</div>
<div class="col">{% _ 'database.table.table-fields' %}</div>
<div class="col col-grow-2">{% _ 'database.table.query' %}</div>
<div class="col text-right">{% _ 'database.table.actions' %}</div>
</strong>
{% ui.form.post "database" %}
{% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %}
<div class="grid table-item align-items-center">
<div class="col"><span>📄</span> <span>{{ $item->tableName() }}</span></div>
<div class="col">{% _ "database.table.fields", [ 'count' => count( $item->fieldList() ) ] %}</div>
<div class="col col-grow-2">
{% if $context->status[$entity]['query'] %}
<code>{{ $context->status[$entity]['query'] }}</code>
{% else %}
<div>🗸 This table is up-to-date</div>
{% endif %}
</div>
<div class="col">
{% switch $context->status[$entity]['msg'] %}
{% case 'unexisting' %}
{% php $createAll[] = $entity %}
<div class="text-right">
<button name="create" value="{{$entity}}" class="btn-blue">🗸 {% _ 'database.table.create' %}</button>
</div>
{% break %}
{% endswitch %}
</div>
</div>
{% endforeach %}
{% if ($createAll ?? 0) > 1 %}
<div class="text-right" style="padding:0.5rem 0">
<button name="createAll" value="{{ implode(',', $createAll) }}" class="btn-red">🗸 {% _ 'database.table.createAll' %}</button>
</div>
{% endif %}
{% ui.endform %}
</div>
{% endforeach %}
{% endif %}
</article>
</section>
<style>
.databases strong.grid {background:#172842;color:#fff}
.databases .db-grid {padding:0.66rem 0.3rem}
.databases .db-grid strong {color:#444}
.databases .db-grid:nth-child(even) {background: #e3e3e3 }
.databases .tables .table-item {padding:0.33rem 0;background:rgba(255,255,255,0.1)}
.databases .tables .table-item:nth-child(even) {background:rgba(255,255,255,0.2)}
.databases summary {background: #172841;color:#fff;margin: 0 -8px 0 -8px;padding:7px 10px}
.tables {background: #172841;margin: 0 -8px 0 -8px;color: #fff;padding: 4px 12px;}
.tables label {padding:10px 5px;display:block}
</style>
{% endsection %}

View File

@ -1,7 +0,0 @@
{% extends "lean/base/layout/console" %}
{% section "content" %}
Welcome to Setup!
{% endsection %}

View File

@ -1,104 +0,0 @@
{% extends "lean/base/console/layout" %}
{% language.set "lean.storage" %}
{% title _("title") %}
{% section "header" %}
<div class="page-title">{% _ "page-title" %}</div>
{% endsection %}
{% section "content" %}
<section>
<header>
<h1>{% _ 'database.header' %}</h1>
</header>
<article class="databases">
{% if $connections %}
<strong class="grid db-grid">
<div class="col db-connection">{% _ 'database.connection' %}</div>
<div class="col db-adapter">{% _ 'database.adapter' %}</div>
<div class="col db-host">{% _ 'database.host' %}</div>
<div class="col db-name">{% _ 'database.name' %}</div>
<div class="col db-username">{% _ 'database.username' %}</div>
</strong>
{% foreach $connections as $connection %}
{% php $conf = $connection->getConfiguration(); %}
<div class="grid db-grid">
<div class="col db-connection">{{ $connection->name }}</div>
<div class="col db-adapter">{{ $conf['adapter'] }}</div>
<div class="col db-host">{{ $conf['host'] }}:{{ $conf['port'] }}</div>
<div class="col db-name">{{ $conf['database'] }}</div>
<div class="col db-username">{{ $conf['username'] }}</div>
</div>
<details>
<summary>
{% _ 'database.table.header' %}
</summary>
<div class="tables">
<strong class="grid table-item">
<div class="col">{% _ 'database.table.name' %}</div>
<div class="col">{% _ 'database.table.table-fields' %}</div>
<div class="col col-grow-2">{% _ 'database.table.query' %}</div>
<div class="col text-right">{% _ 'database.table.actions' %}</div>
</strong>
{% ui.form.post "database" %}
{% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %}
<div class="grid table-item align-items-center">
<div class="col"><span>📄</span> <span>{{ $item->tableName() }}</span></div>
<div class="col">{% _ "database.table.fields", [ 'count' => count( $item->fieldList() ) ] %}</div>
<div class="col col-grow-2">
{% if $context->status[$entity]['query'] %}
<code>{{ $context->status[$entity]['query'] }}</code>
{% else %}
<div>🗸 This table is up-to-date</div>
{% endif %}
</div>
<div class="col">
{% switch $context->status[$entity]['msg'] %}
{% case 'unexisting' %}
{% php $createAll[] = $entity %}
<div class="text-right">
<button name="create" value="{{$entity}}" class="btn-blue">🗸 {% _ 'database.table.create' %}</button>
</div>
{% break %}
{% endswitch %}
</div>
</div>
{% endforeach %}
{% if ($createAll ?? 0) > 1 %}
<div class="text-right" style="padding:0.5rem 0">
<button name="createAll" value="{{ implode(',', $createAll) }}" class="btn-red">🗸 {% _ 'database.table.createAll' %}</button>
</div>
{% endif %}
{% ui.endform %}
</div>
</details>
{% endforeach %}
{% endif %}
</article>
</section>
<style>
.databases strong.grid {background:#172842;color:#eeffee}
.databases .db-grid {padding:0.66rem 0.3rem}
.databases .db-grid strong {color:#444}
.databases .db-grid:nth-child(even) {background: #e3e3e3 }
.databases .tables .table-item {padding:0.33rem 0;background:rgba(255,255,255,0.1)}
.databases .tables .table-item:nth-child(even) {background:rgba(255,255,255,0.2)}
.databases summary {background: #172841;color:#fff;margin: 0 -8px 0 -8px;padding:7px 10px}
.tables {background: #172841;margin: 0 -8px 0 -8px;color: #fff;padding: 3px 10px;}
.tables label {padding:10px 5px;display:block}
</style>
{% endsection %}