58 lines
2.6 KiB
HTML
58 lines
2.6 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div class="bg-white dark:bg-slate-800 shadow rounded-lg p-6">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h2 class="text-2xl font-bold text-gray-900 dark:text-white">管理后台 (Admin Dashboard)</h2>
|
|
<a href="{{ url_for('admin.logout') }}" class="text-red-600 hover:text-red-800">Logout</a>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<!-- ETL Controls -->
|
|
<div class="border border-gray-200 dark:border-gray-700 rounded-lg p-4">
|
|
<h3 class="text-lg font-bold text-gray-900 dark:text-white mb-4">数据管线 (ETL)</h3>
|
|
<div class="space-y-2">
|
|
<a href="{{ url_for('admin.import_match') }}" class="block w-full text-center bg-yrtv-600 text-white py-2 px-4 rounded hover:bg-yrtv-500">上传并导入比赛</a>
|
|
<button onclick="triggerEtl()" class="w-full bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700">运行完整 L1 → L2 → L3</button>
|
|
</div>
|
|
<div id="etlResult" class="mt-4 text-sm text-gray-600 dark:text-gray-400"></div>
|
|
</div>
|
|
|
|
<!-- Tools -->
|
|
<div class="border border-gray-200 dark:border-gray-700 rounded-lg p-4">
|
|
<h3 class="text-lg font-bold text-gray-900 dark:text-white mb-4">工具箱</h3>
|
|
<div class="space-y-2">
|
|
<a href="{{ url_for('admin.data_integrity') }}" class="block w-full text-center bg-emerald-600 text-white py-2 px-4 rounded hover:bg-emerald-700">数据完整性中心</a>
|
|
<a href="{{ url_for('admin.sql_runner') }}" class="block w-full text-center bg-gray-600 text-white py-2 px-4 rounded hover:bg-gray-700">SQL Runner</a>
|
|
<a href="{{ url_for('wiki.index') }}" class="block w-full text-center bg-gray-600 text-white py-2 px-4 rounded hover:bg-gray-700">Manage Wiki</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function triggerEtl() {
|
|
const resultDiv = document.getElementById('etlResult');
|
|
resultDiv.innerText = "正在创建后台流水线...";
|
|
|
|
fetch("{{ url_for('admin.trigger_etl') }}", {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
window.location.href = "{{ url_for('admin.import_match') }}?job_id=" + data.job_id;
|
|
} else {
|
|
resultDiv.innerText = data.error || "启动失败";
|
|
}
|
|
})
|
|
.catch(err => {
|
|
resultDiv.innerText = "Error: " + err;
|
|
});
|
|
}
|
|
</script>
|
|
{% endblock %}
|