71 lines
3.1 KiB
PHTML
71 lines
3.1 KiB
PHTML
{% 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 %} |