- WIP on database storage filling
This commit is contained in:
1 parent
2fd9331c15
commit
7117021750
6 files changed
+208
-8
No files matched your search
@@ -40,7 +40,7 @@
|
||||
<div class="col text-right">{% _ 'database.table.actions' %}</div>
|
||||
</strong>
|
||||
|
||||
{% ui:form.post "database" %}
|
||||
{% ui:form.post "database.migrate", current_url() %}
|
||||
{% 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>
|
||||
@@ -71,6 +71,10 @@
|
||||
</div>
|
||||
{% break %}
|
||||
{% endswitch %}
|
||||
|
||||
<div class="text-right">
|
||||
<a href="{% route 'lean.console:storage.database_insert', [ 'source' => $entity ] %}" class="btn-gray">{% _ 'database.table.add-column' %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endforeach %}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
{% use Ulmus\Attribute\Property\Field %}
|
||||
{% use Lean\Console\Lib\Database\ModifierTypeEnum %}
|
||||
|
||||
{% extends "lean-console/base/layout" %}
|
||||
|
||||
{% language.set "lean.storage" %}
|
||||
|
||||
{% title _("title") %}
|
||||
|
||||
{% section "breadcrumb-items" %}
|
||||
<li class="breadcrumb-item"><a href="{% route 'lean.console:storage.database' %}">{% _ 'database.breadcrumb' %}</a></li>
|
||||
<li class="breadcrumb-item">{% _ 'database_insert.breadcrumb' %}</li>
|
||||
{% endsection %}
|
||||
|
||||
{% section "content" %}
|
||||
<section class="insert">
|
||||
<header class="bg-yellow">
|
||||
<h2>{{ $class }}</h2>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="database_insert">
|
||||
<div class="tables">
|
||||
<strong class="grid table-item">
|
||||
<div class="col">{% _ 'database_insert.table.column' %}</div>
|
||||
<div class="col">{% _ 'database_insert.table.type' %}</div>
|
||||
<div class="col text-center">{% _ 'database_insert.table.attributes' %}</div>
|
||||
<div class="col col-grow-4 text-center">{% _ 'database_insert.table.value' %}</div>
|
||||
</strong>
|
||||
|
||||
{% ui:form.post "database.insert", current_url(get()) %}
|
||||
{% foreach $class::resolveEntity()->fieldList() as $field %}
|
||||
<div class="grid table-item align-items-center column-item">
|
||||
<div class="col">
|
||||
<span>{{ $field->name }}</span>
|
||||
</div>
|
||||
|
||||
<div class="col ">
|
||||
{% foreach $field->getTypes() as $type %}
|
||||
<span title="{{ $type->type }}">{{ $type->isObject() ? substr($type->type, strrpos($type->type, '\\') + 1) : $type->type }}</span>
|
||||
{% endforeach %}
|
||||
</div>
|
||||
|
||||
<div class="col attributes text-center">
|
||||
{% foreach $field->attributes as $attribute %}
|
||||
<span class="attribute" title="{% json.pretty.html $attribute->object %}">{{ $attribute->tag }}</span>
|
||||
{% endforeach %}
|
||||
</div>
|
||||
|
||||
<div class="col col-grow-4">
|
||||
{% foreach $field->getTypes() as $type %}
|
||||
{% php $attr = $field->getAttribute(Field::class)->object->readonly ? [ 'disabled' => 'disabled', 'placeholder' => _('database_insert.readonly') ] : [] %}
|
||||
|
||||
{% if enum_exists($type->type) %}
|
||||
{% php $enum = array_map(fn($e) => $e->value, $type->type::cases()) %}
|
||||
|
||||
{% if $type->nullable %}
|
||||
{% php $enum = [ null => null ] + $enum %}
|
||||
{% endif %}
|
||||
|
||||
{% ui:select $field->name, array_combine($enum, $enum), $context->{$field->name}, $attr %}
|
||||
{% else %}
|
||||
{% ui:text $field->name, $context->{$field->name}, $attr %}
|
||||
{% endif %}
|
||||
{% endforeach %}
|
||||
</div>
|
||||
|
||||
{# <div class="col">{% _ "database.table.fields", [ 'count' => count( $item->fieldList() ) ] %}</div>
|
||||
<div class="col">
|
||||
{% if $context->definition[$entity]['table']->modifier->query ?? false %}
|
||||
<code>{{= implode('<br><br>',(array) $context->definition[$entity]['table']->modifier->query) }}</code>
|
||||
{% else %}
|
||||
<div style="color:#abecab">✓ {% _ 'database.table.uptodate' %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
</div> #}
|
||||
</div>
|
||||
{% endforeach %}
|
||||
|
||||
<div class="grid table-item">
|
||||
<div class="col"></div>
|
||||
<div class="col"></div>
|
||||
<div class="col text-center"></div>
|
||||
<div class="col col-grow-4 text-right py-2">
|
||||
<button type="submit" class="btn-yellow">{% _ 'database_insert.add' %}</button>
|
||||
</div>
|
||||
</div>
|
||||
{% ui:endform %}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
#main-content .insert article {background: #6a6a6a;padding:10px;}
|
||||
|
||||
select, input:not([type="file"]):not([type="button"]) {display: block;width: 100%;height: calc(2rem + 2px);padding: .375rem .75rem;font-size: 1rem;line-height: 1.5;color: #495057;background-color: #fff;background-clip: padding-box;border: 1px solid #ced4da; border-radius: 0; transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;}
|
||||
select:disabled, input[disabled] {filter: contrast(60%);}
|
||||
.database_insert strong.grid {background: #888a91;color:#fff}
|
||||
|
||||
.database_insert .db-grid {padding:0.66rem 0.3rem}
|
||||
.database_insert .db-grid strong {color:#444}
|
||||
.database_insert .db-grid:nth-child(even) {background: #e3e3e3;line-height: 1.5em;font-size: 1.3em;}
|
||||
|
||||
.database_insert .tables {color:#fff}
|
||||
.database_insert .tables .table-item {padding:0.33rem 0;background:rgba(255,255,255,0.1);line-height: 1.8em;}
|
||||
.database_insert .tables .table-item:nth-child(even) {background:rgba(255,255,255,0.2)}
|
||||
.database_insert .attribute {display: inline-block;padding: .25em .4em 0 .4em;font-size: 70%;font-weight: 700;line-height: 1.2rem;text-align: center;white-space: nowrap;vertical-align: baseline;border-radius: .25rem;color:#ffe300; border:1px solid #ffe300}
|
||||
.database_insert summary {background: #172841;color:#fff;margin: 0 -8px 0 -8px;padding:7px 10px}
|
||||
|
||||
.tables {background: #2d3137; #fff;padding: 2px 10px;}
|
||||
.tables label {padding:10px 5px;display:block}
|
||||
section + section { margin-top:15px; }
|
||||
</style>
|
||||
{% endsection %}
|
||||
Reference in new issue
Block a user