- Some bugfixes were made and annotations were converted into attributes
This commit is contained in:
parent
9c8f9903fc
commit
6ff29a576c
|
@ -3,31 +3,18 @@
|
||||||
namespace Lean\Console\Controller;
|
namespace Lean\Console\Controller;
|
||||||
|
|
||||||
use League\Route\Router;
|
use League\Route\Router;
|
||||||
use Picea\Caching\Opcache;
|
use Picea\{ FileFetcher, Picea ,Caching\Opcache, Extension\UrlExtension };
|
||||||
use Picea\FileFetcher;
|
|
||||||
use Picea\Picea;
|
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Route\Annotation\Object\Route as RouteParam,
|
|
||||||
Notes\Route\Annotation\Method\Route,
|
|
||||||
Notes\Security\Annotation\Security,
|
|
||||||
Notes\Tell\Annotation\Language;
|
|
||||||
|
|
||||||
use Lean\Console\{ Form, Lib };
|
use Lean\Console\{ Form, Lib };
|
||||||
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
use Picea\Extension\UrlExtension;
|
|
||||||
|
|
||||||
use function Home\View\{ _, lang, url, route, form };
|
use function Home\View\{ _, lang, url, route, form };
|
||||||
|
|
||||||
/**
|
#[Language("lean.caching")]
|
||||||
* @Language("lean.caching")
|
|
||||||
*/
|
|
||||||
class Caching extends Console {
|
class Caching extends Console {
|
||||||
use Lib\ConsoleControllerTrait;
|
use Lib\ConsoleControllerTrait;
|
||||||
|
|
||||||
/**
|
#[Route(route: "/caching/picea", name: "lean.console:caching")]
|
||||||
* @Route("/caching/picea", "name" => "lean.console:caching")
|
|
||||||
*/
|
|
||||||
public function picea(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function picea(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
|
@ -4,22 +4,15 @@ namespace Lean\Console\Controller;
|
||||||
|
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Route\Annotation\Object\Route as RouteParam,
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
Notes\Route\Annotation\Method\Route,
|
|
||||||
Notes\Security\Annotation\Security,
|
|
||||||
Notes\Tell\Annotation\Language;
|
|
||||||
|
|
||||||
use \Lean\Console\Lib;
|
use \Lean\Console\Lib;
|
||||||
|
|
||||||
/**
|
#[Language("lean.console")]
|
||||||
* @Language("lean.console")
|
|
||||||
*/
|
|
||||||
class Console {
|
class Console {
|
||||||
use Lib\ConsoleControllerTrait;
|
use Lib\ConsoleControllerTrait;
|
||||||
|
|
||||||
/**
|
#[Route(route: "/", name: "lean.console:home")]
|
||||||
* @Route("/", "name" => "lean.console:home")
|
|
||||||
*/
|
|
||||||
public function home(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function home(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
return $this->renderView("lean-console/page/dashboard/index", [
|
return $this->renderView("lean-console/page/dashboard/index", [
|
||||||
|
|
|
@ -4,22 +4,15 @@ namespace Lean\Console\Controller;
|
||||||
|
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Route\Annotation\Object\Route as RouteParam,
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
Notes\Route\Annotation\Method\Route,
|
|
||||||
Notes\Security\Annotation\Security,
|
|
||||||
Notes\Tell\Annotation\Language;
|
|
||||||
|
|
||||||
use \Lean\Console\Lib;
|
use \Lean\Console\Lib;
|
||||||
|
|
||||||
/**
|
#[Language("lean.dev")]
|
||||||
* @Language("lean.dev")
|
|
||||||
*/
|
|
||||||
class Dev {
|
class Dev {
|
||||||
use Lib\ConsoleControllerTrait;
|
use Lib\ConsoleControllerTrait;
|
||||||
|
|
||||||
/**
|
#[Route(route: "/phpinfo", name: "lean.dev:phpinfo")]
|
||||||
* @Route("/phpinfo", "name" => "lean.dev:phpinfo")
|
|
||||||
*/
|
|
||||||
public function home(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function home(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
phpinfo();
|
phpinfo();
|
||||||
|
|
|
@ -5,27 +5,17 @@ namespace Lean\Console\Controller;
|
||||||
use League\Route\Router;
|
use League\Route\Router;
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Route\Annotation\Object\Route as RouteParam,
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
Notes\Route\Annotation\Method\Route,
|
|
||||||
Notes\Security\Annotation\Security,
|
|
||||||
Notes\Tell\Annotation\Language;
|
|
||||||
|
|
||||||
use \Lean\Console\Lib;
|
use \Lean\Console\Lib;
|
||||||
|
|
||||||
use Picea\Extension\UrlExtension;
|
use Picea\Extension\UrlExtension;
|
||||||
|
|
||||||
/**
|
#[Language("lean.request")]
|
||||||
* @Language("lean.request")
|
|
||||||
*/
|
|
||||||
class Request extends Console {
|
class Request extends Console {
|
||||||
use Lib\ConsoleControllerTrait;
|
use Lib\ConsoleControllerTrait;
|
||||||
|
|
||||||
/**
|
#[Route(route: "/request/routes", name: "lean.console:request.route")]
|
||||||
* @Route("/request/routes", "name" => "lean.console:request.route")
|
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param array $arguments
|
|
||||||
* @return ResponseInterface
|
|
||||||
*/
|
|
||||||
public function routes(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function routes(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
$routes = $this->container->has(UrlExtension::class) ? $this->container->get(UrlExtension::class)->getRouteList(true) : false;
|
$routes = $this->container->has(UrlExtension::class) ? $this->container->get(UrlExtension::class)->getRouteList(true) : false;
|
||||||
|
|
|
@ -7,10 +7,7 @@ use League\Route\Router;
|
||||||
use Picea\Ui\Method\FormHandler;
|
use Picea\Ui\Method\FormHandler;
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Route\Annotation\Object\Route as RouteParam,
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
Notes\Route\Annotation\Method\Route,
|
|
||||||
Notes\Security\Annotation\Security,
|
|
||||||
Notes\Tell\Annotation\Language;
|
|
||||||
|
|
||||||
use \Lean\Console\Lib,
|
use \Lean\Console\Lib,
|
||||||
\Lean\Console\Form;
|
\Lean\Console\Form;
|
||||||
|
@ -21,30 +18,37 @@ use Ulmus\Annotation\Classes\Table,
|
||||||
Ulmus\Container\AdapterProxy;
|
Ulmus\Container\AdapterProxy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
#[Language("lean.storage")]
|
||||||
* @Language("lean.storage")
|
|
||||||
*/
|
|
||||||
class Storage extends Console {
|
class Storage extends Console {
|
||||||
use Lib\ConsoleControllerTrait;
|
use Lib\ConsoleControllerTrait;
|
||||||
|
|
||||||
/**
|
#[Route(route: "/storage/database", name: "lean.console:storage.database")]
|
||||||
* @Route("/storage/database", "name" => "lean.console:storage.database")
|
|
||||||
*/
|
|
||||||
public function database(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function database(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
$connections = $this->container->has(AdapterProxy::class) ? $this->container->get(AdapterProxy::class)->connections : false;
|
$connections = $this->container->has(AdapterProxy::class) ? $this->container->get(AdapterProxy::class)->connections : false;
|
||||||
$migrations = $this->container->has(Lib\DatabaseMigrations::class) ? $this->container->get(Lib\DatabaseMigrations::class) : false;
|
$migrations = $this->container->has(Lib\DatabaseMigrations::class) ? $this->container->get(Lib\DatabaseMigrations::class) : false;
|
||||||
$migrations->getEntities();
|
$migrations->getEntities();
|
||||||
|
|
||||||
$form = new FormHandler($request, new Form\Database($migrations), null);
|
$context = (new FormHandler($request, new Form\Storage\DatabaseMigration($migrations)))->context;
|
||||||
$context = $form->context;
|
|
||||||
|
|
||||||
return $this->renderView("lean-console/page/storage/database", get_defined_vars());
|
return $this->renderView("lean-console/page/storage/database", get_defined_vars());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Route(route: "/storage/database/import", name: "lean.console:storage.database_import")]
|
||||||
* @Route("/storage/session", "name" => "lean.console:storage.session")
|
public function database_import(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
*/
|
{
|
||||||
|
$connections = $this->container->has(AdapterProxy::class) ? $this->container->get(AdapterProxy::class)->connections : false;
|
||||||
|
$migrations = $this->container->has(Lib\DatabaseMigrations::class) ? $this->container->get(Lib\DatabaseMigrations::class) : false;
|
||||||
|
$migrations->getEntities();
|
||||||
|
|
||||||
|
$form = new Form\Storage\DatabaseImport($migrations, $connections);
|
||||||
|
|
||||||
|
$context = (new FormHandler($request, $form, $this->pushContext(new Lib\FormContext($request, "database.import"))))->context;
|
||||||
|
|
||||||
|
return $this->renderView("lean-console/page/storage/database_import", get_defined_vars());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route(route: "/storage/session", name: "lean.console:storage.session")] # migrated from: "/storage/session", "name" => "lean.console:storage.session"
|
||||||
public function session(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function session(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
$path = ini_get("session.save_path");
|
$path = ini_get("session.save_path");
|
||||||
|
@ -54,10 +58,7 @@ class Storage extends Console {
|
||||||
return $this->renderView("lean-console/page/storage/session", get_defined_vars());
|
return $this->renderView("lean-console/page/storage/session", get_defined_vars());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Route(route: "/storage/session/content/{hash}", name: "lean.console:storage.session_content")] # migrated from: "/storage/session/content/{hash}", "name" => "lean.console:storage.session_content"
|
||||||
* #Taxus('admin')
|
|
||||||
* @Route("/storage/session/content/{hash}", "name" => "lean.console:storage.session_content")
|
|
||||||
*/
|
|
||||||
public function sessionContent(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function sessionContent(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
$sess = session_encode();
|
$sess = session_encode();
|
||||||
|
|
|
@ -7,24 +7,17 @@ use Picea\FileFetcher;
|
||||||
use Picea\Picea;
|
use Picea\Picea;
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Route\Annotation\Object\Route as RouteParam,
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
Notes\Route\Annotation\Method\Route,
|
|
||||||
Notes\Security\Annotation\Security,
|
|
||||||
Notes\Tell\Annotation\Language;
|
|
||||||
|
|
||||||
use \Lean\Console\Lib;
|
use \Lean\Console\Lib;
|
||||||
|
|
||||||
use Picea\Extension\UrlExtension;
|
use Picea\Extension\UrlExtension;
|
||||||
|
|
||||||
/**
|
#[Language("lean.templating")] # migrated from: "lean.templating"
|
||||||
* @Language("lean.templating")
|
|
||||||
*/
|
|
||||||
class Templating extends Console {
|
class Templating extends Console {
|
||||||
use Lib\ConsoleControllerTrait;
|
use Lib\ConsoleControllerTrait;
|
||||||
|
|
||||||
/**
|
#[Route(route: "/templating/picea", name: "lean.console:templating.picea")]
|
||||||
* @Route("/templating/picea", "name" => "lean.console:templating.picea")
|
|
||||||
*/
|
|
||||||
public function picea(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
public function picea(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
{
|
{
|
||||||
$picea = $this->container->has(Picea::class) ? $this->container->get(Picea::class) : false;
|
$picea = $this->container->has(Picea::class) ? $this->container->get(Picea::class) : false;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Lean\Console\Entity;
|
namespace Lean\Console\Entity\Mysql;
|
||||||
|
|
||||||
use Ulmus\Common\EntityField;
|
use Ulmus\Common\EntityField;
|
||||||
use Ulmus\Entity\Field\Datetime,
|
use Ulmus\Entity\Field\Datetime,
|
||||||
|
@ -8,9 +8,9 @@ use Ulmus\Entity\Field\Datetime,
|
||||||
use Ulmus\EntityCollection;
|
use Ulmus\EntityCollection;
|
||||||
use Ulmus\Migration\FieldDefinition;
|
use Ulmus\Migration\FieldDefinition;
|
||||||
|
|
||||||
/**
|
use Ulmus\Attribute\Obj\Table;
|
||||||
* @Table('name' => "columns", 'database' => "information_schema")
|
|
||||||
*/
|
#[Table(name: "columns", database: "information_schema")] # migrated from: 'name' => "columns", 'database' => "information_schema"
|
||||||
class Column extends InformationSchema\Column
|
class Column extends InformationSchema\Column
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -39,6 +39,5 @@ class Column extends InformationSchema\Column
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\Console\Entity\Mysql;
|
||||||
|
|
||||||
|
use Ulmus\Common\EntityField;
|
||||||
|
use Ulmus\Entity\Field\Datetime,
|
||||||
|
Ulmus\Entity\Sqlite;
|
||||||
|
use Ulmus\EntityCollection;
|
||||||
|
use Ulmus\Migration\FieldDefinition;
|
||||||
|
|
||||||
|
use Ulmus\Attribute\Obj\Table;
|
||||||
|
|
||||||
|
#[Table(name: "columns", database: "information_schema")]
|
||||||
|
class Column extends Sqlite
|
||||||
|
{
|
||||||
|
public function differsFromFieldDefinition(FieldDefinition $definition) : bool
|
||||||
|
{
|
||||||
|
switch(true) {
|
||||||
|
//case $definition->
|
||||||
|
|
||||||
|
// return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public static function entityCollection(...$arguments) : EntityCollection
|
||||||
|
{
|
||||||
|
return new class(...$arguments) extends EntityCollection
|
||||||
|
{
|
||||||
|
public function getEntityData() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\Console\Form\Storage;
|
||||||
|
|
||||||
|
use Picea\Ui\Method\{ FormInterface, FormContext, FormContextInterface };
|
||||||
|
|
||||||
|
use \Lean\Console\{ Lib, Entity };
|
||||||
|
|
||||||
|
use Picea\Compiler\Context;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Ulmus\{ EntityCollection };
|
||||||
|
|
||||||
|
class DatabaseImport implements FormInterface
|
||||||
|
{
|
||||||
|
protected ? Lib\DatabaseMigrations $migration;
|
||||||
|
|
||||||
|
protected array $connections;
|
||||||
|
|
||||||
|
public function __construct(Lib\DatabaseMigrations $migration, array $connections)
|
||||||
|
{
|
||||||
|
$this->migration = $migration;
|
||||||
|
$this->connections = $connections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initialize(FormContextInterface $context) : void
|
||||||
|
{
|
||||||
|
$context->sourceTables ??= new EntityCollection();
|
||||||
|
$context->destinationTables ??= new EntityCollection();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validate(FormContextInterface $context) : bool
|
||||||
|
{
|
||||||
|
if ($context->source) {
|
||||||
|
$filtered = array_filter($this->migration->entities, fn($e, $key) => $key::repository()->adapter->name === $context->source, ARRAY_FILTER_USE_BOTH);
|
||||||
|
$context->sourceTables->replaceWith($filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $context->valid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(FormContextInterface $context) : void
|
||||||
|
{
|
||||||
|
if ($context->copy) {
|
||||||
|
foreach (array_filter($context->copy) as $dest => $source) {
|
||||||
|
foreach($source::repository()->yield() as $src) {
|
||||||
|
$dest::repository()->save( $src->toArray(), null, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getContext(ServerRequestInterface $request, ? string $formName = null) : FormContextInterface
|
||||||
|
{
|
||||||
|
return new class($request, $formName) extends FormContext {
|
||||||
|
|
||||||
|
public EntityCollection $sourceTables;
|
||||||
|
|
||||||
|
public EntityCollection $destinationTables;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Lean\Console\Form;
|
namespace Lean\Console\Form\Storage;
|
||||||
|
|
||||||
use Picea\Ui\Method\{ FormInterface, FormContext, FormContextInterface };
|
use Picea\Ui\Method\{ FormInterface, FormContext, FormContextInterface };
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Ulmus\Common\EntityResolver;
|
use Ulmus\Common\EntityResolver;
|
||||||
use \Ulmus\Entity\InformationSchema\Table;
|
use \Ulmus\Entity\InformationSchema\Table;
|
||||||
|
|
||||||
class Database implements FormInterface
|
class DatabaseMigration implements FormInterface
|
||||||
{
|
{
|
||||||
protected ? Lib\DatabaseMigrations $migration;
|
protected ? Lib\DatabaseMigrations $migration;
|
||||||
|
|
||||||
|
@ -95,9 +95,9 @@ class Database implements FormInterface
|
||||||
$this->initialize($context);
|
$this->initialize($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getContext(ServerRequestInterface $request) : FormContextInterface
|
public static function getContext(ServerRequestInterface $request, ? string $formName = null) : FormContextInterface
|
||||||
{
|
{
|
||||||
return new class($request) extends FormContext {
|
return new class($request, $formName) extends FormContext {
|
||||||
|
|
||||||
public array $status = [];
|
public array $status = [];
|
||||||
|
|
|
@ -6,15 +6,17 @@ use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
use Storage\Session;
|
use Storage\Session;
|
||||||
|
|
||||||
|
use Notes\Tell\Attribute\Language,
|
||||||
|
Notes\Route\Attribute\Object\Route;
|
||||||
|
|
||||||
|
use Notes\Security\Attribute\{ Security, Taxus };
|
||||||
|
|
||||||
use Picea;
|
use Picea;
|
||||||
|
|
||||||
/**
|
#[Language("lean.route")]
|
||||||
* @Language("lean.route")
|
#[Security(locked: false)]
|
||||||
* @RouteParam("methods" => [ 'GET', 'POST', 'DELETE' ], "base" => "/~")
|
#[Taxus("dev")]
|
||||||
* @Security('locked' => false)
|
#[\Notes\Route\Attribute\Object\Route(method: [ 'GET', 'POST', 'DELETE'] , base: "/~")]
|
||||||
* @Taxus("dev")
|
|
||||||
* #Taxus("admin")
|
|
||||||
*/
|
|
||||||
trait ConsoleControllerTrait
|
trait ConsoleControllerTrait
|
||||||
{
|
{
|
||||||
use \Lean\ControllerTrait;
|
use \Lean\ControllerTrait;
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
[class^="btn-"], [class~=" btn-"] { display: inline-block; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; cursor:pointer; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; background:rgba(0,0,0,0.3); color:rgba(255,255,255,0.8); }
|
[class^="btn-"], [class~=" btn-"] { display: inline-block; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; cursor:pointer; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; background:rgba(0,0,0,0.3); color:rgba(255,255,255,0.8); }
|
||||||
[class^="btn-"]:hover, [class~=" btn-"]:hover {border-color: rgba(0, 0, 0, 0.5);text-decoration: underline;}
|
[class^="btn-"]:hover, [class~=" btn-"]:hover {border-color: rgba(0, 0, 0, 0.5);text-decoration: underline;}
|
||||||
.btn-red {background: rgba(255,0,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
.btn-red {background: rgba(155,0,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
||||||
|
.btn-green {background: rgba(0,155,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
||||||
|
.btn-blue {background: rgba(0,0,155,0.5);color: rgba(255, 255, 255, 0.9);}
|
||||||
|
|
||||||
code {white-space:pre;font-family:monospace;color: #e6e6e6;background: #343537;display: block;padding: 1rem;line-height: 1.5em;border: 1px solid #2e2e30;}
|
code {white-space:pre;font-family:monospace;color: #e6e6e6;background: #343537;display: block;padding: 1rem;line-height: 1.5em;border: 1px solid #2e2e30;}
|
||||||
h1 {font-size:2rem;color:#525960}
|
h1 {font-size:2rem;color:#525960}
|
||||||
|
@ -40,4 +42,6 @@ summary {cursor:pointer;}
|
||||||
#main-content {padding:4vh 2vw;border-top:2px solid #7d7d7d;width:100%;}
|
#main-content {padding:4vh 2vw;border-top:2px solid #7d7d7d;width:100%;}
|
||||||
#main-content section {border-radius:4px;box-shadow: 1px 1px 3px rgba(0,0,0,0.5)}
|
#main-content section {border-radius:4px;box-shadow: 1px 1px 3px rgba(0,0,0,0.5)}
|
||||||
#main-content section article {background:#fff;padding:2vh 1vw;}
|
#main-content section article {background:#fff;padding:2vh 1vw;}
|
||||||
#main-content section header {background:#e8e8e8;padding:2vh 1vw;}
|
#main-content section header {background:#e8e8e8;padding:2vh 1vw;font-size:1.4em;color: #4b4848
|
||||||
|
}
|
||||||
|
#main-content section footer {background:#f9f9f9;padding:2vh 1vw;}
|
|
@ -9,15 +9,10 @@
|
||||||
{% endsection %}
|
{% endsection %}
|
||||||
|
|
||||||
{% section "content" %}
|
{% section "content" %}
|
||||||
<section>
|
{% if $connections %}
|
||||||
{% if $connections %}
|
{% foreach $connections as $connection %}
|
||||||
{% foreach $connections as $connection %}
|
<section>
|
||||||
{% php $conf = $connection->getConfiguration(); %}
|
{% php $conf = $connection->getConfiguration(); %}
|
||||||
|
|
||||||
<header>
|
|
||||||
<h1>{{ $connection->name }}</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<article class="databases">
|
<article class="databases">
|
||||||
<strong class="grid db-grid">
|
<strong class="grid db-grid">
|
||||||
<div class="col db-connection">{% _ 'database.connection' %}</div>
|
<div class="col db-connection">{% _ 'database.connection' %}</div>
|
||||||
|
@ -28,11 +23,11 @@
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
<div class="grid db-grid">
|
<div class="grid db-grid">
|
||||||
<div class="col db-connection"></div>
|
<div class="col db-connection">{{ $connection->name }}</div>
|
||||||
<div class="col db-adapter">{{ $conf['adapter'] ?? '-' }}</div>
|
<div class="col db-adapter">{{ $connection->adapter()::class }}</div>
|
||||||
<div class="col db-host">{{ $conf['host'] ?? '-' }}:{{ $conf['port'] ?? '-' }}</div>
|
<div class="col db-host">{{ $connection->adapter()->hostname ?? '-' }}:{{ $connection->adapter()->port ?? '-' }}</div>
|
||||||
<div class="col db-name">{{ $conf['database'] ?? '-' }}</div>
|
<div class="col db-name">{{ $connection->adapter()->database ?? '-' }}</div>
|
||||||
<div class="col db-username">{{ $conf['username'] ?? '-' }}</div>
|
<div class="col db-username">{{ $connection->adapter()->username ?? '-' }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tables">
|
<div class="tables">
|
||||||
|
@ -86,9 +81,9 @@
|
||||||
{% ui.endform %}
|
{% ui.endform %}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{% endforeach %}
|
</section>
|
||||||
{% endif %}
|
{% endforeach %}
|
||||||
</section>
|
{% endif %}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.databases strong.grid {background:#181818;color:#fff}
|
.databases strong.grid {background:#181818;color:#fff}
|
||||||
|
@ -103,5 +98,6 @@
|
||||||
|
|
||||||
.tables {background: #2d3137;margin: 0 -8px 0 -8px;color: #fff;padding: 2px 10px;}
|
.tables {background: #2d3137;margin: 0 -8px 0 -8px;color: #fff;padding: 2px 10px;}
|
||||||
.tables label {padding:10px 5px;display:block}
|
.tables label {padding:10px 5px;display:block}
|
||||||
|
section + section { margin-top:15px; }
|
||||||
</style>
|
</style>
|
||||||
{% endsection %}
|
{% endsection %}
|
|
@ -0,0 +1,71 @@
|
||||||
|
{% extends "lean-console/base/layout" %}
|
||||||
|
|
||||||
|
{% language.set "lean.storage" %}
|
||||||
|
|
||||||
|
{% title _("title") %}
|
||||||
|
|
||||||
|
{% section "header" %}
|
||||||
|
<div class="page-title">{% _ "page-title" %}</div>
|
||||||
|
{% endsection %}
|
||||||
|
|
||||||
|
{% section "content" %}
|
||||||
|
{% if $connections %}
|
||||||
|
{% ui.form.post "database.import" %}
|
||||||
|
<section>
|
||||||
|
<header>Import data from a connection into another</header>
|
||||||
|
|
||||||
|
<article class="databases">
|
||||||
|
{% if ! $context->source %}
|
||||||
|
{% php $select = array_combine(array_column($connections, 'name'), array_column($connections, 'name')) %}
|
||||||
|
|
||||||
|
<div class="db-grid">
|
||||||
|
Source connection: {% ui.select "source", $select %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="db-grid">
|
||||||
|
Destination connection: {% ui.select "destination", $select %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{% ui.hidden 'source', $context->source %}
|
||||||
|
{% ui.hidden 'destination', $context->destination %}
|
||||||
|
|
||||||
|
<div class="db-grid">
|
||||||
|
COPY DATA FROM → TO:
|
||||||
|
{% php $dest = array_filter($migrations->entities, fn($e, $key) => $key::repository()->adapter->name === $context->destination, ARRAY_FILTER_USE_BOTH); %}
|
||||||
|
|
||||||
|
{% foreach $dest as $key => $value %}
|
||||||
|
<div class="db-grid">
|
||||||
|
<span>{% ui.select "copy[$key]", [ null => '' ] + $context->sourceTables->buildArray('entityClass', 'entityClass') %}</span>
|
||||||
|
<span>→</span>
|
||||||
|
<span>{{ sprintf('%s (%s)', $key, $value->tableName()) }}</span>
|
||||||
|
</div>
|
||||||
|
{% endforeach %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<footer class="text-center">
|
||||||
|
<button type="submit" class="btn-blue">Copy</button>
|
||||||
|
<a href="{% route 'lean.console:storage.database' %}" class="btn-red">Cancel</a>
|
||||||
|
</footer>
|
||||||
|
</section>
|
||||||
|
{% ui.endform %}
|
||||||
|
{% else %}
|
||||||
|
No connection found
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.databases strong.grid {background:#181818;color:#fff}
|
||||||
|
|
||||||
|
.databases .db-grid {padding:0.66rem 0.3rem}
|
||||||
|
.databases .db-grid strong {color:#444}
|
||||||
|
.databases .db-grid:nth-child(even) {background: #eaeaea }
|
||||||
|
.databases .tables .table-item {padding:0.33rem 0;background:rgba(255,255,255,0.1);line-height: 1.8em;}
|
||||||
|
.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: #2d3137;margin: 0 -8px 0 -8px;color: #fff;padding: 2px 10px;}
|
||||||
|
.tables label {padding:10px 5px;display:block}
|
||||||
|
section + section { margin-top:15px; }
|
||||||
|
</style>
|
||||||
|
{% endsection %}
|
Loading…
Reference in New Issue