fdb2 1.0.36 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/public/explorer.css +533 -485
- package/dist/public/explorer.js +1277 -868
- package/dist/public/index.css +172 -34
- package/dist/public/index.js +103 -49
- package/dist/public/layout.js +3 -3
- package/dist/public/vue.js +1 -1
- package/dist/server/core/schema/__tests__/canonical.test.ts +195 -0
- package/dist/server/core/schema/__tests__/ddl-emitter.test.ts +456 -0
- package/dist/server/core/schema/__tests__/diff.test.ts +242 -0
- package/dist/server/core/schema/__tests__/roundtrip.property.test.ts +403 -0
- package/dist/server/core/schema/canonical.d.ts +50 -0
- package/dist/server/core/schema/canonical.d.ts.map +1 -0
- package/dist/server/core/schema/canonical.js +212 -0
- package/dist/server/core/schema/canonical.js.map +1 -0
- package/dist/server/core/schema/canonical.ts +223 -0
- package/dist/server/core/schema/ddl-emitter.d.ts +68 -0
- package/dist/server/core/schema/ddl-emitter.d.ts.map +1 -0
- package/dist/server/core/schema/ddl-emitter.js +813 -0
- package/dist/server/core/schema/ddl-emitter.js.map +1 -0
- package/dist/server/core/schema/ddl-emitter.ts +925 -0
- package/dist/server/core/schema/diff.d.ts +16 -0
- package/dist/server/core/schema/diff.d.ts.map +1 -0
- package/dist/server/core/schema/diff.js +115 -0
- package/dist/server/core/schema/diff.js.map +1 -0
- package/dist/server/core/schema/diff.ts +134 -0
- package/dist/server/core/schema/type-defaults.d.ts +27 -0
- package/dist/server/core/schema/type-defaults.d.ts.map +1 -0
- package/dist/server/core/schema/type-defaults.js +61 -0
- package/dist/server/core/schema/type-defaults.js.map +1 -0
- package/dist/server/core/schema/type-defaults.ts +79 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +347 -124
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.ts +336 -161
- package/dist/server/model/ddl-spec.d.ts +163 -0
- package/dist/server/model/ddl-spec.d.ts.map +1 -0
- package/dist/server/model/ddl-spec.js +32 -0
- package/dist/server/model/ddl-spec.js.map +1 -0
- package/dist/server/model/ddl-spec.ts +175 -0
- package/dist/server/service/connection.service.d.ts +20 -0
- package/dist/server/service/connection.service.d.ts.map +1 -1
- package/dist/server/service/connection.service.js +99 -25
- package/dist/server/service/connection.service.js.map +1 -1
- package/dist/server/service/connection.service.ts +104 -25
- package/dist/server/service/database/base.service.d.ts +0 -4
- package/dist/server/service/database/base.service.d.ts.map +1 -1
- package/dist/server/service/database/base.service.js.map +1 -1
- package/dist/server/service/database/base.service.ts +0 -5
- package/dist/server/service/database/clickhouse.service.d.ts +0 -5
- package/dist/server/service/database/clickhouse.service.d.ts.map +1 -1
- package/dist/server/service/database/clickhouse.service.js +0 -49
- package/dist/server/service/database/clickhouse.service.js.map +1 -1
- package/dist/server/service/database/clickhouse.service.ts +0 -52
- package/dist/server/service/database/cockroachdb.service.d.ts +0 -5
- package/dist/server/service/database/cockroachdb.service.d.ts.map +1 -1
- package/dist/server/service/database/cockroachdb.service.js +11 -142
- package/dist/server/service/database/cockroachdb.service.js.map +1 -1
- package/dist/server/service/database/cockroachdb.service.ts +11 -161
- package/dist/server/service/database/database.service.d.ts +55 -2
- package/dist/server/service/database/database.service.d.ts.map +1 -1
- package/dist/server/service/database/database.service.js +246 -4
- package/dist/server/service/database/database.service.js.map +1 -1
- package/dist/server/service/database/database.service.ts +295 -7
- package/dist/server/service/database/mongodb.service.d.ts +0 -6
- package/dist/server/service/database/mongodb.service.d.ts.map +1 -1
- package/dist/server/service/database/mongodb.service.js +0 -8
- package/dist/server/service/database/mongodb.service.js.map +1 -1
- package/dist/server/service/database/mongodb.service.ts +0 -8
- package/dist/server/service/database/mssql.service.d.ts +8 -4
- package/dist/server/service/database/mssql.service.d.ts.map +1 -1
- package/dist/server/service/database/mssql.service.js +27 -132
- package/dist/server/service/database/mssql.service.js.map +1 -1
- package/dist/server/service/database/mssql.service.ts +34 -156
- package/dist/server/service/database/mysql.service.d.ts +0 -4
- package/dist/server/service/database/mysql.service.d.ts.map +1 -1
- package/dist/server/service/database/mysql.service.js +11 -155
- package/dist/server/service/database/mysql.service.js.map +1 -1
- package/dist/server/service/database/mysql.service.ts +17 -184
- package/dist/server/service/database/oracle.service.d.ts +0 -4
- package/dist/server/service/database/oracle.service.d.ts.map +1 -1
- package/dist/server/service/database/oracle.service.js +11 -141
- package/dist/server/service/database/oracle.service.js.map +1 -1
- package/dist/server/service/database/oracle.service.ts +17 -166
- package/dist/server/service/database/postgres.service.d.ts +0 -4
- package/dist/server/service/database/postgres.service.d.ts.map +1 -1
- package/dist/server/service/database/postgres.service.js +11 -150
- package/dist/server/service/database/postgres.service.js.map +1 -1
- package/dist/server/service/database/postgres.service.ts +17 -174
- package/dist/server/service/database/sap.service.d.ts +0 -4
- package/dist/server/service/database/sap.service.d.ts.map +1 -1
- package/dist/server/service/database/sap.service.js +11 -137
- package/dist/server/service/database/sap.service.js.map +1 -1
- package/dist/server/service/database/sap.service.ts +11 -158
- package/dist/server/service/database/sql-type.helper.d.ts +28 -0
- package/dist/server/service/database/sql-type.helper.d.ts.map +1 -0
- package/dist/server/service/database/sql-type.helper.js +113 -0
- package/dist/server/service/database/sql-type.helper.js.map +1 -0
- package/dist/server/service/database/sql-type.helper.ts +115 -0
- package/dist/server/service/database/sqlite.service.d.ts +0 -5
- package/dist/server/service/database/sqlite.service.d.ts.map +1 -1
- package/dist/server/service/database/sqlite.service.js +11 -156
- package/dist/server/service/database/sqlite.service.js.map +1 -1
- package/dist/server/service/database/sqlite.service.ts +17 -183
- package/package.json +1 -1
- package/server.js +1 -1
package/dist/public/explorer.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { i as __require, n as __esmMin, t as __commonJSMin } from "./rolldown-runtime.js";
|
|
2
|
-
import { A as defineComponent, B as renderList, C as createBlock, D as createStaticVNode, E as createSlots, F as nextTick, G as
|
|
3
|
-
import { A as
|
|
2
|
+
import { A as defineComponent, B as renderList, C as createBlock, D as createStaticVNode, E as createSlots, F as nextTick, G as watch, I as onBeforeUnmount, K as withCtx, L as onMounted, O as createTextVNode, S as createBaseVNode, T as createElementBlock, _ as vModelText, a as init_vue_router, b as Fragment, ct as normalizeStyle, d as init_vue_runtime_esm_bundler, g as vModelSelect, h as vModelCheckbox, k as createVNode, l as init_vue_i18n, lt as toDisplayString, nt as ref, o as useRoute, q as withDirectives, s as useRouter, st as normalizeClass, u as useI18n, v as vShow, w as createCommentVNode, x as computed, y as withModifiers, z as openBlock } from "./vue.js";
|
|
3
|
+
import { A as isVSCodeEnvironment, C as init_rpc, D as vscodeSaveFile, E as vscodePickSaveFolder, M as isVSCode, N as defineStore, O as getVSCodeBridge, P as init_pinia, S as blobToBase64, T as vscodeNotifyExported, _ as init__plugin_vue_export_helper, a as dataGrid_default, b as init_base, c as pagination_default, d as init_loading, f as init_toast, g as _plugin_vue_export_helper_default, h as toast_default, i as showConfirm, j as init_detect, k as init_bridge, l as init_modal$1, m as init_toast$1, n as init_modal$2, o as init_dataGrid, p as toast, r as showAlert, s as init_pagination, t as getModalInstance, u as modal_default, v as getT, w as isVscodeWebview, x as request, y as init_i18n } from "./index.js";
|
|
4
4
|
//#region src/service/database.ts
|
|
5
|
+
/**
|
|
6
|
+
* 数据库管理服务
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 解包统一响应:{ ret, msg, data }。
|
|
10
|
+
* 后端现在只返回业务数据、失败一律 throw(由响应层包装成 ret 非 0 + msg 错误信息),
|
|
11
|
+
* 因此这里 ret !== 0 时直接抛出 msg,调用方拿到的就是纯净的业务数据。
|
|
12
|
+
*/
|
|
13
|
+
function unwrapData(res) {
|
|
14
|
+
if (res && typeof res === "object" && "ret" in res && res.ret !== 0) throw new Error(res.msg || "操作失败");
|
|
15
|
+
return res?.data ?? res;
|
|
16
|
+
}
|
|
5
17
|
var ConnectionService, DatabaseService;
|
|
6
18
|
var init_database = __esmMin((() => {
|
|
7
19
|
init_base();
|
|
@@ -193,25 +205,55 @@ var init_database = __esmMin((() => {
|
|
|
193
205
|
});
|
|
194
206
|
}
|
|
195
207
|
/**
|
|
196
|
-
*
|
|
208
|
+
* 手动刷新表列表缓存(全量拉取,用于重名检测等需要最新结构的场景)
|
|
197
209
|
*/
|
|
198
|
-
async
|
|
199
|
-
return request("/api/database/
|
|
210
|
+
async refreshTableCache(connectionId, database) {
|
|
211
|
+
return unwrapData(await request("/api/database/refreshTableCache", {
|
|
212
|
+
id: connectionId,
|
|
213
|
+
database
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 预览建表(目标态 TableSpec -> 建表 DDL 与方言能力,不执行)
|
|
218
|
+
*/
|
|
219
|
+
async previewCreateTable(connectionId, database, spec) {
|
|
220
|
+
return unwrapData(await request("/api/database/previewCreateTable", {
|
|
200
221
|
id: connectionId,
|
|
201
222
|
database,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
223
|
+
spec
|
|
224
|
+
}));
|
|
205
225
|
}
|
|
206
226
|
/**
|
|
207
|
-
*
|
|
227
|
+
* 执行建表(后端检测重名后生成并执行)
|
|
208
228
|
*/
|
|
209
|
-
async
|
|
210
|
-
return request("/api/database/
|
|
229
|
+
async executeCreateTable(connectionId, database, spec) {
|
|
230
|
+
return unwrapData(await request("/api/database/executeCreateTable", {
|
|
211
231
|
id: connectionId,
|
|
212
232
|
database,
|
|
213
|
-
|
|
214
|
-
});
|
|
233
|
+
spec
|
|
234
|
+
}));
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* 预览表结构变更(目标态 TableSpec -> DDL 语句与变更集,不执行)
|
|
238
|
+
*/
|
|
239
|
+
async previewAlterTable(connectionId, database, tableName, spec) {
|
|
240
|
+
return unwrapData(await request("/api/database/previewAlterTable", {
|
|
241
|
+
id: connectionId,
|
|
242
|
+
database,
|
|
243
|
+
tableName,
|
|
244
|
+
spec
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 执行表结构变更(后端重读实时结构生成语句并执行)
|
|
249
|
+
*/
|
|
250
|
+
async executeAlterTable(connectionId, database, tableName, spec) {
|
|
251
|
+
return unwrapData(await request("/api/database/executeAlterTable", {
|
|
252
|
+
id: connectionId,
|
|
253
|
+
database,
|
|
254
|
+
tableName,
|
|
255
|
+
spec
|
|
256
|
+
}));
|
|
215
257
|
}
|
|
216
258
|
/**
|
|
217
259
|
* 插入数据
|
|
@@ -270,6 +312,27 @@ var init_database = __esmMin((() => {
|
|
|
270
312
|
});
|
|
271
313
|
}
|
|
272
314
|
/**
|
|
315
|
+
* 导出数据库架构(DDL)
|
|
316
|
+
* 后端返回:{ success: boolean, schema: string }
|
|
317
|
+
*/
|
|
318
|
+
async exportSchema(connectionId, databaseName) {
|
|
319
|
+
return request("/api/database/exportSchema", {
|
|
320
|
+
id: connectionId,
|
|
321
|
+
databaseName
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* 查看数据库日志
|
|
326
|
+
* 后端返回:{ success: boolean, logs: any[] }
|
|
327
|
+
*/
|
|
328
|
+
async viewLogs(connectionId, databaseName, limit = 100) {
|
|
329
|
+
return request("/api/database/viewLogs", {
|
|
330
|
+
id: connectionId,
|
|
331
|
+
databaseName,
|
|
332
|
+
limit
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
273
336
|
* 恢复数据库
|
|
274
337
|
*/
|
|
275
338
|
async restoreDatabase(connectionId, database, filePath, options) {
|
|
@@ -414,7 +477,7 @@ var init_database = __esmMin((() => {
|
|
|
414
477
|
}));
|
|
415
478
|
//#endregion
|
|
416
479
|
//#region src/components/connection-editor/index.vue?vue&type=script&setup=true&lang.ts
|
|
417
|
-
var _hoisted_1$9, _hoisted_2$9, _hoisted_3$9, _hoisted_4$9, _hoisted_5$9, _hoisted_6$9, _hoisted_7$9, _hoisted_8$9, _hoisted_9$9, _hoisted_10$9, _hoisted_11$9, _hoisted_12$9, _hoisted_13$9, _hoisted_14$9, _hoisted_15$9, _hoisted_16$9, _hoisted_17$9, _hoisted_18$9, _hoisted_19$9, _hoisted_20$8, _hoisted_21$8, _hoisted_22$8, _hoisted_23$8, _hoisted_24$8, _hoisted_25$8, _hoisted_26$7, _hoisted_27$7, _hoisted_28$7, _hoisted_29$7, _hoisted_30$6, _hoisted_31$6, _hoisted_32$6, _hoisted_33$6, _hoisted_34$6, _hoisted_35$6, _hoisted_36$6, _hoisted_37$6, _hoisted_38$6, _hoisted_39$6, _hoisted_40$6, _hoisted_41$6, _hoisted_42$6, _hoisted_43$6, _hoisted_44$6, _hoisted_45$6, _hoisted_46$6, _hoisted_47$
|
|
480
|
+
var _hoisted_1$9, _hoisted_2$9, _hoisted_3$9, _hoisted_4$9, _hoisted_5$9, _hoisted_6$9, _hoisted_7$9, _hoisted_8$9, _hoisted_9$9, _hoisted_10$9, _hoisted_11$9, _hoisted_12$9, _hoisted_13$9, _hoisted_14$9, _hoisted_15$9, _hoisted_16$9, _hoisted_17$9, _hoisted_18$9, _hoisted_19$9, _hoisted_20$8, _hoisted_21$8, _hoisted_22$8, _hoisted_23$8, _hoisted_24$8, _hoisted_25$8, _hoisted_26$7, _hoisted_27$7, _hoisted_28$7, _hoisted_29$7, _hoisted_30$6, _hoisted_31$6, _hoisted_32$6, _hoisted_33$6, _hoisted_34$6, _hoisted_35$6, _hoisted_36$6, _hoisted_37$6, _hoisted_38$6, _hoisted_39$6, _hoisted_40$6, _hoisted_41$6, _hoisted_42$6, _hoisted_43$6, _hoisted_44$6, _hoisted_45$6, _hoisted_46$6, _hoisted_47$5, _hoisted_48$5, _hoisted_49$5, _hoisted_50$5, _hoisted_51$5, _hoisted_52$5, _hoisted_53$5, _hoisted_54$5, _hoisted_55$5, _hoisted_56$5, _hoisted_57$4, _hoisted_58$4, _hoisted_59$4, _hoisted_60$4, _hoisted_61$4, _hoisted_62$4, _hoisted_63$4, _hoisted_64$4, _hoisted_65$4, _hoisted_66$4, _hoisted_67$4, _hoisted_68$4, _hoisted_69$4, _hoisted_70$4, _hoisted_71$4, _hoisted_72$3, _hoisted_73$3, index_vue_vue_type_script_setup_true_lang_default;
|
|
418
481
|
var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
419
482
|
init_vue_runtime_esm_bundler();
|
|
420
483
|
init_vue_i18n();
|
|
@@ -464,7 +527,10 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
464
527
|
_hoisted_35$6 = { class: "form-group-modern" };
|
|
465
528
|
_hoisted_36$6 = { class: "form-label-modern" };
|
|
466
529
|
_hoisted_37$6 = ["placeholder"];
|
|
467
|
-
_hoisted_38$6 = {
|
|
530
|
+
_hoisted_38$6 = {
|
|
531
|
+
key: 2,
|
|
532
|
+
class: "form-section"
|
|
533
|
+
};
|
|
468
534
|
_hoisted_39$6 = { class: "section-header" };
|
|
469
535
|
_hoisted_40$6 = { class: "section-title" };
|
|
470
536
|
_hoisted_41$6 = { class: "section-content" };
|
|
@@ -473,28 +539,40 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
473
539
|
_hoisted_44$6 = { class: "form-label-modern" };
|
|
474
540
|
_hoisted_45$6 = ["placeholder"];
|
|
475
541
|
_hoisted_46$6 = { class: "form-group-modern" };
|
|
476
|
-
_hoisted_47$
|
|
542
|
+
_hoisted_47$5 = { class: "form-label-modern" };
|
|
477
543
|
_hoisted_48$5 = ["placeholder"];
|
|
478
|
-
_hoisted_49$5 = { class: "form-
|
|
479
|
-
_hoisted_50$5 = { class: "section
|
|
480
|
-
_hoisted_51$5 = { class: "section-
|
|
481
|
-
_hoisted_52$
|
|
482
|
-
_hoisted_53$
|
|
483
|
-
_hoisted_54$
|
|
484
|
-
_hoisted_55$
|
|
485
|
-
_hoisted_56$
|
|
544
|
+
_hoisted_49$5 = { class: "form-hint" };
|
|
545
|
+
_hoisted_50$5 = { class: "form-section" };
|
|
546
|
+
_hoisted_51$5 = { class: "section-header" };
|
|
547
|
+
_hoisted_52$5 = { class: "section-title" };
|
|
548
|
+
_hoisted_53$5 = { class: "section-content" };
|
|
549
|
+
_hoisted_54$5 = { class: "form-grid" };
|
|
550
|
+
_hoisted_55$5 = { class: "form-group-modern" };
|
|
551
|
+
_hoisted_56$5 = { class: "form-label-modern" };
|
|
552
|
+
_hoisted_57$4 = ["placeholder"];
|
|
553
|
+
_hoisted_58$4 = { class: "form-group-modern" };
|
|
554
|
+
_hoisted_59$4 = { class: "form-label-modern" };
|
|
555
|
+
_hoisted_60$4 = ["placeholder"];
|
|
556
|
+
_hoisted_61$4 = { class: "form-section" };
|
|
557
|
+
_hoisted_62$4 = { class: "section-header" };
|
|
558
|
+
_hoisted_63$4 = { class: "section-title" };
|
|
559
|
+
_hoisted_64$4 = { class: "section-content" };
|
|
560
|
+
_hoisted_65$4 = { class: "form-group-modern" };
|
|
561
|
+
_hoisted_66$4 = { class: "form-label-modern" };
|
|
562
|
+
_hoisted_67$4 = { class: "form-check-modern" };
|
|
563
|
+
_hoisted_68$4 = {
|
|
486
564
|
class: "form-check-label-modern",
|
|
487
565
|
for: "enabled"
|
|
488
566
|
};
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
567
|
+
_hoisted_69$4 = { class: "check-text" };
|
|
568
|
+
_hoisted_70$4 = { class: "check-description" };
|
|
569
|
+
_hoisted_71$4 = {
|
|
492
570
|
type: "button",
|
|
493
571
|
class: "btn btn-secondary",
|
|
494
572
|
"data-bs-dismiss": "modal"
|
|
495
573
|
};
|
|
496
|
-
|
|
497
|
-
|
|
574
|
+
_hoisted_72$3 = { class: "error-content" };
|
|
575
|
+
_hoisted_73$3 = { class: "error-message" };
|
|
498
576
|
index_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
499
577
|
__name: "index",
|
|
500
578
|
props: {
|
|
@@ -538,6 +616,16 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
538
616
|
isValid: false,
|
|
539
617
|
message: t("connection.typeRequired")
|
|
540
618
|
};
|
|
619
|
+
if (connection.type === "remote") {
|
|
620
|
+
if (!connection.options?.remoteUrl?.trim()) return {
|
|
621
|
+
isValid: false,
|
|
622
|
+
message: t("connection.remoteUrlRequired")
|
|
623
|
+
};
|
|
624
|
+
return {
|
|
625
|
+
isValid: true,
|
|
626
|
+
message: ""
|
|
627
|
+
};
|
|
628
|
+
}
|
|
541
629
|
if (connection.type !== "sqlite") {
|
|
542
630
|
if (!connection.host?.trim()) return {
|
|
543
631
|
isValid: false,
|
|
@@ -591,7 +679,10 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
591
679
|
}
|
|
592
680
|
function showEditModal(connection) {
|
|
593
681
|
editingConnection.value = connection;
|
|
594
|
-
connectionForm.value = {
|
|
682
|
+
connectionForm.value = {
|
|
683
|
+
...connection,
|
|
684
|
+
options: connection.options || {}
|
|
685
|
+
};
|
|
595
686
|
show();
|
|
596
687
|
}
|
|
597
688
|
async function saveConnection(closeModal = true) {
|
|
@@ -703,31 +794,31 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
703
794
|
onOnClose: handleModalClose
|
|
704
795
|
}, {
|
|
705
796
|
footer: withCtx(() => [
|
|
706
|
-
createBaseVNode("button",
|
|
797
|
+
createBaseVNode("button", _hoisted_71$4, [_cache[38] || (_cache[38] = createBaseVNode("i", { class: "bi bi-x-circle me-1" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("common.cancel")), 1)]),
|
|
707
798
|
createBaseVNode("button", {
|
|
708
799
|
type: "button",
|
|
709
800
|
class: "btn btn-outline-primary",
|
|
710
|
-
onClick: _cache[
|
|
711
|
-
}, [_cache[
|
|
801
|
+
onClick: _cache[12] || (_cache[12] = ($event) => testConnection(connectionForm.value))
|
|
802
|
+
}, [_cache[39] || (_cache[39] = createBaseVNode("i", { class: "bi bi-wifi me-1" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.testConnection")), 1)]),
|
|
712
803
|
createBaseVNode("button", {
|
|
713
804
|
type: "button",
|
|
714
805
|
class: "btn btn-primary",
|
|
715
806
|
onClick: saveConnection
|
|
716
|
-
}, [_cache[
|
|
807
|
+
}, [_cache[40] || (_cache[40] = createBaseVNode("i", { class: "bi bi-save me-1" }, null, -1)), createTextVNode(toDisplayString(editingConnection.value ? _ctx.$t("connection.updateConfig") : _ctx.$t("connection.saveConfig")), 1)]),
|
|
717
808
|
createBaseVNode("button", {
|
|
718
809
|
type: "button",
|
|
719
810
|
class: "btn btn-success",
|
|
720
811
|
onClick: saveAndTestConnection
|
|
721
|
-
}, [_cache[
|
|
812
|
+
}, [_cache[41] || (_cache[41] = createBaseVNode("i", { class: "bi bi-check-circle me-1" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.saveAndTest")), 1)])
|
|
722
813
|
]),
|
|
723
814
|
default: withCtx(() => [createBaseVNode("form", {
|
|
724
815
|
onSubmit: withModifiers(saveConnection, ["prevent"]),
|
|
725
816
|
class: "connection-form-modern"
|
|
726
817
|
}, [
|
|
727
|
-
createBaseVNode("div", _hoisted_1$9, [createBaseVNode("div", _hoisted_2$9, [_cache[
|
|
728
|
-
_cache[
|
|
818
|
+
createBaseVNode("div", _hoisted_1$9, [createBaseVNode("div", _hoisted_2$9, [_cache[13] || (_cache[13] = createBaseVNode("div", { class: "section-icon" }, [createBaseVNode("i", { class: "bi bi-info-circle" })], -1)), createBaseVNode("h3", _hoisted_3$9, toDisplayString(_ctx.$t("connection.basicInfo")), 1)]), createBaseVNode("div", _hoisted_4$9, [createBaseVNode("div", _hoisted_5$9, [createBaseVNode("div", _hoisted_6$9, [createBaseVNode("label", _hoisted_7$9, [
|
|
819
|
+
_cache[14] || (_cache[14] = createBaseVNode("i", { class: "bi bi-tag me-2" }, null, -1)),
|
|
729
820
|
createTextVNode(toDisplayString(_ctx.$t("connection.connectionName")) + " ", 1),
|
|
730
|
-
_cache[
|
|
821
|
+
_cache[15] || (_cache[15] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
731
822
|
]), withDirectives(createBaseVNode("input", {
|
|
732
823
|
type: "text",
|
|
733
824
|
class: "form-control-modern",
|
|
@@ -735,9 +826,9 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
735
826
|
placeholder: _ctx.$t("connection.connectionNamePlaceholder"),
|
|
736
827
|
required: ""
|
|
737
828
|
}, null, 8, _hoisted_8$9), [[vModelText, connectionForm.value.name]])]), createBaseVNode("div", _hoisted_9$9, [createBaseVNode("label", _hoisted_10$9, [
|
|
738
|
-
_cache[
|
|
829
|
+
_cache[16] || (_cache[16] = createBaseVNode("i", { class: "bi bi-diagram-3 me-2" }, null, -1)),
|
|
739
830
|
createTextVNode(toDisplayString(_ctx.$t("connection.databaseType")) + " ", 1),
|
|
740
|
-
_cache[
|
|
831
|
+
_cache[17] || (_cache[17] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
741
832
|
]), withDirectives(createBaseVNode("select", {
|
|
742
833
|
class: "form-select-modern",
|
|
743
834
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => connectionForm.value.type = $event),
|
|
@@ -749,11 +840,11 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
749
840
|
value: dbType.value
|
|
750
841
|
}, toDisplayString(dbType.label), 9, _hoisted_12$9);
|
|
751
842
|
}), 128))], 544), [[vModelSelect, connectionForm.value.type]])])])])]),
|
|
752
|
-
connectionForm.value.type !== "sqlite" ? (openBlock(), createElementBlock("div", _hoisted_13$9, [createBaseVNode("div", _hoisted_14$9, [_cache[
|
|
843
|
+
connectionForm.value.type !== "sqlite" && connectionForm.value.type !== "remote" ? (openBlock(), createElementBlock("div", _hoisted_13$9, [createBaseVNode("div", _hoisted_14$9, [_cache[18] || (_cache[18] = createBaseVNode("div", { class: "section-icon" }, [createBaseVNode("i", { class: "bi bi-hdd-network" })], -1)), createBaseVNode("h3", _hoisted_15$9, toDisplayString(_ctx.$t("connection.connectionConfig")), 1)]), createBaseVNode("div", _hoisted_16$9, [createBaseVNode("div", _hoisted_17$9, [
|
|
753
844
|
createBaseVNode("div", _hoisted_18$9, [createBaseVNode("label", _hoisted_19$9, [
|
|
754
|
-
_cache[
|
|
845
|
+
_cache[19] || (_cache[19] = createBaseVNode("i", { class: "bi bi-server me-2" }, null, -1)),
|
|
755
846
|
createTextVNode(toDisplayString(_ctx.$t("connection.host")) + " ", 1),
|
|
756
|
-
_cache[
|
|
847
|
+
_cache[20] || (_cache[20] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
757
848
|
]), withDirectives(createBaseVNode("input", {
|
|
758
849
|
type: "text",
|
|
759
850
|
class: "form-control-modern",
|
|
@@ -762,9 +853,9 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
762
853
|
required: ""
|
|
763
854
|
}, null, 8, _hoisted_20$8), [[vModelText, connectionForm.value.host]])]),
|
|
764
855
|
createBaseVNode("div", _hoisted_21$8, [createBaseVNode("label", _hoisted_22$8, [
|
|
765
|
-
_cache[
|
|
856
|
+
_cache[21] || (_cache[21] = createBaseVNode("i", { class: "bi bi-door-closed me-2" }, null, -1)),
|
|
766
857
|
createTextVNode(toDisplayString(_ctx.$t("connection.port")) + " ", 1),
|
|
767
|
-
_cache[
|
|
858
|
+
_cache[22] || (_cache[22] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
768
859
|
]), withDirectives(createBaseVNode("input", {
|
|
769
860
|
type: "number",
|
|
770
861
|
class: "form-control-modern",
|
|
@@ -780,9 +871,9 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
780
871
|
{ number: true }
|
|
781
872
|
]])]),
|
|
782
873
|
createBaseVNode("div", _hoisted_24$8, [createBaseVNode("label", _hoisted_25$8, [
|
|
783
|
-
_cache[
|
|
874
|
+
_cache[23] || (_cache[23] = createBaseVNode("i", { class: "bi bi-database me-2" }, null, -1)),
|
|
784
875
|
createTextVNode(toDisplayString(_ctx.$t("connection.databaseName")) + " ", 1),
|
|
785
|
-
_cache[
|
|
876
|
+
_cache[24] || (_cache[24] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
786
877
|
]), withDirectives(createBaseVNode("input", {
|
|
787
878
|
type: "text",
|
|
788
879
|
class: "form-control-modern",
|
|
@@ -790,7 +881,7 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
790
881
|
placeholder: _ctx.$t("connection.databaseNamePlaceholder"),
|
|
791
882
|
required: ""
|
|
792
883
|
}, null, 8, _hoisted_26$7), [[vModelText, connectionForm.value.database]])]),
|
|
793
|
-
createBaseVNode("div", _hoisted_27$7, [createBaseVNode("label", _hoisted_28$7, [_cache[
|
|
884
|
+
createBaseVNode("div", _hoisted_27$7, [createBaseVNode("label", _hoisted_28$7, [_cache[25] || (_cache[25] = createBaseVNode("i", { class: "bi bi-clock me-2" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.connectionTimeout")), 1)]), withDirectives(createBaseVNode("input", {
|
|
794
885
|
type: "number",
|
|
795
886
|
class: "form-control-modern",
|
|
796
887
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => connectionForm.value.options.timeout = $event),
|
|
@@ -803,10 +894,10 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
803
894
|
{ number: true }
|
|
804
895
|
]])])
|
|
805
896
|
])])])) : createCommentVNode("", true),
|
|
806
|
-
connectionForm.value.type === "sqlite" ? (openBlock(), createElementBlock("div", _hoisted_30$6, [createBaseVNode("div", _hoisted_31$6, [_cache[
|
|
807
|
-
_cache[
|
|
897
|
+
connectionForm.value.type === "sqlite" ? (openBlock(), createElementBlock("div", _hoisted_30$6, [createBaseVNode("div", _hoisted_31$6, [_cache[26] || (_cache[26] = createBaseVNode("div", { class: "section-icon" }, [createBaseVNode("i", { class: "bi bi-file-earmark-text" })], -1)), createBaseVNode("h3", _hoisted_32$6, toDisplayString(_ctx.$t("connection.sqliteConfig")), 1)]), createBaseVNode("div", _hoisted_33$6, [createBaseVNode("div", _hoisted_34$6, [createBaseVNode("div", _hoisted_35$6, [createBaseVNode("label", _hoisted_36$6, [
|
|
898
|
+
_cache[27] || (_cache[27] = createBaseVNode("i", { class: "bi bi-file-earmark me-2" }, null, -1)),
|
|
808
899
|
createTextVNode(toDisplayString(_ctx.$t("connection.databaseFile")) + " ", 1),
|
|
809
|
-
_cache[
|
|
900
|
+
_cache[28] || (_cache[28] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
810
901
|
]), withDirectives(createBaseVNode("input", {
|
|
811
902
|
type: "text",
|
|
812
903
|
class: "form-control-modern",
|
|
@@ -814,23 +905,39 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
814
905
|
placeholder: _ctx.$t("connection.databaseFilePlaceholder"),
|
|
815
906
|
required: ""
|
|
816
907
|
}, null, 8, _hoisted_37$6), [[vModelText, connectionForm.value.database]])])])])])) : createCommentVNode("", true),
|
|
817
|
-
|
|
908
|
+
connectionForm.value.type === "remote" ? (openBlock(), createElementBlock("div", _hoisted_38$6, [createBaseVNode("div", _hoisted_39$6, [_cache[29] || (_cache[29] = createBaseVNode("div", { class: "section-icon" }, [createBaseVNode("i", { class: "bi bi-cloud" })], -1)), createBaseVNode("h3", _hoisted_40$6, toDisplayString(_ctx.$t("connection.remoteConfig")), 1)]), createBaseVNode("div", _hoisted_41$6, [createBaseVNode("div", _hoisted_42$6, [createBaseVNode("div", _hoisted_43$6, [createBaseVNode("label", _hoisted_44$6, [
|
|
909
|
+
_cache[30] || (_cache[30] = createBaseVNode("i", { class: "bi bi-hdd-network me-2" }, null, -1)),
|
|
910
|
+
createTextVNode(toDisplayString(_ctx.$t("connection.remoteUrl")) + " ", 1),
|
|
911
|
+
_cache[31] || (_cache[31] = createBaseVNode("span", { class: "required" }, "*", -1))
|
|
912
|
+
]), withDirectives(createBaseVNode("input", {
|
|
913
|
+
type: "text",
|
|
914
|
+
class: "form-control-modern",
|
|
915
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => connectionForm.value.options.remoteUrl = $event),
|
|
916
|
+
placeholder: _ctx.$t("connection.remoteUrlPlaceholder"),
|
|
917
|
+
required: ""
|
|
918
|
+
}, null, 8, _hoisted_45$6), [[vModelText, connectionForm.value.options.remoteUrl]])]), createBaseVNode("div", _hoisted_46$6, [createBaseVNode("label", _hoisted_47$5, [_cache[32] || (_cache[32] = createBaseVNode("i", { class: "bi bi-key me-2" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.remoteToken")), 1)]), withDirectives(createBaseVNode("input", {
|
|
919
|
+
type: "password",
|
|
920
|
+
class: "form-control-modern",
|
|
921
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => connectionForm.value.options.remoteToken = $event),
|
|
922
|
+
placeholder: _ctx.$t("connection.remoteTokenPlaceholder")
|
|
923
|
+
}, null, 8, _hoisted_48$5), [[vModelText, connectionForm.value.options.remoteToken]])])]), createBaseVNode("p", _hoisted_49$5, toDisplayString(_ctx.$t("connection.remoteConfigHint")), 1)])])) : createCommentVNode("", true),
|
|
924
|
+
createBaseVNode("div", _hoisted_50$5, [createBaseVNode("div", _hoisted_51$5, [_cache[33] || (_cache[33] = createBaseVNode("div", { class: "section-icon" }, [createBaseVNode("i", { class: "bi bi-shield-lock" })], -1)), createBaseVNode("h3", _hoisted_52$5, toDisplayString(_ctx.$t("connection.authInfo")), 1)]), createBaseVNode("div", _hoisted_53$5, [createBaseVNode("div", _hoisted_54$5, [createBaseVNode("div", _hoisted_55$5, [createBaseVNode("label", _hoisted_56$5, [_cache[34] || (_cache[34] = createBaseVNode("i", { class: "bi bi-person me-2" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.username")), 1)]), withDirectives(createBaseVNode("input", {
|
|
818
925
|
type: "text",
|
|
819
926
|
class: "form-control-modern",
|
|
820
|
-
"onUpdate:modelValue": _cache[
|
|
927
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => connectionForm.value.username = $event),
|
|
821
928
|
placeholder: _ctx.$t("connection.usernamePlaceholder")
|
|
822
|
-
}, null, 8,
|
|
929
|
+
}, null, 8, _hoisted_57$4), [[vModelText, connectionForm.value.username]])]), createBaseVNode("div", _hoisted_58$4, [createBaseVNode("label", _hoisted_59$4, [_cache[35] || (_cache[35] = createBaseVNode("i", { class: "bi bi-key me-2" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.password")), 1)]), withDirectives(createBaseVNode("input", {
|
|
823
930
|
type: "password",
|
|
824
931
|
class: "form-control-modern",
|
|
825
|
-
"onUpdate:modelValue": _cache[
|
|
932
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => connectionForm.value.password = $event),
|
|
826
933
|
placeholder: _ctx.$t("connection.passwordPlaceholder")
|
|
827
|
-
}, null, 8,
|
|
828
|
-
createBaseVNode("div",
|
|
934
|
+
}, null, 8, _hoisted_60$4), [[vModelText, connectionForm.value.password]])])])])]),
|
|
935
|
+
createBaseVNode("div", _hoisted_61$4, [createBaseVNode("div", _hoisted_62$4, [_cache[36] || (_cache[36] = createBaseVNode("div", { class: "section-icon" }, [createBaseVNode("i", { class: "bi bi-gear" })], -1)), createBaseVNode("h3", _hoisted_63$4, toDisplayString(_ctx.$t("connection.otherOptions")), 1)]), createBaseVNode("div", _hoisted_64$4, [createBaseVNode("div", _hoisted_65$4, [createBaseVNode("label", _hoisted_66$4, [_cache[37] || (_cache[37] = createBaseVNode("i", { class: "bi bi-toggle-on me-2" }, null, -1)), createTextVNode(toDisplayString(_ctx.$t("connection.connectionStatus")), 1)]), createBaseVNode("div", _hoisted_67$4, [withDirectives(createBaseVNode("input", {
|
|
829
936
|
class: "form-check-input-modern",
|
|
830
937
|
type: "checkbox",
|
|
831
|
-
"onUpdate:modelValue": _cache[
|
|
938
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => connectionForm.value.enabled = $event),
|
|
832
939
|
id: "enabled"
|
|
833
|
-
}, null, 512), [[vModelCheckbox, connectionForm.value.enabled]]), createBaseVNode("label",
|
|
940
|
+
}, null, 512), [[vModelCheckbox, connectionForm.value.enabled]]), createBaseVNode("label", _hoisted_68$4, [createBaseVNode("span", _hoisted_69$4, toDisplayString(_ctx.$t("connection.enableConnection")), 1), createBaseVNode("span", _hoisted_70$4, toDisplayString(_ctx.$t("connection.enableConnectionDesc")), 1)])])])])])
|
|
834
941
|
], 32)]),
|
|
835
942
|
_: 1
|
|
836
943
|
}, 8, ["title", "closeButton"]), createVNode(modal_default, {
|
|
@@ -847,11 +954,12 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
847
954
|
},
|
|
848
955
|
isFullScreen: false,
|
|
849
956
|
style: {
|
|
850
|
-
maxWidth: "400px
|
|
851
|
-
width: "100%"
|
|
957
|
+
maxWidth: "400px",
|
|
958
|
+
width: "100%",
|
|
959
|
+
margin: "auto"
|
|
852
960
|
}
|
|
853
961
|
}, {
|
|
854
|
-
default: withCtx(() => [createBaseVNode("div",
|
|
962
|
+
default: withCtx(() => [createBaseVNode("div", _hoisted_72$3, [_cache[42] || (_cache[42] = createBaseVNode("div", { class: "error-icon" }, [createBaseVNode("i", { class: "bi bi-exclamation-triangle" })], -1)), createBaseVNode("div", _hoisted_73$3, toDisplayString(errorMessage.value), 1)])]),
|
|
855
963
|
_: 1
|
|
856
964
|
}, 8, ["title", "closeButton"])], 64);
|
|
857
965
|
};
|
|
@@ -859,17 +967,17 @@ var init_index_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
859
967
|
});
|
|
860
968
|
}));
|
|
861
969
|
//#endregion
|
|
862
|
-
//#region src/components/connection-editor/index.vue?vue&type=style&index=0&scoped=
|
|
863
|
-
var
|
|
970
|
+
//#region src/components/connection-editor/index.vue?vue&type=style&index=0&scoped=c314aadc&lang.css
|
|
971
|
+
var init_index_vue_vue_type_style_index_0_scoped_c314aadc_lang = __esmMin((() => {}));
|
|
864
972
|
//#endregion
|
|
865
973
|
//#region src/components/connection-editor/index.vue
|
|
866
974
|
var connection_editor_default;
|
|
867
975
|
var init_connection_editor = __esmMin((() => {
|
|
868
976
|
init_index_vue_vue_type_script_setup_true_lang();
|
|
869
977
|
init_index_vue_vue_type_script_setup_true_lang();
|
|
870
|
-
|
|
978
|
+
init_index_vue_vue_type_style_index_0_scoped_c314aadc_lang();
|
|
871
979
|
init__plugin_vue_export_helper();
|
|
872
|
-
connection_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
980
|
+
connection_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c314aadc"]]);
|
|
873
981
|
})), ModalHelper, modal;
|
|
874
982
|
var init_modal = __esmMin((() => {
|
|
875
983
|
init_vue_runtime_esm_bundler();
|
|
@@ -53117,6 +53225,63 @@ function onThemeChange(cb) {
|
|
|
53117
53225
|
}
|
|
53118
53226
|
var init_theme = __esmMin((() => {}));
|
|
53119
53227
|
//#endregion
|
|
53228
|
+
//#region src/platform/database/utils/helpers.ts
|
|
53229
|
+
async function copyToClipboard(text) {
|
|
53230
|
+
try {
|
|
53231
|
+
await navigator.clipboard.writeText(text);
|
|
53232
|
+
return true;
|
|
53233
|
+
} catch (error) {
|
|
53234
|
+
const textArea = document.createElement("textarea");
|
|
53235
|
+
textArea.value = text;
|
|
53236
|
+
textArea.style.position = "fixed";
|
|
53237
|
+
textArea.style.opacity = "0";
|
|
53238
|
+
document.body.appendChild(textArea);
|
|
53239
|
+
textArea.focus();
|
|
53240
|
+
textArea.select();
|
|
53241
|
+
try {
|
|
53242
|
+
document.execCommand("copy");
|
|
53243
|
+
document.body.removeChild(textArea);
|
|
53244
|
+
return true;
|
|
53245
|
+
} catch (error) {
|
|
53246
|
+
document.body.removeChild(textArea);
|
|
53247
|
+
return false;
|
|
53248
|
+
}
|
|
53249
|
+
}
|
|
53250
|
+
}
|
|
53251
|
+
var init_helpers = __esmMin((() => {}));
|
|
53252
|
+
//#endregion
|
|
53253
|
+
//#region src/platform/database/utils/cm-clipboard.ts
|
|
53254
|
+
function copyOrCut(view, cut) {
|
|
53255
|
+
const { state } = view;
|
|
53256
|
+
const sel = state.selection.main;
|
|
53257
|
+
if (sel.empty) return false;
|
|
53258
|
+
copyToClipboard(state.sliceDoc(sel.from, sel.to));
|
|
53259
|
+
if (cut && !state.facet(EditorState.readOnly)) view.dispatch({
|
|
53260
|
+
changes: {
|
|
53261
|
+
from: sel.from,
|
|
53262
|
+
to: sel.to,
|
|
53263
|
+
insert: ""
|
|
53264
|
+
},
|
|
53265
|
+
selection: { anchor: sel.from }
|
|
53266
|
+
});
|
|
53267
|
+
return true;
|
|
53268
|
+
}
|
|
53269
|
+
var clipboardKeymap;
|
|
53270
|
+
var init_cm_clipboard = __esmMin((() => {
|
|
53271
|
+
init_dist$10();
|
|
53272
|
+
init_dist$11();
|
|
53273
|
+
init_helpers();
|
|
53274
|
+
clipboardKeymap = keymap.of([{
|
|
53275
|
+
key: "Mod-c",
|
|
53276
|
+
preventDefault: true,
|
|
53277
|
+
run: (v) => copyOrCut(v, false)
|
|
53278
|
+
}, {
|
|
53279
|
+
key: "Mod-x",
|
|
53280
|
+
preventDefault: true,
|
|
53281
|
+
run: (v) => copyOrCut(v, true)
|
|
53282
|
+
}]);
|
|
53283
|
+
}));
|
|
53284
|
+
//#endregion
|
|
53120
53285
|
//#region src/platform/database/components/sql-executor.vue?vue&type=script&setup=true&lang.ts
|
|
53121
53286
|
var _hoisted_1$8, _hoisted_2$8, _hoisted_3$8, _hoisted_4$8, _hoisted_5$8, _hoisted_6$8, _hoisted_7$8, _hoisted_8$8, _hoisted_9$8, _hoisted_10$8, _hoisted_11$8, _hoisted_12$8, _hoisted_13$8, _hoisted_14$8, _hoisted_15$8, _hoisted_16$8, _hoisted_17$8, _hoisted_18$8, _hoisted_19$8, sql_executor_vue_vue_type_script_setup_true_lang_default;
|
|
53122
53287
|
var init_sql_executor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
@@ -53133,6 +53298,7 @@ var init_sql_executor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
53133
53298
|
init_modal();
|
|
53134
53299
|
init_export();
|
|
53135
53300
|
init_theme();
|
|
53301
|
+
init_cm_clipboard();
|
|
53136
53302
|
_hoisted_1$8 = { class: "sql-executor" };
|
|
53137
53303
|
_hoisted_2$8 = { class: "sql-toolbar" };
|
|
53138
53304
|
_hoisted_3$8 = { class: "toolbar-left" };
|
|
@@ -53314,6 +53480,7 @@ var init_sql_executor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
53314
53480
|
placeholder(t("sqlExecutor.inputSQLPlaceholder")),
|
|
53315
53481
|
sql(),
|
|
53316
53482
|
...isDarkTheme() ? [oneDark] : [],
|
|
53483
|
+
clipboardKeymap,
|
|
53317
53484
|
keymap.of(defaultKeymap),
|
|
53318
53485
|
EditorView.updateListener.of((update) => {
|
|
53319
53486
|
if (update.docChanged) sqlQuery.value = update.state.doc.toString();
|
|
@@ -53356,6 +53523,7 @@ var init_sql_executor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
53356
53523
|
placeholder(t("sqlExecutor.resultPlaceholder")),
|
|
53357
53524
|
json(),
|
|
53358
53525
|
syntaxHighlighting(defaultHighlightStyle),
|
|
53526
|
+
clipboardKeymap,
|
|
53359
53527
|
keymap.of(defaultKeymap),
|
|
53360
53528
|
EditorView.lineWrapping,
|
|
53361
53529
|
EditorState.readOnly.of(true),
|
|
@@ -53462,7 +53630,7 @@ var init_sql_executor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
53462
53630
|
class: "btn btn-outline-secondary btn-sm",
|
|
53463
53631
|
onClick: formatSql
|
|
53464
53632
|
}, [_cache[2] || (_cache[2] = createBaseVNode("i", { class: "bi bi-braces" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("common.format")), 1)])]), createBaseVNode("div", _hoisted_5$8, [createBaseVNode("button", {
|
|
53465
|
-
class: "btn btn-outline-
|
|
53633
|
+
class: "btn btn-outline-secondary btn-sm",
|
|
53466
53634
|
onClick: clearSql
|
|
53467
53635
|
}, [_cache[3] || (_cache[3] = createBaseVNode("i", { class: "bi bi-trash" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("sqlExecutor.clearBtn")), 1)])])]), createBaseVNode("div", {
|
|
53468
53636
|
class: "sql-container",
|
|
@@ -53499,21 +53667,90 @@ var init_sql_executor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
53499
53667
|
});
|
|
53500
53668
|
}));
|
|
53501
53669
|
//#endregion
|
|
53502
|
-
//#region src/platform/database/components/sql-executor.vue?vue&type=style&index=0&scoped=
|
|
53503
|
-
var
|
|
53670
|
+
//#region src/platform/database/components/sql-executor.vue?vue&type=style&index=0&scoped=601319e8&lang.css
|
|
53671
|
+
var init_sql_executor_vue_vue_type_style_index_0_scoped_601319e8_lang = __esmMin((() => {}));
|
|
53504
53672
|
//#endregion
|
|
53505
53673
|
//#region src/platform/database/components/sql-executor.vue
|
|
53506
53674
|
var sql_executor_default;
|
|
53507
53675
|
var init_sql_executor = __esmMin((() => {
|
|
53508
53676
|
init_sql_executor_vue_vue_type_script_setup_true_lang();
|
|
53509
53677
|
init_sql_executor_vue_vue_type_script_setup_true_lang();
|
|
53510
|
-
|
|
53678
|
+
init_sql_executor_vue_vue_type_style_index_0_scoped_601319e8_lang();
|
|
53511
53679
|
init__plugin_vue_export_helper();
|
|
53512
|
-
sql_executor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(sql_executor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
53680
|
+
sql_executor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(sql_executor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-601319e8"]]);
|
|
53681
|
+
}));
|
|
53682
|
+
//#endregion
|
|
53683
|
+
//#region src/utils/download.ts
|
|
53684
|
+
/**
|
|
53685
|
+
* 保存文本内容为文件。
|
|
53686
|
+
* @param filename 建议文件名(含扩展名)
|
|
53687
|
+
* @param content 文本内容
|
|
53688
|
+
* @param filters 保存对话框的扩展名过滤,如 { SQL: ['sql'] }
|
|
53689
|
+
*/
|
|
53690
|
+
async function saveTextFile(filename, content, filters) {
|
|
53691
|
+
if (isVSCodeEnvironment()) return saveViaHost(filename, content, filters);
|
|
53692
|
+
downloadInBrowser(filename, content);
|
|
53693
|
+
return {};
|
|
53694
|
+
}
|
|
53695
|
+
function downloadInBrowser(filename, content) {
|
|
53696
|
+
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
|
|
53697
|
+
const url = URL.createObjectURL(blob);
|
|
53698
|
+
const a = document.createElement("a");
|
|
53699
|
+
a.href = url;
|
|
53700
|
+
a.download = filename;
|
|
53701
|
+
a.style.display = "none";
|
|
53702
|
+
document.body.appendChild(a);
|
|
53703
|
+
a.click();
|
|
53704
|
+
a.remove();
|
|
53705
|
+
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
53706
|
+
}
|
|
53707
|
+
/**
|
|
53708
|
+
* 走宿主保存:saveFile → saveFileResult(按 id 配对)。
|
|
53709
|
+
*
|
|
53710
|
+
* 直接挂一次性 window 监听而不用 bridge.onMessage:
|
|
53711
|
+
* 后者只加不移,反复保存会累积无效的监听器。
|
|
53712
|
+
* 同样不做 origin 过滤(与 bridge.onMessage 保持一致)。
|
|
53713
|
+
*/
|
|
53714
|
+
function saveViaHost(filename, content, filters) {
|
|
53715
|
+
const bridge = getVSCodeBridge();
|
|
53716
|
+
const id = ++seq;
|
|
53717
|
+
return new Promise((resolve, reject) => {
|
|
53718
|
+
const timer = setTimeout(() => {
|
|
53719
|
+
window.removeEventListener("message", handler);
|
|
53720
|
+
reject(/* @__PURE__ */ new Error("保存文件超时"));
|
|
53721
|
+
}, 12e4);
|
|
53722
|
+
const handler = (event) => {
|
|
53723
|
+
const msg = event.data;
|
|
53724
|
+
if (!msg || msg.command !== "saveFileResult" || msg.id !== id) return;
|
|
53725
|
+
window.removeEventListener("message", handler);
|
|
53726
|
+
clearTimeout(timer);
|
|
53727
|
+
const data = msg.data || {};
|
|
53728
|
+
if (data.error) reject(new Error(data.error));
|
|
53729
|
+
else resolve({
|
|
53730
|
+
path: data.path || void 0,
|
|
53731
|
+
cancelled: !!data.cancelled
|
|
53732
|
+
});
|
|
53733
|
+
};
|
|
53734
|
+
window.addEventListener("message", handler);
|
|
53735
|
+
bridge.postMessage({
|
|
53736
|
+
command: "saveFile",
|
|
53737
|
+
id,
|
|
53738
|
+
data: {
|
|
53739
|
+
filename,
|
|
53740
|
+
content,
|
|
53741
|
+
filters
|
|
53742
|
+
}
|
|
53743
|
+
});
|
|
53744
|
+
});
|
|
53745
|
+
}
|
|
53746
|
+
var seq;
|
|
53747
|
+
var init_download = __esmMin((() => {
|
|
53748
|
+
init_bridge();
|
|
53749
|
+
seq = 0;
|
|
53513
53750
|
}));
|
|
53514
53751
|
//#endregion
|
|
53515
53752
|
//#region src/platform/database/components/connection-detail.vue?vue&type=script&setup=true&lang.ts
|
|
53516
|
-
var _hoisted_1$7, _hoisted_2$7, _hoisted_3$7, _hoisted_4$7, _hoisted_5$7, _hoisted_6$7, _hoisted_7$7, _hoisted_8$7, _hoisted_9$7, _hoisted_10$7, _hoisted_11$7, _hoisted_12$7, _hoisted_13$7, _hoisted_14$7, _hoisted_15$7, _hoisted_16$7, _hoisted_17$7, _hoisted_18$7, _hoisted_19$7, _hoisted_20$7, _hoisted_21$7, _hoisted_22$7, _hoisted_23$7, _hoisted_24$7, _hoisted_25$7, _hoisted_26$6, _hoisted_27$6, _hoisted_28$6, _hoisted_29$6, _hoisted_30$5, _hoisted_31$5, _hoisted_32$5, _hoisted_33$5, _hoisted_34$5, _hoisted_35$5, _hoisted_36$5, _hoisted_37$5, _hoisted_38$5, _hoisted_39$5, _hoisted_40$5, _hoisted_41$5, _hoisted_42$5, _hoisted_43$5, _hoisted_44$5, _hoisted_45$5, _hoisted_46$5, _hoisted_47$
|
|
53753
|
+
var _hoisted_1$7, _hoisted_2$7, _hoisted_3$7, _hoisted_4$7, _hoisted_5$7, _hoisted_6$7, _hoisted_7$7, _hoisted_8$7, _hoisted_9$7, _hoisted_10$7, _hoisted_11$7, _hoisted_12$7, _hoisted_13$7, _hoisted_14$7, _hoisted_15$7, _hoisted_16$7, _hoisted_17$7, _hoisted_18$7, _hoisted_19$7, _hoisted_20$7, _hoisted_21$7, _hoisted_22$7, _hoisted_23$7, _hoisted_24$7, _hoisted_25$7, _hoisted_26$6, _hoisted_27$6, _hoisted_28$6, _hoisted_29$6, _hoisted_30$5, _hoisted_31$5, _hoisted_32$5, _hoisted_33$5, _hoisted_34$5, _hoisted_35$5, _hoisted_36$5, _hoisted_37$5, _hoisted_38$5, _hoisted_39$5, _hoisted_40$5, _hoisted_41$5, _hoisted_42$5, _hoisted_43$5, _hoisted_44$5, _hoisted_45$5, _hoisted_46$5, _hoisted_47$4, _hoisted_48$4, _hoisted_49$4, _hoisted_50$4, _hoisted_51$4, _hoisted_52$4, _hoisted_53$4, _hoisted_54$4, _hoisted_55$4, _hoisted_56$4, _hoisted_57$3, _hoisted_58$3, _hoisted_59$3, _hoisted_60$3, _hoisted_61$3, _hoisted_62$3, _hoisted_63$3, _hoisted_64$3, _hoisted_65$3, _hoisted_66$3, _hoisted_67$3, _hoisted_68$3, _hoisted_69$3, _hoisted_70$3, _hoisted_71$3, _hoisted_72$2, _hoisted_73$2, _hoisted_74$2, _hoisted_75$2, _hoisted_76$2, _hoisted_77$2, _hoisted_78$2, _hoisted_79$2, _hoisted_80$2, _hoisted_81$2, _hoisted_82$2, _hoisted_83$2, _hoisted_84$2, _hoisted_85$2, _hoisted_86$2, _hoisted_87$2, _hoisted_88$2, _hoisted_89$2, _hoisted_90$2, _hoisted_91$2, _hoisted_92$2, _hoisted_93$2, _hoisted_94$2, _hoisted_95$2, _hoisted_96$2, _hoisted_97$2, _hoisted_98$2, _hoisted_99$2, _hoisted_100$2, _hoisted_101$2, _hoisted_102$2, _hoisted_103$2, _hoisted_104$2, _hoisted_105$2, _hoisted_106$2, _hoisted_107$2, _hoisted_108$2, _hoisted_109$1, _hoisted_110$1, _hoisted_111$1, _hoisted_112$1, _hoisted_113$1, _hoisted_114$1, _hoisted_115$1, _hoisted_116$1, _hoisted_117$1, _hoisted_118$1, _hoisted_119$1, _hoisted_120$1, _hoisted_121$1, _hoisted_122$1, _hoisted_123$1, _hoisted_124$1, _hoisted_125$1, _hoisted_126$1, _hoisted_127$1, _hoisted_128, _hoisted_129, _hoisted_130, _hoisted_131, _hoisted_132, _hoisted_133, connection_detail_vue_vue_type_script_setup_true_lang_default;
|
|
53517
53754
|
var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
53518
53755
|
init_vue_runtime_esm_bundler();
|
|
53519
53756
|
init_vue_router();
|
|
@@ -53521,6 +53758,8 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53521
53758
|
init_sql_executor();
|
|
53522
53759
|
init_vue_i18n();
|
|
53523
53760
|
init_modal();
|
|
53761
|
+
init_database();
|
|
53762
|
+
init_download();
|
|
53524
53763
|
_hoisted_1$7 = { class: "connection-detail" };
|
|
53525
53764
|
_hoisted_2$7 = { class: "connection-header" };
|
|
53526
53765
|
_hoisted_3$7 = { class: "connection-info" };
|
|
@@ -53544,123 +53783,172 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53544
53783
|
_hoisted_18$7 = { class: "info-item" };
|
|
53545
53784
|
_hoisted_19$7 = { class: "info-label" };
|
|
53546
53785
|
_hoisted_20$7 = { class: "info-value" };
|
|
53547
|
-
_hoisted_21$7 = {
|
|
53786
|
+
_hoisted_21$7 = {
|
|
53787
|
+
key: 0,
|
|
53788
|
+
class: "info-item"
|
|
53789
|
+
};
|
|
53548
53790
|
_hoisted_22$7 = { class: "info-label" };
|
|
53549
53791
|
_hoisted_23$7 = { class: "info-value" };
|
|
53550
|
-
_hoisted_24$7 = {
|
|
53792
|
+
_hoisted_24$7 = {
|
|
53793
|
+
key: 1,
|
|
53794
|
+
class: "info-item"
|
|
53795
|
+
};
|
|
53551
53796
|
_hoisted_25$7 = { class: "info-label" };
|
|
53552
|
-
_hoisted_26$6 = {
|
|
53797
|
+
_hoisted_26$6 = {
|
|
53798
|
+
class: "info-value",
|
|
53799
|
+
style: { "color": "var(--db-danger-color)" }
|
|
53800
|
+
};
|
|
53553
53801
|
_hoisted_27$6 = { class: "info-item" };
|
|
53554
53802
|
_hoisted_28$6 = { class: "info-label" };
|
|
53555
53803
|
_hoisted_29$6 = { class: "info-value" };
|
|
53556
|
-
_hoisted_30$5 = { class: "
|
|
53557
|
-
_hoisted_31$5 = { class: "
|
|
53558
|
-
_hoisted_32$5 = { class: "
|
|
53559
|
-
_hoisted_33$5 = { class: "
|
|
53560
|
-
_hoisted_34$5 = { class: "
|
|
53561
|
-
_hoisted_35$5 = { class: "
|
|
53562
|
-
_hoisted_36$5 = { class: "
|
|
53563
|
-
_hoisted_37$5 = { class: "
|
|
53564
|
-
_hoisted_38$5 = { class: "
|
|
53804
|
+
_hoisted_30$5 = { class: "info-item" };
|
|
53805
|
+
_hoisted_31$5 = { class: "info-label" };
|
|
53806
|
+
_hoisted_32$5 = { class: "info-value" };
|
|
53807
|
+
_hoisted_33$5 = { class: "info-item" };
|
|
53808
|
+
_hoisted_34$5 = { class: "info-label" };
|
|
53809
|
+
_hoisted_35$5 = { class: "info-value" };
|
|
53810
|
+
_hoisted_36$5 = { class: "col-md-6" };
|
|
53811
|
+
_hoisted_37$5 = { class: "section-title" };
|
|
53812
|
+
_hoisted_38$5 = { class: "stats-grid" };
|
|
53565
53813
|
_hoisted_39$5 = { class: "stat-item" };
|
|
53566
53814
|
_hoisted_40$5 = { class: "stat-value" };
|
|
53567
53815
|
_hoisted_41$5 = { class: "stat-label" };
|
|
53568
53816
|
_hoisted_42$5 = { class: "stat-item" };
|
|
53569
53817
|
_hoisted_43$5 = { class: "stat-value" };
|
|
53570
53818
|
_hoisted_44$5 = { class: "stat-label" };
|
|
53571
|
-
_hoisted_45$5 = { class: "
|
|
53572
|
-
_hoisted_46$5 = { class: "
|
|
53573
|
-
_hoisted_47$
|
|
53574
|
-
_hoisted_48$4 = { class: "
|
|
53575
|
-
_hoisted_49$4 = { class: "
|
|
53576
|
-
_hoisted_50$4 = { class: "
|
|
53577
|
-
_hoisted_51$4 = { class: "
|
|
53578
|
-
_hoisted_52$
|
|
53579
|
-
_hoisted_53$
|
|
53580
|
-
_hoisted_54$
|
|
53581
|
-
_hoisted_55$
|
|
53582
|
-
_hoisted_56$
|
|
53583
|
-
_hoisted_57$3 = { class: "
|
|
53584
|
-
_hoisted_58$3 = {
|
|
53585
|
-
|
|
53586
|
-
|
|
53587
|
-
|
|
53588
|
-
|
|
53589
|
-
|
|
53590
|
-
|
|
53819
|
+
_hoisted_45$5 = { class: "stat-item" };
|
|
53820
|
+
_hoisted_46$5 = { class: "stat-value" };
|
|
53821
|
+
_hoisted_47$4 = { class: "stat-label" };
|
|
53822
|
+
_hoisted_48$4 = { class: "stat-item" };
|
|
53823
|
+
_hoisted_49$4 = { class: "stat-value" };
|
|
53824
|
+
_hoisted_50$4 = { class: "stat-label" };
|
|
53825
|
+
_hoisted_51$4 = { class: "quick-actions" };
|
|
53826
|
+
_hoisted_52$4 = { class: "actions-header" };
|
|
53827
|
+
_hoisted_53$4 = { class: "actions-title" };
|
|
53828
|
+
_hoisted_54$4 = { class: "actions-grid" };
|
|
53829
|
+
_hoisted_55$4 = { class: "action-text" };
|
|
53830
|
+
_hoisted_56$4 = ["disabled"];
|
|
53831
|
+
_hoisted_57$3 = { class: "action-icon" };
|
|
53832
|
+
_hoisted_58$3 = {
|
|
53833
|
+
key: 0,
|
|
53834
|
+
class: "spinner-border spinner-border-sm"
|
|
53835
|
+
};
|
|
53836
|
+
_hoisted_59$3 = {
|
|
53837
|
+
key: 1,
|
|
53838
|
+
class: "bi bi-download"
|
|
53839
|
+
};
|
|
53840
|
+
_hoisted_60$3 = { class: "action-text" };
|
|
53841
|
+
_hoisted_61$3 = { class: "action-text" };
|
|
53842
|
+
_hoisted_62$3 = { class: "connection-tabs" };
|
|
53843
|
+
_hoisted_63$3 = { class: "nav nav-tabs" };
|
|
53844
|
+
_hoisted_64$3 = { class: "nav-item" };
|
|
53845
|
+
_hoisted_65$3 = { class: "badge bg-primary ms-1" };
|
|
53846
|
+
_hoisted_66$3 = { class: "nav-item" };
|
|
53847
|
+
_hoisted_67$3 = { class: "tab-content" };
|
|
53848
|
+
_hoisted_68$3 = { class: "tab-panel" };
|
|
53849
|
+
_hoisted_69$3 = { class: "databases-section" };
|
|
53850
|
+
_hoisted_70$3 = { class: "section-header" };
|
|
53851
|
+
_hoisted_71$3 = { class: "db-search" };
|
|
53852
|
+
_hoisted_72$2 = ["placeholder"];
|
|
53853
|
+
_hoisted_73$2 = ["disabled", "title"];
|
|
53854
|
+
_hoisted_74$2 = {
|
|
53591
53855
|
key: 0,
|
|
53592
53856
|
class: "spinner-border spinner-border-sm"
|
|
53593
53857
|
};
|
|
53594
|
-
|
|
53858
|
+
_hoisted_75$2 = {
|
|
53595
53859
|
key: 1,
|
|
53596
53860
|
class: "bi bi-arrow-clockwise"
|
|
53597
53861
|
};
|
|
53598
|
-
|
|
53599
|
-
|
|
53862
|
+
_hoisted_76$2 = { class: "databases-list" };
|
|
53863
|
+
_hoisted_77$2 = {
|
|
53600
53864
|
key: 0,
|
|
53601
53865
|
class: "loading-state"
|
|
53602
53866
|
};
|
|
53603
|
-
|
|
53867
|
+
_hoisted_78$2 = {
|
|
53604
53868
|
key: 1,
|
|
53605
53869
|
class: "empty-state"
|
|
53606
53870
|
};
|
|
53607
|
-
|
|
53871
|
+
_hoisted_79$2 = {
|
|
53608
53872
|
key: 2,
|
|
53609
53873
|
class: "databases-list-simple"
|
|
53610
53874
|
};
|
|
53611
|
-
|
|
53612
|
-
|
|
53613
|
-
|
|
53614
|
-
|
|
53615
|
-
|
|
53616
|
-
|
|
53617
|
-
|
|
53618
|
-
|
|
53875
|
+
_hoisted_80$2 = ["onClick"];
|
|
53876
|
+
_hoisted_81$2 = { class: "database-item-name" };
|
|
53877
|
+
_hoisted_82$2 = { class: "database-item-actions" };
|
|
53878
|
+
_hoisted_83$2 = { class: "tab-panel" };
|
|
53879
|
+
_hoisted_84$2 = { class: "sql-section" };
|
|
53880
|
+
_hoisted_85$2 = { class: "sql-header" };
|
|
53881
|
+
_hoisted_86$2 = { class: "sql-title" };
|
|
53882
|
+
_hoisted_87$2 = {
|
|
53619
53883
|
key: 0,
|
|
53620
53884
|
class: "sql-db-info"
|
|
53621
53885
|
};
|
|
53622
|
-
|
|
53623
|
-
|
|
53886
|
+
_hoisted_88$2 = { class: "badge bg-info" };
|
|
53887
|
+
_hoisted_89$2 = {
|
|
53624
53888
|
key: 1,
|
|
53625
53889
|
class: "modal fade show d-block",
|
|
53626
53890
|
style: { "background": "rgba(0,0,0,0.5)" }
|
|
53627
53891
|
};
|
|
53628
|
-
|
|
53629
|
-
|
|
53630
|
-
|
|
53631
|
-
|
|
53632
|
-
|
|
53633
|
-
|
|
53634
|
-
|
|
53635
|
-
|
|
53636
|
-
|
|
53637
|
-
_hoisted_89$2 = { class: "mb-3" };
|
|
53638
|
-
_hoisted_90$2 = { class: "form-label" };
|
|
53639
|
-
_hoisted_91$2 = { value: "" };
|
|
53640
|
-
_hoisted_92$2 = { class: "mb-3" };
|
|
53641
|
-
_hoisted_93$2 = { class: "form-label" };
|
|
53642
|
-
_hoisted_94$2 = { value: "" };
|
|
53643
|
-
_hoisted_95$2 = { key: 1 };
|
|
53644
|
-
_hoisted_96$2 = { class: "mb-3" };
|
|
53645
|
-
_hoisted_97$2 = { class: "form-label" };
|
|
53646
|
-
_hoisted_98$2 = ["placeholder"];
|
|
53892
|
+
_hoisted_90$2 = { class: "modal-dialog" };
|
|
53893
|
+
_hoisted_91$2 = { class: "modal-content" };
|
|
53894
|
+
_hoisted_92$2 = { class: "modal-header" };
|
|
53895
|
+
_hoisted_93$2 = { class: "modal-title" };
|
|
53896
|
+
_hoisted_94$2 = { class: "modal-body" };
|
|
53897
|
+
_hoisted_95$2 = { class: "mb-3" };
|
|
53898
|
+
_hoisted_96$2 = { class: "form-label" };
|
|
53899
|
+
_hoisted_97$2 = ["placeholder"];
|
|
53900
|
+
_hoisted_98$2 = { key: 0 };
|
|
53647
53901
|
_hoisted_99$2 = { class: "mb-3" };
|
|
53648
53902
|
_hoisted_100$2 = { class: "form-label" };
|
|
53649
|
-
_hoisted_101$2 =
|
|
53903
|
+
_hoisted_101$2 = { value: "" };
|
|
53650
53904
|
_hoisted_102$2 = { class: "mb-3" };
|
|
53651
53905
|
_hoisted_103$2 = { class: "form-label" };
|
|
53652
53906
|
_hoisted_104$2 = { value: "" };
|
|
53653
|
-
_hoisted_105$2 = {
|
|
53654
|
-
_hoisted_106$2 = { class: "
|
|
53655
|
-
_hoisted_107$2 =
|
|
53656
|
-
_hoisted_108$2 =
|
|
53907
|
+
_hoisted_105$2 = { key: 1 };
|
|
53908
|
+
_hoisted_106$2 = { class: "mb-3" };
|
|
53909
|
+
_hoisted_107$2 = { class: "form-label" };
|
|
53910
|
+
_hoisted_108$2 = ["placeholder"];
|
|
53657
53911
|
_hoisted_109$1 = { class: "mb-3" };
|
|
53658
|
-
_hoisted_110$1 = { class: "
|
|
53659
|
-
_hoisted_111$1 = ["
|
|
53660
|
-
_hoisted_112$1 = {
|
|
53912
|
+
_hoisted_110$1 = { class: "form-label" };
|
|
53913
|
+
_hoisted_111$1 = ["placeholder"];
|
|
53914
|
+
_hoisted_112$1 = { class: "mb-3" };
|
|
53915
|
+
_hoisted_113$1 = { class: "form-label" };
|
|
53916
|
+
_hoisted_114$1 = { value: "" };
|
|
53917
|
+
_hoisted_115$1 = { class: "mb-3" };
|
|
53918
|
+
_hoisted_116$1 = { class: "form-label" };
|
|
53919
|
+
_hoisted_117$1 = ["placeholder"];
|
|
53920
|
+
_hoisted_118$1 = { key: 2 };
|
|
53921
|
+
_hoisted_119$1 = { class: "mb-3" };
|
|
53922
|
+
_hoisted_120$1 = { class: "modal-footer" };
|
|
53923
|
+
_hoisted_121$1 = ["disabled"];
|
|
53924
|
+
_hoisted_122$1 = {
|
|
53661
53925
|
key: 0,
|
|
53662
53926
|
class: "spinner-border spinner-border-sm me-2"
|
|
53663
53927
|
};
|
|
53928
|
+
_hoisted_123$1 = {
|
|
53929
|
+
key: 2,
|
|
53930
|
+
class: "modal fade show d-block",
|
|
53931
|
+
style: { "background": "rgba(0,0,0,0.5)" }
|
|
53932
|
+
};
|
|
53933
|
+
_hoisted_124$1 = { class: "modal-dialog modal-lg" };
|
|
53934
|
+
_hoisted_125$1 = { class: "modal-content" };
|
|
53935
|
+
_hoisted_126$1 = { class: "modal-header" };
|
|
53936
|
+
_hoisted_127$1 = { class: "modal-title" };
|
|
53937
|
+
_hoisted_128 = { class: "modal-body" };
|
|
53938
|
+
_hoisted_129 = {
|
|
53939
|
+
key: 0,
|
|
53940
|
+
class: "logs-state"
|
|
53941
|
+
};
|
|
53942
|
+
_hoisted_130 = {
|
|
53943
|
+
key: 1,
|
|
53944
|
+
class: "logs-state"
|
|
53945
|
+
};
|
|
53946
|
+
_hoisted_131 = {
|
|
53947
|
+
key: 2,
|
|
53948
|
+
class: "logs-table-wrap"
|
|
53949
|
+
};
|
|
53950
|
+
_hoisted_132 = { class: "table table-sm table-bordered mb-0" };
|
|
53951
|
+
_hoisted_133 = { class: "modal-footer" };
|
|
53664
53952
|
connection_detail_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
53665
53953
|
__name: "connection-detail",
|
|
53666
53954
|
props: { connection: {} },
|
|
@@ -53680,6 +53968,7 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53680
53968
|
const props = __props;
|
|
53681
53969
|
const emit = __emit;
|
|
53682
53970
|
const connectionStore = useConnectionStore();
|
|
53971
|
+
const databaseService = new DatabaseService();
|
|
53683
53972
|
const connectionStats = ref({
|
|
53684
53973
|
databaseCount: 0,
|
|
53685
53974
|
tableCount: 0,
|
|
@@ -53692,6 +53981,15 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53692
53981
|
function toggleDetails() {
|
|
53693
53982
|
isDetailsExpanded.value = !isDetailsExpanded.value;
|
|
53694
53983
|
}
|
|
53984
|
+
const exportingSchema = ref(false);
|
|
53985
|
+
const showLogs = ref(false);
|
|
53986
|
+
const loadingLogs = ref(false);
|
|
53987
|
+
const connectionLogs = ref([]);
|
|
53988
|
+
/** 日志列:由首条记录推导,兼容各方言返回的不同字段 */
|
|
53989
|
+
const logColumns = computed(() => {
|
|
53990
|
+
const first = connectionLogs.value.find((l) => l && typeof l === "object");
|
|
53991
|
+
return first ? Object.keys(first) : ["message"];
|
|
53992
|
+
});
|
|
53695
53993
|
const showCreateDatabase = ref(false);
|
|
53696
53994
|
const creatingDatabase = ref(false);
|
|
53697
53995
|
const newDatabase = ref({
|
|
@@ -53777,11 +54075,71 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53777
54075
|
function editConnection() {
|
|
53778
54076
|
if (props.connection) emit("edit-connection", props.connection);
|
|
53779
54077
|
}
|
|
53780
|
-
|
|
53781
|
-
|
|
54078
|
+
/**
|
|
54079
|
+
* 导出架构:连接维度没有「当前库」,逐库调用后端 exportSchema 后拼成一份完整 DDL。
|
|
54080
|
+
* 后端已按方言实现(MySQL/PG/SQLite/MSSQL/Oracle/ClickHouse/CockroachDB/SAP/Mongo)。
|
|
54081
|
+
*/
|
|
54082
|
+
async function exportSchema() {
|
|
54083
|
+
if (!props.connection || exportingSchema.value) return;
|
|
54084
|
+
const conn = props.connection;
|
|
54085
|
+
const connId = conn.id;
|
|
54086
|
+
if (!connId) return;
|
|
54087
|
+
if (!databases.value.length) await connectionStore.loadDatabases();
|
|
54088
|
+
const names = databases.value.map((d) => d.name).filter(Boolean);
|
|
54089
|
+
if (!names.length) {
|
|
54090
|
+
await modal.warning(t("connection.schemaExportNoDatabase"));
|
|
54091
|
+
return;
|
|
54092
|
+
}
|
|
54093
|
+
exportingSchema.value = true;
|
|
54094
|
+
try {
|
|
54095
|
+
const parts = [
|
|
54096
|
+
`-- ${conn.name} 架构导出`,
|
|
54097
|
+
`-- 时间: ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
54098
|
+
`-- 数据库数: ${names.length}`,
|
|
54099
|
+
""
|
|
54100
|
+
];
|
|
54101
|
+
for (const db of names) {
|
|
54102
|
+
const res = await databaseService.exportSchema(connId, db);
|
|
54103
|
+
const schema = String(res?.schema || "").trim();
|
|
54104
|
+
parts.push(`-- ==================== ${db} ====================`);
|
|
54105
|
+
parts.push(schema || `-- (${db} 无表或导出为空)`);
|
|
54106
|
+
parts.push("");
|
|
54107
|
+
}
|
|
54108
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
54109
|
+
const result = await saveTextFile(`${conn.name}-schema-${stamp}.sql`, parts.join("\n"), { SQL: ["sql"] });
|
|
54110
|
+
if (result.cancelled) return;
|
|
54111
|
+
await modal.success(t("connection.schemaExported", {
|
|
54112
|
+
count: names.length,
|
|
54113
|
+
path: result.path ? `\n${result.path}` : ""
|
|
54114
|
+
}));
|
|
54115
|
+
} catch (error) {
|
|
54116
|
+
await modal.error(error?.message || t("connection.schemaExportFailed"));
|
|
54117
|
+
} finally {
|
|
54118
|
+
exportingSchema.value = false;
|
|
54119
|
+
}
|
|
54120
|
+
}
|
|
54121
|
+
/** 查看日志:拉取最近记录后在本组件的弹窗里展示 */
|
|
54122
|
+
async function viewLogs() {
|
|
54123
|
+
const connId = props.connection?.id;
|
|
54124
|
+
if (!connId) return;
|
|
54125
|
+
showLogs.value = true;
|
|
54126
|
+
loadingLogs.value = true;
|
|
54127
|
+
connectionLogs.value = [];
|
|
54128
|
+
try {
|
|
54129
|
+
const res = await databaseService.viewLogs(connId, void 0, 100);
|
|
54130
|
+
connectionLogs.value = Array.isArray(res?.logs) ? res.logs : [];
|
|
54131
|
+
} catch (error) {
|
|
54132
|
+
await modal.error(error?.message || t("connection.logsLoadFailed"));
|
|
54133
|
+
} finally {
|
|
54134
|
+
loadingLogs.value = false;
|
|
54135
|
+
}
|
|
53782
54136
|
}
|
|
53783
|
-
|
|
53784
|
-
|
|
54137
|
+
/** 日志单元格:对象/数组序列化,避免表格里出现 [object Object] */
|
|
54138
|
+
function formatLogCell(row, key) {
|
|
54139
|
+
const v = row?.[key];
|
|
54140
|
+
if (v === null || v === void 0) return "";
|
|
54141
|
+
if (typeof v === "object") return JSON.stringify(v);
|
|
54142
|
+
return String(v);
|
|
53785
54143
|
}
|
|
53786
54144
|
function showCreateDatabaseModal() {
|
|
53787
54145
|
emit("create-database");
|
|
@@ -53837,7 +54195,8 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53837
54195
|
postgres: "PostgreSQL",
|
|
53838
54196
|
mssql: "SQL Server",
|
|
53839
54197
|
sqlite: "SQLite",
|
|
53840
|
-
oracle: "Oracle"
|
|
54198
|
+
oracle: "Oracle",
|
|
54199
|
+
remote: "远程代理服务"
|
|
53841
54200
|
}[type || ""] || "Unknown";
|
|
53842
54201
|
}
|
|
53843
54202
|
function getDbLogoClass(type) {
|
|
@@ -53849,12 +54208,13 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53849
54208
|
postgres: "PG",
|
|
53850
54209
|
mssql: "MS",
|
|
53851
54210
|
sqlite: "SQ",
|
|
53852
|
-
oracle: "OR"
|
|
54211
|
+
oracle: "OR",
|
|
54212
|
+
remote: "R"
|
|
53853
54213
|
}[type || ""] || "DB";
|
|
53854
54214
|
}
|
|
53855
54215
|
return (_ctx, _cache) => {
|
|
53856
54216
|
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
53857
|
-
createBaseVNode("div", _hoisted_2$7, [createBaseVNode("div", _hoisted_3$7, [createBaseVNode("div", _hoisted_4$7, [createBaseVNode("div", { class: normalizeClass(["db-logo", getDbLogoClass(__props.connection?.type)]) }, toDisplayString(getDbLogoText(__props.connection?.type)), 3)]), createBaseVNode("div", _hoisted_5$7, [createBaseVNode("h4", _hoisted_6$7, toDisplayString(__props.connection?.name), 1), createBaseVNode("div", _hoisted_7$7, [createBaseVNode("span", _hoisted_8$7, toDisplayString(getDbTypeLabel(__props.connection?.type)), 1), createBaseVNode("span", { class: normalizeClass(["connection-status", connectionStatusClass.value]) }, [_cache[
|
|
54217
|
+
createBaseVNode("div", _hoisted_2$7, [createBaseVNode("div", _hoisted_3$7, [createBaseVNode("div", _hoisted_4$7, [createBaseVNode("div", { class: normalizeClass(["db-logo", getDbLogoClass(__props.connection?.type)]) }, toDisplayString(getDbLogoText(__props.connection?.type)), 3)]), createBaseVNode("div", _hoisted_5$7, [createBaseVNode("h4", _hoisted_6$7, toDisplayString(__props.connection?.name), 1), createBaseVNode("div", _hoisted_7$7, [createBaseVNode("span", _hoisted_8$7, toDisplayString(getDbTypeLabel(__props.connection?.type)), 1), createBaseVNode("span", { class: normalizeClass(["connection-status", connectionStatusClass.value]) }, [_cache[16] || (_cache[16] = createBaseVNode("div", { class: "status-dot" }, null, -1)), createTextVNode(" " + toDisplayString(connectionStatusText.value), 1)], 2)])])]), createBaseVNode("div", _hoisted_9$7, [
|
|
53858
54218
|
createBaseVNode("button", {
|
|
53859
54219
|
class: "btn btn-sm btn-outline-info",
|
|
53860
54220
|
onClick: toggleDetails,
|
|
@@ -53863,148 +54223,151 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
53863
54223
|
createBaseVNode("button", {
|
|
53864
54224
|
class: "btn btn-sm btn-outline-primary",
|
|
53865
54225
|
onClick: testConnection
|
|
53866
|
-
}, [..._cache[
|
|
54226
|
+
}, [..._cache[17] || (_cache[17] = [createBaseVNode("i", { class: "bi bi-wifi" }, null, -1)])]),
|
|
53867
54227
|
createBaseVNode("button", {
|
|
53868
54228
|
class: "btn btn-sm btn-outline-secondary",
|
|
53869
54229
|
onClick: editConnection
|
|
53870
|
-
}, [_cache[
|
|
54230
|
+
}, [_cache[18] || (_cache[18] = createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("common.edit")), 1)])
|
|
53871
54231
|
])]),
|
|
53872
|
-
isDetailsExpanded.value ? (openBlock(), createElementBlock("div", _hoisted_11$7, [createBaseVNode("div", _hoisted_12$7, [createBaseVNode("div", _hoisted_13$7, [createBaseVNode("div", _hoisted_14$7, [createBaseVNode("div", _hoisted_15$7, [createBaseVNode("h6", _hoisted_16$7, [_cache[
|
|
54232
|
+
isDetailsExpanded.value ? (openBlock(), createElementBlock("div", _hoisted_11$7, [createBaseVNode("div", _hoisted_12$7, [createBaseVNode("div", _hoisted_13$7, [createBaseVNode("div", _hoisted_14$7, [createBaseVNode("div", _hoisted_15$7, [createBaseVNode("h6", _hoisted_16$7, [_cache[19] || (_cache[19] = createBaseVNode("i", { class: "bi bi-info-circle" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("connection.basicInfo")), 1)]), createBaseVNode("div", _hoisted_17$7, [
|
|
53873
54233
|
createBaseVNode("div", _hoisted_18$7, [createBaseVNode("label", _hoisted_19$7, toDisplayString(_ctx.$t("connection.host")), 1), createBaseVNode("div", _hoisted_20$7, toDisplayString(__props.connection?.host), 1)]),
|
|
53874
|
-
|
|
53875
|
-
|
|
53876
|
-
createBaseVNode("div", _hoisted_27$6, [createBaseVNode("label", _hoisted_28$6, toDisplayString(_ctx.$t("connection.
|
|
53877
|
-
|
|
53878
|
-
createBaseVNode("div", _hoisted_33$5, [createBaseVNode("
|
|
53879
|
-
|
|
53880
|
-
createBaseVNode("div", _hoisted_39$5, [createBaseVNode("div", _hoisted_40$5, toDisplayString(
|
|
53881
|
-
createBaseVNode("div", _hoisted_42$5, [createBaseVNode("div", _hoisted_43$5, toDisplayString(connectionStats.value.
|
|
54234
|
+
__props.connection?._isProxy && __props.connection?.options?.remoteUrl ? (openBlock(), createElementBlock("div", _hoisted_21$7, [createBaseVNode("label", _hoisted_22$7, toDisplayString(_ctx.$t("connection.remoteUrl")), 1), createBaseVNode("div", _hoisted_23$7, toDisplayString(__props.connection?.options?.remoteUrl), 1)])) : createCommentVNode("", true),
|
|
54235
|
+
__props.connection?._remoteError ? (openBlock(), createElementBlock("div", _hoisted_24$7, [createBaseVNode("label", _hoisted_25$7, toDisplayString(_ctx.$t("connection.connectionStatus")), 1), createBaseVNode("div", _hoisted_26$6, toDisplayString(__props.connection?._remoteError), 1)])) : createCommentVNode("", true),
|
|
54236
|
+
createBaseVNode("div", _hoisted_27$6, [createBaseVNode("label", _hoisted_28$6, toDisplayString(_ctx.$t("connection.port")), 1), createBaseVNode("div", _hoisted_29$6, toDisplayString(__props.connection?.port), 1)]),
|
|
54237
|
+
createBaseVNode("div", _hoisted_30$5, [createBaseVNode("label", _hoisted_31$5, toDisplayString(_ctx.$t("connection.username")), 1), createBaseVNode("div", _hoisted_32$5, toDisplayString(__props.connection?.username), 1)]),
|
|
54238
|
+
createBaseVNode("div", _hoisted_33$5, [createBaseVNode("label", _hoisted_34$5, toDisplayString(_ctx.$t("connection.databaseType")), 1), createBaseVNode("div", _hoisted_35$5, [createBaseVNode("span", { class: normalizeClass(["db-type-badge", getDbLogoClass(__props.connection?.type)]) }, toDisplayString(getDbTypeLabel(__props.connection?.type)), 3)])])
|
|
54239
|
+
])]), createBaseVNode("div", _hoisted_36$5, [createBaseVNode("h6", _hoisted_37$5, [_cache[20] || (_cache[20] = createBaseVNode("i", { class: "bi bi-bar-chart" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("connection.connectionStats")), 1)]), createBaseVNode("div", _hoisted_38$5, [
|
|
54240
|
+
createBaseVNode("div", _hoisted_39$5, [createBaseVNode("div", _hoisted_40$5, toDisplayString(connectionStats.value.databaseCount || 0), 1), createBaseVNode("div", _hoisted_41$5, toDisplayString(_ctx.$t("connection.databaseCount")), 1)]),
|
|
54241
|
+
createBaseVNode("div", _hoisted_42$5, [createBaseVNode("div", _hoisted_43$5, toDisplayString(connectionStats.value.tableCount || 0), 1), createBaseVNode("div", _hoisted_44$5, toDisplayString(_ctx.$t("connection.tableCount")), 1)]),
|
|
54242
|
+
createBaseVNode("div", _hoisted_45$5, [createBaseVNode("div", _hoisted_46$5, toDisplayString(formatFileSize(connectionStats.value.totalSize || 0)), 1), createBaseVNode("div", _hoisted_47$4, toDisplayString(_ctx.$t("connection.totalSize")), 1)]),
|
|
54243
|
+
createBaseVNode("div", _hoisted_48$4, [createBaseVNode("div", _hoisted_49$4, toDisplayString(connectionStats.value.lastConnected || _ctx.$t("common.never")), 1), createBaseVNode("div", _hoisted_50$4, toDisplayString(_ctx.$t("connection.lastConnected")), 1)])
|
|
53882
54244
|
])])])])])])) : createCommentVNode("", true),
|
|
53883
|
-
createBaseVNode("div",
|
|
54245
|
+
createBaseVNode("div", _hoisted_51$4, [createBaseVNode("div", _hoisted_52$4, [createBaseVNode("h6", _hoisted_53$4, [_cache[21] || (_cache[21] = createBaseVNode("i", { class: "bi bi-lightning" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("connection.quickActions")), 1)])]), createBaseVNode("div", _hoisted_54$4, [
|
|
53884
54246
|
createBaseVNode("button", {
|
|
53885
54247
|
class: "action-btn",
|
|
53886
54248
|
onClick: showCreateDatabaseModal
|
|
53887
|
-
}, [_cache[
|
|
54249
|
+
}, [_cache[22] || (_cache[22] = createBaseVNode("div", { class: "action-icon" }, [createBaseVNode("i", { class: "bi bi-plus-circle" })], -1)), createBaseVNode("div", _hoisted_55$4, toDisplayString(_ctx.$t("connection.createDatabase")), 1)]),
|
|
53888
54250
|
createBaseVNode("button", {
|
|
53889
54251
|
class: "action-btn",
|
|
54252
|
+
disabled: exportingSchema.value,
|
|
53890
54253
|
onClick: exportSchema
|
|
53891
|
-
}, [
|
|
54254
|
+
}, [createBaseVNode("div", _hoisted_57$3, [exportingSchema.value ? (openBlock(), createElementBlock("i", _hoisted_58$3)) : (openBlock(), createElementBlock("i", _hoisted_59$3))]), createBaseVNode("div", _hoisted_60$3, toDisplayString(_ctx.$t("connection.exportSchema")), 1)], 8, _hoisted_56$4),
|
|
53892
54255
|
createBaseVNode("button", {
|
|
53893
54256
|
class: "action-btn",
|
|
53894
54257
|
onClick: viewLogs
|
|
53895
|
-
}, [_cache[
|
|
54258
|
+
}, [_cache[23] || (_cache[23] = createBaseVNode("div", { class: "action-icon" }, [createBaseVNode("i", { class: "bi bi-file-text" })], -1)), createBaseVNode("div", _hoisted_61$3, toDisplayString(_ctx.$t("connection.viewLogs")), 1)])
|
|
53896
54259
|
])]),
|
|
53897
|
-
createBaseVNode("div",
|
|
54260
|
+
createBaseVNode("div", _hoisted_62$3, [createBaseVNode("ul", _hoisted_63$3, [createBaseVNode("li", _hoisted_64$3, [createBaseVNode("button", {
|
|
53898
54261
|
class: normalizeClass(["nav-link", { active: activeTab.value === "databases" }]),
|
|
53899
54262
|
onClick: _cache[0] || (_cache[0] = ($event) => activeTab.value = "databases")
|
|
53900
54263
|
}, [
|
|
53901
|
-
_cache[
|
|
54264
|
+
_cache[24] || (_cache[24] = createBaseVNode("i", { class: "bi bi-database-fill" }, null, -1)),
|
|
53902
54265
|
createTextVNode(" " + toDisplayString(_ctx.$t("connection.databaseList")) + " ", 1),
|
|
53903
|
-
createBaseVNode("span",
|
|
53904
|
-
], 2)]), createBaseVNode("li",
|
|
54266
|
+
createBaseVNode("span", _hoisted_65$3, toDisplayString(databases.value.length), 1)
|
|
54267
|
+
], 2)]), createBaseVNode("li", _hoisted_66$3, [createBaseVNode("button", {
|
|
53905
54268
|
class: normalizeClass(["nav-link", { active: activeTab.value === "sql" }]),
|
|
53906
54269
|
onClick: _cache[1] || (_cache[1] = ($event) => activeTab.value = "sql")
|
|
53907
|
-
}, [_cache[
|
|
54270
|
+
}, [_cache[25] || (_cache[25] = createBaseVNode("i", { class: "bi bi-terminal" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("nav.sqlQuery")), 1)], 2)])]), createBaseVNode("div", _hoisted_67$3, [withDirectives(createBaseVNode("div", _hoisted_68$3, [createBaseVNode("div", _hoisted_69$3, [createBaseVNode("div", _hoisted_70$3, [createBaseVNode("div", _hoisted_71$3, [_cache[26] || (_cache[26] = createBaseVNode("i", { class: "bi bi-search" }, null, -1)), withDirectives(createBaseVNode("input", {
|
|
53908
54271
|
type: "text",
|
|
53909
54272
|
class: "db-search-input",
|
|
53910
54273
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchKeyword.value = $event),
|
|
53911
54274
|
placeholder: _ctx.$t("connection.searchDatabase")
|
|
53912
|
-
}, null, 8,
|
|
54275
|
+
}, null, 8, _hoisted_72$2), [[vModelText, searchKeyword.value]])]), createBaseVNode("button", {
|
|
53913
54276
|
class: "db-refresh-btn",
|
|
53914
54277
|
onClick: loadDatabases,
|
|
53915
54278
|
disabled: loadingDatabases.value,
|
|
53916
54279
|
title: _ctx.$t("common.refresh")
|
|
53917
|
-
}, [loadingDatabases.value ? (openBlock(), createElementBlock("span",
|
|
53918
|
-
_cache[
|
|
54280
|
+
}, [loadingDatabases.value ? (openBlock(), createElementBlock("span", _hoisted_74$2)) : (openBlock(), createElementBlock("i", _hoisted_75$2))], 8, _hoisted_73$2)]), createBaseVNode("div", _hoisted_76$2, [loadingDatabases.value ? (openBlock(), createElementBlock("div", _hoisted_77$2, [_cache[27] || (_cache[27] = createBaseVNode("div", { class: "spinner-border text-primary" }, null, -1)), createBaseVNode("span", null, toDisplayString(_ctx.$t("connection.loadingDatabases")), 1)])) : filteredDatabases.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_78$2, [
|
|
54281
|
+
_cache[29] || (_cache[29] = createBaseVNode("i", { class: "bi bi-database" }, null, -1)),
|
|
53919
54282
|
createBaseVNode("p", null, toDisplayString(searchKeyword.value ? _ctx.$t("connection.noMatchDatabase") : _ctx.$t("connection.noDatabase")), 1),
|
|
53920
54283
|
createBaseVNode("button", {
|
|
53921
54284
|
class: "btn btn-sm btn-primary",
|
|
53922
54285
|
onClick: showCreateDatabaseModal
|
|
53923
|
-
}, [_cache[
|
|
53924
|
-
])) : (openBlock(), createElementBlock("div",
|
|
54286
|
+
}, [_cache[28] || (_cache[28] = createBaseVNode("i", { class: "bi bi-plus" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("connection.createDatabase")), 1)])
|
|
54287
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_79$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(filteredDatabases.value, (database) => {
|
|
53925
54288
|
return openBlock(), createElementBlock("div", {
|
|
53926
54289
|
key: database.name,
|
|
53927
54290
|
class: "database-item",
|
|
53928
54291
|
onClick: ($event) => openDatabase(database)
|
|
53929
54292
|
}, [
|
|
53930
|
-
_cache[
|
|
53931
|
-
createBaseVNode("div",
|
|
53932
|
-
createBaseVNode("div",
|
|
54293
|
+
_cache[31] || (_cache[31] = createBaseVNode("div", { class: "database-item-icon" }, [createBaseVNode("i", { class: "bi bi-database" })], -1)),
|
|
54294
|
+
createBaseVNode("div", _hoisted_81$2, toDisplayString(database.name), 1),
|
|
54295
|
+
createBaseVNode("div", _hoisted_82$2, [createBaseVNode("button", {
|
|
53933
54296
|
class: "btn btn-sm btn-outline-secondary",
|
|
53934
54297
|
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => activeTab.value = "sql", ["stop"]))
|
|
53935
|
-
}, [..._cache[
|
|
53936
|
-
], 8,
|
|
53937
|
-
}), 128))]))])])], 512), [[vShow, activeTab.value === "databases"]]), withDirectives(createBaseVNode("div",
|
|
54298
|
+
}, [..._cache[30] || (_cache[30] = [createBaseVNode("i", { class: "bi bi-terminal" }, null, -1)])])])
|
|
54299
|
+
], 8, _hoisted_80$2);
|
|
54300
|
+
}), 128))]))])])], 512), [[vShow, activeTab.value === "databases"]]), withDirectives(createBaseVNode("div", _hoisted_83$2, [createBaseVNode("div", _hoisted_84$2, [createBaseVNode("div", _hoisted_85$2, [createBaseVNode("h6", _hoisted_86$2, [_cache[32] || (_cache[32] = createBaseVNode("i", { class: "bi bi-terminal" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("nav.sqlQuery")), 1)]), props.connection ? (openBlock(), createElementBlock("div", _hoisted_87$2, [createBaseVNode("span", _hoisted_88$2, toDisplayString(props.connection.name), 1)])) : createCommentVNode("", true)]), createVNode(sql_executor_default, {
|
|
53938
54301
|
connection: props.connection,
|
|
53939
54302
|
database: ""
|
|
53940
54303
|
}, null, 8, ["connection"])])], 512), [[vShow, activeTab.value === "sql"]])])]),
|
|
53941
|
-
showCreateDatabase.value ? (openBlock(), createElementBlock("div",
|
|
53942
|
-
createBaseVNode("div",
|
|
54304
|
+
showCreateDatabase.value ? (openBlock(), createElementBlock("div", _hoisted_89$2, [createBaseVNode("div", _hoisted_90$2, [createBaseVNode("div", _hoisted_91$2, [
|
|
54305
|
+
createBaseVNode("div", _hoisted_92$2, [createBaseVNode("h5", _hoisted_93$2, toDisplayString(_ctx.$t("connection.createDatabaseTitle")), 1), createBaseVNode("button", {
|
|
53943
54306
|
type: "button",
|
|
53944
54307
|
class: "btn-close",
|
|
53945
54308
|
onClick: _cache[4] || (_cache[4] = ($event) => showCreateDatabase.value = false)
|
|
53946
54309
|
})]),
|
|
53947
|
-
createBaseVNode("div",
|
|
53948
|
-
createBaseVNode("div",
|
|
54310
|
+
createBaseVNode("div", _hoisted_94$2, [createBaseVNode("form", null, [
|
|
54311
|
+
createBaseVNode("div", _hoisted_95$2, [createBaseVNode("label", _hoisted_96$2, [createTextVNode(toDisplayString(_ctx.$t("connection.databaseNameLabel")) + " ", 1), _cache[33] || (_cache[33] = createBaseVNode("span", { class: "text-danger" }, "*", -1))]), withDirectives(createBaseVNode("input", {
|
|
53949
54312
|
type: "text",
|
|
53950
54313
|
class: "form-control",
|
|
53951
54314
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => newDatabase.value.name = $event),
|
|
53952
54315
|
placeholder: _ctx.$t("connection.enterDatabaseName"),
|
|
53953
54316
|
required: ""
|
|
53954
|
-
}, null, 8,
|
|
53955
|
-
__props.connection?.type === "mysql" ? (openBlock(), createElementBlock("div",
|
|
54317
|
+
}, null, 8, _hoisted_97$2), [[vModelText, newDatabase.value.name]])]),
|
|
54318
|
+
__props.connection?.type === "mysql" ? (openBlock(), createElementBlock("div", _hoisted_98$2, [createBaseVNode("div", _hoisted_99$2, [createBaseVNode("label", _hoisted_100$2, toDisplayString(_ctx.$t("connection.charset")), 1), withDirectives(createBaseVNode("select", {
|
|
53956
54319
|
class: "form-select",
|
|
53957
54320
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => newDatabase.value.options.charset = $event)
|
|
53958
54321
|
}, [
|
|
53959
|
-
createBaseVNode("option",
|
|
53960
|
-
_cache[
|
|
53961
|
-
_cache[
|
|
53962
|
-
_cache[
|
|
53963
|
-
], 512), [[vModelSelect, newDatabase.value.options.charset]])]), createBaseVNode("div",
|
|
54322
|
+
createBaseVNode("option", _hoisted_101$2, toDisplayString(_ctx.$t("common.default")), 1),
|
|
54323
|
+
_cache[34] || (_cache[34] = createBaseVNode("option", { value: "utf8mb4" }, "utf8mb4", -1)),
|
|
54324
|
+
_cache[35] || (_cache[35] = createBaseVNode("option", { value: "utf8" }, "utf8", -1)),
|
|
54325
|
+
_cache[36] || (_cache[36] = createBaseVNode("option", { value: "latin1" }, "latin1", -1))
|
|
54326
|
+
], 512), [[vModelSelect, newDatabase.value.options.charset]])]), createBaseVNode("div", _hoisted_102$2, [createBaseVNode("label", _hoisted_103$2, toDisplayString(_ctx.$t("connection.collation")), 1), withDirectives(createBaseVNode("select", {
|
|
53964
54327
|
class: "form-select",
|
|
53965
54328
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => newDatabase.value.options.collation = $event)
|
|
53966
54329
|
}, [
|
|
53967
|
-
createBaseVNode("option",
|
|
53968
|
-
_cache[
|
|
53969
|
-
_cache[
|
|
53970
|
-
_cache[
|
|
54330
|
+
createBaseVNode("option", _hoisted_104$2, toDisplayString(_ctx.$t("common.default")), 1),
|
|
54331
|
+
_cache[37] || (_cache[37] = createBaseVNode("option", { value: "utf8mb4_unicode_ci" }, "utf8mb4_unicode_ci", -1)),
|
|
54332
|
+
_cache[38] || (_cache[38] = createBaseVNode("option", { value: "utf8mb4_general_ci" }, "utf8mb4_general_ci", -1)),
|
|
54333
|
+
_cache[39] || (_cache[39] = createBaseVNode("option", { value: "utf8_unicode_ci" }, "utf8_unicode_ci", -1))
|
|
53971
54334
|
], 512), [[vModelSelect, newDatabase.value.options.collation]])])])) : createCommentVNode("", true),
|
|
53972
|
-
__props.connection?.type === "postgres" ? (openBlock(), createElementBlock("div",
|
|
53973
|
-
createBaseVNode("div",
|
|
54335
|
+
__props.connection?.type === "postgres" ? (openBlock(), createElementBlock("div", _hoisted_105$2, [
|
|
54336
|
+
createBaseVNode("div", _hoisted_106$2, [createBaseVNode("label", _hoisted_107$2, toDisplayString(_ctx.$t("connection.owner")), 1), withDirectives(createBaseVNode("input", {
|
|
53974
54337
|
type: "text",
|
|
53975
54338
|
class: "form-control",
|
|
53976
54339
|
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => newDatabase.value.options.owner = $event),
|
|
53977
54340
|
placeholder: _ctx.$t("connection.databaseOwner")
|
|
53978
|
-
}, null, 8,
|
|
53979
|
-
createBaseVNode("div",
|
|
54341
|
+
}, null, 8, _hoisted_108$2), [[vModelText, newDatabase.value.options.owner]])]),
|
|
54342
|
+
createBaseVNode("div", _hoisted_109$1, [createBaseVNode("label", _hoisted_110$1, toDisplayString(_ctx.$t("connection.template")), 1), withDirectives(createBaseVNode("input", {
|
|
53980
54343
|
type: "text",
|
|
53981
54344
|
class: "form-control",
|
|
53982
54345
|
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => newDatabase.value.options.template = $event),
|
|
53983
54346
|
placeholder: _ctx.$t("connection.templateDatabase")
|
|
53984
|
-
}, null, 8,
|
|
53985
|
-
createBaseVNode("div",
|
|
54347
|
+
}, null, 8, _hoisted_111$1), [[vModelText, newDatabase.value.options.template]])]),
|
|
54348
|
+
createBaseVNode("div", _hoisted_112$1, [createBaseVNode("label", _hoisted_113$1, toDisplayString(_ctx.$t("connection.encoding")), 1), withDirectives(createBaseVNode("select", {
|
|
53986
54349
|
class: "form-select",
|
|
53987
54350
|
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => newDatabase.value.options.encoding = $event)
|
|
53988
54351
|
}, [
|
|
53989
|
-
createBaseVNode("option",
|
|
53990
|
-
_cache[
|
|
53991
|
-
_cache[
|
|
54352
|
+
createBaseVNode("option", _hoisted_114$1, toDisplayString(_ctx.$t("common.default")), 1),
|
|
54353
|
+
_cache[40] || (_cache[40] = createBaseVNode("option", { value: "UTF8" }, "UTF8", -1)),
|
|
54354
|
+
_cache[41] || (_cache[41] = createBaseVNode("option", { value: "LATIN1" }, "LATIN1", -1))
|
|
53992
54355
|
], 512), [[vModelSelect, newDatabase.value.options.encoding]])]),
|
|
53993
|
-
createBaseVNode("div",
|
|
54356
|
+
createBaseVNode("div", _hoisted_115$1, [createBaseVNode("label", _hoisted_116$1, toDisplayString(_ctx.$t("connection.tablespace")), 1), withDirectives(createBaseVNode("input", {
|
|
53994
54357
|
type: "text",
|
|
53995
54358
|
class: "form-control",
|
|
53996
54359
|
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => newDatabase.value.options.tablespace = $event),
|
|
53997
54360
|
placeholder: _ctx.$t("connection.tablespace")
|
|
53998
|
-
}, null, 8,
|
|
54361
|
+
}, null, 8, _hoisted_117$1), [[vModelText, newDatabase.value.options.tablespace]])])
|
|
53999
54362
|
])) : createCommentVNode("", true),
|
|
54000
|
-
__props.connection?.type === "mssql" ? (openBlock(), createElementBlock("div",
|
|
54363
|
+
__props.connection?.type === "mssql" ? (openBlock(), createElementBlock("div", _hoisted_118$1, [createBaseVNode("div", _hoisted_119$1, [_cache[42] || (_cache[42] = createBaseVNode("label", { class: "form-label" }, "排序规则", -1)), withDirectives(createBaseVNode("input", {
|
|
54001
54364
|
type: "text",
|
|
54002
54365
|
class: "form-control",
|
|
54003
54366
|
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => newDatabase.value.options.collation = $event),
|
|
54004
54367
|
placeholder: "排序规则"
|
|
54005
54368
|
}, null, 512), [[vModelText, newDatabase.value.options.collation]])])])) : createCommentVNode("", true)
|
|
54006
54369
|
])]),
|
|
54007
|
-
createBaseVNode("div",
|
|
54370
|
+
createBaseVNode("div", _hoisted_120$1, [createBaseVNode("button", {
|
|
54008
54371
|
type: "button",
|
|
54009
54372
|
class: "btn btn-secondary",
|
|
54010
54373
|
onClick: _cache[13] || (_cache[13] = ($event) => showCreateDatabase.value = false)
|
|
@@ -54013,7 +54376,26 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
54013
54376
|
class: "btn btn-primary",
|
|
54014
54377
|
onClick: createDatabase,
|
|
54015
54378
|
disabled: !newDatabase.value.name || creatingDatabase.value
|
|
54016
|
-
}, [creatingDatabase.value ? (openBlock(), createElementBlock("span",
|
|
54379
|
+
}, [creatingDatabase.value ? (openBlock(), createElementBlock("span", _hoisted_122$1)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(_ctx.$t("common.create")), 1)], 8, _hoisted_121$1)])
|
|
54380
|
+
])])])) : createCommentVNode("", true),
|
|
54381
|
+
showLogs.value ? (openBlock(), createElementBlock("div", _hoisted_123$1, [createBaseVNode("div", _hoisted_124$1, [createBaseVNode("div", _hoisted_125$1, [
|
|
54382
|
+
createBaseVNode("div", _hoisted_126$1, [createBaseVNode("h5", _hoisted_127$1, toDisplayString(_ctx.$t("connection.logsTitle")), 1), createBaseVNode("button", {
|
|
54383
|
+
type: "button",
|
|
54384
|
+
class: "btn-close",
|
|
54385
|
+
onClick: _cache[14] || (_cache[14] = ($event) => showLogs.value = false)
|
|
54386
|
+
})]),
|
|
54387
|
+
createBaseVNode("div", _hoisted_128, [loadingLogs.value ? (openBlock(), createElementBlock("div", _hoisted_129, [_cache[43] || (_cache[43] = createBaseVNode("span", { class: "spinner-border spinner-border-sm me-2" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("common.loading")), 1)])) : !connectionLogs.value.length ? (openBlock(), createElementBlock("div", _hoisted_130, toDisplayString(_ctx.$t("connection.logsEmpty")), 1)) : (openBlock(), createElementBlock("div", _hoisted_131, [createBaseVNode("table", _hoisted_132, [createBaseVNode("thead", null, [createBaseVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(logColumns.value, (col) => {
|
|
54388
|
+
return openBlock(), createElementBlock("th", { key: col }, toDisplayString(col), 1);
|
|
54389
|
+
}), 128))])]), createBaseVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(connectionLogs.value, (row, i) => {
|
|
54390
|
+
return openBlock(), createElementBlock("tr", { key: i }, [(openBlock(true), createElementBlock(Fragment, null, renderList(logColumns.value, (col) => {
|
|
54391
|
+
return openBlock(), createElementBlock("td", { key: col }, toDisplayString(formatLogCell(row, col)), 1);
|
|
54392
|
+
}), 128))]);
|
|
54393
|
+
}), 128))])])]))]),
|
|
54394
|
+
createBaseVNode("div", _hoisted_133, [createBaseVNode("button", {
|
|
54395
|
+
type: "button",
|
|
54396
|
+
class: "btn btn-secondary",
|
|
54397
|
+
onClick: _cache[15] || (_cache[15] = ($event) => showLogs.value = false)
|
|
54398
|
+
}, toDisplayString(_ctx.$t("common.close")), 1)])
|
|
54017
54399
|
])])])) : createCommentVNode("", true)
|
|
54018
54400
|
]);
|
|
54019
54401
|
};
|
|
@@ -54021,17 +54403,17 @@ var init_connection_detail_vue_vue_type_script_setup_true_lang = __esmMin((() =>
|
|
|
54021
54403
|
});
|
|
54022
54404
|
}));
|
|
54023
54405
|
//#endregion
|
|
54024
|
-
//#region src/platform/database/components/connection-detail.vue?vue&type=style&index=0&scoped=
|
|
54025
|
-
var
|
|
54406
|
+
//#region src/platform/database/components/connection-detail.vue?vue&type=style&index=0&scoped=0f93f920&lang.css
|
|
54407
|
+
var init_connection_detail_vue_vue_type_style_index_0_scoped_0f93f920_lang = __esmMin((() => {}));
|
|
54026
54408
|
//#endregion
|
|
54027
54409
|
//#region src/platform/database/components/connection-detail.vue
|
|
54028
54410
|
var connection_detail_default;
|
|
54029
54411
|
var init_connection_detail = __esmMin((() => {
|
|
54030
54412
|
init_connection_detail_vue_vue_type_script_setup_true_lang();
|
|
54031
54413
|
init_connection_detail_vue_vue_type_script_setup_true_lang();
|
|
54032
|
-
|
|
54414
|
+
init_connection_detail_vue_vue_type_style_index_0_scoped_0f93f920_lang();
|
|
54033
54415
|
init__plugin_vue_export_helper();
|
|
54034
|
-
connection_detail_default = /*#__PURE__*/ _plugin_vue_export_helper_default(connection_detail_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
54416
|
+
connection_detail_default = /*#__PURE__*/ _plugin_vue_export_helper_default(connection_detail_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0f93f920"]]);
|
|
54035
54417
|
}));
|
|
54036
54418
|
//#endregion
|
|
54037
54419
|
//#region src/typings/database-types.ts
|
|
@@ -55031,7 +55413,7 @@ var init_database_types$1 = __esmMin((() => {
|
|
|
55031
55413
|
label: "VARCHAR",
|
|
55032
55414
|
category: "string",
|
|
55033
55415
|
requiresLength: true,
|
|
55034
|
-
defaultLength:
|
|
55416
|
+
defaultLength: 255,
|
|
55035
55417
|
description: "可变长度字符串"
|
|
55036
55418
|
},
|
|
55037
55419
|
{
|
|
@@ -55053,7 +55435,7 @@ var init_database_types$1 = __esmMin((() => {
|
|
|
55053
55435
|
label: "NVARCHAR",
|
|
55054
55436
|
category: "string",
|
|
55055
55437
|
requiresLength: true,
|
|
55056
|
-
defaultLength:
|
|
55438
|
+
defaultLength: 255,
|
|
55057
55439
|
description: "Unicode可变长度字符串"
|
|
55058
55440
|
},
|
|
55059
55441
|
{
|
|
@@ -55075,7 +55457,7 @@ var init_database_types$1 = __esmMin((() => {
|
|
|
55075
55457
|
label: "VARBINARY",
|
|
55076
55458
|
category: "binary",
|
|
55077
55459
|
requiresLength: true,
|
|
55078
|
-
defaultLength:
|
|
55460
|
+
defaultLength: 255,
|
|
55079
55461
|
description: "可变长度二进制"
|
|
55080
55462
|
},
|
|
55081
55463
|
{
|
|
@@ -55177,159 +55559,108 @@ var init_database_types$1 = __esmMin((() => {
|
|
|
55177
55559
|
};
|
|
55178
55560
|
}));
|
|
55179
55561
|
//#endregion
|
|
55180
|
-
//#region src/utils/database-types.ts
|
|
55181
|
-
/**
|
|
55182
|
-
* 检查是否为数值类型
|
|
55183
|
-
*/
|
|
55184
|
-
function isNumericType(type) {
|
|
55185
|
-
return [
|
|
55186
|
-
"int",
|
|
55187
|
-
"integer",
|
|
55188
|
-
"tinyint",
|
|
55189
|
-
"smallint",
|
|
55190
|
-
"mediumint",
|
|
55191
|
-
"bigint",
|
|
55192
|
-
"decimal",
|
|
55193
|
-
"numeric",
|
|
55194
|
-
"float",
|
|
55195
|
-
"double",
|
|
55196
|
-
"real",
|
|
55197
|
-
"number",
|
|
55198
|
-
"smallserial",
|
|
55199
|
-
"serial",
|
|
55200
|
-
"bigserial",
|
|
55201
|
-
"money",
|
|
55202
|
-
"smallmoney",
|
|
55203
|
-
"binary_float",
|
|
55204
|
-
"binary_double"
|
|
55205
|
-
].some((t) => type.toLowerCase().includes(t));
|
|
55206
|
-
}
|
|
55207
|
-
/**
|
|
55208
|
-
* 检查是否为文本类型
|
|
55209
|
-
*/
|
|
55210
|
-
function isTextType(type) {
|
|
55211
|
-
return [
|
|
55212
|
-
"text",
|
|
55213
|
-
"longtext",
|
|
55214
|
-
"mediumtext",
|
|
55215
|
-
"tinytext",
|
|
55216
|
-
"clob",
|
|
55217
|
-
"nclob",
|
|
55218
|
-
"ntext"
|
|
55219
|
-
].some((t) => type.toLowerCase().includes(t));
|
|
55220
|
-
}
|
|
55221
|
-
/**
|
|
55222
|
-
* 检查是否为日期时间类型
|
|
55223
|
-
*/
|
|
55224
|
-
function isDateTimeType(type) {
|
|
55225
|
-
return [
|
|
55226
|
-
"date",
|
|
55227
|
-
"datetime",
|
|
55228
|
-
"timestamp",
|
|
55229
|
-
"time",
|
|
55230
|
-
"year",
|
|
55231
|
-
"time with time zone",
|
|
55232
|
-
"timestamp with time zone",
|
|
55233
|
-
"timestamp with local time zone",
|
|
55234
|
-
"interval",
|
|
55235
|
-
"datetimeoffset",
|
|
55236
|
-
"datetime2",
|
|
55237
|
-
"smalldatetime"
|
|
55238
|
-
].some((t) => type.toLowerCase().includes(t));
|
|
55239
|
-
}
|
|
55240
|
-
/**
|
|
55241
|
-
* 检查是否为布尔类型
|
|
55242
|
-
*/
|
|
55243
|
-
function isBooleanType(type) {
|
|
55244
|
-
return [
|
|
55245
|
-
"boolean",
|
|
55246
|
-
"bool",
|
|
55247
|
-
"bit",
|
|
55248
|
-
"tinyint(1)"
|
|
55249
|
-
].some((t) => type.toLowerCase().includes(t));
|
|
55250
|
-
}
|
|
55251
|
-
/**
|
|
55252
|
-
* 检查是否为JSON类型
|
|
55253
|
-
*/
|
|
55254
|
-
function isJsonType(type) {
|
|
55255
|
-
return ["json", "jsonb"].includes(type.toLowerCase());
|
|
55256
|
-
}
|
|
55257
|
-
/**
|
|
55258
|
-
* 检查是否为数组类型
|
|
55259
|
-
*/
|
|
55260
|
-
function isArrayType(type) {
|
|
55261
|
-
return type.toLowerCase().endsWith("[]");
|
|
55262
|
-
}
|
|
55263
|
-
var init_database_types = __esmMin((() => {
|
|
55264
|
-
init_database_types$1();
|
|
55265
|
-
}));
|
|
55266
|
-
//#endregion
|
|
55267
55562
|
//#region src/platform/database/components/table-editor.vue?vue&type=script&setup=true&lang.ts
|
|
55268
|
-
var _hoisted_1$6, _hoisted_2$6, _hoisted_3$6, _hoisted_4$6, _hoisted_5$6, _hoisted_6$6, _hoisted_7$6, _hoisted_8$6, _hoisted_9$6, _hoisted_10$6, _hoisted_11$6, _hoisted_12$6, _hoisted_13$6, _hoisted_14$6, _hoisted_15$6, _hoisted_16$6, _hoisted_17$6, _hoisted_18$6, _hoisted_19$6, _hoisted_20$6, _hoisted_21$6, _hoisted_22$6, _hoisted_23$6, _hoisted_24$6, _hoisted_25$6, _hoisted_26$5, _hoisted_27$5, _hoisted_28$5, _hoisted_29$5, _hoisted_30$4, _hoisted_31$4, _hoisted_32$4, _hoisted_33$4, _hoisted_34$4, _hoisted_35$4, _hoisted_36$4, _hoisted_37$4, _hoisted_38$4, _hoisted_39$4, _hoisted_40$4, _hoisted_41$4, _hoisted_42$4, _hoisted_43$4, _hoisted_44$4, _hoisted_45$4, _hoisted_46$4, _hoisted_47$
|
|
55563
|
+
var _hoisted_1$6, _hoisted_2$6, _hoisted_3$6, _hoisted_4$6, _hoisted_5$6, _hoisted_6$6, _hoisted_7$6, _hoisted_8$6, _hoisted_9$6, _hoisted_10$6, _hoisted_11$6, _hoisted_12$6, _hoisted_13$6, _hoisted_14$6, _hoisted_15$6, _hoisted_16$6, _hoisted_17$6, _hoisted_18$6, _hoisted_19$6, _hoisted_20$6, _hoisted_21$6, _hoisted_22$6, _hoisted_23$6, _hoisted_24$6, _hoisted_25$6, _hoisted_26$5, _hoisted_27$5, _hoisted_28$5, _hoisted_29$5, _hoisted_30$4, _hoisted_31$4, _hoisted_32$4, _hoisted_33$4, _hoisted_34$4, _hoisted_35$4, _hoisted_36$4, _hoisted_37$4, _hoisted_38$4, _hoisted_39$4, _hoisted_40$4, _hoisted_41$4, _hoisted_42$4, _hoisted_43$4, _hoisted_44$4, _hoisted_45$4, _hoisted_46$4, _hoisted_47$3, _hoisted_48$3, _hoisted_49$3, _hoisted_50$3, _hoisted_51$3, _hoisted_52$3, _hoisted_53$3, _hoisted_54$3, _hoisted_55$3, _hoisted_56$3, CUSTOM_TYPE_VALUE, table_editor_vue_vue_type_script_setup_true_lang_default;
|
|
55269
55564
|
var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
55270
55565
|
init_vue_runtime_esm_bundler();
|
|
55271
55566
|
init_vue_i18n();
|
|
55272
55567
|
init_database();
|
|
55273
55568
|
init_modal();
|
|
55274
55569
|
init_database_types$1();
|
|
55275
|
-
|
|
55276
|
-
|
|
55277
|
-
|
|
55278
|
-
|
|
55279
|
-
|
|
55280
|
-
|
|
55281
|
-
|
|
55282
|
-
|
|
55283
|
-
|
|
55284
|
-
|
|
55285
|
-
|
|
55286
|
-
|
|
55287
|
-
|
|
55288
|
-
|
|
55289
|
-
|
|
55290
|
-
|
|
55291
|
-
|
|
55292
|
-
|
|
55293
|
-
|
|
55294
|
-
|
|
55295
|
-
|
|
55296
|
-
|
|
55297
|
-
|
|
55298
|
-
|
|
55299
|
-
|
|
55300
|
-
|
|
55301
|
-
|
|
55570
|
+
_hoisted_1$6 = {
|
|
55571
|
+
key: 0,
|
|
55572
|
+
class: "modal fade show",
|
|
55573
|
+
style: {
|
|
55574
|
+
"display": "block",
|
|
55575
|
+
"background-color": "rgba(0,0,0,0.5)"
|
|
55576
|
+
}
|
|
55577
|
+
};
|
|
55578
|
+
_hoisted_2$6 = { class: "modal-content" };
|
|
55579
|
+
_hoisted_3$6 = { class: "modal-header" };
|
|
55580
|
+
_hoisted_4$6 = { class: "modal-title" };
|
|
55581
|
+
_hoisted_5$6 = { class: "modal-body" };
|
|
55582
|
+
_hoisted_6$6 = { class: "table-info-section mb-4" };
|
|
55583
|
+
_hoisted_7$6 = { class: "section-title" };
|
|
55584
|
+
_hoisted_8$6 = { class: "row" };
|
|
55585
|
+
_hoisted_9$6 = { class: "col-md-6" };
|
|
55586
|
+
_hoisted_10$6 = { class: "mb-3" };
|
|
55587
|
+
_hoisted_11$6 = { class: "form-label" };
|
|
55588
|
+
_hoisted_12$6 = ["disabled", "placeholder"];
|
|
55589
|
+
_hoisted_13$6 = { class: "col-md-6" };
|
|
55590
|
+
_hoisted_14$6 = { class: "mb-3" };
|
|
55591
|
+
_hoisted_15$6 = { class: "form-label" };
|
|
55592
|
+
_hoisted_16$6 = [
|
|
55593
|
+
"disabled",
|
|
55594
|
+
"title",
|
|
55595
|
+
"placeholder"
|
|
55596
|
+
];
|
|
55597
|
+
_hoisted_17$6 = { class: "columns-section" };
|
|
55598
|
+
_hoisted_18$6 = { class: "section-header d-flex justify-content-between align-items-center mb-3" };
|
|
55599
|
+
_hoisted_19$6 = { class: "section-title mb-0" };
|
|
55600
|
+
_hoisted_20$6 = { class: "table-responsive" };
|
|
55601
|
+
_hoisted_21$6 = { class: "table table-sm table-bordered" };
|
|
55602
|
+
_hoisted_22$6 = { width: "120" };
|
|
55603
|
+
_hoisted_23$6 = { width: "140" };
|
|
55604
|
+
_hoisted_24$6 = { width: "120" };
|
|
55605
|
+
_hoisted_25$6 = { width: "80" };
|
|
55606
|
+
_hoisted_26$5 = { width: "100" };
|
|
55302
55607
|
_hoisted_27$5 = { width: "80" };
|
|
55303
|
-
_hoisted_28$5 = { width: "
|
|
55304
|
-
_hoisted_29$5 =
|
|
55305
|
-
_hoisted_30$4 = [
|
|
55306
|
-
|
|
55307
|
-
|
|
55308
|
-
|
|
55309
|
-
|
|
55608
|
+
_hoisted_28$5 = { width: "80" };
|
|
55609
|
+
_hoisted_29$5 = { width: "100" };
|
|
55610
|
+
_hoisted_30$4 = [
|
|
55611
|
+
"onUpdate:modelValue",
|
|
55612
|
+
"disabled",
|
|
55613
|
+
"title",
|
|
55614
|
+
"placeholder"
|
|
55615
|
+
];
|
|
55616
|
+
_hoisted_31$4 = ["onUpdate:modelValue"];
|
|
55617
|
+
_hoisted_32$4 = { value: "" };
|
|
55618
|
+
_hoisted_33$4 = ["label"];
|
|
55619
|
+
_hoisted_34$4 = ["value"];
|
|
55620
|
+
_hoisted_35$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55621
|
+
_hoisted_36$4 = {
|
|
55310
55622
|
key: 0,
|
|
55311
55623
|
class: "input-group input-group-sm"
|
|
55312
55624
|
};
|
|
55313
|
-
_hoisted_35$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55314
|
-
_hoisted_36$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55315
55625
|
_hoisted_37$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55316
|
-
_hoisted_38$4 =
|
|
55626
|
+
_hoisted_38$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55627
|
+
_hoisted_39$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55628
|
+
_hoisted_40$4 = {
|
|
55317
55629
|
key: 1,
|
|
55318
55630
|
class: "text-muted"
|
|
55319
55631
|
};
|
|
55320
|
-
|
|
55321
|
-
|
|
55322
|
-
|
|
55323
|
-
_hoisted_42$4 = { class: "form-check" };
|
|
55324
|
-
_hoisted_43$4 = ["onUpdate:modelValue", "onChange"];
|
|
55632
|
+
_hoisted_41$4 = { class: "form-check" };
|
|
55633
|
+
_hoisted_42$4 = ["onUpdate:modelValue"];
|
|
55634
|
+
_hoisted_43$4 = ["onUpdate:modelValue", "placeholder"];
|
|
55325
55635
|
_hoisted_44$4 = { class: "form-check" };
|
|
55326
|
-
_hoisted_45$4 = [
|
|
55327
|
-
|
|
55328
|
-
|
|
55329
|
-
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55636
|
+
_hoisted_45$4 = [
|
|
55637
|
+
"onUpdate:modelValue",
|
|
55638
|
+
"disabled",
|
|
55639
|
+
"title",
|
|
55640
|
+
"onChange"
|
|
55641
|
+
];
|
|
55642
|
+
_hoisted_46$4 = { class: "form-check" };
|
|
55643
|
+
_hoisted_47$3 = [
|
|
55644
|
+
"onUpdate:modelValue",
|
|
55645
|
+
"disabled",
|
|
55646
|
+
"title",
|
|
55647
|
+
"onChange"
|
|
55648
|
+
];
|
|
55649
|
+
_hoisted_48$3 = [
|
|
55650
|
+
"onUpdate:modelValue",
|
|
55651
|
+
"disabled",
|
|
55652
|
+
"title",
|
|
55653
|
+
"placeholder"
|
|
55654
|
+
];
|
|
55655
|
+
_hoisted_49$3 = ["onClick", "disabled"];
|
|
55656
|
+
_hoisted_50$3 = { class: "sql-preview-section mt-4" };
|
|
55657
|
+
_hoisted_51$3 = { class: "d-flex align-items-center justify-content-between" };
|
|
55658
|
+
_hoisted_52$3 = { class: "section-title mb-0" };
|
|
55659
|
+
_hoisted_53$3 = ["disabled"];
|
|
55660
|
+
_hoisted_54$3 = { class: "sql-preview mt-2" };
|
|
55661
|
+
_hoisted_55$3 = { class: "modal-footer" };
|
|
55662
|
+
_hoisted_56$3 = ["disabled", "title"];
|
|
55663
|
+
CUSTOM_TYPE_VALUE = "__custom__";
|
|
55333
55664
|
table_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
55334
55665
|
__name: "table-editor",
|
|
55335
55666
|
props: {
|
|
@@ -55346,6 +55677,10 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55346
55677
|
const emit = __emit;
|
|
55347
55678
|
const databaseService = new DatabaseService();
|
|
55348
55679
|
const { t } = useI18n();
|
|
55680
|
+
function rawType(column) {
|
|
55681
|
+
if (!column) return "";
|
|
55682
|
+
return column.type === CUSTOM_TYPE_VALUE ? column.customType || "" : column.type || "";
|
|
55683
|
+
}
|
|
55349
55684
|
const columnTypes = computed(() => {
|
|
55350
55685
|
if (!props.connection) return [];
|
|
55351
55686
|
return getColumnTypesByName(props.connection.type);
|
|
@@ -55364,6 +55699,7 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55364
55699
|
columns: [{
|
|
55365
55700
|
name: "",
|
|
55366
55701
|
type: "",
|
|
55702
|
+
customType: "",
|
|
55367
55703
|
length: "",
|
|
55368
55704
|
precision: null,
|
|
55369
55705
|
scale: null,
|
|
@@ -55374,11 +55710,6 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55374
55710
|
comment: ""
|
|
55375
55711
|
}]
|
|
55376
55712
|
});
|
|
55377
|
-
const originalTableData = ref({
|
|
55378
|
-
tableName: "",
|
|
55379
|
-
tableComment: "",
|
|
55380
|
-
columns: []
|
|
55381
|
-
});
|
|
55382
55713
|
function parseColumnType(typeStr) {
|
|
55383
55714
|
const result = { baseType: typeStr };
|
|
55384
55715
|
if (!typeStr) return result;
|
|
@@ -55400,10 +55731,13 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55400
55731
|
tableName: props.table.name || "",
|
|
55401
55732
|
tableComment: props.table.comment || "",
|
|
55402
55733
|
columns: columns.map((col) => {
|
|
55403
|
-
const
|
|
55734
|
+
const rawColType = col.type || "";
|
|
55735
|
+
const parsed = parseColumnType(rawColType);
|
|
55736
|
+
const isNonNumericParamType = /^[a-zA-Z\s]+\([^)]*'[^)]*\)$/.test(rawColType);
|
|
55404
55737
|
return {
|
|
55405
55738
|
name: col.name || "",
|
|
55406
|
-
type: parsed.baseType,
|
|
55739
|
+
type: isNonNumericParamType ? CUSTOM_TYPE_VALUE : parsed.baseType,
|
|
55740
|
+
customType: isNonNumericParamType ? rawColType : col.customType || "",
|
|
55407
55741
|
length: col.length || parsed.length || "",
|
|
55408
55742
|
precision: col.precision || parsed.precision || null,
|
|
55409
55743
|
scale: col.scale || parsed.scale || null,
|
|
@@ -55416,14 +55750,15 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55416
55750
|
}) || []
|
|
55417
55751
|
};
|
|
55418
55752
|
formData.value = { ...tableData };
|
|
55419
|
-
originalTableData.value = JSON.parse(JSON.stringify(tableData));
|
|
55420
55753
|
} else {
|
|
55754
|
+
const isCreateWithPrefill = props.mode === "create" && props.table;
|
|
55421
55755
|
formData.value = {
|
|
55422
|
-
tableName: "",
|
|
55423
|
-
tableComment: "",
|
|
55756
|
+
tableName: isCreateWithPrefill ? props.table.name || "" : "",
|
|
55757
|
+
tableComment: isCreateWithPrefill ? props.table.comment || "" : "",
|
|
55424
55758
|
columns: [{
|
|
55425
55759
|
name: "",
|
|
55426
55760
|
type: "",
|
|
55761
|
+
customType: "",
|
|
55427
55762
|
length: "",
|
|
55428
55763
|
precision: null,
|
|
55429
55764
|
scale: null,
|
|
@@ -55434,43 +55769,98 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55434
55769
|
comment: ""
|
|
55435
55770
|
}]
|
|
55436
55771
|
};
|
|
55437
|
-
originalTableData.value = {
|
|
55438
|
-
tableName: "",
|
|
55439
|
-
tableComment: "",
|
|
55440
|
-
columns: []
|
|
55441
|
-
};
|
|
55442
55772
|
}
|
|
55443
55773
|
}
|
|
55444
|
-
|
|
55445
|
-
|
|
55446
|
-
|
|
55447
|
-
|
|
55448
|
-
|
|
55449
|
-
|
|
55450
|
-
|
|
55451
|
-
|
|
55452
|
-
|
|
55453
|
-
|
|
55454
|
-
|
|
55455
|
-
|
|
55456
|
-
|
|
55457
|
-
|
|
55458
|
-
|
|
55459
|
-
|
|
55460
|
-
|
|
55461
|
-
|
|
55462
|
-
|
|
55463
|
-
|
|
55464
|
-
|
|
55465
|
-
|
|
55466
|
-
|
|
55774
|
+
/**
|
|
55775
|
+
* 目标态组装:UI 表单 -> TableSpec(前端唯一的职责)。
|
|
55776
|
+
* 原始态由后端实时读取,diff/SQL 生成全部在后端 schema 引擎完成——
|
|
55777
|
+
* 前端不再持有"旧结构缓存",缓存过期导致的错误语句从机制上消除。
|
|
55778
|
+
*/
|
|
55779
|
+
function buildTableSpec() {
|
|
55780
|
+
const columns = formData.value.columns.filter((col) => col.name && rawType(col)).map((col) => {
|
|
55781
|
+
const raw = rawType(col).trim();
|
|
55782
|
+
const isCustom = col.type === CUSTOM_TYPE_VALUE;
|
|
55783
|
+
const hasDefault = col.defaultValue !== "" && col.defaultValue !== null && col.defaultValue !== void 0;
|
|
55784
|
+
const spec = {
|
|
55785
|
+
name: col.name.trim(),
|
|
55786
|
+
type: isCustom ? raw : col.type,
|
|
55787
|
+
nullable: col.nullable,
|
|
55788
|
+
hasDefault,
|
|
55789
|
+
autoIncrement: !!col.isAutoIncrement
|
|
55790
|
+
};
|
|
55791
|
+
if (isCustom) spec.customType = raw;
|
|
55792
|
+
else {
|
|
55793
|
+
if (col.length !== "" && col.length !== null && col.length !== void 0) spec.length = col.length;
|
|
55794
|
+
if (col.precision !== null && col.precision !== void 0 && col.precision !== "") spec.precision = col.precision;
|
|
55795
|
+
if (col.scale !== null && col.scale !== void 0 && col.scale !== "") spec.scale = col.scale;
|
|
55796
|
+
}
|
|
55797
|
+
if (hasDefault) spec.defaultValue = String(col.defaultValue);
|
|
55798
|
+
if (col.comment) spec.comment = col.comment;
|
|
55799
|
+
return spec;
|
|
55467
55800
|
});
|
|
55468
|
-
return
|
|
55801
|
+
return {
|
|
55802
|
+
name: formData.value.tableName.trim(),
|
|
55803
|
+
comment: formData.value.tableComment ?? "",
|
|
55804
|
+
columns,
|
|
55805
|
+
primaryKey: formData.value.columns.filter((c) => c.isPrimary && c.name).map((c) => c.name.trim())
|
|
55806
|
+
};
|
|
55807
|
+
}
|
|
55808
|
+
const previewSql = ref("-- 完善表单后将在此显示后端生成的 SQL");
|
|
55809
|
+
const caps = ref(null);
|
|
55810
|
+
let previewTimer = null;
|
|
55811
|
+
let previewSeq = 0;
|
|
55812
|
+
async function refreshPreview() {
|
|
55813
|
+
if (!props.connection?.id) return;
|
|
55814
|
+
if (props.mode === "edit" && !props.table?.name) return;
|
|
55815
|
+
if (!formData.value.tableName) return;
|
|
55816
|
+
if (formData.value.columns.some((col) => col.name && !rawType(col))) {
|
|
55817
|
+
previewSql.value = "-- 请完善字段信息(列名与类型)后再查看 SQL";
|
|
55818
|
+
return;
|
|
55819
|
+
}
|
|
55820
|
+
const seq = ++previewSeq;
|
|
55821
|
+
const spec = buildTableSpec();
|
|
55822
|
+
try {
|
|
55823
|
+
const data = props.mode === "create" ? await databaseService.previewCreateTable(props.connection.id, props.database, spec) : await databaseService.previewAlterTable(props.connection.id, props.database, props.table.name, spec);
|
|
55824
|
+
if (seq !== previewSeq) return;
|
|
55825
|
+
if (data?.capabilities) caps.value = data.capabilities;
|
|
55826
|
+
previewSql.value = data?.preview || (props.mode === "create" ? "-- 完善表单后将在此显示建表 SQL" : "没有检测到任何修改");
|
|
55827
|
+
} catch (error) {
|
|
55828
|
+
if (seq !== previewSeq) return;
|
|
55829
|
+
previewSql.value = `预览失败: ${error?.message || error}`;
|
|
55830
|
+
}
|
|
55831
|
+
}
|
|
55832
|
+
watch(formData, () => {
|
|
55833
|
+
if (previewTimer) clearTimeout(previewTimer);
|
|
55834
|
+
previewTimer = setTimeout(refreshPreview, 500);
|
|
55835
|
+
}, { deep: true });
|
|
55836
|
+
const tableCommentDisabled = computed(() => caps.value?.tableComment === false);
|
|
55837
|
+
const columnCommentDisabled = computed(() => caps.value?.columnComment === false);
|
|
55838
|
+
const pkDisabled = computed(() => props.mode === "edit" && caps.value?.alterPrimaryKey === false);
|
|
55839
|
+
const renameDisabled = computed(() => props.mode === "edit" && caps.value?.renameColumn === false);
|
|
55840
|
+
const submitDisabled = computed(() => props.mode === "create" && caps.value?.createTable === false || props.mode === "edit" && caps.value?.alterStrategy === "unsupported");
|
|
55841
|
+
const submitDisabledHint = computed(() => {
|
|
55842
|
+
if (props.mode === "create" && caps.value?.createTable === false) return "该数据库类型不支持通过 SQL 建表";
|
|
55843
|
+
if (props.mode === "edit" && caps.value?.alterStrategy === "unsupported") return "该数据库类型不支持在线修改表结构";
|
|
55844
|
+
return "";
|
|
55845
|
+
});
|
|
55846
|
+
const refreshingTables = ref(false);
|
|
55847
|
+
async function refreshTableList() {
|
|
55848
|
+
if (!props.connection?.id) return;
|
|
55849
|
+
refreshingTables.value = true;
|
|
55850
|
+
try {
|
|
55851
|
+
await databaseService.refreshTableCache(props.connection.id, props.database);
|
|
55852
|
+
await refreshPreview();
|
|
55853
|
+
} catch (error) {
|
|
55854
|
+
await modal.warning(`刷新表列表失败: ${error?.message || error}`);
|
|
55855
|
+
} finally {
|
|
55856
|
+
refreshingTables.value = false;
|
|
55857
|
+
}
|
|
55469
55858
|
}
|
|
55470
55859
|
function addColumn() {
|
|
55471
55860
|
formData.value.columns.push({
|
|
55472
55861
|
name: "",
|
|
55473
55862
|
type: "",
|
|
55863
|
+
customType: "",
|
|
55474
55864
|
length: "",
|
|
55475
55865
|
precision: null,
|
|
55476
55866
|
scale: null,
|
|
@@ -55480,186 +55870,23 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55480
55870
|
isAutoIncrement: false,
|
|
55481
55871
|
comment: ""
|
|
55482
55872
|
});
|
|
55873
|
+
refreshPreview();
|
|
55483
55874
|
}
|
|
55484
55875
|
function removeColumn(index) {
|
|
55485
|
-
if (formData.value.columns.length > 1)
|
|
55876
|
+
if (formData.value.columns.length > 1) {
|
|
55877
|
+
formData.value.columns.splice(index, 1);
|
|
55878
|
+
refreshPreview();
|
|
55879
|
+
}
|
|
55486
55880
|
}
|
|
55487
|
-
function onPrimaryKeyChange(column
|
|
55488
|
-
if (column.isPrimary) formData.value.columns.forEach((col, idx) => {
|
|
55489
|
-
if (idx !== index) col.isPrimary = false;
|
|
55490
|
-
});
|
|
55881
|
+
function onPrimaryKeyChange(column) {
|
|
55491
55882
|
if (!column.isPrimary) column.isAutoIncrement = false;
|
|
55492
55883
|
}
|
|
55493
|
-
function
|
|
55494
|
-
if (!
|
|
55495
|
-
|
|
55496
|
-
|
|
55497
|
-
|
|
55498
|
-
|
|
55499
|
-
case "mysql": return `\`${name}\``;
|
|
55500
|
-
case "postgres": return `"${name}"`;
|
|
55501
|
-
case "sqlite": return `"${name}"`;
|
|
55502
|
-
case "oracle": return `"${name.toUpperCase()}"`;
|
|
55503
|
-
case "mssql": return `[${name}]`;
|
|
55504
|
-
default: return `"${name}"`;
|
|
55505
|
-
}
|
|
55506
|
-
};
|
|
55507
|
-
const columnsSQL = formData.value.columns.map((col) => {
|
|
55508
|
-
if (!col.name || !col.type) return "";
|
|
55509
|
-
let sql = `${quoteIdentifier(col.name)} ${col.type}`;
|
|
55510
|
-
if (!col.type.includes("(") && col.length && (needsLength(col) || col.type.includes("CHAR"))) sql += `(${col.length})`;
|
|
55511
|
-
else if (!col.type.includes("(") && col.precision) if (col.scale) sql += `(${col.precision},${col.scale})`;
|
|
55512
|
-
else sql += `(${col.precision})`;
|
|
55513
|
-
const isSqliteAutoIncrementPrimary = props.connection?.type.toLowerCase() === "sqlite" && col.isAutoIncrement && col.isPrimary;
|
|
55514
|
-
if (!col.nullable && !isSqliteAutoIncrementPrimary) sql += " NOT NULL";
|
|
55515
|
-
if (col.defaultValue) sql += ` DEFAULT ${formatDefaultValue(col.defaultValue, col.type)}`;
|
|
55516
|
-
if (col.isAutoIncrement) switch (props.connection?.type.toLowerCase()) {
|
|
55517
|
-
case "mysql":
|
|
55518
|
-
sql += " AUTO_INCREMENT";
|
|
55519
|
-
break;
|
|
55520
|
-
case "postgres":
|
|
55521
|
-
if (col.type.toLowerCase().includes("serial") || col.type.toLowerCase().includes("bigserial")) {} else sql += " GENERATED ALWAYS AS IDENTITY";
|
|
55522
|
-
break;
|
|
55523
|
-
case "sqlite":
|
|
55524
|
-
if (col.type.toUpperCase() === "INT") sql = sql.replace(/\bINT\b/, "INTEGER");
|
|
55525
|
-
if (col.isPrimary) sql += " PRIMARY KEY AUTOINCREMENT";
|
|
55526
|
-
else sql += " AUTOINCREMENT";
|
|
55527
|
-
break;
|
|
55528
|
-
case "oracle": break;
|
|
55529
|
-
case "mssql":
|
|
55530
|
-
sql += " IDENTITY(1,1)";
|
|
55531
|
-
break;
|
|
55532
|
-
}
|
|
55533
|
-
if (col.comment) switch (props.connection?.type.toLowerCase()) {
|
|
55534
|
-
case "mysql":
|
|
55535
|
-
sql += ` COMMENT '${col.comment}'`;
|
|
55536
|
-
break;
|
|
55537
|
-
case "postgres": break;
|
|
55538
|
-
case "sqlite": break;
|
|
55539
|
-
case "oracle":
|
|
55540
|
-
sql += ` COMMENT '${col.comment}'`;
|
|
55541
|
-
break;
|
|
55542
|
-
case "mssql": break;
|
|
55543
|
-
}
|
|
55544
|
-
return sql;
|
|
55545
|
-
}).filter((sql) => sql).join(",\n ");
|
|
55546
|
-
const primaryKeys = formData.value.columns.filter((col) => col.isPrimary).map((col) => quoteIdentifier(col.name));
|
|
55547
|
-
let sql = `CREATE TABLE ${quoteIdentifier(formData.value.tableName)} (\n ${columnsSQL}`;
|
|
55548
|
-
const hasSqliteAutoIncrementPrimary = props.connection?.type.toLowerCase() === "sqlite" && formData.value.columns.some((col) => col.isAutoIncrement && col.isPrimary);
|
|
55549
|
-
if (primaryKeys.length > 0 && !hasSqliteAutoIncrementPrimary) sql += `,\n PRIMARY KEY (${primaryKeys.join(", ")})`;
|
|
55550
|
-
sql += "\n)";
|
|
55551
|
-
switch (props.connection?.type.toLowerCase()) {
|
|
55552
|
-
case "mysql":
|
|
55553
|
-
if (formData.value.tableComment) sql += ` COMMENT='${formData.value.tableComment}'`;
|
|
55554
|
-
sql += " ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
|
|
55555
|
-
break;
|
|
55556
|
-
case "postgres": break;
|
|
55557
|
-
case "oracle":
|
|
55558
|
-
if (formData.value.tableComment) sql += ` COMMENT '${formData.value.tableComment}'`;
|
|
55559
|
-
break;
|
|
55560
|
-
case "mssql": break;
|
|
55561
|
-
}
|
|
55562
|
-
if (props.connection?.type.toLowerCase() === "postgres") {
|
|
55563
|
-
const commentStatements = [];
|
|
55564
|
-
if (formData.value.tableComment) commentStatements.push(`COMMENT ON TABLE ${quoteIdentifier(formData.value.tableName)} IS '${formData.value.tableComment}'`);
|
|
55565
|
-
formData.value.columns.forEach((col) => {
|
|
55566
|
-
if (col.comment) commentStatements.push(`COMMENT ON COLUMN ${quoteIdentifier(formData.value.tableName)}.${quoteIdentifier(col.name)} IS '${col.comment}'`);
|
|
55567
|
-
});
|
|
55568
|
-
if (commentStatements.length > 0) sql += ";\n" + commentStatements.join(";\n");
|
|
55569
|
-
}
|
|
55570
|
-
return sql;
|
|
55571
|
-
} else {
|
|
55572
|
-
const quoteIdentifier = (name) => {
|
|
55573
|
-
if (!props.connection) return `"${name}"`;
|
|
55574
|
-
switch (props.connection.type.toLowerCase()) {
|
|
55575
|
-
case "mysql": return `\`${name}\``;
|
|
55576
|
-
case "postgres": return `"${name}"`;
|
|
55577
|
-
case "sqlite": return `"${name}"`;
|
|
55578
|
-
case "oracle": return `"${name.toUpperCase()}"`;
|
|
55579
|
-
case "mssql": return `[${name}]`;
|
|
55580
|
-
default: return `"${name}"`;
|
|
55581
|
-
}
|
|
55582
|
-
};
|
|
55583
|
-
const sqlStatements = [];
|
|
55584
|
-
const tableName = formData.value.tableName;
|
|
55585
|
-
if (formData.value.tableComment) switch (props.connection?.type.toLowerCase()) {
|
|
55586
|
-
case "mysql":
|
|
55587
|
-
sqlStatements.push(`ALTER TABLE ${quoteIdentifier(tableName)} COMMENT='${formData.value.tableComment}'`);
|
|
55588
|
-
break;
|
|
55589
|
-
case "postgres":
|
|
55590
|
-
sqlStatements.push(`COMMENT ON TABLE ${quoteIdentifier(tableName)} IS '${formData.value.tableComment}'`);
|
|
55591
|
-
break;
|
|
55592
|
-
case "oracle":
|
|
55593
|
-
sqlStatements.push(`COMMENT ON TABLE ${quoteIdentifier(tableName)} IS '${formData.value.tableComment}'`);
|
|
55594
|
-
break;
|
|
55595
|
-
case "mssql":
|
|
55596
|
-
sqlStatements.push(`EXEC sp_addextendedproperty 'MS_Description', '${formData.value.tableComment}', 'SCHEMA', 'dbo', 'TABLE', '${tableName}'`);
|
|
55597
|
-
break;
|
|
55598
|
-
}
|
|
55599
|
-
formData.value.columns.forEach((col) => {
|
|
55600
|
-
if (!col.name || !col.type) return;
|
|
55601
|
-
let columnSQL = `${quoteIdentifier(col.name)} ${col.type}`;
|
|
55602
|
-
if (!col.type.includes("(") && col.length && (needsLength(col) || col.type.includes("CHAR"))) columnSQL += `(${col.length})`;
|
|
55603
|
-
else if (!col.type.includes("(") && col.precision) if (col.scale) columnSQL += `(${col.precision},${col.scale})`;
|
|
55604
|
-
else columnSQL += `(${col.precision})`;
|
|
55605
|
-
if (!col.nullable) columnSQL += " NOT NULL";
|
|
55606
|
-
else columnSQL += " NULL";
|
|
55607
|
-
if (col.defaultValue) columnSQL += ` DEFAULT ${formatDefaultValue(col.defaultValue, col.type)}`;
|
|
55608
|
-
let commentStatement = "";
|
|
55609
|
-
if (col.comment) switch (props.connection?.type.toLowerCase()) {
|
|
55610
|
-
case "mysql":
|
|
55611
|
-
columnSQL += ` COMMENT '${col.comment}'`;
|
|
55612
|
-
break;
|
|
55613
|
-
case "postgres":
|
|
55614
|
-
commentStatement = `COMMENT ON COLUMN ${quoteIdentifier(tableName)}.${quoteIdentifier(col.name)} IS '${col.comment}'`;
|
|
55615
|
-
break;
|
|
55616
|
-
case "oracle":
|
|
55617
|
-
columnSQL += ` COMMENT '${col.comment}'`;
|
|
55618
|
-
break;
|
|
55619
|
-
case "mssql":
|
|
55620
|
-
commentStatement = `EXEC sp_addextendedproperty 'MS_Description', '${col.comment}', 'SCHEMA', 'dbo', 'TABLE', '${tableName}', 'COLUMN', '${col.name}'`;
|
|
55621
|
-
break;
|
|
55622
|
-
}
|
|
55623
|
-
switch (props.connection?.type.toLowerCase()) {
|
|
55624
|
-
case "mysql":
|
|
55625
|
-
sqlStatements.push(`ALTER TABLE ${quoteIdentifier(tableName)} MODIFY COLUMN ${columnSQL}`);
|
|
55626
|
-
break;
|
|
55627
|
-
case "postgres":
|
|
55628
|
-
case "mssql":
|
|
55629
|
-
sqlStatements.push(`ALTER TABLE ${quoteIdentifier(tableName)} ALTER COLUMN ${columnSQL}`);
|
|
55630
|
-
break;
|
|
55631
|
-
case "oracle":
|
|
55632
|
-
sqlStatements.push(`ALTER TABLE ${quoteIdentifier(tableName)} MODIFY ${columnSQL}`);
|
|
55633
|
-
break;
|
|
55634
|
-
case "sqlite":
|
|
55635
|
-
sqlStatements.push(`-- SQLite 不支持直接修改列,需要重建表`);
|
|
55636
|
-
break;
|
|
55637
|
-
}
|
|
55638
|
-
if (commentStatement) sqlStatements.push(commentStatement);
|
|
55639
|
-
});
|
|
55640
|
-
const primaryKeys = formData.value.columns.filter((col) => col.isPrimary).map((col) => quoteIdentifier(col.name));
|
|
55641
|
-
if (primaryKeys.length > 0) {
|
|
55642
|
-
sqlStatements.push(`ALTER TABLE ${quoteIdentifier(tableName)} DROP PRIMARY KEY`);
|
|
55643
|
-
sqlStatements.push(`ALTER TABLE ${quoteIdentifier(tableName)} ADD PRIMARY KEY (${primaryKeys.join(", ")})`);
|
|
55644
|
-
}
|
|
55645
|
-
return sqlStatements.join(";\n") + ";";
|
|
55646
|
-
}
|
|
55647
|
-
}
|
|
55648
|
-
function formatDefaultValue(value, type) {
|
|
55649
|
-
if (value === null || value === void 0 || value === "") return "NULL";
|
|
55650
|
-
const lowerValue = String(value).toLowerCase();
|
|
55651
|
-
if ([
|
|
55652
|
-
"current_timestamp",
|
|
55653
|
-
"now()",
|
|
55654
|
-
"current_date",
|
|
55655
|
-
"current_time",
|
|
55656
|
-
"localtimestamp",
|
|
55657
|
-
"localtime"
|
|
55658
|
-
].includes(lowerValue)) return value;
|
|
55659
|
-
const lowerType = type.toLowerCase();
|
|
55660
|
-
if (isNumericType(lowerType) && !isNaN(value)) return String(value);
|
|
55661
|
-
if (isBooleanType(lowerType)) return value ? "TRUE" : "FALSE";
|
|
55662
|
-
return `'${String(value).replace(/'/g, "''")}'`;
|
|
55884
|
+
function onAutoIncrementChange(column, index) {
|
|
55885
|
+
if (!column.isAutoIncrement) return;
|
|
55886
|
+
formData.value.columns.forEach((col, idx) => {
|
|
55887
|
+
col.isPrimary = idx === index;
|
|
55888
|
+
if (idx !== index) col.isAutoIncrement = false;
|
|
55889
|
+
});
|
|
55663
55890
|
}
|
|
55664
55891
|
async function submit() {
|
|
55665
55892
|
try {
|
|
@@ -55667,7 +55894,7 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55667
55894
|
await modal.warning("请输入表名");
|
|
55668
55895
|
return;
|
|
55669
55896
|
}
|
|
55670
|
-
if (formData.value.columns.some((col) => !col.name || !col
|
|
55897
|
+
if (formData.value.columns.some((col) => !col.name || !rawType(col))) {
|
|
55671
55898
|
await modal.warning("请完善所有字段信息");
|
|
55672
55899
|
return;
|
|
55673
55900
|
}
|
|
@@ -55675,30 +55902,28 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55675
55902
|
await modal.warning("请先选择数据库连接");
|
|
55676
55903
|
return;
|
|
55677
55904
|
}
|
|
55678
|
-
|
|
55679
|
-
if (
|
|
55680
|
-
const
|
|
55681
|
-
|
|
55682
|
-
|
|
55683
|
-
|
|
55684
|
-
|
|
55685
|
-
await modal.info("没有检测到任何修改");
|
|
55686
|
-
return;
|
|
55687
|
-
}
|
|
55688
|
-
result = await databaseService.alterTable(props.connection.id, props.database, tableDiff);
|
|
55905
|
+
const result = props.mode === "create" ? await databaseService.executeCreateTable(props.connection.id, props.database, buildTableSpec()) : await databaseService.executeAlterTable(props.connection.id, props.database, props.table.name, buildTableSpec());
|
|
55906
|
+
if (!result?.statements || result.statements.length === 0) {
|
|
55907
|
+
const liveCols = result?.liveColumns;
|
|
55908
|
+
const live = liveCols?.length ? liveCols.join("、") : "(未知)";
|
|
55909
|
+
const tip = liveCols?.length ? `当前实时表已有列:${live}\n若你以为新增的字段出现在上面,说明它之前已保存成功,或本来就存在。` : "未读取到实时表结构,请刷新表列表后重试。";
|
|
55910
|
+
await modal.info(`没有检测到任何修改。\n${tip}`);
|
|
55911
|
+
return;
|
|
55689
55912
|
}
|
|
55690
55913
|
emit("submit", {
|
|
55691
|
-
success:
|
|
55692
|
-
message:
|
|
55693
|
-
data: result
|
|
55914
|
+
success: true,
|
|
55915
|
+
message: props.mode === "create" ? "表创建成功" : "表结构修改成功",
|
|
55916
|
+
data: result,
|
|
55694
55917
|
mode: props.mode
|
|
55695
55918
|
});
|
|
55696
55919
|
close();
|
|
55697
55920
|
} catch (error) {
|
|
55698
55921
|
console.error("提交失败:", error);
|
|
55922
|
+
const message = error?.message || "操作失败";
|
|
55923
|
+
await modal.error(message);
|
|
55699
55924
|
emit("submit", {
|
|
55700
55925
|
success: false,
|
|
55701
|
-
message
|
|
55926
|
+
message,
|
|
55702
55927
|
mode: props.mode
|
|
55703
55928
|
});
|
|
55704
55929
|
}
|
|
@@ -55707,7 +55932,12 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55707
55932
|
emit("close");
|
|
55708
55933
|
}
|
|
55709
55934
|
watch(() => props.visible, (newVal) => {
|
|
55710
|
-
if (newVal)
|
|
55935
|
+
if (newVal) {
|
|
55936
|
+
initFormData();
|
|
55937
|
+
caps.value = null;
|
|
55938
|
+
previewSql.value = "-- 完善表单后将在此显示后端生成的 SQL";
|
|
55939
|
+
setTimeout(refreshPreview, 0);
|
|
55940
|
+
}
|
|
55711
55941
|
});
|
|
55712
55942
|
function getCategoryLabel(category) {
|
|
55713
55943
|
return {
|
|
@@ -55724,9 +55954,16 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55724
55954
|
}[category] || category;
|
|
55725
55955
|
}
|
|
55726
55956
|
function getSelectedType(column) {
|
|
55727
|
-
|
|
55728
|
-
|
|
55729
|
-
|
|
55957
|
+
const raw = rawType(column);
|
|
55958
|
+
if (!raw) return null;
|
|
55959
|
+
if (raw.includes("(")) return null;
|
|
55960
|
+
const lower = raw.trim().toLowerCase();
|
|
55961
|
+
let typeInfo = columnTypes.value.find((t) => t.name.toLowerCase() === lower);
|
|
55962
|
+
if (!typeInfo) {
|
|
55963
|
+
const typeName = lower.match(/^[a-zA-Z]+/)?.[0] || lower;
|
|
55964
|
+
typeInfo = columnTypes.value.find((t) => t.name.toLowerCase() === typeName);
|
|
55965
|
+
}
|
|
55966
|
+
return typeInfo || null;
|
|
55730
55967
|
}
|
|
55731
55968
|
function needsLength(column) {
|
|
55732
55969
|
return getSelectedType(column)?.requiresLength || false;
|
|
@@ -55744,166 +55981,186 @@ var init_table_editor_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55744
55981
|
if (props.visible) initFormData();
|
|
55745
55982
|
});
|
|
55746
55983
|
return (_ctx, _cache) => {
|
|
55747
|
-
return __props.visible ? (openBlock(), createElementBlock("div", {
|
|
55748
|
-
key: 0,
|
|
55749
|
-
class: "modal fade show",
|
|
55750
|
-
style: {
|
|
55751
|
-
"display": "block",
|
|
55752
|
-
"background-color": "rgba(0,0,0,0.5)"
|
|
55753
|
-
},
|
|
55754
|
-
onClick: close
|
|
55755
|
-
}, [createBaseVNode("div", {
|
|
55984
|
+
return __props.visible ? (openBlock(), createElementBlock("div", _hoisted_1$6, [createBaseVNode("div", {
|
|
55756
55985
|
class: "modal-dialog modal-lg",
|
|
55757
55986
|
style: {
|
|
55758
55987
|
"width": "80%",
|
|
55759
55988
|
"max-width": "none"
|
|
55760
55989
|
},
|
|
55761
55990
|
onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
|
|
55762
|
-
}, [createBaseVNode("div",
|
|
55763
|
-
createBaseVNode("div",
|
|
55991
|
+
}, [createBaseVNode("div", _hoisted_2$6, [
|
|
55992
|
+
createBaseVNode("div", _hoisted_3$6, [createBaseVNode("h5", _hoisted_4$6, [_cache[3] || (_cache[3] = createBaseVNode("i", { class: "bi bi-pencil-square me-2" }, null, -1)), createTextVNode(" " + toDisplayString(__props.mode === "create" ? _ctx.$t("tableEditor.createNewTable") : _ctx.$t("tableEditor.modifyStructure")), 1)]), createBaseVNode("button", {
|
|
55764
55993
|
type: "button",
|
|
55765
55994
|
class: "btn-close",
|
|
55766
55995
|
onClick: close
|
|
55767
55996
|
})]),
|
|
55768
|
-
createBaseVNode("div",
|
|
55769
|
-
createBaseVNode("div",
|
|
55997
|
+
createBaseVNode("div", _hoisted_5$6, [
|
|
55998
|
+
createBaseVNode("div", _hoisted_6$6, [createBaseVNode("h6", _hoisted_7$6, toDisplayString(_ctx.$t("tableEditor.tableInfo")), 1), createBaseVNode("div", _hoisted_8$6, [createBaseVNode("div", _hoisted_9$6, [createBaseVNode("div", _hoisted_10$6, [createBaseVNode("label", _hoisted_11$6, toDisplayString(_ctx.$t("tableEditor.tableNameLabel")), 1), withDirectives(createBaseVNode("input", {
|
|
55770
55999
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value.tableName = $event),
|
|
55771
56000
|
type: "text",
|
|
55772
56001
|
class: "form-control",
|
|
55773
56002
|
disabled: __props.mode === "edit",
|
|
55774
56003
|
placeholder: _ctx.$t("tableEditor.tableNamePlaceholder")
|
|
55775
|
-
}, null, 8,
|
|
56004
|
+
}, null, 8, _hoisted_12$6), [[vModelText, formData.value.tableName]])])]), createBaseVNode("div", _hoisted_13$6, [createBaseVNode("div", _hoisted_14$6, [createBaseVNode("label", _hoisted_15$6, toDisplayString(_ctx.$t("tableEditor.tableCommentLabel")), 1), withDirectives(createBaseVNode("input", {
|
|
55776
56005
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formData.value.tableComment = $event),
|
|
55777
56006
|
type: "text",
|
|
55778
56007
|
class: "form-control",
|
|
56008
|
+
disabled: tableCommentDisabled.value,
|
|
56009
|
+
title: tableCommentDisabled.value ? "该数据库不支持表注释" : void 0,
|
|
55779
56010
|
placeholder: _ctx.$t("tableEditor.tableCommentPlaceholder")
|
|
55780
|
-
}, null, 8,
|
|
55781
|
-
createBaseVNode("div",
|
|
56011
|
+
}, null, 8, _hoisted_16$6), [[vModelText, formData.value.tableComment]])])])])]),
|
|
56012
|
+
createBaseVNode("div", _hoisted_17$6, [createBaseVNode("div", _hoisted_18$6, [createBaseVNode("h6", _hoisted_19$6, toDisplayString(_ctx.$t("tableEditor.columnManagement")), 1), createBaseVNode("button", {
|
|
55782
56013
|
class: "btn btn-success btn-sm",
|
|
55783
56014
|
onClick: addColumn
|
|
55784
|
-
}, [_cache[4] || (_cache[4] = createBaseVNode("i", { class: "bi bi-plus-lg" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("tableEditor.addColumn")), 1)])]), createBaseVNode("div",
|
|
55785
|
-
createBaseVNode("th",
|
|
55786
|
-
createBaseVNode("th",
|
|
55787
|
-
createBaseVNode("th",
|
|
55788
|
-
createBaseVNode("th",
|
|
55789
|
-
createBaseVNode("th",
|
|
55790
|
-
createBaseVNode("th",
|
|
55791
|
-
createBaseVNode("th",
|
|
56015
|
+
}, [_cache[4] || (_cache[4] = createBaseVNode("i", { class: "bi bi-plus-lg" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("tableEditor.addColumn")), 1)])]), createBaseVNode("div", _hoisted_20$6, [createBaseVNode("table", _hoisted_21$6, [createBaseVNode("thead", null, [createBaseVNode("tr", null, [
|
|
56016
|
+
createBaseVNode("th", _hoisted_22$6, toDisplayString(_ctx.$t("tableEditor.columnNameHeader")), 1),
|
|
56017
|
+
createBaseVNode("th", _hoisted_23$6, toDisplayString(_ctx.$t("tableEditor.dataTypeHeader")), 1),
|
|
56018
|
+
createBaseVNode("th", _hoisted_24$6, toDisplayString(_ctx.$t("tableEditor.lengthPrecisionHeader")), 1),
|
|
56019
|
+
createBaseVNode("th", _hoisted_25$6, toDisplayString(_ctx.$t("tableEditor.nullableHeader")), 1),
|
|
56020
|
+
createBaseVNode("th", _hoisted_26$5, toDisplayString(_ctx.$t("tableEditor.defaultHeader")), 1),
|
|
56021
|
+
createBaseVNode("th", _hoisted_27$5, toDisplayString(_ctx.$t("tableEditor.primaryKeyHeader")), 1),
|
|
56022
|
+
createBaseVNode("th", _hoisted_28$5, toDisplayString(_ctx.$t("tableEditor.autoIncHeader")), 1),
|
|
55792
56023
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableEditor.commentHeader")), 1),
|
|
55793
|
-
createBaseVNode("th",
|
|
56024
|
+
createBaseVNode("th", _hoisted_29$5, toDisplayString(_ctx.$t("tableEditor.operationsHeader")), 1)
|
|
55794
56025
|
])]), createBaseVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(formData.value.columns, (column, index) => {
|
|
55795
56026
|
return openBlock(), createElementBlock("tr", { key: index }, [
|
|
55796
56027
|
createBaseVNode("td", null, [withDirectives(createBaseVNode("input", {
|
|
55797
56028
|
"onUpdate:modelValue": ($event) => column.name = $event,
|
|
55798
56029
|
type: "text",
|
|
55799
56030
|
class: "form-control form-control-sm",
|
|
56031
|
+
disabled: renameDisabled.value,
|
|
56032
|
+
title: renameDisabled.value ? "该数据库不支持修改列名" : void 0,
|
|
55800
56033
|
placeholder: _ctx.$t("tableEditor.columnNamePlaceholder")
|
|
55801
|
-
}, null, 8,
|
|
56034
|
+
}, null, 8, _hoisted_30$4), [[vModelText, column.name]])]),
|
|
55802
56035
|
createBaseVNode("td", null, [withDirectives(createBaseVNode("select", {
|
|
55803
56036
|
"onUpdate:modelValue": ($event) => column.type = $event,
|
|
55804
56037
|
class: "form-select form-select-sm"
|
|
55805
|
-
}, [
|
|
55806
|
-
|
|
55807
|
-
|
|
55808
|
-
|
|
55809
|
-
|
|
55810
|
-
|
|
55811
|
-
|
|
55812
|
-
|
|
55813
|
-
|
|
55814
|
-
|
|
55815
|
-
|
|
55816
|
-
|
|
56038
|
+
}, [
|
|
56039
|
+
createBaseVNode("option", _hoisted_32$4, toDisplayString(_ctx.$t("tableEditor.selectType")), 1),
|
|
56040
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(columnTypesByCategory.value, (types, category) => {
|
|
56041
|
+
return openBlock(), createElementBlock("optgroup", {
|
|
56042
|
+
key: category,
|
|
56043
|
+
label: getCategoryLabel(category)
|
|
56044
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(types, (type) => {
|
|
56045
|
+
return openBlock(), createElementBlock("option", {
|
|
56046
|
+
key: type.name,
|
|
56047
|
+
value: type.name
|
|
56048
|
+
}, toDisplayString(type.label), 9, _hoisted_34$4);
|
|
56049
|
+
}), 128))], 8, _hoisted_33$4);
|
|
56050
|
+
}), 128)),
|
|
56051
|
+
createBaseVNode("option", { value: CUSTOM_TYPE_VALUE }, toDisplayString(_ctx.$t("tableEditor.customType")), 1)
|
|
56052
|
+
], 8, _hoisted_31$4), [[vModelSelect, column.type]]), column.type === CUSTOM_TYPE_VALUE ? withDirectives((openBlock(), createElementBlock("input", {
|
|
56053
|
+
key: 0,
|
|
56054
|
+
"onUpdate:modelValue": ($event) => column.customType = $event,
|
|
56055
|
+
type: "text",
|
|
56056
|
+
class: "form-control form-control-sm mt-1",
|
|
56057
|
+
placeholder: _ctx.$t("tableEditor.customTypePlaceholder")
|
|
56058
|
+
}, null, 8, _hoisted_35$4)), [[vModelText, column.customType]]) : createCommentVNode("", true)]),
|
|
56059
|
+
createBaseVNode("td", null, [needsLength(column) || needsPrecision(column) ? (openBlock(), createElementBlock("div", _hoisted_36$4, [
|
|
55817
56060
|
needsLength(column) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
55818
56061
|
key: 0,
|
|
55819
56062
|
"onUpdate:modelValue": ($event) => column.length = $event,
|
|
55820
56063
|
type: "number",
|
|
55821
56064
|
class: "form-control form-control-sm",
|
|
55822
56065
|
placeholder: _ctx.$t("tableEditor.lengthPlaceholder")
|
|
55823
|
-
}, null, 8,
|
|
56066
|
+
}, null, 8, _hoisted_37$4)), [[vModelText, column.length]]) : createCommentVNode("", true),
|
|
55824
56067
|
needsPrecision(column) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
55825
56068
|
key: 1,
|
|
55826
56069
|
"onUpdate:modelValue": ($event) => column.precision = $event,
|
|
55827
56070
|
type: "number",
|
|
55828
56071
|
class: "form-control form-control-sm",
|
|
55829
56072
|
placeholder: _ctx.$t("tableEditor.precisionPlaceholder")
|
|
55830
|
-
}, null, 8,
|
|
56073
|
+
}, null, 8, _hoisted_38$4)), [[vModelText, column.precision]]) : createCommentVNode("", true),
|
|
55831
56074
|
needsScale(column) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
55832
56075
|
key: 2,
|
|
55833
56076
|
"onUpdate:modelValue": ($event) => column.scale = $event,
|
|
55834
56077
|
type: "number",
|
|
55835
56078
|
class: "form-control form-control-sm",
|
|
55836
56079
|
placeholder: _ctx.$t("tableEditor.scalePlaceholder")
|
|
55837
|
-
}, null, 8,
|
|
55838
|
-
])) : (openBlock(), createElementBlock("span",
|
|
55839
|
-
createBaseVNode("td", null, [createBaseVNode("div",
|
|
56080
|
+
}, null, 8, _hoisted_39$4)), [[vModelText, column.scale]]) : createCommentVNode("", true)
|
|
56081
|
+
])) : (openBlock(), createElementBlock("span", _hoisted_40$4, "-"))]),
|
|
56082
|
+
createBaseVNode("td", null, [createBaseVNode("div", _hoisted_41$4, [withDirectives(createBaseVNode("input", {
|
|
55840
56083
|
"onUpdate:modelValue": ($event) => column.nullable = $event,
|
|
55841
56084
|
type: "checkbox",
|
|
55842
56085
|
class: "form-check-input"
|
|
55843
|
-
}, null, 8,
|
|
56086
|
+
}, null, 8, _hoisted_42$4), [[vModelCheckbox, column.nullable]])])]),
|
|
55844
56087
|
createBaseVNode("td", null, [withDirectives(createBaseVNode("input", {
|
|
55845
56088
|
"onUpdate:modelValue": ($event) => column.defaultValue = $event,
|
|
55846
56089
|
type: "text",
|
|
55847
56090
|
class: "form-control form-control-sm",
|
|
55848
56091
|
placeholder: _ctx.$t("tableEditor.defaultHeader")
|
|
55849
|
-
}, null, 8,
|
|
55850
|
-
createBaseVNode("td", null, [createBaseVNode("div",
|
|
56092
|
+
}, null, 8, _hoisted_43$4), [[vModelText, column.defaultValue]])]),
|
|
56093
|
+
createBaseVNode("td", null, [createBaseVNode("div", _hoisted_44$4, [withDirectives(createBaseVNode("input", {
|
|
55851
56094
|
"onUpdate:modelValue": ($event) => column.isPrimary = $event,
|
|
55852
56095
|
type: "checkbox",
|
|
55853
56096
|
class: "form-check-input",
|
|
55854
|
-
|
|
55855
|
-
|
|
55856
|
-
|
|
56097
|
+
disabled: pkDisabled.value,
|
|
56098
|
+
title: pkDisabled.value ? "该数据库不支持在线修改主键" : void 0,
|
|
56099
|
+
onChange: ($event) => onPrimaryKeyChange(column)
|
|
56100
|
+
}, null, 40, _hoisted_45$4), [[vModelCheckbox, column.isPrimary]])])]),
|
|
56101
|
+
createBaseVNode("td", null, [createBaseVNode("div", _hoisted_46$4, [withDirectives(createBaseVNode("input", {
|
|
55857
56102
|
"onUpdate:modelValue": ($event) => column.isAutoIncrement = $event,
|
|
55858
56103
|
type: "checkbox",
|
|
55859
56104
|
class: "form-check-input",
|
|
55860
|
-
disabled: !column.isPrimary || !supportsAutoIncrement(column)
|
|
55861
|
-
|
|
56105
|
+
disabled: !column.isPrimary || !supportsAutoIncrement(column),
|
|
56106
|
+
title: supportsAutoIncrement(column) ? "自增列将作为唯一主键" : void 0,
|
|
56107
|
+
onChange: ($event) => onAutoIncrementChange(column, index)
|
|
56108
|
+
}, null, 40, _hoisted_47$3), [[vModelCheckbox, column.isAutoIncrement]])])]),
|
|
55862
56109
|
createBaseVNode("td", null, [withDirectives(createBaseVNode("input", {
|
|
55863
56110
|
"onUpdate:modelValue": ($event) => column.comment = $event,
|
|
55864
56111
|
type: "text",
|
|
55865
56112
|
class: "form-control form-control-sm",
|
|
56113
|
+
disabled: columnCommentDisabled.value,
|
|
56114
|
+
title: columnCommentDisabled.value ? "该数据库不支持列注释" : void 0,
|
|
55866
56115
|
placeholder: _ctx.$t("tableEditor.fieldComment")
|
|
55867
|
-
}, null, 8,
|
|
56116
|
+
}, null, 8, _hoisted_48$3), [[vModelText, column.comment]])]),
|
|
55868
56117
|
createBaseVNode("td", null, [createBaseVNode("button", {
|
|
55869
56118
|
class: "btn btn-outline-danger btn-sm",
|
|
55870
56119
|
onClick: ($event) => removeColumn(index),
|
|
55871
56120
|
disabled: formData.value.columns.length <= 1
|
|
55872
|
-
}, [..._cache[5] || (_cache[5] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8,
|
|
56121
|
+
}, [..._cache[5] || (_cache[5] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_49$3)])
|
|
55873
56122
|
]);
|
|
55874
56123
|
}), 128))])])])]),
|
|
55875
|
-
createBaseVNode("div",
|
|
56124
|
+
createBaseVNode("div", _hoisted_50$3, [createBaseVNode("div", _hoisted_51$3, [createBaseVNode("h6", _hoisted_52$3, toDisplayString(_ctx.$t("tableEditor.sqlPreview")), 1), createBaseVNode("button", {
|
|
56125
|
+
type: "button",
|
|
56126
|
+
class: "btn btn-sm btn-outline-secondary",
|
|
56127
|
+
disabled: refreshingTables.value,
|
|
56128
|
+
title: "重新拉取表列表(重名检测等依赖它;预览默认走 30 秒缓存)",
|
|
56129
|
+
onClick: refreshTableList
|
|
56130
|
+
}, toDisplayString(refreshingTables.value ? "刷新中..." : "刷新表列表"), 9, _hoisted_53$3)]), createBaseVNode("pre", _hoisted_54$3, toDisplayString(previewSql.value), 1)])
|
|
55876
56131
|
]),
|
|
55877
|
-
createBaseVNode("div",
|
|
56132
|
+
createBaseVNode("div", _hoisted_55$3, [createBaseVNode("button", {
|
|
55878
56133
|
type: "button",
|
|
55879
56134
|
class: "btn btn-secondary",
|
|
55880
56135
|
onClick: close
|
|
55881
56136
|
}, toDisplayString(_ctx.$t("common.cancel")), 1), createBaseVNode("button", {
|
|
55882
56137
|
type: "button",
|
|
55883
56138
|
class: "btn btn-primary",
|
|
56139
|
+
disabled: submitDisabled.value,
|
|
56140
|
+
title: submitDisabledHint.value || void 0,
|
|
55884
56141
|
onClick: submit
|
|
55885
|
-
}, toDisplayString(_ctx.$t("common.save")),
|
|
56142
|
+
}, toDisplayString(_ctx.$t("common.save")), 9, _hoisted_56$3)])
|
|
55886
56143
|
])])])) : createCommentVNode("", true);
|
|
55887
56144
|
};
|
|
55888
56145
|
}
|
|
55889
56146
|
});
|
|
55890
56147
|
}));
|
|
55891
56148
|
//#endregion
|
|
55892
|
-
//#region src/platform/database/components/table-editor.vue?vue&type=style&index=0&scoped=
|
|
55893
|
-
var
|
|
56149
|
+
//#region src/platform/database/components/table-editor.vue?vue&type=style&index=0&scoped=5fb24ab7&lang.css
|
|
56150
|
+
var init_table_editor_vue_vue_type_style_index_0_scoped_5fb24ab7_lang = __esmMin((() => {}));
|
|
55894
56151
|
//#endregion
|
|
55895
56152
|
//#region src/platform/database/components/table-editor.vue
|
|
55896
56153
|
var table_editor_default;
|
|
55897
56154
|
var init_table_editor = __esmMin((() => {
|
|
55898
56155
|
init_table_editor_vue_vue_type_script_setup_true_lang();
|
|
55899
56156
|
init_table_editor_vue_vue_type_script_setup_true_lang();
|
|
55900
|
-
|
|
56157
|
+
init_table_editor_vue_vue_type_style_index_0_scoped_5fb24ab7_lang();
|
|
55901
56158
|
init__plugin_vue_export_helper();
|
|
55902
|
-
table_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(table_editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
56159
|
+
table_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(table_editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-5fb24ab7"]]);
|
|
55903
56160
|
}));
|
|
55904
56161
|
//#endregion
|
|
55905
56162
|
//#region src/platform/database/components/db-tools.vue?vue&type=script&setup=true&lang.ts
|
|
55906
|
-
var _hoisted_1$5, _hoisted_2$5, _hoisted_3$5, _hoisted_4$5, _hoisted_5$5, _hoisted_6$5, _hoisted_7$5, _hoisted_8$5, _hoisted_9$5, _hoisted_10$5, _hoisted_11$5, _hoisted_12$5, _hoisted_13$5, _hoisted_14$5, _hoisted_15$5, _hoisted_16$5, _hoisted_17$5, _hoisted_18$5, _hoisted_19$5, _hoisted_20$5, _hoisted_21$5, _hoisted_22$5, _hoisted_23$5, _hoisted_24$5, _hoisted_25$5, _hoisted_26$4, _hoisted_27$4, _hoisted_28$4, _hoisted_29$4, _hoisted_30$3, _hoisted_31$3, _hoisted_32$3, _hoisted_33$3, _hoisted_34$3, _hoisted_35$3, _hoisted_36$3, _hoisted_37$3, _hoisted_38$3, _hoisted_39$3, _hoisted_40$3, _hoisted_41$3, _hoisted_42$3, _hoisted_43$3, _hoisted_44$3, _hoisted_45$3, _hoisted_46$3, _hoisted_47$
|
|
56163
|
+
var _hoisted_1$5, _hoisted_2$5, _hoisted_3$5, _hoisted_4$5, _hoisted_5$5, _hoisted_6$5, _hoisted_7$5, _hoisted_8$5, _hoisted_9$5, _hoisted_10$5, _hoisted_11$5, _hoisted_12$5, _hoisted_13$5, _hoisted_14$5, _hoisted_15$5, _hoisted_16$5, _hoisted_17$5, _hoisted_18$5, _hoisted_19$5, _hoisted_20$5, _hoisted_21$5, _hoisted_22$5, _hoisted_23$5, _hoisted_24$5, _hoisted_25$5, _hoisted_26$4, _hoisted_27$4, _hoisted_28$4, _hoisted_29$4, _hoisted_30$3, _hoisted_31$3, _hoisted_32$3, _hoisted_33$3, _hoisted_34$3, _hoisted_35$3, _hoisted_36$3, _hoisted_37$3, _hoisted_38$3, _hoisted_39$3, _hoisted_40$3, _hoisted_41$3, _hoisted_42$3, _hoisted_43$3, _hoisted_44$3, _hoisted_45$3, _hoisted_46$3, _hoisted_47$2, _hoisted_48$2, _hoisted_49$2, _hoisted_50$2, _hoisted_51$2, _hoisted_52$2, _hoisted_53$2, _hoisted_54$2, _hoisted_55$2, _hoisted_56$2, _hoisted_57$2, _hoisted_58$2, _hoisted_59$2, _hoisted_60$2, _hoisted_61$2, _hoisted_62$2, _hoisted_63$2, _hoisted_64$2, _hoisted_65$2, _hoisted_66$2, _hoisted_67$2, _hoisted_68$2, _hoisted_69$2, _hoisted_70$2, _hoisted_71$2, _hoisted_72$1, _hoisted_73$1, _hoisted_74$1, _hoisted_75$1, _hoisted_76$1, _hoisted_77$1, _hoisted_78$1, _hoisted_79$1, _hoisted_80$1, _hoisted_81$1, _hoisted_82$1, _hoisted_83$1, _hoisted_84$1, _hoisted_85$1, _hoisted_86$1, _hoisted_87$1, _hoisted_88$1, _hoisted_89$1, _hoisted_90$1, _hoisted_91$1, _hoisted_92$1, _hoisted_93$1, _hoisted_94$1, _hoisted_95$1, _hoisted_96$1, _hoisted_97$1, _hoisted_98$1, _hoisted_99$1, _hoisted_100$1, _hoisted_101$1, _hoisted_102$1, _hoisted_103$1, _hoisted_104$1, _hoisted_105$1, _hoisted_106$1, _hoisted_107$1, _hoisted_108$1, db_tools_vue_vue_type_script_setup_true_lang_default;
|
|
55907
56164
|
var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
55908
56165
|
init_vue_runtime_esm_bundler();
|
|
55909
56166
|
init_vue_i18n();
|
|
@@ -55968,7 +56225,7 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55968
56225
|
_hoisted_44$3 = { value: "" };
|
|
55969
56226
|
_hoisted_45$3 = ["value"];
|
|
55970
56227
|
_hoisted_46$3 = { class: "col-md-6" };
|
|
55971
|
-
_hoisted_47$
|
|
56228
|
+
_hoisted_47$2 = { class: "form-label" };
|
|
55972
56229
|
_hoisted_48$2 = { value: "" };
|
|
55973
56230
|
_hoisted_49$2 = ["value"];
|
|
55974
56231
|
_hoisted_50$2 = { class: "col-md-12" };
|
|
@@ -55996,11 +56253,11 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
55996
56253
|
_hoisted_69$2 = { class: "row g-3" };
|
|
55997
56254
|
_hoisted_70$2 = { class: "col-md-6" };
|
|
55998
56255
|
_hoisted_71$2 = { class: "form-check" };
|
|
55999
|
-
_hoisted_72$
|
|
56256
|
+
_hoisted_72$1 = {
|
|
56000
56257
|
class: "form-check-label",
|
|
56001
56258
|
for: "syncStructure"
|
|
56002
56259
|
};
|
|
56003
|
-
_hoisted_73$
|
|
56260
|
+
_hoisted_73$1 = { class: "col-md-6" };
|
|
56004
56261
|
_hoisted_74$1 = { class: "form-check" };
|
|
56005
56262
|
_hoisted_75$1 = {
|
|
56006
56263
|
class: "form-check-label",
|
|
@@ -56074,7 +56331,6 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56074
56331
|
const { t } = useI18n();
|
|
56075
56332
|
const connectionService = new ConnectionService();
|
|
56076
56333
|
const props = __props;
|
|
56077
|
-
const emit = __emit;
|
|
56078
56334
|
const databaseService = new DatabaseService();
|
|
56079
56335
|
const restoreModalVisible = ref(false);
|
|
56080
56336
|
const selectedFile = ref(null);
|
|
@@ -56221,29 +56477,60 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56221
56477
|
function showPermissionsModal() {
|
|
56222
56478
|
addExecutionResult(t("dbTools.permissionMgmt"), "info", { message: t("dbTools.featureInDev", { feature: t("dbTools.permissionMgmt") }) });
|
|
56223
56479
|
}
|
|
56224
|
-
|
|
56225
|
-
|
|
56226
|
-
|
|
56480
|
+
/** 把查询结果规整成结果区可展示的结构(查询类为行数组,管理类为执行回执) */
|
|
56481
|
+
function toDisplayData(sql, data) {
|
|
56482
|
+
if (Array.isArray(data)) return {
|
|
56227
56483
|
sql,
|
|
56228
|
-
|
|
56229
|
-
|
|
56230
|
-
|
|
56484
|
+
rowCount: data.length,
|
|
56485
|
+
rows: data
|
|
56486
|
+
};
|
|
56487
|
+
if (data && typeof data === "object") return {
|
|
56488
|
+
sql,
|
|
56489
|
+
...data
|
|
56490
|
+
};
|
|
56491
|
+
return {
|
|
56492
|
+
sql,
|
|
56493
|
+
result: data
|
|
56494
|
+
};
|
|
56495
|
+
}
|
|
56496
|
+
/**
|
|
56497
|
+
* 工具页自己执行 SQL 并把结果写入结果区。
|
|
56498
|
+
* 旧实现只 emit('execute-sql') 交给上层编辑器执行,工具页仅留一句"已发送 SQL 查询",
|
|
56499
|
+
* 查询结果在工具页永远看不到;改为本地执行后不再向上 emit,避免同一条 SQL 被执行两次
|
|
56500
|
+
* (对 FLUSH LOGS 这类非幂等语句尤其重要)。
|
|
56501
|
+
*/
|
|
56502
|
+
async function runSqlTool(operation, sql) {
|
|
56503
|
+
if (!props.connection?.id) {
|
|
56504
|
+
modal.warning(t("dbTools.selectConnectionFirst"));
|
|
56505
|
+
return;
|
|
56506
|
+
}
|
|
56507
|
+
try {
|
|
56508
|
+
const res = await databaseService.executeQuery(props.connection.id, sql, props.database);
|
|
56509
|
+
if (res.ret === 0) addExecutionResult(operation, "success", toDisplayData(sql, res.data));
|
|
56510
|
+
else {
|
|
56511
|
+
modal.error(res.msg || t("dbTools.execFailed"));
|
|
56512
|
+
addExecutionResult(operation, "error", {
|
|
56513
|
+
sql,
|
|
56514
|
+
...formatError(res)
|
|
56515
|
+
});
|
|
56516
|
+
}
|
|
56517
|
+
} catch (error) {
|
|
56518
|
+
console.error(`${operation}失败:`, error);
|
|
56519
|
+
modal.error(error?.msg || error?.message || t("dbTools.execFailed"));
|
|
56520
|
+
addExecutionResult(operation, "error", {
|
|
56521
|
+
sql,
|
|
56522
|
+
...formatError(error)
|
|
56523
|
+
});
|
|
56524
|
+
}
|
|
56525
|
+
}
|
|
56526
|
+
function showProcessList() {
|
|
56527
|
+
runSqlTool(t("dbTools.processList"), "SHOW PROCESSLIST");
|
|
56231
56528
|
}
|
|
56232
56529
|
function showSlowQueries() {
|
|
56233
|
-
|
|
56234
|
-
addExecutionResult(t("dbTools.slowQueries"), "info", {
|
|
56235
|
-
sql,
|
|
56236
|
-
message: t("dbTools.sqlSent")
|
|
56237
|
-
});
|
|
56238
|
-
emit("execute-sql", sql);
|
|
56530
|
+
runSqlTool(t("dbTools.slowQueries"), "SELECT * FROM mysql.slow_log ORDER BY start_time DESC LIMIT 10");
|
|
56239
56531
|
}
|
|
56240
56532
|
function showConnectionsList() {
|
|
56241
|
-
|
|
56242
|
-
addExecutionResult(t("dbTools.connectionCount"), "info", {
|
|
56243
|
-
sql,
|
|
56244
|
-
message: t("dbTools.sqlSent")
|
|
56245
|
-
});
|
|
56246
|
-
emit("execute-sql", sql);
|
|
56533
|
+
runSqlTool(t("dbTools.connectionCount"), "SHOW STATUS LIKE \"Threads_connected\"");
|
|
56247
56534
|
}
|
|
56248
56535
|
async function optimizeDatabase() {
|
|
56249
56536
|
const operation = t("dbTools.optimizeDatabase");
|
|
@@ -56291,18 +56578,12 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56291
56578
|
}
|
|
56292
56579
|
}
|
|
56293
56580
|
async function clearLogs() {
|
|
56294
|
-
t("dbTools.clearLogs");
|
|
56295
|
-
[
|
|
56581
|
+
const operation = t("dbTools.clearLogs");
|
|
56582
|
+
for (const sql of [
|
|
56296
56583
|
"TRUNCATE TABLE mysql.slow_log",
|
|
56297
56584
|
"TRUNCATE TABLE mysql.general_log",
|
|
56298
56585
|
"FLUSH LOGS"
|
|
56299
|
-
].
|
|
56300
|
-
addExecutionResult(`${t("dbTools.clearLogs")} - ${sql.split(" ")[1]}`, "info", {
|
|
56301
|
-
sql,
|
|
56302
|
-
message: t("dbTools.sqlSent")
|
|
56303
|
-
});
|
|
56304
|
-
emit("execute-sql", sql);
|
|
56305
|
-
});
|
|
56586
|
+
]) await runSqlTool(`${operation} - ${sql.split(" ")[1]}`, sql);
|
|
56306
56587
|
}
|
|
56307
56588
|
function showExportModal() {
|
|
56308
56589
|
addExecutionResult(t("dbTools.exportStructure"), "info", { message: t("dbTools.featureInDev", { feature: t("dbTools.exportStructure") }) });
|
|
@@ -56347,7 +56628,7 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56347
56628
|
addExecutionResult(operation, "success", { checks: results });
|
|
56348
56629
|
}
|
|
56349
56630
|
function showStatistics() {
|
|
56350
|
-
|
|
56631
|
+
runSqlTool(t("dbTools.dataStatistics"), `
|
|
56351
56632
|
SELECT
|
|
56352
56633
|
table_name as '表名',
|
|
56353
56634
|
table_rows as '记录数',
|
|
@@ -56355,20 +56636,10 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56355
56636
|
FROM information_schema.tables
|
|
56356
56637
|
WHERE table_schema = DATABASE()
|
|
56357
56638
|
ORDER BY (data_length + index_length) DESC
|
|
56358
|
-
|
|
56359
|
-
addExecutionResult(t("dbTools.dataStatistics"), "info", {
|
|
56360
|
-
sql,
|
|
56361
|
-
message: t("dbTools.sqlSent")
|
|
56362
|
-
});
|
|
56363
|
-
emit("execute-sql", sql);
|
|
56639
|
+
`);
|
|
56364
56640
|
}
|
|
56365
56641
|
function showAuditLog() {
|
|
56366
|
-
|
|
56367
|
-
addExecutionResult(t("dbTools.auditLog"), "info", {
|
|
56368
|
-
sql,
|
|
56369
|
-
message: t("dbTools.sqlSent")
|
|
56370
|
-
});
|
|
56371
|
-
emit("execute-sql", sql);
|
|
56642
|
+
runSqlTool(t("dbTools.auditLog"), "SELECT * FROM mysql.general_log ORDER BY event_time DESC LIMIT 100");
|
|
56372
56643
|
}
|
|
56373
56644
|
function showRestoreModal() {
|
|
56374
56645
|
restoreModalVisible.value = true;
|
|
@@ -56618,7 +56889,7 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56618
56889
|
value: conn.id
|
|
56619
56890
|
}, toDisplayString(conn.name) + " (" + toDisplayString(conn.type) + ")", 9, _hoisted_45$3);
|
|
56620
56891
|
}), 128))], 512), [[vModelSelect, selectedConnectionId.value]])]),
|
|
56621
|
-
createBaseVNode("div", _hoisted_46$3, [createBaseVNode("label", _hoisted_47$
|
|
56892
|
+
createBaseVNode("div", _hoisted_46$3, [createBaseVNode("label", _hoisted_47$2, toDisplayString(_ctx.$t("dbTools.selectDatabaseLabel")), 1), withDirectives(createBaseVNode("select", {
|
|
56622
56893
|
class: "form-select",
|
|
56623
56894
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => selectedDatabaseName.value = $event)
|
|
56624
56895
|
}, [createBaseVNode("option", _hoisted_48$2, toDisplayString(_ctx.$t("dbTools.selectDatabasePlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(databases.value, (db) => {
|
|
@@ -56636,7 +56907,7 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56636
56907
|
createBaseVNode("div", _hoisted_53$2, [createBaseVNode("label", _hoisted_54$2, toDisplayString(_ctx.$t("dbTools.dbTypeLabel")), 1), withDirectives(createBaseVNode("select", {
|
|
56637
56908
|
class: "form-select",
|
|
56638
56909
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => syncConfig.value.target.dbType = $event)
|
|
56639
|
-
}, [..._cache[51] || (_cache[51] = [createStaticVNode("<option value=\"mysql\" data-v-
|
|
56910
|
+
}, [..._cache[51] || (_cache[51] = [createStaticVNode("<option value=\"mysql\" data-v-4c55e089>MySQL</option><option value=\"postgresql\" data-v-4c55e089>PostgreSQL</option><option value=\"sqlite\" data-v-4c55e089>SQLite</option><option value=\"sqlserver\" data-v-4c55e089>SQL Server</option><option value=\"oracle\" data-v-4c55e089>Oracle</option>", 5)])], 512), [[vModelSelect, syncConfig.value.target.dbType]])]),
|
|
56640
56911
|
createBaseVNode("div", _hoisted_55$2, [createBaseVNode("label", _hoisted_56$2, toDisplayString(_ctx.$t("dbTools.hostLabel")), 1), withDirectives(createBaseVNode("input", {
|
|
56641
56912
|
type: "text",
|
|
56642
56913
|
class: "form-control",
|
|
@@ -56675,8 +56946,8 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56675
56946
|
class: "form-check-input",
|
|
56676
56947
|
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => syncConfig.value.options.syncStructure = $event),
|
|
56677
56948
|
id: "syncStructure"
|
|
56678
|
-
}, null, 512), [[vModelCheckbox, syncConfig.value.options.syncStructure]]), createBaseVNode("label", _hoisted_72$
|
|
56679
|
-
createBaseVNode("div", _hoisted_73$
|
|
56949
|
+
}, null, 512), [[vModelCheckbox, syncConfig.value.options.syncStructure]]), createBaseVNode("label", _hoisted_72$1, toDisplayString(_ctx.$t("dbTools.syncStructure")), 1)])]),
|
|
56950
|
+
createBaseVNode("div", _hoisted_73$1, [createBaseVNode("div", _hoisted_74$1, [withDirectives(createBaseVNode("input", {
|
|
56680
56951
|
type: "checkbox",
|
|
56681
56952
|
class: "form-check-input",
|
|
56682
56953
|
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => syncConfig.value.options.syncData = $event),
|
|
@@ -56776,21 +57047,21 @@ var init_db_tools_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56776
57047
|
});
|
|
56777
57048
|
}));
|
|
56778
57049
|
//#endregion
|
|
56779
|
-
//#region src/platform/database/components/db-tools.vue?vue&type=style&index=0&scoped=
|
|
56780
|
-
var
|
|
57050
|
+
//#region src/platform/database/components/db-tools.vue?vue&type=style&index=0&scoped=4c55e089&lang.css
|
|
57051
|
+
var init_db_tools_vue_vue_type_style_index_0_scoped_4c55e089_lang = __esmMin((() => {}));
|
|
56781
57052
|
//#endregion
|
|
56782
57053
|
//#region src/platform/database/components/db-tools.vue
|
|
56783
57054
|
var db_tools_default;
|
|
56784
57055
|
var init_db_tools = __esmMin((() => {
|
|
56785
57056
|
init_db_tools_vue_vue_type_script_setup_true_lang();
|
|
56786
57057
|
init_db_tools_vue_vue_type_script_setup_true_lang();
|
|
56787
|
-
|
|
57058
|
+
init_db_tools_vue_vue_type_style_index_0_scoped_4c55e089_lang();
|
|
56788
57059
|
init__plugin_vue_export_helper();
|
|
56789
|
-
db_tools_default = /*#__PURE__*/ _plugin_vue_export_helper_default(db_tools_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
57060
|
+
db_tools_default = /*#__PURE__*/ _plugin_vue_export_helper_default(db_tools_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-4c55e089"]]);
|
|
56790
57061
|
}));
|
|
56791
57062
|
//#endregion
|
|
56792
57063
|
//#region src/platform/database/components/database-detail.vue?vue&type=script&setup=true&lang.ts
|
|
56793
|
-
var _hoisted_1$4, _hoisted_2$4, _hoisted_3$4, _hoisted_4$4, _hoisted_5$4, _hoisted_6$4, _hoisted_7$4, _hoisted_8$4, _hoisted_9$4, _hoisted_10$4, _hoisted_11$4, _hoisted_12$4, _hoisted_13$4, _hoisted_14$4, _hoisted_15$4, _hoisted_16$4, _hoisted_17$4, _hoisted_18$4, _hoisted_19$4, _hoisted_20$4, _hoisted_21$4, _hoisted_22$4, _hoisted_23$4, _hoisted_24$4, _hoisted_25$4, _hoisted_26$3, _hoisted_27$3, _hoisted_28$3, _hoisted_29$3, _hoisted_30$2, _hoisted_31$2, _hoisted_32$2, _hoisted_33$2, _hoisted_34$2, _hoisted_35$2, _hoisted_36$2, _hoisted_37$2, _hoisted_38$2, _hoisted_39$2, _hoisted_40$2, _hoisted_41$2, _hoisted_42$2, _hoisted_43$2, _hoisted_44$2, _hoisted_45$2, _hoisted_46$2, _hoisted_47$
|
|
57064
|
+
var _hoisted_1$4, _hoisted_2$4, _hoisted_3$4, _hoisted_4$4, _hoisted_5$4, _hoisted_6$4, _hoisted_7$4, _hoisted_8$4, _hoisted_9$4, _hoisted_10$4, _hoisted_11$4, _hoisted_12$4, _hoisted_13$4, _hoisted_14$4, _hoisted_15$4, _hoisted_16$4, _hoisted_17$4, _hoisted_18$4, _hoisted_19$4, _hoisted_20$4, _hoisted_21$4, _hoisted_22$4, _hoisted_23$4, _hoisted_24$4, _hoisted_25$4, _hoisted_26$3, _hoisted_27$3, _hoisted_28$3, _hoisted_29$3, _hoisted_30$2, _hoisted_31$2, _hoisted_32$2, _hoisted_33$2, _hoisted_34$2, _hoisted_35$2, _hoisted_36$2, _hoisted_37$2, _hoisted_38$2, _hoisted_39$2, _hoisted_40$2, _hoisted_41$2, _hoisted_42$2, _hoisted_43$2, _hoisted_44$2, _hoisted_45$2, _hoisted_46$2, _hoisted_47$1, _hoisted_48$1, _hoisted_49$1, _hoisted_50$1, _hoisted_51$1, _hoisted_52$1, _hoisted_53$1, _hoisted_54$1, _hoisted_55$1, _hoisted_56$1, _hoisted_57$1, _hoisted_58$1, _hoisted_59$1, _hoisted_60$1, _hoisted_61$1, _hoisted_62$1, _hoisted_63$1, _hoisted_64$1, _hoisted_65$1, _hoisted_66$1, _hoisted_67$1, _hoisted_68$1, _hoisted_69$1, _hoisted_70$1, _hoisted_71$1, _hoisted_72, _hoisted_73, _hoisted_74, _hoisted_75, _hoisted_76, _hoisted_77, _hoisted_78, _hoisted_79, _hoisted_80, _hoisted_81, _hoisted_82, _hoisted_83, _hoisted_84, _hoisted_85, _hoisted_86, _hoisted_87, _hoisted_88, _hoisted_89, _hoisted_90, _hoisted_91, _hoisted_92, _hoisted_93, _hoisted_94, _hoisted_95, _hoisted_96, _hoisted_97, _hoisted_98, _hoisted_99, _hoisted_100, _hoisted_101, _hoisted_102, _hoisted_103, _hoisted_104, _hoisted_105, _hoisted_106, _hoisted_107, _hoisted_108, _hoisted_109, _hoisted_110, _hoisted_111, _hoisted_112, _hoisted_113, _hoisted_114, _hoisted_115, _hoisted_116, _hoisted_117, _hoisted_118, _hoisted_119, _hoisted_120, _hoisted_121, _hoisted_122, _hoisted_123, _hoisted_124, _hoisted_125, _hoisted_126, _hoisted_127, database_detail_vue_vue_type_script_setup_true_lang_default;
|
|
56794
57065
|
var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
56795
57066
|
init_vue_runtime_esm_bundler();
|
|
56796
57067
|
init_vue_i18n();
|
|
@@ -56844,22 +57115,22 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56844
57115
|
_hoisted_37$2 = ["title"];
|
|
56845
57116
|
_hoisted_38$2 = { class: "table-engine" };
|
|
56846
57117
|
_hoisted_39$2 = ["title"];
|
|
56847
|
-
_hoisted_40$2 = { class: "
|
|
56848
|
-
_hoisted_41$2 =
|
|
56849
|
-
_hoisted_42$2 = {
|
|
57118
|
+
_hoisted_40$2 = { class: "table-actions" };
|
|
57119
|
+
_hoisted_41$2 = ["onClick", "title"];
|
|
57120
|
+
_hoisted_42$2 = { class: "card-body" };
|
|
57121
|
+
_hoisted_43$2 = { class: "table-stats" };
|
|
57122
|
+
_hoisted_44$2 = {
|
|
56850
57123
|
key: 0,
|
|
56851
57124
|
class: "stat"
|
|
56852
57125
|
};
|
|
56853
|
-
|
|
56854
|
-
|
|
56855
|
-
|
|
57126
|
+
_hoisted_45$2 = { class: "stat-label" };
|
|
57127
|
+
_hoisted_46$2 = { class: "stat-value" };
|
|
57128
|
+
_hoisted_47$1 = {
|
|
56856
57129
|
key: 1,
|
|
56857
57130
|
class: "stat"
|
|
56858
57131
|
};
|
|
56859
|
-
|
|
56860
|
-
|
|
56861
|
-
_hoisted_48$1 = { class: "table-actions" };
|
|
56862
|
-
_hoisted_49$1 = ["onClick"];
|
|
57132
|
+
_hoisted_48$1 = { class: "stat-label" };
|
|
57133
|
+
_hoisted_49$1 = { class: "stat-value" };
|
|
56863
57134
|
_hoisted_50$1 = {
|
|
56864
57135
|
key: 0,
|
|
56865
57136
|
class: "empty-state"
|
|
@@ -56900,11 +57171,11 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
56900
57171
|
};
|
|
56901
57172
|
_hoisted_70$1 = { class: "procedure-type" };
|
|
56902
57173
|
_hoisted_71$1 = { class: "badge bg-info" };
|
|
56903
|
-
_hoisted_72
|
|
57174
|
+
_hoisted_72 = {
|
|
56904
57175
|
key: 0,
|
|
56905
57176
|
class: "badge bg-secondary ms-1"
|
|
56906
57177
|
};
|
|
56907
|
-
_hoisted_73
|
|
57178
|
+
_hoisted_73 = { class: "card-body" };
|
|
56908
57179
|
_hoisted_74 = { class: "procedure-actions" };
|
|
56909
57180
|
_hoisted_75 = ["onClick"];
|
|
56910
57181
|
_hoisted_76 = ["onClick"];
|
|
@@ -57008,7 +57279,8 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57008
57279
|
const procedures = ref([]);
|
|
57009
57280
|
const editingProcedure = ref(null);
|
|
57010
57281
|
const showTableEditor = ref(false);
|
|
57011
|
-
const
|
|
57282
|
+
const tableEditorMode = ref("create");
|
|
57283
|
+
const editingTable = ref(null);
|
|
57012
57284
|
const tables = computed(() => {
|
|
57013
57285
|
return props.tables || [];
|
|
57014
57286
|
});
|
|
@@ -57045,21 +57317,39 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57045
57317
|
}
|
|
57046
57318
|
function createTable() {
|
|
57047
57319
|
if (!newTable.value.name.trim()) return;
|
|
57048
|
-
|
|
57320
|
+
tableEditorMode.value = "create";
|
|
57321
|
+
editingTable.value = {
|
|
57322
|
+
name: newTable.value.name,
|
|
57323
|
+
comment: newTable.value.comment,
|
|
57324
|
+
rowCount: 0,
|
|
57325
|
+
dataSize: 0,
|
|
57326
|
+
indexSize: 0,
|
|
57327
|
+
columns: []
|
|
57328
|
+
};
|
|
57049
57329
|
showTableEditor.value = true;
|
|
57050
57330
|
showCreateTable.value = false;
|
|
57051
57331
|
}
|
|
57052
|
-
function editTable(table) {
|
|
57053
|
-
|
|
57054
|
-
|
|
57332
|
+
async function editTable(table) {
|
|
57333
|
+
if (!props.connection?.id) return;
|
|
57334
|
+
try {
|
|
57335
|
+
const response = await databaseService.getTableInfo(props.connection.id, props.database, table.name);
|
|
57336
|
+
editingTable.value = response.data || null;
|
|
57337
|
+
tableEditorMode.value = "edit";
|
|
57338
|
+
showTableEditor.value = true;
|
|
57339
|
+
} catch (error) {
|
|
57340
|
+
console.error("获取表结构失败:", error);
|
|
57341
|
+
modal.error(t("databaseDetail.getTableInfoFailed"));
|
|
57342
|
+
}
|
|
57055
57343
|
}
|
|
57056
57344
|
function createNewTable() {
|
|
57057
|
-
|
|
57345
|
+
tableEditorMode.value = "create";
|
|
57346
|
+
editingTable.value = null;
|
|
57058
57347
|
showTableEditor.value = true;
|
|
57059
57348
|
}
|
|
57060
57349
|
function closeTableEditor() {
|
|
57061
57350
|
showTableEditor.value = false;
|
|
57062
|
-
|
|
57351
|
+
tableEditorMode.value = "create";
|
|
57352
|
+
editingTable.value = null;
|
|
57063
57353
|
}
|
|
57064
57354
|
onMounted(() => {
|
|
57065
57355
|
if (props.connection?.id && props.database) {
|
|
@@ -57094,28 +57384,53 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57094
57384
|
};
|
|
57095
57385
|
showCreateView.value = true;
|
|
57096
57386
|
}
|
|
57387
|
+
/**
|
|
57388
|
+
* 提取对象定义文本(视图/存储过程共用)。
|
|
57389
|
+
* 后端定义类接口返回的就是 SQL 字符串,并统一包装成 { ret, msg, data };
|
|
57390
|
+
* 这里兼容「字符串 / 数组 / { definition }」三种形态,避免取值路径变化导致编辑框空白。
|
|
57391
|
+
*/
|
|
57392
|
+
function extractDefinition(result) {
|
|
57393
|
+
const raw = typeof result === "string" ? result : result?.data;
|
|
57394
|
+
if (typeof raw === "string") return raw;
|
|
57395
|
+
if (Array.isArray(raw)) return String(raw[0]?.definition ?? raw[0]?.ddl ?? "");
|
|
57396
|
+
if (raw && typeof raw === "object") return String(raw.definition ?? raw.ddl ?? raw.sql ?? "");
|
|
57397
|
+
return "";
|
|
57398
|
+
}
|
|
57097
57399
|
async function editView(view) {
|
|
57098
57400
|
try {
|
|
57099
|
-
const
|
|
57401
|
+
const definition = extractDefinition(await databaseService.getViewDefinition(props.connection?.id || "", props.database, view.name));
|
|
57100
57402
|
editingView.value = {
|
|
57101
57403
|
name: view.name,
|
|
57102
|
-
definition
|
|
57404
|
+
definition,
|
|
57103
57405
|
comment: view.comment
|
|
57104
57406
|
};
|
|
57105
57407
|
showCreateView.value = true;
|
|
57408
|
+
if (!definition) modal.warning(t("databaseDetail.getViewDefFailed"));
|
|
57106
57409
|
} catch (error) {
|
|
57107
57410
|
console.error("获取视图定义失败:", error);
|
|
57108
57411
|
modal.error(t("databaseDetail.getViewDefFailed"));
|
|
57109
57412
|
}
|
|
57110
57413
|
}
|
|
57414
|
+
/**
|
|
57415
|
+
* 视图定义归一为「AS 之后的部分」。
|
|
57416
|
+
* 各方言 getViewDefinition 返回的形态不同:MySQL/PG/MSSQL 只给 SELECT 片段,
|
|
57417
|
+
* 而 SQLite/Oracle 给的是完整 CREATE VIEW 语句——直接回传会被后端再拼一次
|
|
57418
|
+
* `CREATE VIEW <name> AS ...` 而变成语法错误,改名时还会沿用旧视图名。
|
|
57419
|
+
*/
|
|
57420
|
+
function normalizeViewDefinition(definition) {
|
|
57421
|
+
const s = String(definition || "").trim();
|
|
57422
|
+
const m = /^CREATE\s+(?:OR\s+REPLACE\s+)?(?:ALGORITHM\s*=\s*\w+\s+)?(?:DEFINER\s*=\s*\S+\s+)?(?:SQL\s+SECURITY\s+\w+\s+)?VIEW\s+.+?\s+AS\s+/is.exec(s);
|
|
57423
|
+
return m ? s.slice(m[0].length).trim() : s;
|
|
57424
|
+
}
|
|
57111
57425
|
async function createOrUpdateView() {
|
|
57112
57426
|
if (!editingView.value?.name || !editingView.value?.definition) {
|
|
57113
57427
|
modal.error(t("databaseDetail.fillViewNameAndDef"));
|
|
57114
57428
|
return;
|
|
57115
57429
|
}
|
|
57116
57430
|
try {
|
|
57431
|
+
const definition = normalizeViewDefinition(editingView.value.definition);
|
|
57117
57432
|
if (views.value.some((v) => v.name === editingView.value.name)) await databaseService.dropView(props.connection?.id || "", props.database, editingView.value.name);
|
|
57118
|
-
const result = await databaseService.createView(props.connection?.id || "", props.database, editingView.value.name,
|
|
57433
|
+
const result = await databaseService.createView(props.connection?.id || "", props.database, editingView.value.name, definition);
|
|
57119
57434
|
if (result.success || result.ret === 0) {
|
|
57120
57435
|
await modal.success(t("databaseDetail.viewSaveSuccess"));
|
|
57121
57436
|
showCreateView.value = false;
|
|
@@ -57164,13 +57479,14 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57164
57479
|
}
|
|
57165
57480
|
async function editProcedure(procedure) {
|
|
57166
57481
|
try {
|
|
57167
|
-
const
|
|
57482
|
+
const definition = extractDefinition(await databaseService.getProcedureDefinition(props.connection?.id || "", props.database, procedure.name));
|
|
57168
57483
|
editingProcedure.value = {
|
|
57169
57484
|
name: procedure.name,
|
|
57170
|
-
definition
|
|
57485
|
+
definition,
|
|
57171
57486
|
comment: procedure.comment
|
|
57172
57487
|
};
|
|
57173
57488
|
showCreateProcedure.value = true;
|
|
57489
|
+
if (!definition) modal.warning(t("databaseDetail.getProcedureDefFailed"));
|
|
57174
57490
|
} catch (error) {
|
|
57175
57491
|
console.error("获取存储过程定义失败:", error);
|
|
57176
57492
|
modal.error(t("databaseDetail.getProcedureDefFailed"));
|
|
@@ -57243,7 +57559,7 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57243
57559
|
_cache[21] || (_cache[21] = createBaseVNode("i", { class: "bi bi-chevron-right" }, null, -1)),
|
|
57244
57560
|
createBaseVNode("span", _hoisted_9$4, toDisplayString(__props.database), 1),
|
|
57245
57561
|
createBaseVNode("span", _hoisted_10$4, toDisplayString(getDbTypeLabel(__props.connection?.type)), 1)
|
|
57246
|
-
])])]), createBaseVNode("div", _hoisted_11$4, [createBaseVNode("div", _hoisted_12$4, [createBaseVNode("div", _hoisted_13$4, toDisplayString(
|
|
57562
|
+
])])]), createBaseVNode("div", _hoisted_11$4, [createBaseVNode("div", _hoisted_12$4, [createBaseVNode("div", _hoisted_13$4, toDisplayString((tables.value || []).length), 1), createBaseVNode("div", _hoisted_14$4, toDisplayString(_ctx.$t("connection.tableCount")), 1)]), createBaseVNode("div", _hoisted_15$4, [createBaseVNode("div", _hoisted_16$4, toDisplayString(formatSize(__props.databaseInfo?.size || 0)), 1), createBaseVNode("div", _hoisted_17$4, toDisplayString(_ctx.$t("databaseDetail.size")), 1)])])])]),
|
|
57247
57563
|
createBaseVNode("div", _hoisted_18$4, [createBaseVNode("ul", _hoisted_19$4, [
|
|
57248
57564
|
createBaseVNode("li", _hoisted_20$4, [createBaseVNode("button", {
|
|
57249
57565
|
class: normalizeClass(["nav-link", { active: activeTab.value === "tables" }]),
|
|
@@ -57277,17 +57593,22 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57277
57593
|
key: table.name,
|
|
57278
57594
|
class: "table-card",
|
|
57279
57595
|
onClick: ($event) => selectTable(table)
|
|
57280
|
-
}, [createBaseVNode("div", _hoisted_34$2, [
|
|
57281
|
-
class: "table-
|
|
57282
|
-
|
|
57283
|
-
|
|
57284
|
-
|
|
57285
|
-
|
|
57286
|
-
|
|
57287
|
-
|
|
57288
|
-
|
|
57289
|
-
|
|
57290
|
-
|
|
57596
|
+
}, [createBaseVNode("div", _hoisted_34$2, [
|
|
57597
|
+
_cache[31] || (_cache[31] = createBaseVNode("div", { class: "table-icon" }, [createBaseVNode("i", { class: "bi bi-table" })], -1)),
|
|
57598
|
+
createBaseVNode("div", _hoisted_35$2, [createBaseVNode("div", _hoisted_36$2, [createBaseVNode("div", {
|
|
57599
|
+
class: "table-name",
|
|
57600
|
+
title: table.name
|
|
57601
|
+
}, toDisplayString(table.name), 9, _hoisted_37$2), createBaseVNode("div", _hoisted_38$2, toDisplayString(table.engine || "-"), 1)]), table.comment ? (openBlock(), createElementBlock("div", {
|
|
57602
|
+
key: 0,
|
|
57603
|
+
class: "table-comment-header",
|
|
57604
|
+
title: table.comment
|
|
57605
|
+
}, toDisplayString(table.comment), 9, _hoisted_39$2)) : createCommentVNode("", true)]),
|
|
57606
|
+
createBaseVNode("div", _hoisted_40$2, [createBaseVNode("button", {
|
|
57607
|
+
class: "btn btn-sm btn-outline-primary",
|
|
57608
|
+
onClick: withModifiers(($event) => editTable(table), ["stop"]),
|
|
57609
|
+
title: _ctx.$t("common.edit")
|
|
57610
|
+
}, [..._cache[30] || (_cache[30] = [createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)])], 8, _hoisted_41$2)])
|
|
57611
|
+
]), createBaseVNode("div", _hoisted_42$2, [createBaseVNode("div", _hoisted_43$2, [table.rowCount !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_44$2, [createBaseVNode("span", _hoisted_45$2, toDisplayString(_ctx.$t("databaseDetail.rowCountLabel")), 1), createBaseVNode("span", _hoisted_46$2, toDisplayString(formatNumber(table.rowCount)), 1)])) : createCommentVNode("", true), table.dataSize !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_47$1, [createBaseVNode("span", _hoisted_48$1, toDisplayString(_ctx.$t("databaseDetail.size")), 1), createBaseVNode("span", _hoisted_49$1, toDisplayString(formatSize(table.dataSize)), 1)])) : createCommentVNode("", true)])])], 8, _hoisted_33$2);
|
|
57291
57612
|
}), 128))]), !tables.value || tables.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_50$1, [
|
|
57292
57613
|
_cache[33] || (_cache[33] = createBaseVNode("i", { class: "bi bi-inbox" }, null, -1)),
|
|
57293
57614
|
createBaseVNode("p", null, toDisplayString(_ctx.$t("databaseDetail.noTable")), 1),
|
|
@@ -57334,8 +57655,8 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57334
57655
|
}, [createBaseVNode("div", _hoisted_66$1, [_cache[43] || (_cache[43] = createBaseVNode("div", { class: "procedure-icon" }, [createBaseVNode("i", { class: "bi bi-gear" })], -1)), createBaseVNode("div", _hoisted_67$1, [
|
|
57335
57656
|
createBaseVNode("div", _hoisted_68$1, toDisplayString(procedure.name), 1),
|
|
57336
57657
|
procedure.comment ? (openBlock(), createElementBlock("div", _hoisted_69$1, toDisplayString(procedure.comment), 1)) : createCommentVNode("", true),
|
|
57337
|
-
createBaseVNode("div", _hoisted_70$1, [createBaseVNode("span", _hoisted_71$1, toDisplayString(procedure.type), 1), procedure.returnType ? (openBlock(), createElementBlock("span", _hoisted_72
|
|
57338
|
-
])]), createBaseVNode("div", _hoisted_73
|
|
57658
|
+
createBaseVNode("div", _hoisted_70$1, [createBaseVNode("span", _hoisted_71$1, toDisplayString(procedure.type), 1), procedure.returnType ? (openBlock(), createElementBlock("span", _hoisted_72, toDisplayString(procedure.returnType), 1)) : createCommentVNode("", true)])
|
|
57659
|
+
])]), createBaseVNode("div", _hoisted_73, [createBaseVNode("div", _hoisted_74, [createBaseVNode("button", {
|
|
57339
57660
|
class: "btn btn-sm btn-outline-primary",
|
|
57340
57661
|
onClick: ($event) => editProcedure(procedure)
|
|
57341
57662
|
}, [_cache[44] || (_cache[44] = createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("common.edit")), 1)], 8, _hoisted_75), createBaseVNode("button", {
|
|
@@ -57463,8 +57784,8 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57463
57784
|
visible: showTableEditor.value,
|
|
57464
57785
|
connection: __props.connection,
|
|
57465
57786
|
database: __props.database,
|
|
57466
|
-
|
|
57467
|
-
mode:
|
|
57787
|
+
table: editingTable.value,
|
|
57788
|
+
mode: tableEditorMode.value,
|
|
57468
57789
|
onClose: closeTableEditor,
|
|
57469
57790
|
onSubmit: handleTableChange,
|
|
57470
57791
|
onExecuteSql: handleExecuteSQL
|
|
@@ -57472,7 +57793,7 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57472
57793
|
"visible",
|
|
57473
57794
|
"connection",
|
|
57474
57795
|
"database",
|
|
57475
|
-
"table
|
|
57796
|
+
"table",
|
|
57476
57797
|
"mode"
|
|
57477
57798
|
])
|
|
57478
57799
|
]);
|
|
@@ -57481,17 +57802,104 @@ var init_database_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
57481
57802
|
});
|
|
57482
57803
|
}));
|
|
57483
57804
|
//#endregion
|
|
57484
|
-
//#region src/platform/database/components/database-detail.vue?vue&type=style&index=0&scoped=
|
|
57485
|
-
var
|
|
57805
|
+
//#region src/platform/database/components/database-detail.vue?vue&type=style&index=0&scoped=82eeefa1&lang.css
|
|
57806
|
+
var init_database_detail_vue_vue_type_style_index_0_scoped_82eeefa1_lang = __esmMin((() => {}));
|
|
57486
57807
|
//#endregion
|
|
57487
57808
|
//#region src/platform/database/components/database-detail.vue
|
|
57488
57809
|
var database_detail_default;
|
|
57489
57810
|
var init_database_detail = __esmMin((() => {
|
|
57490
57811
|
init_database_detail_vue_vue_type_script_setup_true_lang();
|
|
57491
57812
|
init_database_detail_vue_vue_type_script_setup_true_lang();
|
|
57492
|
-
|
|
57813
|
+
init_database_detail_vue_vue_type_style_index_0_scoped_82eeefa1_lang();
|
|
57493
57814
|
init__plugin_vue_export_helper();
|
|
57494
|
-
database_detail_default = /*#__PURE__*/ _plugin_vue_export_helper_default(database_detail_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
57815
|
+
database_detail_default = /*#__PURE__*/ _plugin_vue_export_helper_default(database_detail_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-82eeefa1"]]);
|
|
57816
|
+
}));
|
|
57817
|
+
//#endregion
|
|
57818
|
+
//#region src/utils/database-types.ts
|
|
57819
|
+
/**
|
|
57820
|
+
* 检查是否为数值类型
|
|
57821
|
+
*/
|
|
57822
|
+
function isNumericType(type) {
|
|
57823
|
+
return [
|
|
57824
|
+
"int",
|
|
57825
|
+
"integer",
|
|
57826
|
+
"tinyint",
|
|
57827
|
+
"smallint",
|
|
57828
|
+
"mediumint",
|
|
57829
|
+
"bigint",
|
|
57830
|
+
"decimal",
|
|
57831
|
+
"numeric",
|
|
57832
|
+
"float",
|
|
57833
|
+
"double",
|
|
57834
|
+
"real",
|
|
57835
|
+
"number",
|
|
57836
|
+
"smallserial",
|
|
57837
|
+
"serial",
|
|
57838
|
+
"bigserial",
|
|
57839
|
+
"money",
|
|
57840
|
+
"smallmoney",
|
|
57841
|
+
"binary_float",
|
|
57842
|
+
"binary_double"
|
|
57843
|
+
].some((t) => type.toLowerCase().includes(t));
|
|
57844
|
+
}
|
|
57845
|
+
/**
|
|
57846
|
+
* 检查是否为文本类型
|
|
57847
|
+
*/
|
|
57848
|
+
function isTextType(type) {
|
|
57849
|
+
return [
|
|
57850
|
+
"text",
|
|
57851
|
+
"longtext",
|
|
57852
|
+
"mediumtext",
|
|
57853
|
+
"tinytext",
|
|
57854
|
+
"clob",
|
|
57855
|
+
"nclob",
|
|
57856
|
+
"ntext"
|
|
57857
|
+
].some((t) => type.toLowerCase().includes(t));
|
|
57858
|
+
}
|
|
57859
|
+
/**
|
|
57860
|
+
* 检查是否为日期时间类型
|
|
57861
|
+
*/
|
|
57862
|
+
function isDateTimeType(type) {
|
|
57863
|
+
return [
|
|
57864
|
+
"date",
|
|
57865
|
+
"datetime",
|
|
57866
|
+
"timestamp",
|
|
57867
|
+
"time",
|
|
57868
|
+
"year",
|
|
57869
|
+
"time with time zone",
|
|
57870
|
+
"timestamp with time zone",
|
|
57871
|
+
"timestamp with local time zone",
|
|
57872
|
+
"interval",
|
|
57873
|
+
"datetimeoffset",
|
|
57874
|
+
"datetime2",
|
|
57875
|
+
"smalldatetime"
|
|
57876
|
+
].some((t) => type.toLowerCase().includes(t));
|
|
57877
|
+
}
|
|
57878
|
+
/**
|
|
57879
|
+
* 检查是否为布尔类型
|
|
57880
|
+
*/
|
|
57881
|
+
function isBooleanType(type) {
|
|
57882
|
+
return [
|
|
57883
|
+
"boolean",
|
|
57884
|
+
"bool",
|
|
57885
|
+
"bit",
|
|
57886
|
+
"tinyint(1)"
|
|
57887
|
+
].some((t) => type.toLowerCase().includes(t));
|
|
57888
|
+
}
|
|
57889
|
+
/**
|
|
57890
|
+
* 检查是否为JSON类型
|
|
57891
|
+
*/
|
|
57892
|
+
function isJsonType(type) {
|
|
57893
|
+
return ["json", "jsonb"].includes(type.toLowerCase());
|
|
57894
|
+
}
|
|
57895
|
+
/**
|
|
57896
|
+
* 检查是否为数组类型
|
|
57897
|
+
*/
|
|
57898
|
+
function isArrayType(type) {
|
|
57899
|
+
return type.toLowerCase().endsWith("[]");
|
|
57900
|
+
}
|
|
57901
|
+
var init_database_types = __esmMin((() => {
|
|
57902
|
+
init_database_types$1();
|
|
57495
57903
|
}));
|
|
57496
57904
|
//#endregion
|
|
57497
57905
|
//#region src/platform/database/components/data-editor.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -58229,7 +58637,7 @@ var init_table_data_grid = __esmMin((() => {
|
|
|
58229
58637
|
}));
|
|
58230
58638
|
//#endregion
|
|
58231
58639
|
//#region src/platform/database/components/table-detail.vue?vue&type=script&setup=true&lang.ts
|
|
58232
|
-
var _hoisted_1$1, _hoisted_2$1, _hoisted_3$1, _hoisted_4$1, _hoisted_5$1, _hoisted_6$1, _hoisted_7$1, _hoisted_8$1, _hoisted_9$1, _hoisted_10$1, _hoisted_11$1, _hoisted_12$1, _hoisted_13$1, _hoisted_14$1, _hoisted_15$1, _hoisted_16$1, _hoisted_17$1, _hoisted_18$1, _hoisted_19$1, _hoisted_20$1, _hoisted_21$1, _hoisted_22$1, _hoisted_23$1, _hoisted_24$1, _hoisted_25$1, _hoisted_26$1, _hoisted_27$1, _hoisted_28$1, _hoisted_29$1, _hoisted_30$1, _hoisted_31$1, _hoisted_32$1, _hoisted_33$1, _hoisted_34$1, _hoisted_35$1, _hoisted_36$1, _hoisted_37$1, _hoisted_38$1, _hoisted_39$1, _hoisted_40$1, _hoisted_41$1, _hoisted_42$1, _hoisted_43$1, _hoisted_44$1, _hoisted_45$1, _hoisted_46$1, _hoisted_47
|
|
58640
|
+
var _hoisted_1$1, _hoisted_2$1, _hoisted_3$1, _hoisted_4$1, _hoisted_5$1, _hoisted_6$1, _hoisted_7$1, _hoisted_8$1, _hoisted_9$1, _hoisted_10$1, _hoisted_11$1, _hoisted_12$1, _hoisted_13$1, _hoisted_14$1, _hoisted_15$1, _hoisted_16$1, _hoisted_17$1, _hoisted_18$1, _hoisted_19$1, _hoisted_20$1, _hoisted_21$1, _hoisted_22$1, _hoisted_23$1, _hoisted_24$1, _hoisted_25$1, _hoisted_26$1, _hoisted_27$1, _hoisted_28$1, _hoisted_29$1, _hoisted_30$1, _hoisted_31$1, _hoisted_32$1, _hoisted_33$1, _hoisted_34$1, _hoisted_35$1, _hoisted_36$1, _hoisted_37$1, _hoisted_38$1, _hoisted_39$1, _hoisted_40$1, _hoisted_41$1, _hoisted_42$1, _hoisted_43$1, _hoisted_44$1, _hoisted_45$1, _hoisted_46$1, _hoisted_47, _hoisted_48, _hoisted_49, _hoisted_50, _hoisted_51, _hoisted_52, _hoisted_53, _hoisted_54, _hoisted_55, _hoisted_56, _hoisted_57, _hoisted_58, _hoisted_59, _hoisted_60, _hoisted_61, _hoisted_62, _hoisted_63, _hoisted_64, _hoisted_65, _hoisted_66, _hoisted_67, _hoisted_68, _hoisted_69, _hoisted_70, _hoisted_71, table_detail_vue_vue_type_script_setup_true_lang_default;
|
|
58233
58641
|
var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
58234
58642
|
init_vue_runtime_esm_bundler();
|
|
58235
58643
|
init_vue_i18n();
|
|
@@ -58301,7 +58709,7 @@ var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58301
58709
|
_hoisted_44$1 = { class: "table table-bordered" };
|
|
58302
58710
|
_hoisted_45$1 = { class: "table-dark" };
|
|
58303
58711
|
_hoisted_46$1 = { width: "100" };
|
|
58304
|
-
_hoisted_47
|
|
58712
|
+
_hoisted_47 = {
|
|
58305
58713
|
key: 0,
|
|
58306
58714
|
class: "badge bg-primary"
|
|
58307
58715
|
};
|
|
@@ -58311,29 +58719,27 @@ var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58311
58719
|
class: "badge bg-success"
|
|
58312
58720
|
};
|
|
58313
58721
|
_hoisted_50 = { key: 1 };
|
|
58314
|
-
_hoisted_51 =
|
|
58315
|
-
_hoisted_52 =
|
|
58316
|
-
_hoisted_53 =
|
|
58317
|
-
_hoisted_54 = { class: "
|
|
58318
|
-
_hoisted_55 = { class: "
|
|
58319
|
-
_hoisted_56 = { class: "
|
|
58320
|
-
_hoisted_57 = {
|
|
58321
|
-
_hoisted_58 = { class: "
|
|
58322
|
-
_hoisted_59 = {
|
|
58323
|
-
_hoisted_60 =
|
|
58324
|
-
_hoisted_61 =
|
|
58325
|
-
_hoisted_62 =
|
|
58326
|
-
_hoisted_63 =
|
|
58327
|
-
_hoisted_64 = { class: "
|
|
58328
|
-
_hoisted_65 = { class: "
|
|
58329
|
-
_hoisted_66 = { class: "
|
|
58330
|
-
_hoisted_67 = {
|
|
58331
|
-
_hoisted_68 = { class: "
|
|
58332
|
-
_hoisted_69 =
|
|
58333
|
-
_hoisted_70 = { class: "
|
|
58334
|
-
_hoisted_71 =
|
|
58335
|
-
_hoisted_72 = { class: "tab-panel" };
|
|
58336
|
-
_hoisted_73 = { class: "sql-section" };
|
|
58722
|
+
_hoisted_51 = ["title", "onClick"];
|
|
58723
|
+
_hoisted_52 = { class: "tab-panel" };
|
|
58724
|
+
_hoisted_53 = { class: "indexes-content" };
|
|
58725
|
+
_hoisted_54 = { class: "indexes-table" };
|
|
58726
|
+
_hoisted_55 = { class: "table table-bordered" };
|
|
58727
|
+
_hoisted_56 = { class: "table-dark" };
|
|
58728
|
+
_hoisted_57 = { width: "100" };
|
|
58729
|
+
_hoisted_58 = { class: "badge bg-info" };
|
|
58730
|
+
_hoisted_59 = { class: "btn-group btn-group-sm" };
|
|
58731
|
+
_hoisted_60 = ["onClick"];
|
|
58732
|
+
_hoisted_61 = ["onClick"];
|
|
58733
|
+
_hoisted_62 = { class: "tab-panel" };
|
|
58734
|
+
_hoisted_63 = { class: "relations-content" };
|
|
58735
|
+
_hoisted_64 = { class: "relations-table" };
|
|
58736
|
+
_hoisted_65 = { class: "table table-bordered" };
|
|
58737
|
+
_hoisted_66 = { class: "table-dark" };
|
|
58738
|
+
_hoisted_67 = { width: "100" };
|
|
58739
|
+
_hoisted_68 = { class: "btn-group btn-group-sm" };
|
|
58740
|
+
_hoisted_69 = ["onClick"];
|
|
58741
|
+
_hoisted_70 = { class: "tab-panel" };
|
|
58742
|
+
_hoisted_71 = { class: "sql-section" };
|
|
58337
58743
|
table_detail_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
58338
58744
|
__name: "table-detail",
|
|
58339
58745
|
props: {
|
|
@@ -58561,15 +58967,6 @@ var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58561
58967
|
tableEditorMode.value = "edit";
|
|
58562
58968
|
showTableEditor.value = true;
|
|
58563
58969
|
}
|
|
58564
|
-
function deleteColumn(column) {
|
|
58565
|
-
modal.confirm(t("tableDetail.confirmDeleteColumn", { name: column.name }), {
|
|
58566
|
-
confirmButtonText: "删除",
|
|
58567
|
-
cancelButtonText: "取消",
|
|
58568
|
-
type: "danger"
|
|
58569
|
-
}).then((result) => {
|
|
58570
|
-
if (result) emit("refresh-structure");
|
|
58571
|
-
});
|
|
58572
|
-
}
|
|
58573
58970
|
function editIndex(index) {
|
|
58574
58971
|
console.log("编辑索引:", index);
|
|
58575
58972
|
}
|
|
@@ -58830,47 +59227,45 @@ var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58830
59227
|
createBaseVNode("td", null, [createBaseVNode("code", null, toDisplayString(column.type), 1)]),
|
|
58831
59228
|
createBaseVNode("td", null, [createBaseVNode("span", { class: normalizeClass(column.nullable ? "text-warning" : "text-success") }, [createBaseVNode("i", { class: normalizeClass(column.nullable ? "bi bi-unlock" : "bi bi-lock-fill") }, null, 2), createTextVNode(" " + toDisplayString(column.nullable ? "YES" : "NO"), 1)], 2)]),
|
|
58832
59229
|
createBaseVNode("td", null, toDisplayString(column.defaultValue || "-"), 1),
|
|
58833
|
-
createBaseVNode("td", null, [column.isPrimary ? (openBlock(), createElementBlock("span", _hoisted_47
|
|
59230
|
+
createBaseVNode("td", null, [column.isPrimary ? (openBlock(), createElementBlock("span", _hoisted_47, [_cache[37] || (_cache[37] = createBaseVNode("i", { class: "bi bi-key-fill" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("tableDetail.primaryKeyHeader")), 1)])) : (openBlock(), createElementBlock("span", _hoisted_48, "-"))]),
|
|
58834
59231
|
createBaseVNode("td", null, [column.isAutoIncrement ? (openBlock(), createElementBlock("span", _hoisted_49, [_cache[38] || (_cache[38] = createBaseVNode("i", { class: "bi bi-arrow-up-circle" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("tableDetail.autoIncHeader")), 1)])) : (openBlock(), createElementBlock("span", _hoisted_50, "-"))]),
|
|
58835
59232
|
createBaseVNode("td", null, toDisplayString(column.comment || "-"), 1),
|
|
58836
|
-
createBaseVNode("td", null, [createBaseVNode("
|
|
59233
|
+
createBaseVNode("td", null, [createBaseVNode("button", {
|
|
58837
59234
|
class: "btn btn-outline-primary btn-sm",
|
|
59235
|
+
title: _ctx.$t("tableDetail.modifyStructure"),
|
|
58838
59236
|
onClick: ($event) => editColumn(column)
|
|
58839
|
-
}, [..._cache[39] || (_cache[39] = [createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)])], 8,
|
|
58840
|
-
class: "btn btn-outline-danger btn-sm",
|
|
58841
|
-
onClick: ($event) => deleteColumn(column)
|
|
58842
|
-
}, [..._cache[40] || (_cache[40] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_53)])])
|
|
59237
|
+
}, [..._cache[39] || (_cache[39] = [createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)])], 8, _hoisted_51)])
|
|
58843
59238
|
]);
|
|
58844
59239
|
}), 128))])])])])], 512), [[vShow, activeTab.value === "structure"]]),
|
|
58845
|
-
withDirectives(createBaseVNode("div",
|
|
59240
|
+
withDirectives(createBaseVNode("div", _hoisted_52, [createBaseVNode("div", _hoisted_53, [createBaseVNode("div", _hoisted_54, [createBaseVNode("table", _hoisted_55, [createBaseVNode("thead", _hoisted_56, [createBaseVNode("tr", null, [
|
|
58846
59241
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.indexNameHeader")), 1),
|
|
58847
59242
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.typeHeader")), 1),
|
|
58848
59243
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.uniqueHeader")), 1),
|
|
58849
59244
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.columnsHeader")), 1),
|
|
58850
|
-
createBaseVNode("th",
|
|
59245
|
+
createBaseVNode("th", _hoisted_57, toDisplayString(_ctx.$t("tableDetail.operationsHeader")), 1)
|
|
58851
59246
|
])]), createBaseVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.tableStructure?.indexes || [], (index) => {
|
|
58852
59247
|
return openBlock(), createElementBlock("tr", { key: index.name }, [
|
|
58853
59248
|
createBaseVNode("td", null, [createBaseVNode("strong", null, toDisplayString(index.name), 1)]),
|
|
58854
|
-
createBaseVNode("td", null, [createBaseVNode("span",
|
|
59249
|
+
createBaseVNode("td", null, [createBaseVNode("span", _hoisted_58, toDisplayString(index.type), 1)]),
|
|
58855
59250
|
createBaseVNode("td", null, [createBaseVNode("span", { class: normalizeClass(index.unique ? "text-success" : "text-secondary") }, [createBaseVNode("i", { class: normalizeClass(index.unique ? "bi bi-check-circle-fill" : "bi bi-circle") }, null, 2), createTextVNode(" " + toDisplayString(index.unique ? _ctx.$t("common.yes") : _ctx.$t("common.no")), 1)], 2)]),
|
|
58856
59251
|
createBaseVNode("td", null, [createBaseVNode("code", null, toDisplayString(index.columns.join(", ")), 1)]),
|
|
58857
|
-
createBaseVNode("td", null, [createBaseVNode("div",
|
|
59252
|
+
createBaseVNode("td", null, [createBaseVNode("div", _hoisted_59, [createBaseVNode("button", {
|
|
58858
59253
|
class: "btn btn-outline-primary btn-sm",
|
|
58859
59254
|
onClick: ($event) => editIndex(index)
|
|
58860
|
-
}, [..._cache[
|
|
59255
|
+
}, [..._cache[40] || (_cache[40] = [createBaseVNode("i", { class: "bi bi-pencil" }, null, -1)])], 8, _hoisted_60), createBaseVNode("button", {
|
|
58861
59256
|
class: "btn btn-outline-danger btn-sm",
|
|
58862
59257
|
onClick: ($event) => deleteIndex(index)
|
|
58863
|
-
}, [..._cache[
|
|
59258
|
+
}, [..._cache[41] || (_cache[41] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_61)])])
|
|
58864
59259
|
]);
|
|
58865
59260
|
}), 128))])])])])], 512), [[vShow, activeTab.value === "indexes"]]),
|
|
58866
|
-
withDirectives(createBaseVNode("div",
|
|
59261
|
+
withDirectives(createBaseVNode("div", _hoisted_62, [createBaseVNode("div", _hoisted_63, [createBaseVNode("div", _hoisted_64, [createBaseVNode("table", _hoisted_65, [createBaseVNode("thead", _hoisted_66, [createBaseVNode("tr", null, [
|
|
58867
59262
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.constraintNameHeader")), 1),
|
|
58868
59263
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.localColumnHeader")), 1),
|
|
58869
59264
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.targetTableHeader")), 1),
|
|
58870
59265
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.targetColumnHeader")), 1),
|
|
58871
59266
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.onDeleteHeader")), 1),
|
|
58872
59267
|
createBaseVNode("th", null, toDisplayString(_ctx.$t("tableDetail.onUpdateHeader")), 1),
|
|
58873
|
-
createBaseVNode("th",
|
|
59268
|
+
createBaseVNode("th", _hoisted_67, toDisplayString(_ctx.$t("tableDetail.operationsHeader")), 1)
|
|
58874
59269
|
])]), createBaseVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.tableStructure?.foreignKeys || [], (fk) => {
|
|
58875
59270
|
return openBlock(), createElementBlock("tr", { key: fk.name }, [
|
|
58876
59271
|
createBaseVNode("td", null, [createBaseVNode("strong", null, toDisplayString(fk.name), 1)]),
|
|
@@ -58879,13 +59274,13 @@ var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58879
59274
|
createBaseVNode("td", null, [createBaseVNode("code", null, toDisplayString(fk.referencedColumn), 1)]),
|
|
58880
59275
|
createBaseVNode("td", null, toDisplayString(fk.onDelete || "-"), 1),
|
|
58881
59276
|
createBaseVNode("td", null, toDisplayString(fk.onUpdate || "-"), 1),
|
|
58882
|
-
createBaseVNode("td", null, [createBaseVNode("div",
|
|
59277
|
+
createBaseVNode("td", null, [createBaseVNode("div", _hoisted_68, [createBaseVNode("button", {
|
|
58883
59278
|
class: "btn btn-outline-danger btn-sm",
|
|
58884
59279
|
onClick: ($event) => deleteForeignKey(fk)
|
|
58885
|
-
}, [..._cache[
|
|
59280
|
+
}, [..._cache[42] || (_cache[42] = [createBaseVNode("i", { class: "bi bi-trash" }, null, -1)])], 8, _hoisted_69)])])
|
|
58886
59281
|
]);
|
|
58887
59282
|
}), 128))])])])])], 512), [[vShow, activeTab.value === "relations"]]),
|
|
58888
|
-
withDirectives(createBaseVNode("div",
|
|
59283
|
+
withDirectives(createBaseVNode("div", _hoisted_70, [createBaseVNode("div", _hoisted_71, [createVNode(sql_executor_default, {
|
|
58889
59284
|
connection: __props.connection,
|
|
58890
59285
|
database: __props.database
|
|
58891
59286
|
}, null, 8, ["connection", "database"])])], 512), [[vShow, activeTab.value === "sql"]])
|
|
@@ -58932,21 +59327,40 @@ var init_table_detail_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58932
59327
|
});
|
|
58933
59328
|
}));
|
|
58934
59329
|
//#endregion
|
|
58935
|
-
//#region src/platform/database/components/table-detail.vue?vue&type=style&index=0&scoped=
|
|
58936
|
-
var
|
|
59330
|
+
//#region src/platform/database/components/table-detail.vue?vue&type=style&index=0&scoped=aefb7a86&lang.css
|
|
59331
|
+
var init_table_detail_vue_vue_type_style_index_0_scoped_aefb7a86_lang = __esmMin((() => {}));
|
|
58937
59332
|
//#endregion
|
|
58938
59333
|
//#region src/platform/database/components/table-detail.vue
|
|
58939
59334
|
var table_detail_default;
|
|
58940
59335
|
var init_table_detail = __esmMin((() => {
|
|
58941
59336
|
init_table_detail_vue_vue_type_script_setup_true_lang();
|
|
58942
59337
|
init_table_detail_vue_vue_type_script_setup_true_lang();
|
|
58943
|
-
|
|
59338
|
+
init_table_detail_vue_vue_type_style_index_0_scoped_aefb7a86_lang();
|
|
58944
59339
|
init__plugin_vue_export_helper();
|
|
58945
|
-
table_detail_default = /*#__PURE__*/ _plugin_vue_export_helper_default(table_detail_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
59340
|
+
table_detail_default = /*#__PURE__*/ _plugin_vue_export_helper_default(table_detail_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-aefb7a86"]]);
|
|
58946
59341
|
}));
|
|
58947
59342
|
//#endregion
|
|
59343
|
+
//#region src/platform/database/utils/table.ts
|
|
59344
|
+
/**
|
|
59345
|
+
* 表元数据的通用判定(TableEntity 的跨方言差异集中在这里)。
|
|
59346
|
+
*
|
|
59347
|
+
* 各数据库方言 getTables 写入的 `type` 值并不统一:
|
|
59348
|
+
* - MySQL 的 information_schema.TABLES 给 'BASE TABLE' / 'VIEW'
|
|
59349
|
+
* - 其它方言可能写小写 'view',也可能完全不填 type
|
|
59350
|
+
* 因此统一按「包含 VIEW」判定;缺省(无 type)按普通表处理。
|
|
59351
|
+
*/
|
|
59352
|
+
/** 是否视图。 */
|
|
59353
|
+
function isViewTable(table) {
|
|
59354
|
+
return String(table?.type || "").toUpperCase().includes("VIEW");
|
|
59355
|
+
}
|
|
59356
|
+
/** 从混合列表(表 + 视图)中筛出普通表。 */
|
|
59357
|
+
function pickTables(list) {
|
|
59358
|
+
return (list || []).filter((t) => !isViewTable(t));
|
|
59359
|
+
}
|
|
59360
|
+
var init_table = __esmMin((() => {}));
|
|
59361
|
+
//#endregion
|
|
58948
59362
|
//#region src/platform/database/explorer.vue?vue&type=script&setup=true&lang.ts
|
|
58949
|
-
var _hoisted_1, _hoisted_2, _hoisted_3, _hoisted_4, _hoisted_5, _hoisted_6, _hoisted_7, _hoisted_8, _hoisted_9, _hoisted_10, _hoisted_11, _hoisted_12, _hoisted_13, _hoisted_14, _hoisted_15, _hoisted_16, _hoisted_17, _hoisted_18, _hoisted_19, _hoisted_20, _hoisted_21, _hoisted_22, _hoisted_23, _hoisted_24, _hoisted_25, _hoisted_26, _hoisted_27, _hoisted_28, _hoisted_29, _hoisted_30, _hoisted_31, _hoisted_32, _hoisted_33, _hoisted_34, _hoisted_35, _hoisted_36, _hoisted_37, _hoisted_38, _hoisted_39, _hoisted_40, _hoisted_41, _hoisted_42, _hoisted_43, _hoisted_44, _hoisted_45, _hoisted_46,
|
|
59363
|
+
var _hoisted_1, _hoisted_2, _hoisted_3, _hoisted_4, _hoisted_5, _hoisted_6, _hoisted_7, _hoisted_8, _hoisted_9, _hoisted_10, _hoisted_11, _hoisted_12, _hoisted_13, _hoisted_14, _hoisted_15, _hoisted_16, _hoisted_17, _hoisted_18, _hoisted_19, _hoisted_20, _hoisted_21, _hoisted_22, _hoisted_23, _hoisted_24, _hoisted_25, _hoisted_26, _hoisted_27, _hoisted_28, _hoisted_29, _hoisted_30, _hoisted_31, _hoisted_32, _hoisted_33, _hoisted_34, _hoisted_35, _hoisted_36, _hoisted_37, _hoisted_38, _hoisted_39, _hoisted_40, _hoisted_41, _hoisted_42, _hoisted_43, _hoisted_44, _hoisted_45, _hoisted_46, explorer_vue_vue_type_script_setup_true_lang_default;
|
|
58950
59364
|
var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
58951
59365
|
init_vue_runtime_esm_bundler();
|
|
58952
59366
|
init_vue_router();
|
|
@@ -58957,6 +59371,7 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
58957
59371
|
init_connection_detail();
|
|
58958
59372
|
init_database_detail();
|
|
58959
59373
|
init_table_detail();
|
|
59374
|
+
init_table();
|
|
58960
59375
|
init_modal();
|
|
58961
59376
|
_hoisted_1 = { class: "database-explorer" };
|
|
58962
59377
|
_hoisted_2 = { class: "explorer-layout" };
|
|
@@ -59014,18 +59429,17 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59014
59429
|
};
|
|
59015
59430
|
_hoisted_40 = { class: "node-actions" };
|
|
59016
59431
|
_hoisted_41 = ["onClick", "title"];
|
|
59017
|
-
_hoisted_42 =
|
|
59018
|
-
_hoisted_43 = {
|
|
59432
|
+
_hoisted_42 = {
|
|
59019
59433
|
key: 0,
|
|
59020
59434
|
class: "empty-state"
|
|
59021
59435
|
};
|
|
59022
|
-
|
|
59023
|
-
|
|
59024
|
-
|
|
59436
|
+
_hoisted_43 = { class: "empty-text" };
|
|
59437
|
+
_hoisted_44 = { class: "explorer-main" };
|
|
59438
|
+
_hoisted_45 = {
|
|
59025
59439
|
key: 3,
|
|
59026
59440
|
class: "default-state"
|
|
59027
59441
|
};
|
|
59028
|
-
|
|
59442
|
+
_hoisted_46 = { class: "default-content" };
|
|
59029
59443
|
explorer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
59030
59444
|
__name: "explorer",
|
|
59031
59445
|
setup(__props) {
|
|
@@ -59045,6 +59459,7 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59045
59459
|
const databaseCache = ref(/* @__PURE__ */ new Map());
|
|
59046
59460
|
const tableCache = ref(/* @__PURE__ */ new Map());
|
|
59047
59461
|
const databaseInfoCache = ref(/* @__PURE__ */ new Map());
|
|
59462
|
+
const inflightTables = /* @__PURE__ */ new Map();
|
|
59048
59463
|
const activeTab = ref("overview");
|
|
59049
59464
|
const activeTableTab = ref("data");
|
|
59050
59465
|
const tableData = ref([]);
|
|
@@ -59094,20 +59509,17 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59094
59509
|
expandedConnections.value.add(connectionId);
|
|
59095
59510
|
loadDatabasesForConnection(connection);
|
|
59096
59511
|
}
|
|
59097
|
-
if (database) setTimeout(() => {
|
|
59512
|
+
if (database) setTimeout(async () => {
|
|
59098
59513
|
selectedDatabase.value = database;
|
|
59099
59514
|
selectedTable.value = null;
|
|
59100
59515
|
activeTab.value = "tables";
|
|
59101
59516
|
const dbKey = `${connectionId}-${database}`;
|
|
59102
59517
|
expandedDatabases.value.add(dbKey);
|
|
59103
59518
|
loadDatabaseInfo(connection, database);
|
|
59104
|
-
loadTablesForDatabase(connection, database, true);
|
|
59105
|
-
|
|
59106
|
-
|
|
59107
|
-
|
|
59108
|
-
isUpdatingFromUrl = false;
|
|
59109
|
-
});
|
|
59110
|
-
else isUpdatingFromUrl = false;
|
|
59519
|
+
await loadTablesForDatabase(connection, database, true);
|
|
59520
|
+
const t = tableName ? getTablesForDatabase(connectionId, database).find((x) => x.name === tableName) : void 0;
|
|
59521
|
+
if (t) selectTable(connection, database, t);
|
|
59522
|
+
isUpdatingFromUrl = false;
|
|
59111
59523
|
}, 100);
|
|
59112
59524
|
else isUpdatingFromUrl = false;
|
|
59113
59525
|
}
|
|
@@ -59148,6 +59560,7 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59148
59560
|
}
|
|
59149
59561
|
}
|
|
59150
59562
|
async function loadDatabasesForConnection(connection, forceRefresh = false) {
|
|
59563
|
+
if (connection._isProxy) return;
|
|
59151
59564
|
const cacheKey = connection.id || "";
|
|
59152
59565
|
if (!forceRefresh && databaseCache.value.has(cacheKey)) return;
|
|
59153
59566
|
if (!loadingConnections.value.has(cacheKey)) loadingConnections.value.add(cacheKey);
|
|
@@ -59196,27 +59609,33 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59196
59609
|
}
|
|
59197
59610
|
async function loadTablesForDatabase(connection, database, forceRefresh = false) {
|
|
59198
59611
|
const dbKey = `${connection.id}-${database}`;
|
|
59199
|
-
|
|
59612
|
+
const inflight = inflightTables.get(dbKey);
|
|
59613
|
+
if (inflight) return inflight;
|
|
59200
59614
|
if (!forceRefresh && tableCache.value.has(dbKey)) return;
|
|
59201
59615
|
loadingTables.value.add(dbKey);
|
|
59202
|
-
|
|
59203
|
-
|
|
59204
|
-
|
|
59205
|
-
|
|
59206
|
-
|
|
59207
|
-
|
|
59208
|
-
|
|
59209
|
-
|
|
59210
|
-
|
|
59211
|
-
|
|
59212
|
-
|
|
59213
|
-
|
|
59214
|
-
|
|
59215
|
-
|
|
59216
|
-
|
|
59217
|
-
|
|
59218
|
-
|
|
59219
|
-
|
|
59616
|
+
const task = (async () => {
|
|
59617
|
+
try {
|
|
59618
|
+
const tables = (await databaseService.getDatabaseInfo(connection.id, database))?.data?.tables || [];
|
|
59619
|
+
const newCache = new Map(tableCache.value);
|
|
59620
|
+
newCache.set(dbKey, tables);
|
|
59621
|
+
tableCache.value = newCache;
|
|
59622
|
+
} catch (error) {
|
|
59623
|
+
console.error("加载表失败:", error);
|
|
59624
|
+
modal.error(error.msg || error.message || "加载表失败", {
|
|
59625
|
+
operation: "LOAD_TABLES",
|
|
59626
|
+
database,
|
|
59627
|
+
stack: error.stack
|
|
59628
|
+
});
|
|
59629
|
+
const newCache = new Map(tableCache.value);
|
|
59630
|
+
newCache.set(dbKey, []);
|
|
59631
|
+
tableCache.value = newCache;
|
|
59632
|
+
} finally {
|
|
59633
|
+
loadingTables.value.delete(dbKey);
|
|
59634
|
+
inflightTables.delete(dbKey);
|
|
59635
|
+
}
|
|
59636
|
+
})();
|
|
59637
|
+
inflightTables.set(dbKey, task);
|
|
59638
|
+
return task;
|
|
59220
59639
|
}
|
|
59221
59640
|
async function loadDatabaseInfo(connection, database, forceRefresh = false) {
|
|
59222
59641
|
const dbKey = `${connection.id}-${database}`;
|
|
@@ -59317,10 +59736,14 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59317
59736
|
function getDatabasesForConnection(connectionId) {
|
|
59318
59737
|
return databaseCache.value.get(connectionId) || [];
|
|
59319
59738
|
}
|
|
59739
|
+
/**
|
|
59740
|
+
* 左侧树只展示表:视图不进树——点开会被当成表进入表详情(视图没有主键/索引/外键,
|
|
59741
|
+
* 结构页也不适用),视图统一由数据库详情页的"视图"标签页承载(独立 getViews 接口)。
|
|
59742
|
+
*/
|
|
59320
59743
|
function getTablesForDatabase(connectionId, database) {
|
|
59321
59744
|
if (!connectionId) return [];
|
|
59322
59745
|
const dbKey = `${connectionId}-${database}`;
|
|
59323
|
-
return tableCache.value.get(dbKey) || [];
|
|
59746
|
+
return pickTables(tableCache.value.get(dbKey) || []);
|
|
59324
59747
|
}
|
|
59325
59748
|
function editConnection(connection) {
|
|
59326
59749
|
connectionEditorRef.value?.showEditModal(connection);
|
|
@@ -59362,12 +59785,6 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59362
59785
|
function handleOpenSqlQuery(connection) {
|
|
59363
59786
|
showToast("提示", "SQL查询功能开发中...", "info");
|
|
59364
59787
|
}
|
|
59365
|
-
function handleExportSchema(connection) {
|
|
59366
|
-
showToast("提示", "架构导出功能开发中...", "info");
|
|
59367
|
-
}
|
|
59368
|
-
function handleViewLogs(connection) {
|
|
59369
|
-
showToast("提示", "日志查看功能开发中...", "info");
|
|
59370
|
-
}
|
|
59371
59788
|
function refreshAll() {
|
|
59372
59789
|
databaseCache.value.clear();
|
|
59373
59790
|
tableCache.value.clear();
|
|
@@ -59383,17 +59800,14 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59383
59800
|
showToast("", "表结构已刷新", "success");
|
|
59384
59801
|
}
|
|
59385
59802
|
}
|
|
59386
|
-
function viewTableStructure(connection, database, table) {
|
|
59387
|
-
selectTable(connection, database, table);
|
|
59388
|
-
activeTableTab.value = "structure";
|
|
59389
|
-
}
|
|
59390
59803
|
function getDbTypeLabel(type) {
|
|
59391
59804
|
return {
|
|
59392
59805
|
mysql: "MySQL",
|
|
59393
59806
|
postgres: "PostgreSQL",
|
|
59394
59807
|
sqlite: "SQLite",
|
|
59395
59808
|
mssql: "SQL Server",
|
|
59396
|
-
oracle: "Oracle"
|
|
59809
|
+
oracle: "Oracle",
|
|
59810
|
+
remote: "远程代理服务"
|
|
59397
59811
|
}[type] || type;
|
|
59398
59812
|
}
|
|
59399
59813
|
function getDbLogoClass(type) {
|
|
@@ -59411,7 +59825,8 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59411
59825
|
postgres: "P",
|
|
59412
59826
|
sqlite: "S",
|
|
59413
59827
|
mssql: "MS",
|
|
59414
|
-
oracle: "O"
|
|
59828
|
+
oracle: "O",
|
|
59829
|
+
remote: "R"
|
|
59415
59830
|
}[type] || "D";
|
|
59416
59831
|
}
|
|
59417
59832
|
function formatNumber(num) {
|
|
@@ -59689,7 +60104,7 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59689
60104
|
key: `${connection.id}-${database}-${table.name}`,
|
|
59690
60105
|
class: normalizeClass(["tree-node table-node", { "selected": selectedTable.value?.name === table.name && selectedDatabase.value === database && selectedConnection.value?.id === connection.id }])
|
|
59691
60106
|
}, [createBaseVNode("div", _hoisted_35, [
|
|
59692
|
-
_cache[
|
|
60107
|
+
_cache[13] || (_cache[13] = createBaseVNode("div", { class: "node-icon" }, [createBaseVNode("i", { class: "bi bi-table" })], -1)),
|
|
59693
60108
|
createBaseVNode("div", {
|
|
59694
60109
|
class: "node-main",
|
|
59695
60110
|
onClick: ($event) => selectTable(connection, database, table)
|
|
@@ -59698,26 +60113,20 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59698
60113
|
class: "btn btn-sm btn-icon",
|
|
59699
60114
|
onClick: withModifiers(($event) => refreshTable(connection, database, table), ["stop"]),
|
|
59700
60115
|
title: _ctx.$t("explorer.refreshTable")
|
|
59701
|
-
}, [..._cache[12] || (_cache[12] = [createBaseVNode("i", { class: "bi bi-arrow-clockwise" }, null, -1)])], 8, _hoisted_41)
|
|
59702
|
-
class: "btn btn-sm btn-icon",
|
|
59703
|
-
onClick: withModifiers(($event) => viewTableStructure(connection, database, table), ["stop"]),
|
|
59704
|
-
title: _ctx.$t("explorer.viewStructure")
|
|
59705
|
-
}, [..._cache[13] || (_cache[13] = [createBaseVNode("i", { class: "bi bi-diagram-3" }, null, -1)])], 8, _hoisted_42)])
|
|
60116
|
+
}, [..._cache[12] || (_cache[12] = [createBaseVNode("i", { class: "bi bi-arrow-clockwise" }, null, -1)])], 8, _hoisted_41)])
|
|
59706
60117
|
])], 2);
|
|
59707
60118
|
}), 128))])) : createCommentVNode("", true)], 2);
|
|
59708
60119
|
}), 128))])) : createCommentVNode("", true)], 2);
|
|
59709
|
-
}), 128))]), connections.value.length === 0 ? (openBlock(), createElementBlock("div",
|
|
60120
|
+
}), 128))]), connections.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_42, [_cache[15] || (_cache[15] = createBaseVNode("div", { class: "empty-icon" }, [createBaseVNode("i", { class: "bi bi-inbox" })], -1)), createBaseVNode("div", _hoisted_43, [createBaseVNode("p", null, toDisplayString(_ctx.$t("connection.noConnectionYet")), 1), createBaseVNode("button", {
|
|
59710
60121
|
class: "btn btn-primary btn-sm",
|
|
59711
60122
|
onClick: showAddConnectionModal
|
|
59712
|
-
}, [_cache[
|
|
60123
|
+
}, [_cache[14] || (_cache[14] = createBaseVNode("i", { class: "bi bi-plus" }, null, -1)), createTextVNode(" " + toDisplayString(_ctx.$t("explorer.addConnection")), 1)])])])) : createCommentVNode("", true)])]), createBaseVNode("div", _hoisted_44, [selectedConnection.value && !selectedDatabase.value && !selectedTable.value ? (openBlock(), createBlock(connection_detail_default, {
|
|
59713
60124
|
key: 0,
|
|
59714
60125
|
connection: selectedConnection.value,
|
|
59715
60126
|
onTestConnection: handleTestConnection,
|
|
59716
60127
|
onEditConnection: handleEditConnection,
|
|
59717
60128
|
onRefreshAll: handleRefreshAll,
|
|
59718
60129
|
onOpenSqlQuery: handleOpenSqlQuery,
|
|
59719
|
-
onExportSchema: handleExportSchema,
|
|
59720
|
-
onViewLogs: handleViewLogs,
|
|
59721
60130
|
onCreateDatabase: handleCreateDatabase
|
|
59722
60131
|
}, null, 8, ["connection"])) : selectedConnection.value && selectedDatabase.value && !selectedTable.value ? (openBlock(), createBlock(database_detail_default, {
|
|
59723
60132
|
key: 1,
|
|
@@ -59769,8 +60178,8 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59769
60178
|
"total",
|
|
59770
60179
|
"sql-result",
|
|
59771
60180
|
"sql-executing"
|
|
59772
|
-
])) : (openBlock(), createElementBlock("div",
|
|
59773
|
-
_cache[
|
|
60181
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_45, [createBaseVNode("div", _hoisted_46, [
|
|
60182
|
+
_cache[16] || (_cache[16] = createBaseVNode("div", { class: "default-icon" }, [createBaseVNode("i", { class: "bi bi-diagram-3" })], -1)),
|
|
59774
60183
|
createBaseVNode("h5", null, toDisplayString(_ctx.$t("explorer.defaultTitle")), 1),
|
|
59775
60184
|
createBaseVNode("p", null, toDisplayString(_ctx.$t("explorer.defaultDesc")), 1)
|
|
59776
60185
|
])]))])]),
|
|
@@ -59789,8 +60198,8 @@ var init_explorer_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
59789
60198
|
});
|
|
59790
60199
|
}));
|
|
59791
60200
|
//#endregion
|
|
59792
|
-
//#region src/platform/database/explorer.vue?vue&type=style&index=0&scoped=
|
|
59793
|
-
var
|
|
60201
|
+
//#region src/platform/database/explorer.vue?vue&type=style&index=0&scoped=e2c2b105&lang.css
|
|
60202
|
+
var init_explorer_vue_vue_type_style_index_0_scoped_e2c2b105_lang = __esmMin((() => {}));
|
|
59794
60203
|
//#endregion
|
|
59795
60204
|
//#region src/platform/database/explorer.vue
|
|
59796
60205
|
var explorer_default;
|
|
@@ -59798,8 +60207,8 @@ var explorer_default;
|
|
|
59798
60207
|
__esmMin((() => {
|
|
59799
60208
|
init_explorer_vue_vue_type_script_setup_true_lang();
|
|
59800
60209
|
init_explorer_vue_vue_type_script_setup_true_lang();
|
|
59801
|
-
|
|
60210
|
+
init_explorer_vue_vue_type_style_index_0_scoped_e2c2b105_lang();
|
|
59802
60211
|
init__plugin_vue_export_helper();
|
|
59803
|
-
explorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(explorer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
60212
|
+
explorer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(explorer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e2c2b105"]]);
|
|
59804
60213
|
}))();
|
|
59805
60214
|
export { explorer_default as default };
|