diff --git a/src/Controller/Console.php b/src/Controller/Console.php index 82d4719..73e68c5 100644 --- a/src/Controller/Console.php +++ b/src/Controller/Console.php @@ -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", [ ]); } diff --git a/src/Controller/Request.php b/src/Controller/Request.php index fc4c57b..32aac8f 100644 --- a/src/Controller/Request.php +++ b/src/Controller/Request.php @@ -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 ]); } diff --git a/src/Controller/Storage.php b/src/Controller/Storage.php index 1f23a16..ba9fc6d 100644 --- a/src/Controller/Storage.php +++ b/src/Controller/Storage.php @@ -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 diff --git a/src/Form/Database.php b/src/Form/Database.php index f713780..c2965a2 100644 --- a/src/Form/Database.php +++ b/src/Form/Database.php @@ -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 diff --git a/src/Lib/ConsoleControllerTrait.php b/src/Lib/ConsoleControllerTrait.php index 85abab9..6af4701 100644 --- a/src/Lib/ConsoleControllerTrait.php +++ b/src/Lib/ConsoleControllerTrait.php @@ -15,7 +15,7 @@ use Picea; */ trait ConsoleControllerTrait { - use \Lean\Console\ControllerTrait; + use \Lean\ControllerTrait; protected ContainerInterface $container; diff --git a/view/base/console/layout.phtml b/view/base/console/layout.phtml deleted file mode 100644 index 51bf499..0000000 --- a/view/base/console/layout.phtml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - {{ title() }} - - - - {% section "head" %}{% endsection %} - - - -
- {% section "header" %}{% endsection %} -
- -
- {% section "nav" %} - {% view "lean/base/console/main-nav" %} - {% endsection %} - -
- {% section "content" %}{% endsection %} -
-
- - - - \ No newline at end of file diff --git a/view/base/layout/console.phtml b/view/base/layout/console.phtml deleted file mode 100644 index f4e41b5..0000000 --- a/view/base/layout/console.phtml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - {{ title() }} - - - - {% section "head" %}{% endsection %} - - - -
{% section "header" %}{% endsection %}
-
{% section "content" %}{% endsection %}
- - - \ No newline at end of file diff --git a/view/base/asset/lean.css b/view/lean-console/base/asset/lean.css similarity index 100% rename from view/base/asset/lean.css rename to view/lean-console/base/asset/lean.css diff --git a/view/base/console/main-nav.phtml b/view/lean-console/base/console/main-nav.phtml similarity index 100% rename from view/base/console/main-nav.phtml rename to view/lean-console/base/console/main-nav.phtml diff --git a/view/lean-console/base/layout.phtml b/view/lean-console/base/layout.phtml new file mode 100644 index 0000000..01d9ba1 --- /dev/null +++ b/view/lean-console/base/layout.phtml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + {{ title() }} + + + + {% section "head" %}{% endsection %} + + + +
+ {% section "header" %}{% endsection %} +
+ +
+ {% section "nav" %} + {% view "lean-console/base/console/main-nav" %} + {% endsection %} + +
+ {% section "content" %}{% endsection %} +
+
+ + + + \ No newline at end of file diff --git a/view/page/dashboard/index.phtml b/view/lean-console/page/dashboard/index.phtml similarity index 76% rename from view/page/dashboard/index.phtml rename to view/lean-console/page/dashboard/index.phtml index 2829bf0..5358797 100644 --- a/view/page/dashboard/index.phtml +++ b/view/lean-console/page/dashboard/index.phtml @@ -1,4 +1,4 @@ -{% extends "lean/base/console/layout" %} +{% extends "lean-console/base/layout" %} {% language.set "lean.console" %} diff --git a/view/page/request/route.phtml b/view/lean-console/page/request/route.phtml similarity index 96% rename from view/page/request/route.phtml rename to view/lean-console/page/request/route.phtml index 4452bac..b051b10 100644 --- a/view/page/request/route.phtml +++ b/view/lean-console/page/request/route.phtml @@ -1,4 +1,4 @@ -{% extends "lean/base/console/layout" %} +{% extends "lean-console/base/layout" %} {% language.set "lean.request" %} @@ -33,7 +33,6 @@ {% endforeach %} - {% else %} {% _ 'routeless' %} {% endif %} diff --git a/view/lean-console/page/setup/index.phtml b/view/lean-console/page/setup/index.phtml new file mode 100644 index 0000000..275df6d --- /dev/null +++ b/view/lean-console/page/setup/index.phtml @@ -0,0 +1,7 @@ +{% extends "lean-console/base/layout" %} + + +{% section "content" %} + Welcome to Setup! + +{% endsection %} \ No newline at end of file diff --git a/view/lean-console/page/storage/database.phtml b/view/lean-console/page/storage/database.phtml new file mode 100644 index 0000000..1af4189 --- /dev/null +++ b/view/lean-console/page/storage/database.phtml @@ -0,0 +1,99 @@ +{% extends "lean-console/base/layout" %} + +{% language.set "lean.storage" %} + +{% title _("title") %} + +{% section "header" %} +
{% _ "page-title" %}
+{% endsection %} + +{% section "content" %} +
+
+

