feat(datasets): add SQL template chips for column mapping modal
Как на maintenance с шаблоном баннера — добавил чипсы-шаблоны SQL-запросов над textarea в модалке маппинга колонок: - information_schema — вставляет запрос к information_schema с JOIN pg_description для получения описаний колонок - Custom table — вставляет запрос к кастомной таблице маппинга - Clear — очищает поле Чипсы в стиле rounded-full с hover-эффектами, подпись "Шаблоны:" и title-tooltip на каждой кнопке. i18n: 6 новых ключей (sql_templates, sql_template_*).
This commit is contained in:
@@ -80,5 +80,11 @@
|
||||
"start_mapping_tip": "Start mapping task for selected datasets",
|
||||
"cancel_tip": "Cancel and close",
|
||||
"llm_provider_tip": "Select LLM provider for documentation generation",
|
||||
"start_docs_tip": "Start documentation generation for selected datasets"
|
||||
"start_docs_tip": "Start documentation generation for selected datasets",
|
||||
"sql_templates": "Templates",
|
||||
"sql_template_info_schema": "information_schema",
|
||||
"sql_template_custom": "Custom table",
|
||||
"sql_template_clear": "Clear",
|
||||
"sql_template_info_schema_tip": "Insert information_schema query template for column lookup",
|
||||
"sql_template_custom_tip": "Insert custom mapping table query template"
|
||||
}
|
||||
|
||||
@@ -80,5 +80,11 @@
|
||||
"start_mapping_tip": "Запустить задачу маппинга для выбранных датасетов",
|
||||
"cancel_tip": "Отменить и закрыть",
|
||||
"llm_provider_tip": "Выберите LLM-провайдера для генерации документации",
|
||||
"start_docs_tip": "Запустить генерацию документации для выбранных датасетов"
|
||||
"start_docs_tip": "Запустить генерацию документации для выбранных датасетов",
|
||||
"sql_templates": "Шаблоны",
|
||||
"sql_template_info_schema": "information_schema",
|
||||
"sql_template_custom": "Кастомная таблица",
|
||||
"sql_template_clear": "Очистить",
|
||||
"sql_template_info_schema_tip": "Вставить шаблон запроса к information_schema для поиска колонок",
|
||||
"sql_template_custom_tip": "Вставить шаблон запроса к кастомной таблице маппинга"
|
||||
}
|
||||
|
||||
@@ -389,6 +389,27 @@
|
||||
</label>
|
||||
<HelpTooltip text={$t.datasets?.sql_query_tip || ""} />
|
||||
</span>
|
||||
<!-- SQL template chips -->
|
||||
<div class="flex flex-wrap gap-1.5 mb-2">
|
||||
<span class="text-xs text-gray-400 mr-0.5 self-center">{$t.datasets?.sql_templates ?? 'Шаблоны'}:</span>
|
||||
<button
|
||||
type="button"
|
||||
class="px-2 py-0.5 text-xs border border-gray-300 rounded-full text-gray-500 hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 transition-colors"
|
||||
title={$t.datasets?.sql_template_info_schema_tip}
|
||||
onclick={() => { mapSqlQuery = "SELECT c.column_name, c.data_type, pgd.description\nFROM information_schema.columns c\nLEFT JOIN pg_catalog.pg_description pgd ON pgd.objsubid = c.ordinal_position\n AND pgd.objoid = (SELECT attrelid FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = c.table_name) AND attname = c.column_name)\nWHERE c.table_schema = 'public'\n AND c.table_name = 'your_table_name'\nORDER BY c.ordinal_position;" }}
|
||||
>information_schema</button>
|
||||
<button
|
||||
type="button"
|
||||
class="px-2 py-0.5 text-xs border border-gray-300 rounded-full text-gray-500 hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 transition-colors"
|
||||
title={$t.datasets?.sql_template_custom_tip}
|
||||
onclick={() => { mapSqlQuery = "SELECT column_name, description AS verbose_name\nFROM my_column_mappings\nWHERE table_name = 'your_table_name'\nORDER BY column_name;" }}
|
||||
>{$t.datasets?.sql_template_custom ?? 'Кастомная таблица'}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="px-2 py-0.5 text-xs border border-gray-300 rounded-full text-gray-400 hover:border-red-300 hover:text-red-500 transition-colors"
|
||||
onclick={() => { mapSqlQuery = ""; }}
|
||||
>{$t.datasets?.sql_template_clear ?? 'Очистить'}</button>
|
||||
</div>
|
||||
<textarea
|
||||
id="map-sql-query"
|
||||
class="w-full border rounded px-2 py-1.5 mb-4 font-mono text-xs"
|
||||
|
||||
Reference in New Issue
Block a user