整理代码
This commit is contained in:
1 parent
e87c4ee6a8
commit
a45e33f94b
39 files changed
+264
-917
No files matched your search
@@ -297,11 +297,6 @@ export async function query(sql, database, tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
// 灌演示数据。
|
||||
export async function seedDemoData(database) {
|
||||
return request('/api/demo-data', jsonInit('POST', {}), database);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 设置
|
||||
|
||||
// 读取服务器设置。
|
||||
|
||||
@@ -147,7 +147,6 @@ function renderShell() {
|
||||
<div class="brand"><span class="brand-mark">ChuSQL</span><span class="brand-name">数据库终端</span></div>
|
||||
<nav class="titlebar-actions">
|
||||
<button data-action="new-query" title="新建查询">新建查询</button>
|
||||
<button data-action="demo-data" title="灌一份演示数据">演示数据</button>
|
||||
<button data-action="refresh" title="重新加载当前库">刷新</button>
|
||||
<button data-action="settings" title="IDE 与服务器设置">设置</button>
|
||||
</nav>
|
||||
@@ -1400,7 +1399,7 @@ function startSplitterDrag(kind, event) {
|
||||
|
||||
// 这些动作都要求已经选中一个库(服务没有默认库)
|
||||
const DATABASE_ACTIONS = new Set([
|
||||
'open-normalization', 'analyze-normalization', 'open-table', 'demo-data', 'open-table-dialog', 'create-table',
|
||||
'open-normalization', 'analyze-normalization', 'open-table', 'open-table-dialog', 'create-table',
|
||||
'open-index-dialog', 'create-index', 'drop-table', 'drop-column', 'drop-index',
|
||||
'drop-database', 'commit', 'rollback', 'copy-sql',
|
||||
]);
|
||||
@@ -1496,18 +1495,6 @@ function onClick(event) {
|
||||
case 'refresh':
|
||||
void loadWorkspace().then(reloadOpenTables);
|
||||
return;
|
||||
case 'demo-data':
|
||||
void (async () => {
|
||||
try {
|
||||
const report = await api.seedDemoData(state.database);
|
||||
log('info', `演示数据:新建 ${(report.created ?? []).length} 张,保留 ${(report.skipped ?? []).length} 张。`);
|
||||
await loadWorkspace();
|
||||
await reloadOpenTables();
|
||||
} catch (error) {
|
||||
fail(error);
|
||||
}
|
||||
})();
|
||||
return;
|
||||
case 'open-db-dialog':
|
||||
region('dlg-db-name').value = '';
|
||||
region('dlg-db-error').textContent = '';
|
||||
|
||||
Reference in new issue
Block a user