This commit is contained in:
parent
d19de44668
commit
21b8bc2560
|
|
@ -1803,6 +1803,43 @@ class DeploymentServer:
|
||||||
|
|
||||||
// 加载表列表
|
// 加载表列表
|
||||||
loadTables(dbName);
|
loadTables(dbName);
|
||||||
|
|
||||||
|
// 加载SQL历史记录
|
||||||
|
loadSQLHistory(dbName);
|
||||||
|
}}
|
||||||
|
|
||||||
|
// 加载SQL历史记录
|
||||||
|
function loadSQLHistory(dbName) {{
|
||||||
|
fetch(`/api/database/history?db=${{dbName}}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {{
|
||||||
|
const historyPanel = document.getElementById('historyPanel');
|
||||||
|
const historyContainer = document.getElementById('historyContainer');
|
||||||
|
|
||||||
|
if (data.success && data.history && data.history.length > 0) {{
|
||||||
|
historyPanel.style.display = 'block';
|
||||||
|
historyContainer.innerHTML = data.history.map(sql =>
|
||||||
|
`<div class="history-item" onclick="loadHistorySQL('${{sql.replace(/'/g, "\\\\'").replace(/"/g, '"')}}')">${{escapeHtml(sql)}}</div>`
|
||||||
|
).join('');
|
||||||
|
}} else {{
|
||||||
|
historyPanel.style.display = 'none';
|
||||||
|
}}
|
||||||
|
}})
|
||||||
|
.catch(error => {{
|
||||||
|
console.error('加载历史记录失败:', error);
|
||||||
|
}});
|
||||||
|
}}
|
||||||
|
|
||||||
|
// 加载历史SQL到编辑器
|
||||||
|
function loadHistorySQL(sql) {{
|
||||||
|
document.getElementById('sqlEditor').value = sql;
|
||||||
|
}}
|
||||||
|
|
||||||
|
// HTML转义函数
|
||||||
|
function escapeHtml(text) {{
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.textContent = text;
|
||||||
|
return div.innerHTML;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
// 加载表列表
|
// 加载表列表
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue