94 lines
5.3 KiB
PHTML
94 lines
5.3 KiB
PHTML
{% use Lean\Console\Lib\Database\ModifierTypeEnum %}
|
|
|
|
{% extends "lean-console/base/layout" %}
|
|
|
|
{% language.set "lean.storage" %}
|
|
|
|
{% title _("title") %}
|
|
|
|
{% section "breadcrumb-items" %}
|
|
<li class="breadcrumb-item">{% _ 'database.breadcrumb' %}</li>
|
|
{% endsection %}
|
|
|
|
{% section "content" %}
|
|
{% if $connections %}
|
|
{% foreach $connections as $connection %}
|
|
{% php $conf = $connection->getConfiguration(); %}
|
|
|
|
<section class="connection">
|
|
<header>
|
|
<div class="icon-database icon-purple">
|
|
{% include "lean-console/svg/icon-database.svg" %}
|
|
</div>
|
|
|
|
<h2>{% _.raw 'database.connection', [ 'name' => $connection->name ] %}</h2>
|
|
</header>
|
|
|
|
<article>
|
|
{% ui:form.post "database.migrate", current_url() %}
|
|
{% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %}
|
|
<div class="single-table grid">
|
|
<div class="col-5 col-xxl flex align-items-center">
|
|
<div class="icon-yellow">
|
|
{% include "lean-console/svg/icon-table.svg" %}
|
|
</div>
|
|
|
|
<div>
|
|
<div class="tablename">{{ $item->tableName() }}</div>
|
|
<div class="classname">{{ $entity }}</div>
|
|
<div class="tableinfo">
|
|
<span class="fieldcount">{% _ "database.table.fields", [ 'count' => count( $item->fieldList() ) ] %}</span>
|
|
|
|
{% if $context->definition[$entity]['table']->modifier->type !== ModifierTypeEnum::Create %}
|
|
<span class="entriescount">{% _.raw 'database.table.entries', [ 'count' => $entity::repository()->count() ] %}</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-5 col-lg flex align-items-center">
|
|
{% if $context->definition[$entity]['table']->modifier->query ?? false %}
|
|
<code class="query">{{= implode('<br><br>',(array) $context->definition[$entity]['table']->modifier->query) }}</code>
|
|
{% else %}
|
|
<code class="uptodate">✓ {% _ 'database.table.uptodate' %}</code>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="col-2 col-lg flex align-items-center">
|
|
<div class="btn-wrapper">
|
|
{% switch $context->definition[$entity]['table']->modifier->type ?? false %}
|
|
{% case ModifierTypeEnum::Create %}
|
|
{% php $createAll[] = $entity %}
|
|
<button name="create" value="{{$entity}}" class="btn-red btn-sm">✓ {% _ 'database.table.create' %}</button>
|
|
</div>
|
|
{% break %}
|
|
|
|
{% case ModifierTypeEnum::Alter %}
|
|
{% php $alterAll[] = $entity %}
|
|
<button name="alter" value="{{$entity}}" class="btn-blue btn-sm">✓ {% _ 'database.table.alter' %}</button>
|
|
{% break %}
|
|
{% endswitch %}
|
|
<a href="{% route 'lean.console:storage.database_insert', [ 'source' => $entity ] %}" class="btn-purple btn-sm">{% _ 'database.table.add-column' %}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endforeach %}
|
|
{% ui:endform %}
|
|
</article>
|
|
</section>
|
|
{% endforeach %}
|
|
{% endif %}
|
|
|
|
<style>
|
|
.connection .single-table {padding: 10px 5px 10px 5px;}
|
|
.connection .single-table:nth-child(2n + 1) {background: #fafafa;}
|
|
.connection .single-table + .single-table {border-top: 1px solid #eaeaea;}
|
|
.connection + .connection { margin-top:25px ;}
|
|
.connection .tablename {font-weight:bold;margin-bottom:5px;text-transform: uppercase}
|
|
.connection .tableinfo {color: #9c9b9b;font-size:85%;margin-top:2px}
|
|
.connection .classname {color: #601a7b; line-height:1.2rem}
|
|
.connection .entriescount:before {content:"•"; padding-right: 8px; padding-left: 2px}
|
|
.connection .query {color:#6f0463;white-space: pre;border-color:#c9a5c7}
|
|
.connection .uptodate {color:#0a9178;border-color:#a0d2ca}
|
|
.connection .btn-wrapper {display:flex; flex-direction:column; gap:5px; max-width:80%; margin-left:auto }
|
|
</style>
|
|
{% endsection %} |