{% _ 'database.header' %}

+
+ +
+ {% if $connections %} + +
{% _ 'database.connection' %}
+
{% _ 'database.adapter' %}
+
{% _ 'database.host' %}
+
{% _ 'database.name' %}
+
{% _ 'database.username' %}
+
+ + {% foreach $connections as $connection %} + {% php $conf = $connection->getConfiguration(); %} + +
+
{{ $connection->name }}
+
{{ $conf['adapter'] }}
+
{{ $conf['host'] }}:{{ $conf['port'] }}
+
{{ $conf['database'] }}
+
{{ $conf['username'] }}
+
+ +
+ +
{% _ 'database.table.name' %}
+
{% _ 'database.table.table-fields' %}
+
{% _ 'database.table.query' %}
+
{% _ 'database.table.actions' %}
+
+ + {% ui.form.post "database" %} + {% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %} +
+
📄 {{ $item->tableName() }}
+
{% _ "database.table.fields", [ 'count' => count( $item->fieldList() ) ] %}
+
+ {% if $context->status[$entity]['query'] %} + {{ $context->status[$entity]['query'] }} + {% else %} +
🗸 This table is up-to-date
+ {% endif %} +
+
+ {% switch $context->status[$entity]['msg'] %} + {% case 'unexisting' %} + {% php $createAll[] = $entity %} + +
+ +
+ {% break %} + {% endswitch %} +
+
+ {% endforeach %} + + {% if ($createAll ?? 0) > 1 %} +
+ +
+ {% endif %} + {% ui.endform %} +
+ + {% endforeach %} + {% endif %} +
+
+ + +{% endsection %} \ No newline at end of file diff --git a/view/page/setup/index.phtml b/view/page/setup/index.phtml deleted file mode 100644 index de5206a..0000000 --- a/view/page/setup/index.phtml +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "lean/base/layout/console" %} - - -{% section "content" %} - Welcome to Setup! - -{% endsection %} \ No newline at end of file diff --git a/view/page/storage/database.phtml b/view/page/storage/database.phtml deleted file mode 100644 index e38c92b..0000000 --- a/view/page/storage/database.phtml +++ /dev/null @@ -1,104 +0,0 @@ -{% extends "lean/base/console/layout" %} - -{% language.set "lean.storage" %} - -{% title _("title") %} - -{% section "header" %} -
{% _ "page-title" %}
-{% endsection %} - -{% section "content" %} -
-
-

{% _ 'database.header' %}

-
- -
- {% if $connections %} - -
{% _ 'database.connection' %}
-
{% _ 'database.adapter' %}
-
{% _ 'database.host' %}
-
{% _ 'database.name' %}
-
{% _ 'database.username' %}
-
- - {% foreach $connections as $connection %} - {% php $conf = $connection->getConfiguration(); %} - -
-
{{ $connection->name }}
-
{{ $conf['adapter'] }}
-
{{ $conf['host'] }}:{{ $conf['port'] }}
-
{{ $conf['database'] }}
-
{{ $conf['username'] }}
-
- -
- - {% _ 'database.table.header' %} - - -
- -
{% _ 'database.table.name' %}
-
{% _ 'database.table.table-fields' %}
-
{% _ 'database.table.query' %}
-
{% _ 'database.table.actions' %}
-
- - {% ui.form.post "database" %} - {% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %} -
-
📄 {{ $item->tableName() }}
-
{% _ "database.table.fields", [ 'count' => count( $item->fieldList() ) ] %}
-
- {% if $context->status[$entity]['query'] %} - {{ $context->status[$entity]['query'] }} - {% else %} -
🗸 This table is up-to-date
- {% endif %} -
-
- {% switch $context->status[$entity]['msg'] %} - {% case 'unexisting' %} - {% php $createAll[] = $entity %} - -
- -
- {% break %} - {% endswitch %} -
-
- {% endforeach %} - - {% if ($createAll ?? 0) > 1 %} -
- -
- {% endif %} - {% ui.endform %} -
-
- {% endforeach %} - {% endif %} -
-
- - -{% endsection %} \ No newline at end of file