Files
komp_ac/web/templates/pages/analytics/catalog.html
2026-08-03 15:48:21 +02:00

45 lines
2.0 KiB
HTML

{# POST /api/catalog — crate::pages::analytics::ui::CatalogFragment #}
{% if tables.is_empty() %}
<p class="hint">This profile has no analytics tables.</p>
{% else %}
<p class="schema-summary"><strong>{{ tables.len() }}</strong> tables available</p>
<div class="catalog-tables">
{% for table in tables %}
<details class="catalog-table">
<summary>
<code>{{ table.name }}</code>
</summary>
<button type="button" class="starter-query" data-sql="{{ table.starter_query }}"
x-on:click="sql = $el.dataset.sql; $refs.sql.focus()">Use starter query</button>
<ul class="columns">
{% for column in table.columns %}
<li>
<button type="button" class="column-name" data-insert="{{ column.insert_text }}"
x-on:click="$refs.sql.setRangeText($el.dataset.insert, $refs.sql.selectionStart, $refs.sql.selectionEnd, 'end'); sql = $refs.sql.value; $refs.sql.focus()">{{ column.name }}</button>
<span>{{ column.details }}</span>
</li>
{% endfor %}
</ul>
{% if !table.links.is_empty() %}
<div class="links">
<span>Links</span>
<ul>
{% for link in table.links %}
<li><code>{{ link.source_column }}</code><code>{{ link.linked_table }}</code>{% if link.required %} (required){% endif %}</li>
{% endfor %}
</ul>
</div>
{% endif %}
</details>
{% endfor %}
</div>
<details class="llm-context">
<summary>LLM schema context</summary>
<p class="hint">Copy this entire text and include it when asking an LLM to write a query.</p>
<textarea x-ref="llmSchema" readonly>{{ llm_context }}</textarea>
<button type="button" class="secondary"
x-on:click="navigator.clipboard.writeText($refs.llmSchema.value); copied = true">Copy context</button>
<span class="hint" x-show="copied" x-cloak>Copied</span>
</details>
{% endif %}