dsh-database-view 0.5.0 → 0.6.0
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/dsh.plugin.json +1 -1
- package/lib/client.js +600 -262
- package/lib/host/config.js +46 -4
- package/lib/host/config.js.map +1 -1
- package/lib/host/native.js +9 -2
- package/lib/host/native.js.map +1 -1
- package/lib/host/routes.js +7 -0
- package/lib/host/routes.js.map +1 -1
- package/lib/host/tools.js +4 -8
- package/lib/host/tools.js.map +1 -1
- package/lib/shared/toolbaractions.js +1 -1
- package/lib/shared/toolbaractions.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -154,6 +154,7 @@ var api = {
|
|
|
154
154
|
env: () => post("/env"),
|
|
155
155
|
health: () => post("/health"),
|
|
156
156
|
saveConnection: (draft) => post("/connections/save", { ...draft }),
|
|
157
|
+
duplicateConnection: (id, name2) => post("/connections/duplicate", { id, name: name2 }),
|
|
157
158
|
deleteConnection: (id) => post("/connections/delete", { id }),
|
|
158
159
|
restoreConnection: (id) => post("/connections/restore", { id }),
|
|
159
160
|
purgeConnection: (id) => post("/connections/purge", { id }),
|
|
@@ -193,6 +194,11 @@ var zh = {
|
|
|
193
194
|
"app.addTitle": "新增数据源",
|
|
194
195
|
"app.edit": "编辑",
|
|
195
196
|
"app.editTitle": "编辑选中的数据源",
|
|
197
|
+
"app.copy": "复制",
|
|
198
|
+
"app.copyTitle": "复制选中的数据源",
|
|
199
|
+
"app.copyName": "{name} 副本",
|
|
200
|
+
"notify.duplicated": "已复制数据源",
|
|
201
|
+
"notify.duplicateFailed": "复制失败:{error}",
|
|
196
202
|
"app.refresh": "刷新",
|
|
197
203
|
"app.refreshTitle": "刷新选中的数据源",
|
|
198
204
|
"app.delete": "删除",
|
|
@@ -213,6 +219,7 @@ var zh = {
|
|
|
213
219
|
"app.confirmTitle": "确认操作",
|
|
214
220
|
"app.continue": "继续",
|
|
215
221
|
"conn.newTitle": "新建数据源连接",
|
|
222
|
+
"conn.copyTitle": "复制数据源",
|
|
216
223
|
"conn.editTitle": "编辑连接",
|
|
217
224
|
"conn.name": "名称",
|
|
218
225
|
"conn.type": "数据库类型",
|
|
@@ -226,7 +233,6 @@ var zh = {
|
|
|
226
233
|
"conn.ssh": "通过 SSH 隧道连接",
|
|
227
234
|
"conn.tls": "启用 TLS / SSL",
|
|
228
235
|
"conn.readonly": "只读连接(面板与 Agent 均拒绝写操作)",
|
|
229
|
-
"conn.readonlyEdit": "只读连接(仅新建时设置,创建后不能修改;需变更请新建连接)",
|
|
230
236
|
"conn.test": "测试连接",
|
|
231
237
|
"conn.save": "保存",
|
|
232
238
|
"conn.cancel": "取消",
|
|
@@ -422,6 +428,13 @@ var zh = {
|
|
|
422
428
|
"menu.sortDesc": "按此列降序",
|
|
423
429
|
"menu.clearSort": "清除排序",
|
|
424
430
|
"menu.copyColumnValues": "复制本列值({n} 行)",
|
|
431
|
+
"menu.copyColumnName": "复制列名「{name}」",
|
|
432
|
+
"menu.showAllColumns": "显示全部列",
|
|
433
|
+
"menu.showAllColumnsHidden": "显示全部列(已隐藏 {n} 列)",
|
|
434
|
+
"menu.filterPage": "用该值筛选当前页",
|
|
435
|
+
"menu.inListShort": "IN 列表",
|
|
436
|
+
"menu.whereShort": "WHERE 条件",
|
|
437
|
+
"menu.copyCellValue": "复制单元格值",
|
|
425
438
|
"menu.copyIn": "复制为 IN 列表",
|
|
426
439
|
"menu.copyComma": "复制本列(逗号分隔)",
|
|
427
440
|
"menu.copyAllColumns": "复制全部列名",
|
|
@@ -498,6 +511,162 @@ var zh = {
|
|
|
498
511
|
"table.clearColumnFilters": "清除列筛选",
|
|
499
512
|
"shortcut.aria": "{label} 的快捷键",
|
|
500
513
|
"conn.keepPassword": "留空则保持不变",
|
|
514
|
+
"redis.dbDefault": "db{n}(默认)",
|
|
515
|
+
"redis.chooseDb": "选择要展示的数据库",
|
|
516
|
+
"redis.allDbs": "所有数据库",
|
|
517
|
+
"redis.dbTitle": "Redis 逻辑库 db{n}{default}",
|
|
518
|
+
"redis.dbTitleDefault": "(默认)",
|
|
519
|
+
"redis.keysCount": "{n} 个键",
|
|
520
|
+
"redis.scanKeys": "扫描键",
|
|
521
|
+
"redis.scanning": "正在扫描键…",
|
|
522
|
+
"redis.loading": "正在加载…",
|
|
523
|
+
"redis.loadMore": "加载更多键",
|
|
524
|
+
"redis.noDb": "未选择数据库,使用行尾的数据库按钮选择",
|
|
525
|
+
"redis.emptyKeys": "没有键",
|
|
526
|
+
"redis.emptyMatch": "没有匹配的键",
|
|
527
|
+
"redis.emptyDb": "这个库还没有键",
|
|
528
|
+
"redis.noKeyword": "没有包含这个关键字的键",
|
|
529
|
+
"redis.noTtl": "没有带过期时间的键",
|
|
530
|
+
"redis.noCandidates": "没有匹配的候选",
|
|
531
|
+
"redis.copyKeys": "复制键名",
|
|
532
|
+
"redis.copyResult": "复制结果",
|
|
533
|
+
"redis.copiedResult": "已复制",
|
|
534
|
+
"redis.copiedResultTitle": "已复制这条命令的结果",
|
|
535
|
+
"redis.copyResultTitle": "复制这条命令的结果",
|
|
536
|
+
"redis.command": "命令",
|
|
537
|
+
"redis.commandPlaceholder": "例如 GET shop:customer:42",
|
|
538
|
+
"redis.clearCommand": "清空命令框({binding})",
|
|
539
|
+
"redis.clear": "清空",
|
|
540
|
+
"redis.history": "历史",
|
|
541
|
+
"redis.run": "执行",
|
|
542
|
+
"redis.writeCommand": " · 写命令",
|
|
543
|
+
"redis.scanTitle": "服务器端 glob 匹配(* ? []),按 Enter 重新扫描",
|
|
544
|
+
"redis.patternPlaceholder": "键模式,例如 shop:*",
|
|
545
|
+
"redis.clearPattern": "清空键模式",
|
|
546
|
+
"redis.onlyTtl": "只看有 TTL",
|
|
547
|
+
"redis.onlyTtlTitle": "只列出设置了过期时间的键",
|
|
548
|
+
"redis.filterKeysTitle": "在当前已加载的键里按子串筛选,不会重新扫描",
|
|
549
|
+
"redis.filterKeysPlaceholder": "筛选键名",
|
|
550
|
+
"redis.clearKeyFilter": "清空键名筛选",
|
|
551
|
+
"redis.allTypes": "全部类型",
|
|
552
|
+
"redis.scan": "扫描",
|
|
553
|
+
"redis.continue": "继续",
|
|
554
|
+
"redis.continueTitle": "延续上一次扫描",
|
|
555
|
+
"redis.scanFirst": "先扫描一次",
|
|
556
|
+
"redis.scanCount": "{visible} / {total} 个键",
|
|
557
|
+
"redis.allLoaded": " · 已全部加载",
|
|
558
|
+
"redis.conditionChanged": " · 条件已改,点「扫描」重新开始",
|
|
559
|
+
"redis.copyKeysTitle": "把当前列表里的键名按换行复制出来",
|
|
560
|
+
"redis.copyKeysCount": "键名({n} 个)",
|
|
561
|
+
"redis.retry": "重试",
|
|
562
|
+
"redis.copyError": "复制错误信息",
|
|
563
|
+
"redis.copy": "复制",
|
|
564
|
+
"redis.scanningDb": "正在扫描键…",
|
|
565
|
+
"redis.keyList": "Redis 键列表",
|
|
566
|
+
"redis.key": "键",
|
|
567
|
+
"redis.type": "类型",
|
|
568
|
+
"redis.length": "长度",
|
|
569
|
+
"redis.noExpiry": "不过期",
|
|
570
|
+
"redis.ttlSeconds": "{n} 秒",
|
|
571
|
+
"redis.sortName": "按名称排序",
|
|
572
|
+
"redis.sortNameDesc": "按名称倒序",
|
|
573
|
+
"redis.sortTtl": "按剩余时间升序",
|
|
574
|
+
"redis.sortTtlDesc": "按剩余时间降序",
|
|
575
|
+
"redis.sortSize": "按长度升序",
|
|
576
|
+
"redis.sortSizeDesc": "按长度降序",
|
|
577
|
+
"redis.restoreScanOrder": "恢复扫描顺序",
|
|
578
|
+
"redis.copyKey": "复制键名",
|
|
579
|
+
"redis.valueCount": "{n} 条",
|
|
580
|
+
"redis.valueTruncated": "已截断",
|
|
581
|
+
"redis.reloading": "正在重新读取",
|
|
582
|
+
"redis.reloadKey": "重新读取这个键",
|
|
583
|
+
"redis.refreshingValue": "正在刷新键值",
|
|
584
|
+
"redis.refreshValue": "刷新键值",
|
|
585
|
+
"redis.copiedPartial": "已复制取回的部分(列表已截断)",
|
|
586
|
+
"redis.copyPartial": "复制取回的部分(列表已截断)",
|
|
587
|
+
"redis.copiedValue": "已复制值",
|
|
588
|
+
"redis.copyValue": "复制值",
|
|
589
|
+
"redis.valueCopied": "值已复制",
|
|
590
|
+
"redis.copiedKey": "已复制键名",
|
|
591
|
+
"redis.keyCopied": "键名已复制",
|
|
592
|
+
"redis.largeValue": "值太大,只显示了前 {kb} KB;复制按钮拿到的是完整值。",
|
|
593
|
+
"redis.ttlForever": "永久",
|
|
594
|
+
"redis.ttlExpired": "已过期",
|
|
595
|
+
"redis.headerValue": "值",
|
|
596
|
+
"redis.headerField": "字段",
|
|
597
|
+
"redis.headerMember": "成员",
|
|
598
|
+
"redis.headerScore": "分数",
|
|
599
|
+
"redis.headerId": "ID",
|
|
600
|
+
"redis.historyCopy": "复制语句",
|
|
601
|
+
"redis.historyPin": "收藏该语句",
|
|
602
|
+
"redis.historyUnpin": "取消收藏",
|
|
603
|
+
"redis.historySearch": "搜索历史语句",
|
|
604
|
+
"redis.historyPinned": "收藏 · {n}",
|
|
605
|
+
"redis.historyRecent": "最近执行 · {n}",
|
|
606
|
+
"redis.historyClear": "清空最近执行",
|
|
607
|
+
"redis.historyConfirmClear": "再点一次就清空最近执行",
|
|
608
|
+
"redis.historyConfirm": "确认清空",
|
|
609
|
+
"redis.historyEmpty": "还没有执行过语句",
|
|
610
|
+
"redis.historyNoMatch": "没有匹配的语句",
|
|
611
|
+
"data.filterKeys": "键",
|
|
612
|
+
"data.filterTables": "库表",
|
|
613
|
+
"data.filterPlaceholder": "筛选{label}…",
|
|
614
|
+
"data.filterAria": "筛选{label}",
|
|
615
|
+
"data.clearFilter": "清空筛选",
|
|
616
|
+
"data.loadingKey": "读取键值",
|
|
617
|
+
"data.loadingStructure": "读取结构",
|
|
618
|
+
"data.objectsMatch": "{n} 个对象匹配",
|
|
619
|
+
"data.redisHelp": "展开 Redis 数据源和逻辑库,选择键可查看值、TTL 与长度;行尾按钮可选择显示的数据库。",
|
|
620
|
+
"console.noDataSources": "还没有数据源",
|
|
621
|
+
"console.noDataSourcesDesc": "先在「数据库」标签页中新增数据源,再回来执行查询。",
|
|
622
|
+
"console.readonlyWrite": "这是一条只读连接,不能执行写命令",
|
|
623
|
+
"console.readonlyWriteDetail": "把连接设置里的「只读」关掉,再执行要修改 Redis 数据的命令",
|
|
624
|
+
"console.confirmRedisWrite": "即将执行会修改 Redis 数据的命令。",
|
|
625
|
+
"console.confirmRun": "确认执行",
|
|
626
|
+
"console.execute": "执行",
|
|
627
|
+
"console.confirmWrite": "即将执行写语句,可能修改或删除数据。",
|
|
628
|
+
"console.confirmWriteMulti": "即将顺序执行 {n} 条语句(含写语句),可能修改或删除数据。",
|
|
629
|
+
"console.multiFail": "第 {n}/{total} 条语句执行失败:{message}",
|
|
630
|
+
"console.multiDone": "已顺序执行 {n} 条语句",
|
|
631
|
+
"console.noPlan": "没有返回执行计划",
|
|
632
|
+
"console.queryResult": "查询结果",
|
|
633
|
+
"console.noFilteredRows": "当前页没有匹配筛选条件的行",
|
|
634
|
+
"console.noRowsReturned": "这条语句没有返回任何行",
|
|
635
|
+
"console.affectedRows": "影响行数",
|
|
636
|
+
"console.noAffectedRows": "没有返回行",
|
|
637
|
+
"console.rowsAffected": "{n} 行受影响",
|
|
638
|
+
"console.selectedRows": "已选 {n} 行",
|
|
639
|
+
"console.pageOut": "这一页没有数据,已回到第一页",
|
|
640
|
+
"console.pageOutTitle": "这一页已经超出结果范围(可能有人删了数据或条件刚变过)",
|
|
641
|
+
"console.truncated": "结果已截断,仅取回 {n} 行",
|
|
642
|
+
"console.truncatedTitle": "还有更多行没有取回:调大行数上限,或用导出的「全部」",
|
|
643
|
+
"console.cancelExport": "取消",
|
|
644
|
+
"console.stopExport": "停止导出,已取到的行不会写入文件",
|
|
645
|
+
"console.executing": "正在执行 {index}/{total}…",
|
|
646
|
+
"console.selectedRun": "已执行选中内容",
|
|
647
|
+
"console.txOpen": "事务进行中",
|
|
648
|
+
"console.pageable": "可分页查询",
|
|
649
|
+
"console.statementN": "第 {n} 条",
|
|
650
|
+
"console.allLimitTitle": "一次取回全部结果(最多 {n} 行)",
|
|
651
|
+
"console.allLimit": "上限 {n} 行",
|
|
652
|
+
"console.plan": "执行计划",
|
|
653
|
+
"console.copyPlan": "复制计划",
|
|
654
|
+
"console.closePlan": "关闭计划",
|
|
655
|
+
"console.copyPlanTable": "把表格形式的计划复制成制表符分隔的文本",
|
|
656
|
+
"console.copyPlanText": "复制计划文本",
|
|
657
|
+
"console.noCandidates": "没有匹配的候选",
|
|
658
|
+
"console.kindColumn": "列",
|
|
659
|
+
"console.kindTable": "表",
|
|
660
|
+
"console.kindDatabase": "库",
|
|
661
|
+
"console.kindFunction": "函数",
|
|
662
|
+
"console.kindAlias": "别名",
|
|
663
|
+
"console.kindSnippet": "片段",
|
|
664
|
+
"console.kindKeyword": "关键字",
|
|
665
|
+
"console.noTargetTable": "当前语句没有目标表,无法导出 SQL",
|
|
666
|
+
"console.exported": "{format} 已导出 {n} 行",
|
|
667
|
+
"console.exportProgress": "{format} 正在取 {n} 行…",
|
|
668
|
+
"console.exportCancelled": "{format} 导出已取消",
|
|
669
|
+
"console.copyFailed": "复制失败:这个环境不允许访问剪贴板",
|
|
501
670
|
"table.rows": "行",
|
|
502
671
|
"table.export.page": "导出当前页",
|
|
503
672
|
"table.export.selected": "导出已选",
|
|
@@ -536,6 +705,7 @@ var zh = {
|
|
|
536
705
|
"settings.agentWrites": "允许 Agent 工具执行写语句(仅非只读连接)",
|
|
537
706
|
"settings.confirmDestructive": "执行破坏性操作前需要二次确认",
|
|
538
707
|
"settings.save": "保存",
|
|
708
|
+
"settings.saving": "正在保存…",
|
|
539
709
|
"settings.shortcuts": "快捷键",
|
|
540
710
|
"settings.restore": "恢复默认",
|
|
541
711
|
"settings.toolbar": "数据源工具栏",
|
|
@@ -559,7 +729,6 @@ var zh = {
|
|
|
559
729
|
"table.dmlSubmit": "提交",
|
|
560
730
|
"table.dmlCancel": "取消",
|
|
561
731
|
"table.noPrimaryKey": "未检测到主键,WHERE 将按原始全部列匹配。",
|
|
562
|
-
"console.execute": "执行",
|
|
563
732
|
"console.cancel": "取消",
|
|
564
733
|
"console.waiting": "等待执行",
|
|
565
734
|
"console.waitingHint": "上面的语句会在当前数据源上运行,结果按页展示。",
|
|
@@ -581,6 +750,11 @@ var en = {
|
|
|
581
750
|
"app.addTitle": "Add data source",
|
|
582
751
|
"app.edit": "Edit",
|
|
583
752
|
"app.editTitle": "Edit selected data source",
|
|
753
|
+
"app.copy": "Duplicate",
|
|
754
|
+
"app.copyTitle": "Duplicate selected data source",
|
|
755
|
+
"app.copyName": "Copy of {name}",
|
|
756
|
+
"notify.duplicated": "Data source duplicated",
|
|
757
|
+
"notify.duplicateFailed": "Duplicate failed: {error}",
|
|
584
758
|
"app.refresh": "Refresh",
|
|
585
759
|
"app.refreshTitle": "Refresh selected data source",
|
|
586
760
|
"app.delete": "Delete",
|
|
@@ -601,6 +775,7 @@ var en = {
|
|
|
601
775
|
"app.confirmTitle": "Confirm action",
|
|
602
776
|
"app.continue": "Continue",
|
|
603
777
|
"conn.newTitle": "New data source",
|
|
778
|
+
"conn.copyTitle": "Duplicate data source",
|
|
604
779
|
"conn.editTitle": "Edit connection",
|
|
605
780
|
"conn.name": "Name",
|
|
606
781
|
"conn.type": "Database type",
|
|
@@ -614,7 +789,6 @@ var en = {
|
|
|
614
789
|
"conn.ssh": "Connect through an SSH tunnel",
|
|
615
790
|
"conn.tls": "Enable TLS / SSL",
|
|
616
791
|
"conn.readonly": "Read-only (panel and agent tools reject writes)",
|
|
617
|
-
"conn.readonlyEdit": "Read-only (set at creation; create a new connection to change it)",
|
|
618
792
|
"conn.test": "Test connection",
|
|
619
793
|
"conn.save": "Save",
|
|
620
794
|
"conn.cancel": "Cancel",
|
|
@@ -810,6 +984,13 @@ var en = {
|
|
|
810
984
|
"menu.sortDesc": "Sort descending",
|
|
811
985
|
"menu.clearSort": "Clear sort",
|
|
812
986
|
"menu.copyColumnValues": "Copy column values ({n} rows)",
|
|
987
|
+
"menu.copyColumnName": "Copy column name “{name}”",
|
|
988
|
+
"menu.showAllColumns": "Show all columns",
|
|
989
|
+
"menu.showAllColumnsHidden": "Show all columns ({n} hidden)",
|
|
990
|
+
"menu.filterPage": "Filter this page by this value",
|
|
991
|
+
"menu.inListShort": "IN list",
|
|
992
|
+
"menu.whereShort": "WHERE clause",
|
|
993
|
+
"menu.copyCellValue": "Copy cell value",
|
|
813
994
|
"menu.copyIn": "Copy as IN list",
|
|
814
995
|
"menu.copyComma": "Copy column (comma separated)",
|
|
815
996
|
"menu.copyAllColumns": "Copy all column names",
|
|
@@ -886,6 +1067,162 @@ var en = {
|
|
|
886
1067
|
"table.clearColumnFilters": "Clear column filters",
|
|
887
1068
|
"shortcut.aria": "{label} shortcut",
|
|
888
1069
|
"conn.keepPassword": "Leave empty to keep it",
|
|
1070
|
+
"redis.dbDefault": "db{n} (default)",
|
|
1071
|
+
"redis.chooseDb": "Choose visible databases",
|
|
1072
|
+
"redis.allDbs": "All databases",
|
|
1073
|
+
"redis.dbTitle": "Redis database db{n}{default}",
|
|
1074
|
+
"redis.dbTitleDefault": " (default)",
|
|
1075
|
+
"redis.keysCount": "{n} keys",
|
|
1076
|
+
"redis.scanKeys": "Scan keys",
|
|
1077
|
+
"redis.scanning": "Scanning keys…",
|
|
1078
|
+
"redis.loading": "Loading…",
|
|
1079
|
+
"redis.loadMore": "Load more keys",
|
|
1080
|
+
"redis.noDb": "No database selected; use the row-end database picker",
|
|
1081
|
+
"redis.emptyKeys": "No keys",
|
|
1082
|
+
"redis.emptyMatch": "No matching keys",
|
|
1083
|
+
"redis.emptyDb": "This database has no keys yet",
|
|
1084
|
+
"redis.noKeyword": "No keys contain this keyword",
|
|
1085
|
+
"redis.noTtl": "No keys have a TTL",
|
|
1086
|
+
"redis.noCandidates": "No matching candidates",
|
|
1087
|
+
"redis.copyKeys": "Copy key names",
|
|
1088
|
+
"redis.copyResult": "Copy result",
|
|
1089
|
+
"redis.copiedResult": "Copied",
|
|
1090
|
+
"redis.copiedResultTitle": "Command result copied",
|
|
1091
|
+
"redis.copyResultTitle": "Copy this command result",
|
|
1092
|
+
"redis.command": "Command",
|
|
1093
|
+
"redis.commandPlaceholder": "e.g. GET shop:customer:42",
|
|
1094
|
+
"redis.clearCommand": "Clear the command box ({binding})",
|
|
1095
|
+
"redis.clear": "Clear",
|
|
1096
|
+
"redis.history": "History",
|
|
1097
|
+
"redis.run": "Run",
|
|
1098
|
+
"redis.writeCommand": " · write command",
|
|
1099
|
+
"redis.scanTitle": "Server-side glob match (* ? []); press Enter to scan again",
|
|
1100
|
+
"redis.patternPlaceholder": "Key pattern, e.g. shop:*",
|
|
1101
|
+
"redis.clearPattern": "Clear key pattern",
|
|
1102
|
+
"redis.onlyTtl": "Only keys with TTL",
|
|
1103
|
+
"redis.onlyTtlTitle": "Show only keys with an expiry",
|
|
1104
|
+
"redis.filterKeysTitle": "Filter the loaded keys by substring; does not rescan",
|
|
1105
|
+
"redis.filterKeysPlaceholder": "Filter keys",
|
|
1106
|
+
"redis.clearKeyFilter": "Clear key filter",
|
|
1107
|
+
"redis.allTypes": "All types",
|
|
1108
|
+
"redis.scan": "Scan",
|
|
1109
|
+
"redis.continue": "Continue",
|
|
1110
|
+
"redis.continueTitle": "Continue the previous scan",
|
|
1111
|
+
"redis.scanFirst": "Scan once first",
|
|
1112
|
+
"redis.scanCount": "{visible} / {total} keys",
|
|
1113
|
+
"redis.allLoaded": " · all loaded",
|
|
1114
|
+
"redis.conditionChanged": " · conditions changed; press Scan to start over",
|
|
1115
|
+
"redis.copyKeysTitle": "Copy the key names in this list, one per line",
|
|
1116
|
+
"redis.copyKeysCount": "key names ({n})",
|
|
1117
|
+
"redis.retry": "Retry",
|
|
1118
|
+
"redis.copyError": "Copy error",
|
|
1119
|
+
"redis.copy": "Copy",
|
|
1120
|
+
"redis.scanningDb": "Scanning keys…",
|
|
1121
|
+
"redis.keyList": "Redis keys",
|
|
1122
|
+
"redis.key": "Key",
|
|
1123
|
+
"redis.type": "Type",
|
|
1124
|
+
"redis.length": "Length",
|
|
1125
|
+
"redis.noExpiry": "No expiry",
|
|
1126
|
+
"redis.ttlSeconds": "{n} seconds",
|
|
1127
|
+
"redis.sortName": "Sort by name",
|
|
1128
|
+
"redis.sortNameDesc": "Sort by name descending",
|
|
1129
|
+
"redis.sortTtl": "Sort by TTL ascending",
|
|
1130
|
+
"redis.sortTtlDesc": "Sort by TTL descending",
|
|
1131
|
+
"redis.sortSize": "Sort by length ascending",
|
|
1132
|
+
"redis.sortSizeDesc": "Sort by length descending",
|
|
1133
|
+
"redis.restoreScanOrder": "Restore scan order",
|
|
1134
|
+
"redis.copyKey": "Copy key name",
|
|
1135
|
+
"redis.valueCount": "{n} entries",
|
|
1136
|
+
"redis.valueTruncated": "Truncated",
|
|
1137
|
+
"redis.reloading": "Reloading",
|
|
1138
|
+
"redis.reloadKey": "Reload this key",
|
|
1139
|
+
"redis.refreshingValue": "Refreshing value",
|
|
1140
|
+
"redis.refreshValue": "Refresh value",
|
|
1141
|
+
"redis.copiedPartial": "Copied the fetched part (list truncated)",
|
|
1142
|
+
"redis.copyPartial": "Copy the fetched part (list truncated)",
|
|
1143
|
+
"redis.copiedValue": "Value copied",
|
|
1144
|
+
"redis.copyValue": "Copy value",
|
|
1145
|
+
"redis.valueCopied": "Value copied",
|
|
1146
|
+
"redis.copiedKey": "Key name copied",
|
|
1147
|
+
"redis.keyCopied": "Key name copied",
|
|
1148
|
+
"redis.largeValue": "Value is too large; showing the first {kb} KB. Copy still gets the full value.",
|
|
1149
|
+
"redis.ttlForever": "No expiry",
|
|
1150
|
+
"redis.ttlExpired": "Expired",
|
|
1151
|
+
"redis.headerValue": "Value",
|
|
1152
|
+
"redis.headerField": "Field",
|
|
1153
|
+
"redis.headerMember": "Member",
|
|
1154
|
+
"redis.headerScore": "Score",
|
|
1155
|
+
"redis.headerId": "ID",
|
|
1156
|
+
"redis.historyCopy": "Copy statement",
|
|
1157
|
+
"redis.historyPin": "Pin this statement",
|
|
1158
|
+
"redis.historyUnpin": "Unpin",
|
|
1159
|
+
"redis.historySearch": "Search history",
|
|
1160
|
+
"redis.historyPinned": "Pinned · {n}",
|
|
1161
|
+
"redis.historyRecent": "Recent · {n}",
|
|
1162
|
+
"redis.historyClear": "Clear recent statements",
|
|
1163
|
+
"redis.historyConfirmClear": "Click again to clear recent statements",
|
|
1164
|
+
"redis.historyConfirm": "Confirm clear",
|
|
1165
|
+
"redis.historyEmpty": "No statements executed yet",
|
|
1166
|
+
"redis.historyNoMatch": "No matching statements",
|
|
1167
|
+
"data.filterKeys": "keys",
|
|
1168
|
+
"data.filterTables": "tables",
|
|
1169
|
+
"data.filterPlaceholder": "Filter {label}…",
|
|
1170
|
+
"data.filterAria": "Filter {label}",
|
|
1171
|
+
"data.clearFilter": "Clear filter",
|
|
1172
|
+
"data.loadingKey": "Loading value",
|
|
1173
|
+
"data.loadingStructure": "Loading structure",
|
|
1174
|
+
"data.objectsMatch": "{n} objects match",
|
|
1175
|
+
"data.redisHelp": "Expand a Redis data source and its databases, then select a key to inspect its value, TTL and length. Use the row-end picker to choose visible databases.",
|
|
1176
|
+
"console.noDataSources": "No data sources yet",
|
|
1177
|
+
"console.noDataSourcesDesc": "Add a data source on the Database View tab, then come back to run queries.",
|
|
1178
|
+
"console.readonlyWrite": "This is a read-only connection; write commands are not allowed",
|
|
1179
|
+
"console.readonlyWriteDetail": "Turn off Read-only in the connection settings before running commands that change Redis data",
|
|
1180
|
+
"console.confirmRedisWrite": "This command will modify Redis data.",
|
|
1181
|
+
"console.confirmRun": "Confirm run",
|
|
1182
|
+
"console.execute": "Run",
|
|
1183
|
+
"console.confirmWrite": "This runs a write statement that may change or delete data.",
|
|
1184
|
+
"console.confirmWriteMulti": "This runs {n} statements in order (including writes); data may change or be deleted.",
|
|
1185
|
+
"console.multiFail": "Statement {n}/{total} failed: {message}",
|
|
1186
|
+
"console.multiDone": "Ran {n} statements in order",
|
|
1187
|
+
"console.noPlan": "No execution plan returned",
|
|
1188
|
+
"console.queryResult": "Query result",
|
|
1189
|
+
"console.noFilteredRows": "No rows on this page match the filter",
|
|
1190
|
+
"console.noRowsReturned": "This statement returned no rows",
|
|
1191
|
+
"console.affectedRows": "Affected rows",
|
|
1192
|
+
"console.noAffectedRows": "No rows returned",
|
|
1193
|
+
"console.rowsAffected": "{n} rows affected",
|
|
1194
|
+
"console.selectedRows": "{n} rows selected",
|
|
1195
|
+
"console.pageOut": "This page is out of range; returned to the first page",
|
|
1196
|
+
"console.pageOutTitle": "This page is past the result range (rows were removed or conditions changed)",
|
|
1197
|
+
"console.truncated": "Result truncated; only {n} rows fetched",
|
|
1198
|
+
"console.truncatedTitle": "More rows were not fetched: increase the row limit or use Export all",
|
|
1199
|
+
"console.cancelExport": "Cancel",
|
|
1200
|
+
"console.stopExport": "Stop exporting; fetched rows will not be written",
|
|
1201
|
+
"console.executing": "Running {index}/{total}…",
|
|
1202
|
+
"console.selectedRun": "Selection executed",
|
|
1203
|
+
"console.txOpen": "Transaction open",
|
|
1204
|
+
"console.pageable": "Pageable query",
|
|
1205
|
+
"console.statementN": "Statement {n}",
|
|
1206
|
+
"console.allLimitTitle": "Fetch all results at once (up to {n} rows)",
|
|
1207
|
+
"console.allLimit": "Limit {n} rows",
|
|
1208
|
+
"console.plan": "Execution plan",
|
|
1209
|
+
"console.copyPlan": "Copy plan",
|
|
1210
|
+
"console.closePlan": "Close plan",
|
|
1211
|
+
"console.copyPlanTable": "Copy the tabular plan as tab-separated text",
|
|
1212
|
+
"console.copyPlanText": "Copy plan text",
|
|
1213
|
+
"console.noCandidates": "No matching candidates",
|
|
1214
|
+
"console.kindColumn": "column",
|
|
1215
|
+
"console.kindTable": "table",
|
|
1216
|
+
"console.kindDatabase": "database",
|
|
1217
|
+
"console.kindFunction": "function",
|
|
1218
|
+
"console.kindAlias": "alias",
|
|
1219
|
+
"console.kindSnippet": "snippet",
|
|
1220
|
+
"console.kindKeyword": "keyword",
|
|
1221
|
+
"console.noTargetTable": "This statement has no target table; cannot export SQL",
|
|
1222
|
+
"console.exported": "{format} exported {n} rows",
|
|
1223
|
+
"console.exportProgress": "{format} fetching {n} rows…",
|
|
1224
|
+
"console.exportCancelled": "{format} export cancelled",
|
|
1225
|
+
"console.copyFailed": "Copy failed: clipboard access is not allowed in this environment",
|
|
889
1226
|
"table.rows": "rows",
|
|
890
1227
|
"table.export.page": "Export current page",
|
|
891
1228
|
"table.export.selected": "Export selected",
|
|
@@ -924,6 +1261,7 @@ var en = {
|
|
|
924
1261
|
"settings.agentWrites": "Allow agent tools to run writes (non-read-only connections)",
|
|
925
1262
|
"settings.confirmDestructive": "Confirm destructive operations",
|
|
926
1263
|
"settings.save": "Save",
|
|
1264
|
+
"settings.saving": "Saving…",
|
|
927
1265
|
"settings.shortcuts": "Shortcuts",
|
|
928
1266
|
"settings.restore": "Restore defaults",
|
|
929
1267
|
"settings.toolbar": "Data source toolbar",
|
|
@@ -947,7 +1285,6 @@ var en = {
|
|
|
947
1285
|
"table.dmlSubmit": "Submit",
|
|
948
1286
|
"table.dmlCancel": "Cancel",
|
|
949
1287
|
"table.noPrimaryKey": "No primary key detected; the WHERE clause will match all original columns.",
|
|
950
|
-
"console.execute": "Run",
|
|
951
1288
|
"console.cancel": "Cancel",
|
|
952
1289
|
"console.waiting": "Ready to run",
|
|
953
1290
|
"console.waitingHint": "The statement runs against the current data source and pages the result.",
|
|
@@ -1008,7 +1345,7 @@ function formatMs(ms) {
|
|
|
1008
1345
|
}
|
|
1009
1346
|
function formatTtl(seconds) {
|
|
1010
1347
|
if (!Number.isFinite(seconds)) return "—";
|
|
1011
|
-
if (seconds < 0) return "
|
|
1348
|
+
if (seconds < 0) return t("redis.ttlForever");
|
|
1012
1349
|
const whole = Math.round(seconds);
|
|
1013
1350
|
if (whole < 60) return `${whole}s`;
|
|
1014
1351
|
if (whole < 3600) return `${Math.floor(whole / 60)}m`;
|
|
@@ -2515,12 +2852,6 @@ function RefreshIcon(props) {
|
|
|
2515
2852
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 4v7h-7" })
|
|
2516
2853
|
] }) });
|
|
2517
2854
|
}
|
|
2518
|
-
function SettingsIcon(props) {
|
|
2519
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { transform: "translate(12 12) scale(0.88) translate(-12 -12)", children: [
|
|
2520
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "3.2" }),
|
|
2521
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1 1.55V21a2 2 0 1 1-4 0v-.09a1.7 1.7 0 0 0-1.11-1.55 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.55-1H3a2 2 0 1 1 0-4h.09a1.7 1.7 0 0 0 1.55-1.11 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34h.01a1.7 1.7 0 0 0 1-1.55V3a2 2 0 1 1 4 0v.09a1.7 1.7 0 0 0 1 1.55 1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87v.01a1.7 1.7 0 0 0 1.55 1H21a2 2 0 1 1 0 4h-.09a1.7 1.7 0 0 0-1.51 1Z" })
|
|
2522
|
-
] }) });
|
|
2523
|
-
}
|
|
2524
2855
|
function PlayIcon(props) {
|
|
2525
2856
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 5.5v13l11-6.5-11-6.5Z", fill: "currentColor", stroke: "none" }) });
|
|
2526
2857
|
}
|
|
@@ -2852,7 +3183,7 @@ function useConsoleAutoComplete() {
|
|
|
2852
3183
|
var import_react5 = require("react");
|
|
2853
3184
|
|
|
2854
3185
|
// src/shared/toolbaractions.ts
|
|
2855
|
-
var TOOLBAR_ACTION_IDS = ["add", "edit", "refresh", "delete", "console", "trash"
|
|
3186
|
+
var TOOLBAR_ACTION_IDS = ["add", "edit", "duplicate", "refresh", "delete", "console", "trash"];
|
|
2856
3187
|
var TOOLBAR_ACTION_SET = new Set(TOOLBAR_ACTION_IDS);
|
|
2857
3188
|
function isToolbarActionId(value) {
|
|
2858
3189
|
return typeof value === "string" && TOOLBAR_ACTION_SET.has(value);
|
|
@@ -2883,6 +3214,9 @@ var TOOLBAR_ACTION_LABEL = {
|
|
|
2883
3214
|
get edit() {
|
|
2884
3215
|
return t("app.edit");
|
|
2885
3216
|
},
|
|
3217
|
+
get duplicate() {
|
|
3218
|
+
return t("app.copy");
|
|
3219
|
+
},
|
|
2886
3220
|
get refresh() {
|
|
2887
3221
|
return t("app.refresh");
|
|
2888
3222
|
},
|
|
@@ -2894,9 +3228,6 @@ var TOOLBAR_ACTION_LABEL = {
|
|
|
2894
3228
|
},
|
|
2895
3229
|
get trash() {
|
|
2896
3230
|
return t("app.trash");
|
|
2897
|
-
},
|
|
2898
|
-
get settings() {
|
|
2899
|
-
return t("app.settings");
|
|
2900
3231
|
}
|
|
2901
3232
|
};
|
|
2902
3233
|
function toolbarActionIcon(id, size = 14) {
|
|
@@ -2905,6 +3236,8 @@ function toolbarActionIcon(id, size = 14) {
|
|
|
2905
3236
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PlusIcon, { size });
|
|
2906
3237
|
case "edit":
|
|
2907
3238
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(EditIcon, { size });
|
|
3239
|
+
case "duplicate":
|
|
3240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CopyIcon, { size });
|
|
2908
3241
|
case "refresh":
|
|
2909
3242
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RefreshIcon, { size });
|
|
2910
3243
|
case "delete":
|
|
@@ -2913,8 +3246,6 @@ function toolbarActionIcon(id, size = 14) {
|
|
|
2913
3246
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TerminalIcon, { size });
|
|
2914
3247
|
case "trash":
|
|
2915
3248
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RecycleIcon, { size });
|
|
2916
|
-
case "settings":
|
|
2917
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SettingsIcon, { size });
|
|
2918
3249
|
}
|
|
2919
3250
|
}
|
|
2920
3251
|
var savedOrder2 = orderToolbarActions(void 0);
|
|
@@ -3505,33 +3836,35 @@ function ConnectionModal(props) {
|
|
|
3505
3836
|
const [testResult, setTestResult] = (0, import_react8.useState)(null);
|
|
3506
3837
|
const [error, setError] = (0, import_react8.useState)("");
|
|
3507
3838
|
const editing = props.editing;
|
|
3839
|
+
const seed = editing === null ? props.seed ?? null : null;
|
|
3840
|
+
const source = editing ?? seed;
|
|
3508
3841
|
(0, import_react8.useEffect)(() => {
|
|
3509
3842
|
setError("");
|
|
3510
3843
|
setTestResult(null);
|
|
3511
3844
|
setSaving(false);
|
|
3512
3845
|
setTesting(false);
|
|
3513
3846
|
if (!props.open) return;
|
|
3514
|
-
if (
|
|
3515
|
-
setChoice(
|
|
3516
|
-
setName(editing.name);
|
|
3517
|
-
setHost(
|
|
3518
|
-
setPort(String(
|
|
3519
|
-
setUser(
|
|
3520
|
-
setDatabase(
|
|
3521
|
-
setRedisDb(String(
|
|
3522
|
-
setReadOnly(
|
|
3523
|
-
setSshEnabled(
|
|
3524
|
-
setSshHost(
|
|
3525
|
-
setSshPort(String(
|
|
3526
|
-
setSshUser(
|
|
3527
|
-
setSshAuth(
|
|
3528
|
-
setSshKeyPath(
|
|
3847
|
+
if (source) {
|
|
3848
|
+
setChoice(source.driver);
|
|
3849
|
+
setName(editing ? source.name : t2("app.copyName", { name: source.name }));
|
|
3850
|
+
setHost(source.host);
|
|
3851
|
+
setPort(String(source.port));
|
|
3852
|
+
setUser(source.user);
|
|
3853
|
+
setDatabase(source.database);
|
|
3854
|
+
setRedisDb(String(source.redisDb));
|
|
3855
|
+
setReadOnly(source.readOnly);
|
|
3856
|
+
setSshEnabled(source.ssh !== void 0);
|
|
3857
|
+
setSshHost(source.ssh?.host ?? "");
|
|
3858
|
+
setSshPort(String(source.ssh?.port ?? 22));
|
|
3859
|
+
setSshUser(source.ssh?.user ?? "");
|
|
3860
|
+
setSshAuth(source.ssh?.auth ?? "password");
|
|
3861
|
+
setSshKeyPath(source.ssh?.privateKeyPath ?? "");
|
|
3529
3862
|
setSshPassword("");
|
|
3530
3863
|
setSshPassphrase("");
|
|
3531
|
-
setTlsEnabled(
|
|
3532
|
-
setTlsMode(
|
|
3533
|
-
setTlsCaPath(
|
|
3534
|
-
setTlsAllowInvalid(
|
|
3864
|
+
setTlsEnabled(source.tls !== void 0 && source.tls.mode !== "disable");
|
|
3865
|
+
setTlsMode(source.tls?.mode === "verify-ca" || source.tls?.mode === "require" ? source.tls.mode : "verify-full");
|
|
3866
|
+
setTlsCaPath(source.tls?.caPath ?? "");
|
|
3867
|
+
setTlsAllowInvalid(source.tls?.allowInvalidHostname === true);
|
|
3535
3868
|
setPassword("");
|
|
3536
3869
|
setClearPassword(false);
|
|
3537
3870
|
return;
|
|
@@ -3558,7 +3891,7 @@ function ConnectionModal(props) {
|
|
|
3558
3891
|
setTlsAllowInvalid(false);
|
|
3559
3892
|
setPassword("");
|
|
3560
3893
|
setClearPassword(false);
|
|
3561
|
-
}, [props.open, editing]);
|
|
3894
|
+
}, [props.open, editing, seed, t2]);
|
|
3562
3895
|
if (!props.open) return null;
|
|
3563
3896
|
const preset = presetOf(choice) ?? PRESETS.mysql;
|
|
3564
3897
|
const fileBased = preset.hostOptional === true;
|
|
@@ -3582,6 +3915,7 @@ function ConnectionModal(props) {
|
|
|
3582
3915
|
};
|
|
3583
3916
|
const buildDraft = () => ({
|
|
3584
3917
|
id: editing?.id,
|
|
3918
|
+
...editing === null && seed !== null ? { copyFromId: seed.id } : {},
|
|
3585
3919
|
name: name2.trim(),
|
|
3586
3920
|
driver: choice,
|
|
3587
3921
|
// File based engines keep no host; do not persist whatever the previous preset left behind.
|
|
@@ -3592,9 +3926,7 @@ function ConnectionModal(props) {
|
|
|
3592
3926
|
...clearPassword ? { clearPassword: true } : {},
|
|
3593
3927
|
database: isRedis ? "" : database.trim(),
|
|
3594
3928
|
redisDb: Number.parseInt(redisDb, 10) || 0,
|
|
3595
|
-
|
|
3596
|
-
// always keeps the stored value (the switch is disabled for existing rows).
|
|
3597
|
-
readOnly: editing ? editing.readOnly : readOnly,
|
|
3929
|
+
readOnly,
|
|
3598
3930
|
...supportsSsh && sshEnabled ? {
|
|
3599
3931
|
ssh: {
|
|
3600
3932
|
enabled: true,
|
|
@@ -3626,7 +3958,7 @@ function ConnectionModal(props) {
|
|
|
3626
3958
|
if (!Number.isInteger(draft.ssh.port) || draft.ssh.port < 1 || draft.ssh.port > 65535) return "SSH 端口需在 1-65535 之间";
|
|
3627
3959
|
if (draft.ssh.user === "") return "请填写 SSH 用户名";
|
|
3628
3960
|
if (draft.ssh.auth === "key" && (draft.ssh.privateKeyPath === void 0 || draft.ssh.privateKeyPath === "")) return "请填写 SSH 私钥路径";
|
|
3629
|
-
if (draft.ssh.auth === "password" && sshPassword === "" && !editing?.hasSshPassword) return "请填写 SSH 密码";
|
|
3961
|
+
if (draft.ssh.auth === "password" && sshPassword === "" && !editing?.hasSshPassword && !seed?.hasSshPassword) return "请填写 SSH 密码";
|
|
3630
3962
|
}
|
|
3631
3963
|
return "";
|
|
3632
3964
|
};
|
|
@@ -3644,7 +3976,7 @@ function ConnectionModal(props) {
|
|
|
3644
3976
|
setTesting(true);
|
|
3645
3977
|
setError("");
|
|
3646
3978
|
try {
|
|
3647
|
-
setTestResult(await api.testConnection(
|
|
3979
|
+
setTestResult(await api.testConnection(draft));
|
|
3648
3980
|
} catch (cause) {
|
|
3649
3981
|
setTestResult(null);
|
|
3650
3982
|
setError(errorText2(cause));
|
|
@@ -3678,7 +4010,7 @@ function ConnectionModal(props) {
|
|
|
3678
4010
|
open: props.open,
|
|
3679
4011
|
title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dshdb-inline", children: [
|
|
3680
4012
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DatabaseIcon, { size: 14 }),
|
|
3681
|
-
editing ? `${t2("conn.editTitle")} · ${editing.name}` : t2("conn.newTitle")
|
|
4013
|
+
editing ? `${t2("conn.editTitle")} · ${editing.name}` : seed ? `${t2("conn.copyTitle")} · ${seed.name}` : t2("conn.newTitle")
|
|
3682
4014
|
] }),
|
|
3683
4015
|
onClose: props.onClose,
|
|
3684
4016
|
footer: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
@@ -3785,8 +4117,7 @@ function ConnectionModal(props) {
|
|
|
3785
4117
|
{
|
|
3786
4118
|
checked: readOnly,
|
|
3787
4119
|
onChange: setReadOnly,
|
|
3788
|
-
|
|
3789
|
-
label: editing == null ? t2("conn.readonly") : t2("conn.readonlyEdit")
|
|
4120
|
+
label: t2("conn.readonly")
|
|
3790
4121
|
}
|
|
3791
4122
|
) })
|
|
3792
4123
|
] }),
|
|
@@ -3996,20 +4327,20 @@ function redisValueTable(value) {
|
|
|
3996
4327
|
switch (value.type) {
|
|
3997
4328
|
case "string": {
|
|
3998
4329
|
const raw = text(value.value);
|
|
3999
|
-
return parseJsonContainer(raw) === null ? { headers: ["
|
|
4330
|
+
return parseJsonContainer(raw) === null ? { headers: [t("redis.headerValue")], rows: [[raw]] } : null;
|
|
4000
4331
|
}
|
|
4001
4332
|
case "hash": {
|
|
4002
4333
|
const record = asRecord(value.value);
|
|
4003
4334
|
if (record === null) return null;
|
|
4004
|
-
return { headers: ["
|
|
4335
|
+
return { headers: [t("redis.headerField"), t("redis.headerValue")], rows: Object.entries(record).map(([field, item]) => [field, text(item)]) };
|
|
4005
4336
|
}
|
|
4006
4337
|
case "list":
|
|
4007
|
-
return { headers: ["#", "
|
|
4338
|
+
return { headers: ["#", t("redis.headerValue")], rows: asArray(value.value).map((item, index) => [String(index + 1), text(item)]) };
|
|
4008
4339
|
case "set":
|
|
4009
|
-
return { headers: ["#", "
|
|
4340
|
+
return { headers: ["#", t("redis.headerMember")], rows: asArray(value.value).map((item, index) => [String(index + 1), text(item)]) };
|
|
4010
4341
|
case "zset":
|
|
4011
4342
|
return {
|
|
4012
|
-
headers: ["
|
|
4343
|
+
headers: [t("redis.headerMember"), t("redis.headerScore")],
|
|
4013
4344
|
rows: asArray(value.value).map((item) => {
|
|
4014
4345
|
const record = asRecord(item) ?? {};
|
|
4015
4346
|
return [text(record.member), text(record.score)];
|
|
@@ -4017,7 +4348,7 @@ function redisValueTable(value) {
|
|
|
4017
4348
|
};
|
|
4018
4349
|
case "stream":
|
|
4019
4350
|
return {
|
|
4020
|
-
headers: ["
|
|
4351
|
+
headers: [t("redis.headerId"), t("redis.headerField")],
|
|
4021
4352
|
rows: asArray(value.value).map((item) => {
|
|
4022
4353
|
const entry = asArray(item);
|
|
4023
4354
|
return [text(entry[0]), text(entry[1])];
|
|
@@ -4028,10 +4359,10 @@ function redisValueTable(value) {
|
|
|
4028
4359
|
}
|
|
4029
4360
|
}
|
|
4030
4361
|
function redisTtlLabel(ttl) {
|
|
4031
|
-
if (ttl === -1) return "
|
|
4032
|
-
if (ttl === -2) return "
|
|
4362
|
+
if (ttl === -1) return t("redis.ttlForever");
|
|
4363
|
+
if (ttl === -2) return t("redis.ttlExpired");
|
|
4033
4364
|
if (ttl >= 60) return formatTtl(ttl);
|
|
4034
|
-
return
|
|
4365
|
+
return t("redis.ttlSeconds", { n: Math.max(0, Math.round(ttl)) });
|
|
4035
4366
|
}
|
|
4036
4367
|
|
|
4037
4368
|
// src/client/redisview.tsx
|
|
@@ -4043,6 +4374,7 @@ var RedisValuePanel = (0, import_react10.memo)(function RedisValuePanel2({
|
|
|
4043
4374
|
refreshing = false,
|
|
4044
4375
|
onRefresh
|
|
4045
4376
|
}) {
|
|
4377
|
+
const t2 = useI18n();
|
|
4046
4378
|
const table = redisValueTable(value);
|
|
4047
4379
|
const fullText = redisValueText(value.value);
|
|
4048
4380
|
const text2 = fullText.slice(0, DISPLAY_TEXT_LIMIT);
|
|
@@ -4056,18 +4388,15 @@ var RedisValuePanel = (0, import_react10.memo)(function RedisValuePanel2({
|
|
|
4056
4388
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dshdb-redis-meta", children: [
|
|
4057
4389
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tag, { children: value.type }),
|
|
4058
4390
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dshdb-muted", children: redisTtlLabel(value.ttl) }),
|
|
4059
|
-
value.size === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
4060
|
-
|
|
4061
|
-
" 条"
|
|
4062
|
-
] }),
|
|
4063
|
-
value.truncated ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tag, { tone: "warn", children: "已截断" }) : null,
|
|
4391
|
+
value.size === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dshdb-muted", children: t2("redis.valueCount", { n: formatCount(value.size) }) }),
|
|
4392
|
+
value.truncated ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Tag, { tone: "warn", children: t2("redis.valueTruncated") }) : null,
|
|
4064
4393
|
onRefresh === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4065
4394
|
"button",
|
|
4066
4395
|
{
|
|
4067
4396
|
type: "button",
|
|
4068
4397
|
className: "dshdb-row-action",
|
|
4069
|
-
title: refreshing ? "
|
|
4070
|
-
"aria-label": refreshing ? "
|
|
4398
|
+
title: refreshing ? t2("redis.reloading") : t2("redis.reloadKey"),
|
|
4399
|
+
"aria-label": refreshing ? t2("redis.refreshingValue") : t2("redis.refreshValue"),
|
|
4071
4400
|
disabled: refreshing,
|
|
4072
4401
|
onClick: onRefresh,
|
|
4073
4402
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RefreshIcon, { size: 12 })
|
|
@@ -4078,8 +4407,8 @@ var RedisValuePanel = (0, import_react10.memo)(function RedisValuePanel2({
|
|
|
4078
4407
|
{
|
|
4079
4408
|
type: "button",
|
|
4080
4409
|
className: "dshdb-row-action",
|
|
4081
|
-
title: value.truncated ? copiedValue ? "
|
|
4082
|
-
"aria-label": copiedValue ? "
|
|
4410
|
+
title: value.truncated ? copiedValue ? t2("redis.copiedPartial") : t2("redis.copyPartial") : copiedValue ? t2("redis.copiedValue") : t2("redis.copyValue"),
|
|
4411
|
+
"aria-label": copiedValue ? t2("redis.valueCopied") : t2("redis.copyValue"),
|
|
4083
4412
|
onClick: () => {
|
|
4084
4413
|
void copyText(redisValueText(value.value)).then((ok) => valueFlash.flash(ok));
|
|
4085
4414
|
},
|
|
@@ -4093,8 +4422,8 @@ var RedisValuePanel = (0, import_react10.memo)(function RedisValuePanel2({
|
|
|
4093
4422
|
{
|
|
4094
4423
|
type: "button",
|
|
4095
4424
|
className: "dshdb-row-action",
|
|
4096
|
-
title: copied ? "
|
|
4097
|
-
"aria-label": copied ? "
|
|
4425
|
+
title: copied ? t2("redis.copiedKey") : t2("redis.copyKey"),
|
|
4426
|
+
"aria-label": copied ? t2("redis.keyCopied") : t2("redis.copyKey"),
|
|
4098
4427
|
onClick: () => {
|
|
4099
4428
|
void copyText(value.key).then((ok) => keyFlash.flash(ok));
|
|
4100
4429
|
},
|
|
@@ -4105,11 +4434,7 @@ var RedisValuePanel = (0, import_react10.memo)(function RedisValuePanel2({
|
|
|
4105
4434
|
] }),
|
|
4106
4435
|
table === null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
4107
4436
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "dshdb-console-value", children: text2 }),
|
|
4108
|
-
clipped ? /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
4109
|
-
"值太大,只显示了前 ",
|
|
4110
|
-
DISPLAY_TEXT_LIMIT / 1024,
|
|
4111
|
-
" KB;复制按钮拿到的是完整值。"
|
|
4112
|
-
] }) : null
|
|
4437
|
+
clipped ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dshdb-muted", style: { margin: "6px 0 0" }, children: t2("redis.largeValue", { kb: DISPLAY_TEXT_LIMIT / 1024 }) }) : null
|
|
4113
4438
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "dshdb-grid-wrap dshdb-redis-table", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("table", { className: "dshdb-grid", children: [
|
|
4114
4439
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("tr", { children: [
|
|
4115
4440
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("th", { className: "dshdb-num", children: "#" }),
|
|
@@ -4120,11 +4445,7 @@ var RedisValuePanel = (0, import_react10.memo)(function RedisValuePanel2({
|
|
|
4120
4445
|
row.map((cell, column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("td", { title: cell.slice(0, 512), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dshdb-mono", children: cell.slice(0, DISPLAY_TEXT_LIMIT) }) }, column))
|
|
4121
4446
|
] }, index)) })
|
|
4122
4447
|
] }) }),
|
|
4123
|
-
clipped ? /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
4124
|
-
"值太大,只显示了前 ",
|
|
4125
|
-
DISPLAY_TEXT_LIMIT / 1024,
|
|
4126
|
-
" KB;复制按钮拿到的是完整值。"
|
|
4127
|
-
] }) : null
|
|
4448
|
+
clipped ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dshdb-muted", style: { margin: "6px 0 0" }, children: t2("redis.largeValue", { kb: DISPLAY_TEXT_LIMIT / 1024 }) }) : null
|
|
4128
4449
|
] });
|
|
4129
4450
|
});
|
|
4130
4451
|
|
|
@@ -4545,11 +4866,11 @@ function appendConnection(context, connection) {
|
|
|
4545
4866
|
if (!visible) return;
|
|
4546
4867
|
const dbItems = Array.from({ length: state.redisDatabases[connection.id] ?? 16 }, (_, index) => ({
|
|
4547
4868
|
id: String(index),
|
|
4548
|
-
label: index === connection.redisDb ?
|
|
4869
|
+
label: index === connection.redisDb ? t("redis.dbDefault", { n: index }) : `db${index}`
|
|
4549
4870
|
}));
|
|
4550
4871
|
const picker = redis ? {
|
|
4551
|
-
title: "
|
|
4552
|
-
allLabel: "
|
|
4872
|
+
title: t("redis.chooseDb"),
|
|
4873
|
+
allLabel: t("redis.allDbs"),
|
|
4553
4874
|
items: dbItems,
|
|
4554
4875
|
visible: redisDbs.map(String),
|
|
4555
4876
|
mode: "redis-dbs"
|
|
@@ -4859,7 +5180,7 @@ function appendObject(context, connection, schema, object) {
|
|
|
4859
5180
|
function appendRedis(context, connection, visibleDbs, online) {
|
|
4860
5181
|
const { state, filter, rows } = context;
|
|
4861
5182
|
if (visibleDbs.length === 0) {
|
|
4862
|
-
note(rows, `${connection.id}#redis-empty`, "
|
|
5183
|
+
note(rows, `${connection.id}#redis-empty`, t("redis.noDb"), 2);
|
|
4863
5184
|
return;
|
|
4864
5185
|
}
|
|
4865
5186
|
const keysByDb = state.redisKeys[connection.id];
|
|
@@ -4888,15 +5209,15 @@ function appendRedis(context, connection, visibleDbs, online) {
|
|
|
4888
5209
|
db,
|
|
4889
5210
|
label: `db${db}`,
|
|
4890
5211
|
mono: true,
|
|
4891
|
-
title:
|
|
5212
|
+
title: t("redis.dbTitle", { n: db, default: db === connection.redisDb ? t("redis.dbTitleDefault") : "" }),
|
|
4892
5213
|
defaultDb: db === connection.redisDb,
|
|
4893
5214
|
loading,
|
|
4894
5215
|
online,
|
|
4895
|
-
meta: !loading && keys !== void 0 ?
|
|
5216
|
+
meta: !loading && keys !== void 0 ? t("redis.keysCount", { n: keys.length }) : void 0
|
|
4896
5217
|
});
|
|
4897
5218
|
if (!open) continue;
|
|
4898
5219
|
if (keys === void 0 && loading) {
|
|
4899
|
-
note(rows, `${nodeKey}#loading`, "
|
|
5220
|
+
note(rows, `${nodeKey}#loading`, t("redis.scanning"), 2, true);
|
|
4900
5221
|
}
|
|
4901
5222
|
if (keys === void 0 && !loading) {
|
|
4902
5223
|
rows.push({
|
|
@@ -4911,11 +5232,11 @@ function appendRedis(context, connection, visibleDbs, online) {
|
|
|
4911
5232
|
action: "scan",
|
|
4912
5233
|
connectionId: connection.id,
|
|
4913
5234
|
db,
|
|
4914
|
-
label: "
|
|
5235
|
+
label: t("redis.scanKeys")
|
|
4915
5236
|
});
|
|
4916
5237
|
}
|
|
4917
5238
|
if (keys !== void 0 && list.length === 0) {
|
|
4918
|
-
note(rows, `${nodeKey}#empty`, filter !== "" ? "
|
|
5239
|
+
note(rows, `${nodeKey}#empty`, filter !== "" ? t("redis.emptyMatch") : t("redis.emptyKeys"), 2);
|
|
4919
5240
|
}
|
|
4920
5241
|
for (const key of list) {
|
|
4921
5242
|
rows.push({
|
|
@@ -4952,7 +5273,7 @@ function appendRedis(context, connection, visibleDbs, online) {
|
|
|
4952
5273
|
connectionId: connection.id,
|
|
4953
5274
|
db,
|
|
4954
5275
|
loading,
|
|
4955
|
-
label: loading ? "
|
|
5276
|
+
label: loading ? t("redis.loading") : t("redis.loadMore")
|
|
4956
5277
|
});
|
|
4957
5278
|
}
|
|
4958
5279
|
}
|
|
@@ -5445,7 +5766,7 @@ function DataView(props) {
|
|
|
5445
5766
|
propsRef.current = props;
|
|
5446
5767
|
const { connections, selectedId, servers, expanded, schemas, objects, cachedAt, detail, detailLoading } = props;
|
|
5447
5768
|
const selected = connections.find((connection) => connection.id === selectedId);
|
|
5448
|
-
const treeFilterLabel = selected?.dialect === "redis" ? "
|
|
5769
|
+
const treeFilterLabel = selected?.dialect === "redis" ? t2("data.filterKeys") : t2("data.filterTables");
|
|
5449
5770
|
const handleRowDragStart = (event, id) => {
|
|
5450
5771
|
if (props.onReorderConnections === void 0) return;
|
|
5451
5772
|
if (event.dataTransfer) {
|
|
@@ -6017,8 +6338,8 @@ function DataView(props) {
|
|
|
6017
6338
|
onBlur: (event) => {
|
|
6018
6339
|
if (event.currentTarget.value === "") setFilterOpen(false);
|
|
6019
6340
|
},
|
|
6020
|
-
placeholder:
|
|
6021
|
-
"aria-label":
|
|
6341
|
+
placeholder: t2("data.filterPlaceholder", { label: treeFilterLabel }),
|
|
6342
|
+
"aria-label": t2("data.filterAria", { label: treeFilterLabel }),
|
|
6022
6343
|
autoFocus: true
|
|
6023
6344
|
}
|
|
6024
6345
|
),
|
|
@@ -6027,8 +6348,8 @@ function DataView(props) {
|
|
|
6027
6348
|
{
|
|
6028
6349
|
type: "button",
|
|
6029
6350
|
className: "dshdb-row-action",
|
|
6030
|
-
title: "
|
|
6031
|
-
"aria-label": "
|
|
6351
|
+
title: t2("data.clearFilter"),
|
|
6352
|
+
"aria-label": t2("data.clearFilter"),
|
|
6032
6353
|
onClick: () => {
|
|
6033
6354
|
setFilter("");
|
|
6034
6355
|
setSettledFilter("");
|
|
@@ -6037,7 +6358,7 @@ function DataView(props) {
|
|
|
6037
6358
|
}
|
|
6038
6359
|
) : null
|
|
6039
6360
|
] }) : null,
|
|
6040
|
-
loadingDetail ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loading, { label: props.redisDetailLoading ? "
|
|
6361
|
+
loadingDetail ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loading, { label: props.redisDetailLoading ? t2("data.loadingKey") : t2("data.loadingStructure") }) : null
|
|
6041
6362
|
] }) : null,
|
|
6042
6363
|
connections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6043
6364
|
EmptyState,
|
|
@@ -6049,10 +6370,7 @@ function DataView(props) {
|
|
|
6049
6370
|
}
|
|
6050
6371
|
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Panel, { className: "dshdb-grow", bodyClassName: "dshdb-panel-body-pad", children: [
|
|
6051
6372
|
filterSummary !== null && filterSummary.connections === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "dshdb-filter-empty", children: t2("data.noMatches") }) : null,
|
|
6052
|
-
filterSummary !== null && filterSummary.objects > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.
|
|
6053
|
-
filterSummary.objects,
|
|
6054
|
-
" 个对象匹配"
|
|
6055
|
-
] }) : null,
|
|
6373
|
+
filterSummary !== null && filterSummary.objects > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "dshdb-filter-empty", children: t2("data.objectsMatch", { n: filterSummary.objects }) }) : null,
|
|
6056
6374
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6057
6375
|
"div",
|
|
6058
6376
|
{
|
|
@@ -6193,7 +6511,7 @@ function DataView(props) {
|
|
|
6193
6511
|
]
|
|
6194
6512
|
}
|
|
6195
6513
|
) : null,
|
|
6196
|
-
!detail && !props.redisDetail && !detailLoading && !props.redisDetailLoading && connections.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "dshdb-muted", style: { padding: "0 2px" }, children: selected?.dialect === "redis" ? "
|
|
6514
|
+
!detail && !props.redisDetail && !detailLoading && !props.redisDetailLoading && connections.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "dshdb-muted", style: { padding: "0 2px" }, children: selected?.dialect === "redis" ? t2("data.redisHelp") : t2("data.help") }) : null,
|
|
6197
6515
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TreeMenu, { menu: objectMenu, onClose: () => setObjectMenu(null) }),
|
|
6198
6516
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TreeMenu, { menu: schemaMenu, onClose: () => setSchemaMenu(null) }),
|
|
6199
6517
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TreeMenu, { menu: connectionMenu, onClose: () => setConnectionMenu(null) })
|
|
@@ -6280,7 +6598,8 @@ function App(props) {
|
|
|
6280
6598
|
const [settingsOpen, setSettingsOpen] = (0, import_react17.useState)(false);
|
|
6281
6599
|
const [connModal, setConnModal] = (0, import_react17.useState)({
|
|
6282
6600
|
open: false,
|
|
6283
|
-
editing: null
|
|
6601
|
+
editing: null,
|
|
6602
|
+
seed: null
|
|
6284
6603
|
});
|
|
6285
6604
|
const [ddlModal, setDdlModal] = (0, import_react17.useState)({
|
|
6286
6605
|
open: false,
|
|
@@ -6422,7 +6741,7 @@ function App(props) {
|
|
|
6422
6741
|
setDeleting(true);
|
|
6423
6742
|
try {
|
|
6424
6743
|
await api.deleteConnection(connection.id);
|
|
6425
|
-
setConnModal({ open: false, editing: null });
|
|
6744
|
+
setConnModal({ open: false, editing: null, seed: null });
|
|
6426
6745
|
notify("连接已移入回收站", "success");
|
|
6427
6746
|
await refresh();
|
|
6428
6747
|
} catch (error) {
|
|
@@ -6476,7 +6795,7 @@ function App(props) {
|
|
|
6476
6795
|
id: "add",
|
|
6477
6796
|
label: t2("app.add"),
|
|
6478
6797
|
title: t2("app.addTitle"),
|
|
6479
|
-
onClick: () => setConnModal({ open: true, editing: null })
|
|
6798
|
+
onClick: () => setConnModal({ open: true, editing: null, seed: null })
|
|
6480
6799
|
},
|
|
6481
6800
|
{
|
|
6482
6801
|
id: "edit",
|
|
@@ -6484,7 +6803,16 @@ function App(props) {
|
|
|
6484
6803
|
title: t2("app.editTitle"),
|
|
6485
6804
|
disabled: !selected || deleting,
|
|
6486
6805
|
onClick: () => {
|
|
6487
|
-
if (selected) setConnModal({ open: true, editing: selected });
|
|
6806
|
+
if (selected) setConnModal({ open: true, editing: selected, seed: null });
|
|
6807
|
+
}
|
|
6808
|
+
},
|
|
6809
|
+
{
|
|
6810
|
+
id: "duplicate",
|
|
6811
|
+
label: t2("app.copy"),
|
|
6812
|
+
title: t2("app.copyTitle"),
|
|
6813
|
+
disabled: !selected,
|
|
6814
|
+
onClick: () => {
|
|
6815
|
+
if (selected) setConnModal({ open: true, editing: null, seed: selected });
|
|
6488
6816
|
}
|
|
6489
6817
|
},
|
|
6490
6818
|
{
|
|
@@ -6534,7 +6862,7 @@ function App(props) {
|
|
|
6534
6862
|
height: "100%",
|
|
6535
6863
|
minHeight: 0
|
|
6536
6864
|
};
|
|
6537
|
-
const openAddConnection = (0, import_react17.useCallback)(() => setConnModal({ open: true, editing: null }), []);
|
|
6865
|
+
const openAddConnection = (0, import_react17.useCallback)(() => setConnModal({ open: true, editing: null, seed: null }), []);
|
|
6538
6866
|
const connectTree = (0, import_react17.useCallback)((id) => void connect(id), [connect]);
|
|
6539
6867
|
const refreshTree = (0, import_react17.useCallback)(() => void refreshSelected(), [refreshSelected]);
|
|
6540
6868
|
const toggleTreeSchema = (0, import_react17.useCallback)(
|
|
@@ -6810,7 +7138,8 @@ function App(props) {
|
|
|
6810
7138
|
{
|
|
6811
7139
|
open: connModal.open,
|
|
6812
7140
|
editing: connModal.editing,
|
|
6813
|
-
|
|
7141
|
+
seed: connModal.seed,
|
|
7142
|
+
onClose: () => setConnModal({ open: false, editing: null, seed: null }),
|
|
6814
7143
|
onSaved: () => void refresh(),
|
|
6815
7144
|
onDelete: (connection) => void deleteConnection(connection),
|
|
6816
7145
|
notify
|
|
@@ -14201,7 +14530,7 @@ function HistoryRow(props) {
|
|
|
14201
14530
|
children: [
|
|
14202
14531
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-sql", children: oneLine(props.entry.statement) }),
|
|
14203
14532
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-time", children: historyAgo(props.entry.at) }),
|
|
14204
|
-
props.entry.rows === void 0 && props.entry.elapsedMs === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-meta", children: props.entry.rows === void 0 ? formatMs(props.entry.elapsedMs ?? 0) : `${formatCount(props.entry.rows)}
|
|
14533
|
+
props.entry.rows === void 0 && props.entry.elapsedMs === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-meta", children: props.entry.rows === void 0 ? formatMs(props.entry.elapsedMs ?? 0) : `${formatCount(props.entry.rows)} ${t("table.rows")} · ${formatMs(props.entry.elapsedMs ?? 0)}` })
|
|
14205
14534
|
]
|
|
14206
14535
|
}
|
|
14207
14536
|
),
|
|
@@ -14210,8 +14539,8 @@ function HistoryRow(props) {
|
|
|
14210
14539
|
{
|
|
14211
14540
|
type: "button",
|
|
14212
14541
|
className: "dshdb-history-copy",
|
|
14213
|
-
"aria-label": "
|
|
14214
|
-
title: "
|
|
14542
|
+
"aria-label": t("redis.historyCopy"),
|
|
14543
|
+
title: t("redis.historyCopy"),
|
|
14215
14544
|
onClick: () => void copyText(props.entry.statement),
|
|
14216
14545
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CopyIcon, { size: 11 })
|
|
14217
14546
|
}
|
|
@@ -14222,8 +14551,8 @@ function HistoryRow(props) {
|
|
|
14222
14551
|
type: "button",
|
|
14223
14552
|
className: "dshdb-history-star",
|
|
14224
14553
|
"data-pinned": props.pinned,
|
|
14225
|
-
"aria-label": props.pinned ? "
|
|
14226
|
-
title: props.pinned ? "
|
|
14554
|
+
"aria-label": props.pinned ? t("redis.historyUnpin") : t("redis.historyPin"),
|
|
14555
|
+
title: props.pinned ? t("redis.historyUnpin") : t("redis.historyPin"),
|
|
14227
14556
|
onClick: () => props.onTogglePin(props.entry),
|
|
14228
14557
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StarIcon, { size: 11, filled: props.pinned })
|
|
14229
14558
|
}
|
|
@@ -14248,17 +14577,14 @@ var HistoryPanel = (0, import_react20.memo)(function HistoryPanel2(props) {
|
|
|
14248
14577
|
{
|
|
14249
14578
|
type: "search",
|
|
14250
14579
|
className: "dshdb-input",
|
|
14251
|
-
"aria-label": "
|
|
14252
|
-
placeholder: "
|
|
14580
|
+
"aria-label": t("redis.historySearch"),
|
|
14581
|
+
placeholder: t("redis.historySearch"),
|
|
14253
14582
|
value: query,
|
|
14254
14583
|
onChange: (event) => setQuery(event.target.value)
|
|
14255
14584
|
}
|
|
14256
14585
|
) }) : null,
|
|
14257
14586
|
pins.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "dshdb-history-group", children: [
|
|
14258
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "dshdb-history-head", children: /* @__PURE__ */ (0, import_jsx_runtime17.
|
|
14259
|
-
"收藏 · ",
|
|
14260
|
-
pins.length
|
|
14261
|
-
] }) }),
|
|
14587
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "dshdb-history-head", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-title", children: t("redis.historyPinned", { n: pins.length }) }) }),
|
|
14262
14588
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "dshdb-history-list", children: pins.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14263
14589
|
HistoryRow,
|
|
14264
14590
|
{
|
|
@@ -14271,17 +14597,14 @@ var HistoryPanel = (0, import_react20.memo)(function HistoryPanel2(props) {
|
|
|
14271
14597
|
)) })
|
|
14272
14598
|
] }) : null,
|
|
14273
14599
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "dshdb-history-head", children: [
|
|
14274
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.
|
|
14275
|
-
"最近执行 · ",
|
|
14276
|
-
entries.length
|
|
14277
|
-
] }),
|
|
14600
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-title", children: t("redis.historyRecent", { n: entries.length }) }),
|
|
14278
14601
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14279
14602
|
Button,
|
|
14280
14603
|
{
|
|
14281
14604
|
size: "sm",
|
|
14282
14605
|
variant: "ghost",
|
|
14283
14606
|
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ClearIcon, { size: 12 }),
|
|
14284
|
-
title: clearArmed ? "
|
|
14607
|
+
title: clearArmed ? t("redis.historyConfirmClear") : t("redis.historyClear"),
|
|
14285
14608
|
onClick: () => {
|
|
14286
14609
|
if (!clearArmed) {
|
|
14287
14610
|
setClearArmed(true);
|
|
@@ -14290,11 +14613,11 @@ var HistoryPanel = (0, import_react20.memo)(function HistoryPanel2(props) {
|
|
|
14290
14613
|
setClearArmed(false);
|
|
14291
14614
|
props.onClear();
|
|
14292
14615
|
},
|
|
14293
|
-
children: clearArmed ? "
|
|
14616
|
+
children: clearArmed ? t("redis.historyConfirm") : t("redis.clear")
|
|
14294
14617
|
}
|
|
14295
14618
|
)
|
|
14296
14619
|
] }),
|
|
14297
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "dshdb-history-list", children: entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-empty", children: needle === "" ? "
|
|
14620
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "dshdb-history-list", children: entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-history-empty", children: needle === "" ? t("redis.historyEmpty") : t("redis.historyNoMatch") }) : entries.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14298
14621
|
HistoryRow,
|
|
14299
14622
|
{
|
|
14300
14623
|
entry,
|
|
@@ -14330,7 +14653,7 @@ var KeyRow = (0, import_react20.memo)(function KeyRow2({
|
|
|
14330
14653
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "dshdb-num", children: index + 1 }),
|
|
14331
14654
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { title: info.key, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-mono", children: info.key }) }),
|
|
14332
14655
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tag, { children: info.type }) }),
|
|
14333
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "dshdb-num", title: info.ttl < 0 ? "
|
|
14656
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "dshdb-num", title: info.ttl < 0 ? t("redis.noExpiry") : t("redis.ttlSeconds", { n: info.ttl }), children: formatTtl(info.ttl) }),
|
|
14334
14657
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "dshdb-num", children: info.size === void 0 ? "" : formatCount(info.size) })
|
|
14335
14658
|
]
|
|
14336
14659
|
}
|
|
@@ -14355,7 +14678,7 @@ var KeyGrid = (0, import_react20.memo)(function KeyGrid2({
|
|
|
14355
14678
|
const openMenu = (0, import_react20.useCallback)((event, key) => {
|
|
14356
14679
|
event.preventDefault();
|
|
14357
14680
|
const items = [
|
|
14358
|
-
{ label: "
|
|
14681
|
+
{ label: t("redis.copyKey"), run: () => void copyText(key.key) },
|
|
14359
14682
|
{
|
|
14360
14683
|
label: t("console.copyKeys"),
|
|
14361
14684
|
run: () => void copyText(rowsRef.current.map((info) => info.key).join("\n"))
|
|
@@ -14364,29 +14687,29 @@ var KeyGrid = (0, import_react20.memo)(function KeyGrid2({
|
|
|
14364
14687
|
setMenu({ ...placeMenu(event.clientX, event.clientY, items), items });
|
|
14365
14688
|
}, []);
|
|
14366
14689
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
14367
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("table", { className: "dshdb-grid", "aria-label": "
|
|
14690
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("table", { className: "dshdb-grid", "aria-label": t("redis.keyList"), children: [
|
|
14368
14691
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { children: [
|
|
14369
14692
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { className: "dshdb-num", children: "#" }),
|
|
14370
14693
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14371
14694
|
"th",
|
|
14372
14695
|
{
|
|
14373
14696
|
className: "dshdb-th-sortable",
|
|
14374
|
-
title: sort === "none" ? "
|
|
14697
|
+
title: sort === "none" ? t("redis.sortName") : sort === "asc" ? t("redis.sortNameDesc") : t("redis.restoreScanOrder"),
|
|
14375
14698
|
"data-sorted": sort === "none" ? void 0 : sort,
|
|
14376
14699
|
"aria-sort": sort === "asc" ? "ascending" : sort === "desc" ? "descending" : "none",
|
|
14377
14700
|
onClick: () => setSort(nextKeySort(sort)),
|
|
14378
14701
|
children: [
|
|
14379
|
-
"
|
|
14702
|
+
t("redis.key"),
|
|
14380
14703
|
sort === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-sort-arrow", children: sort === "asc" ? "▲" : "▼" })
|
|
14381
14704
|
]
|
|
14382
14705
|
}
|
|
14383
14706
|
),
|
|
14384
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { children: "
|
|
14707
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { children: t("redis.type") }),
|
|
14385
14708
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14386
14709
|
"th",
|
|
14387
14710
|
{
|
|
14388
14711
|
className: "dshdb-th-sortable",
|
|
14389
|
-
title: ttlSort === "none" ? "
|
|
14712
|
+
title: ttlSort === "none" ? t("redis.sortTtl") : ttlSort === "asc" ? t("redis.sortTtlDesc") : t("redis.restoreScanOrder"),
|
|
14390
14713
|
"data-sorted": ttlSort === "none" ? void 0 : ttlSort,
|
|
14391
14714
|
"aria-sort": ttlSort === "asc" ? "ascending" : ttlSort === "desc" ? "descending" : "none",
|
|
14392
14715
|
onClick: () => setTtlSort(nextKeySort(ttlSort)),
|
|
@@ -14400,18 +14723,18 @@ var KeyGrid = (0, import_react20.memo)(function KeyGrid2({
|
|
|
14400
14723
|
"th",
|
|
14401
14724
|
{
|
|
14402
14725
|
className: "dshdb-th-sortable",
|
|
14403
|
-
title: sizeSort === "none" ? "
|
|
14726
|
+
title: sizeSort === "none" ? t("redis.sortSize") : sizeSort === "asc" ? t("redis.sortSizeDesc") : t("redis.restoreScanOrder"),
|
|
14404
14727
|
"data-sorted": sizeSort === "none" ? void 0 : sizeSort,
|
|
14405
14728
|
"aria-sort": sizeSort === "asc" ? "ascending" : sizeSort === "desc" ? "descending" : "none",
|
|
14406
14729
|
onClick: () => setSizeSort(nextKeySort(sizeSort)),
|
|
14407
14730
|
children: [
|
|
14408
|
-
"
|
|
14731
|
+
t("redis.length"),
|
|
14409
14732
|
sizeSort === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "dshdb-sort-arrow", children: sizeSort === "asc" ? "▲" : "▼" })
|
|
14410
14733
|
]
|
|
14411
14734
|
}
|
|
14412
14735
|
)
|
|
14413
14736
|
] }) }),
|
|
14414
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "dshdb-muted", colSpan: 5, style: { padding: "10px 12px" }, children: emptyText ?? "
|
|
14737
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: "dshdb-muted", colSpan: 5, style: { padding: "10px 12px" }, children: emptyText ?? t("redis.emptyMatch") }) }) : rows.map((key, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14415
14738
|
KeyRow,
|
|
14416
14739
|
{
|
|
14417
14740
|
info: key,
|
|
@@ -14709,7 +15032,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
14709
15032
|
const askConfirm = (0, import_react22.useCallback)((message, detail) => {
|
|
14710
15033
|
return new Promise((resolve) => {
|
|
14711
15034
|
setConfirm({
|
|
14712
|
-
request: { title: "
|
|
15035
|
+
request: { title: t2("console.confirmRun"), message, detail, danger: true, confirmLabel: t2("console.execute") },
|
|
14713
15036
|
resolve
|
|
14714
15037
|
});
|
|
14715
15038
|
});
|
|
@@ -14971,7 +15294,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
14971
15294
|
setScriptResults(collected);
|
|
14972
15295
|
setScriptIndex(Math.max(0, collected.length - 1));
|
|
14973
15296
|
const failure2 = failureText(error);
|
|
14974
|
-
setFailure({ message:
|
|
15297
|
+
setFailure({ message: t2("console.multiFail", { n: index + 1, total: parts.length, message: failure2.message }), detail: failure2.detail ?? part });
|
|
14975
15298
|
if (last !== null) {
|
|
14976
15299
|
setResult(last);
|
|
14977
15300
|
setPage(0);
|
|
@@ -14987,7 +15310,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
14987
15310
|
setPage(0);
|
|
14988
15311
|
setBase("");
|
|
14989
15312
|
setSourceSql(parts[parts.length - 1] ?? "");
|
|
14990
|
-
setMultiNote(
|
|
15313
|
+
setMultiNote(t2("console.multiDone", { n: parts.length }));
|
|
14991
15314
|
setHistory(pushHistory("sql", parts.join(";\n")));
|
|
14992
15315
|
if (last !== null) setHistory(annotateHistory("sql", parts.join(";\n"), { rows: last.rows.length, elapsedMs: last.elapsedMs }));
|
|
14993
15316
|
if (parts.some(looksLikeDdl)) {
|
|
@@ -15040,7 +15363,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15040
15363
|
if (parts.length === 0) return;
|
|
15041
15364
|
const isWrite = parts.some((part) => looksLikeWrite(part));
|
|
15042
15365
|
if (isWrite && settings?.confirmDestructive === true) {
|
|
15043
|
-
const ok = await askConfirm(parts.length > 1 ?
|
|
15366
|
+
const ok = await askConfirm(parts.length > 1 ? t2("console.confirmWriteMulti", { n: parts.length }) : t2("console.confirmWrite"), body);
|
|
15044
15367
|
if (!ok) return;
|
|
15045
15368
|
}
|
|
15046
15369
|
if (parts.length > 1) {
|
|
@@ -15129,7 +15452,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15129
15452
|
setPage(0);
|
|
15130
15453
|
setBase("");
|
|
15131
15454
|
if (next.plan === void 0) {
|
|
15132
|
-
setFailure({ message: next.warnings.join("
|
|
15455
|
+
setFailure({ message: next.warnings.join("; ") || t2("console.noPlan"), detail: next.statements.join("\n") });
|
|
15133
15456
|
}
|
|
15134
15457
|
} catch (error) {
|
|
15135
15458
|
if (token !== planToken.current) return;
|
|
@@ -15258,13 +15581,13 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15258
15581
|
const isWrite = looksLikeRedisWrite(text2);
|
|
15259
15582
|
if (isWrite && connection?.readOnly === true) {
|
|
15260
15583
|
setValueError({
|
|
15261
|
-
message: "
|
|
15262
|
-
detail: "
|
|
15584
|
+
message: t2("console.readonlyWrite"),
|
|
15585
|
+
detail: t2("console.readonlyWriteDetail")
|
|
15263
15586
|
});
|
|
15264
15587
|
return;
|
|
15265
15588
|
}
|
|
15266
15589
|
if (isWrite && settings?.confirmDestructive === true) {
|
|
15267
|
-
const ok = await askConfirm("
|
|
15590
|
+
const ok = await askConfirm(t2("console.confirmRedisWrite"), text2);
|
|
15268
15591
|
if (!ok) return;
|
|
15269
15592
|
}
|
|
15270
15593
|
recallRef.current = -1;
|
|
@@ -15474,29 +15797,29 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15474
15797
|
const active = rowSort?.column === column.name ? rowSort.direction : null;
|
|
15475
15798
|
const index = columns.findIndex((item) => item.name === column.name);
|
|
15476
15799
|
return [
|
|
15477
|
-
{ label: "
|
|
15478
|
-
{ label: "
|
|
15479
|
-
{ label: "
|
|
15480
|
-
{ label:
|
|
15800
|
+
{ label: t2("menu.sortAsc"), disabled: active === "asc", run: () => setRowSort({ column: column.name, direction: "asc" }) },
|
|
15801
|
+
{ label: t2("menu.sortDesc"), disabled: active === "desc", run: () => setRowSort({ column: column.name, direction: "desc" }) },
|
|
15802
|
+
{ label: t2("menu.clearSort"), disabled: rowSort === null, run: () => setRowSort(null) },
|
|
15803
|
+
{ label: t2("menu.copyColumnName", { name: column.name }), run: () => void copyText(column.name).then(noteCopied("列名")) },
|
|
15481
15804
|
{
|
|
15482
15805
|
label: t2("menu.copyColumnValues", { n: filteredRows.length }),
|
|
15483
15806
|
disabled: filteredRows.length === 0 || index < 0,
|
|
15484
|
-
run: () => void copyText(columnValues(filteredRows, index)).then(noteCopied("
|
|
15807
|
+
run: () => void copyText(columnValues(filteredRows, index)).then(noteCopied(t2("redis.headerValue")))
|
|
15485
15808
|
},
|
|
15486
15809
|
{
|
|
15487
15810
|
label: t2("menu.copyIn"),
|
|
15488
15811
|
disabled: filteredRows.length === 0 || index < 0,
|
|
15489
|
-
run: () => void copyText(inListOf(connection?.dialect ?? "mysql", filteredRows, index)).then(noteCopied("
|
|
15812
|
+
run: () => void copyText(inListOf(connection?.dialect ?? "mysql", filteredRows, index)).then(noteCopied(t2("menu.inListShort")))
|
|
15490
15813
|
},
|
|
15491
15814
|
{
|
|
15492
15815
|
label: t2("menu.copyComma"),
|
|
15493
15816
|
disabled: filteredRows.length === 0 || index < 0,
|
|
15494
|
-
run: () => void copyText(commaValues(filteredRows, index)).then(noteCopied("
|
|
15817
|
+
run: () => void copyText(commaValues(filteredRows, index)).then(noteCopied(t2("menu.copyComma")))
|
|
15495
15818
|
},
|
|
15496
15819
|
{
|
|
15497
15820
|
label: t2("menu.copyAllColumns"),
|
|
15498
15821
|
disabled: displayColumns.length === 0,
|
|
15499
|
-
run: () => void copyText(columnNames(connection?.dialect ?? "mysql", displayColumns)).then(noteCopied("
|
|
15822
|
+
run: () => void copyText(columnNames(connection?.dialect ?? "mysql", displayColumns)).then(noteCopied(t2("menu.copyAllColumns")))
|
|
15500
15823
|
},
|
|
15501
15824
|
{
|
|
15502
15825
|
label: t2("menu.copySelectColumns", { n: displayColumns.length }),
|
|
@@ -15504,7 +15827,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15504
15827
|
run: () => {
|
|
15505
15828
|
const target = tableTarget();
|
|
15506
15829
|
if (target === null) return;
|
|
15507
|
-
void copyText(selectColumnsSql(connection?.dialect ?? "mysql", target.schema, target.table, displayColumns)).then(noteCopied("
|
|
15830
|
+
void copyText(selectColumnsSql(connection?.dialect ?? "mysql", target.schema, target.table, displayColumns)).then(noteCopied(t2("menu.copySelect")));
|
|
15508
15831
|
}
|
|
15509
15832
|
},
|
|
15510
15833
|
{
|
|
@@ -15530,7 +15853,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15530
15853
|
run: () => setHiddenColumns(onlyColumn(displayColumns, column.name))
|
|
15531
15854
|
},
|
|
15532
15855
|
{
|
|
15533
|
-
label: hiddenCount === 0 ? "
|
|
15856
|
+
label: hiddenCount === 0 ? t2("menu.showAllColumns") : t2("menu.showAllColumnsHidden", { n: hiddenCount }),
|
|
15534
15857
|
disabled: hiddenCount === 0,
|
|
15535
15858
|
run: () => setHiddenColumns(null)
|
|
15536
15859
|
}
|
|
@@ -15551,8 +15874,8 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15551
15874
|
const gridCellMenu = (0, import_react22.useCallback)(
|
|
15552
15875
|
(cell) => [
|
|
15553
15876
|
{ label: t2("menu.viewFull"), run: () => setCellView(cellValueView(cell.column.name, cell.value)) },
|
|
15554
|
-
{ label: "
|
|
15555
|
-
{ label: "
|
|
15877
|
+
{ label: t2("menu.filterPage"), run: () => setRowFilter(cellCopyText(cell.value)) },
|
|
15878
|
+
{ label: t2("menu.copyCellValue"), run: () => void copyText(cellCopyText(cell.value)).then(noteCopied(t2("menu.copyCellValue"))) },
|
|
15556
15879
|
{
|
|
15557
15880
|
label: t2("menu.copyInsert"),
|
|
15558
15881
|
disabled: tableTarget() === null,
|
|
@@ -15566,9 +15889,9 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15566
15889
|
},
|
|
15567
15890
|
{
|
|
15568
15891
|
label: t2("menu.copyWhere"),
|
|
15569
|
-
run: () => void copyText(`WHERE ${cellWhere(connection?.dialect ?? "mysql", cell.column, cell.value)}`).then(noteCopied("
|
|
15892
|
+
run: () => void copyText(`WHERE ${cellWhere(connection?.dialect ?? "mysql", cell.column, cell.value)}`).then(noteCopied(t2("menu.whereShort")))
|
|
15570
15893
|
},
|
|
15571
|
-
{ label: `复制整行(${displayColumns.length} 列,制表符分隔)`, run: () => void copyText(rowToTsv(displayColumns, cell.row)).then(noteCopied("
|
|
15894
|
+
{ label: `复制整行(${displayColumns.length} 列,制表符分隔)`, run: () => void copyText(rowToTsv(displayColumns, cell.row)).then(noteCopied(t2("menu.copyRow", { n: displayColumns.length }))) }
|
|
15572
15895
|
],
|
|
15573
15896
|
[base, connection?.dialect, displayColumns, schema, sourceSql]
|
|
15574
15897
|
);
|
|
@@ -15596,8 +15919,8 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15596
15919
|
EmptyState,
|
|
15597
15920
|
{
|
|
15598
15921
|
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DatabaseIcon, { size: 22 }),
|
|
15599
|
-
title: "
|
|
15600
|
-
description: "
|
|
15922
|
+
title: t2("console.noDataSources"),
|
|
15923
|
+
description: t2("console.noDataSourcesDesc")
|
|
15601
15924
|
}
|
|
15602
15925
|
) });
|
|
15603
15926
|
}
|
|
@@ -15615,7 +15938,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15615
15938
|
openTableTab({ connectionId: selectedId, schema: target.schema, table: target.table, kind });
|
|
15616
15939
|
};
|
|
15617
15940
|
const noTableNote = () => {
|
|
15618
|
-
setExportNote("
|
|
15941
|
+
setExportNote(t2("console.noTargetTable"));
|
|
15619
15942
|
setTimeout(() => setExportNote(""), 5e3);
|
|
15620
15943
|
};
|
|
15621
15944
|
const exportPage = (format) => {
|
|
@@ -15634,7 +15957,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15634
15957
|
rows: displayRows
|
|
15635
15958
|
});
|
|
15636
15959
|
downloadText(exportFilename(target?.schema ?? "", target?.table ?? "console", format), payload.mime, payload.text);
|
|
15637
|
-
setExportNote(
|
|
15960
|
+
setExportNote(t2("console.exported", { format: format.toUpperCase(), n: displayRows.length }));
|
|
15638
15961
|
setTimeout(() => setExportNote(""), 5e3);
|
|
15639
15962
|
};
|
|
15640
15963
|
const exportSelected = (format) => {
|
|
@@ -15654,7 +15977,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15654
15977
|
rows: picked
|
|
15655
15978
|
});
|
|
15656
15979
|
downloadText(exportFilename(target?.schema ?? "", target?.table ?? "console", format), payload.mime, payload.text);
|
|
15657
|
-
setExportNote(
|
|
15980
|
+
setExportNote(t2("console.exported", { format: format.toUpperCase(), n: picked.length }));
|
|
15658
15981
|
setTimeout(() => setExportNote(""), 5e3);
|
|
15659
15982
|
setSelectedRows(/* @__PURE__ */ new Set());
|
|
15660
15983
|
};
|
|
@@ -15674,7 +15997,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15674
15997
|
limit: EXPORT_LIMIT,
|
|
15675
15998
|
batch: EXPORT_BATCH,
|
|
15676
15999
|
cancelled: () => exportCancelled.current,
|
|
15677
|
-
onProgress: (count) => setExportNote(
|
|
16000
|
+
onProgress: (count) => setExportNote(t2("console.exportProgress", { format: format.toUpperCase(), n: formatCount(count) })),
|
|
15678
16001
|
fetch: async ({ page: sourcePage }) => {
|
|
15679
16002
|
const sqlText = wrapPage(connection?.dialect ?? "mysql", base, EXPORT_BATCH, sourcePage);
|
|
15680
16003
|
const next = await queryWithRetry(
|
|
@@ -15689,7 +16012,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15689
16012
|
}
|
|
15690
16013
|
});
|
|
15691
16014
|
if (exportCancelled.current) {
|
|
15692
|
-
setExportNote(
|
|
16015
|
+
setExportNote(t2("console.exportCancelled", { format: format.toUpperCase() }));
|
|
15693
16016
|
setTimeout(() => setExportNote(""), 5e3);
|
|
15694
16017
|
return;
|
|
15695
16018
|
}
|
|
@@ -15703,7 +16026,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15703
16026
|
rows: data
|
|
15704
16027
|
});
|
|
15705
16028
|
downloadText(exportFilename(target?.schema ?? "", target?.table ?? "console", format), payload.mime, payload.text);
|
|
15706
|
-
setExportNote(
|
|
16029
|
+
setExportNote(t2("console.exported", { format: format.toUpperCase(), n: data.length }));
|
|
15707
16030
|
setTimeout(() => setExportNote(""), 5e3);
|
|
15708
16031
|
} catch (error) {
|
|
15709
16032
|
setFailure(failureText(error));
|
|
@@ -15961,7 +16284,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
15961
16284
|
{
|
|
15962
16285
|
className: "dshdb-select dshdb-select-inline dshdb-console-select",
|
|
15963
16286
|
"aria-label": t2("console.redisDb"),
|
|
15964
|
-
title: "
|
|
16287
|
+
title: t2("redis.dbTitle"),
|
|
15965
16288
|
value: activeRedisDb,
|
|
15966
16289
|
onChange: (event) => {
|
|
15967
16290
|
invalidateRun();
|
|
@@ -16023,8 +16346,8 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16023
16346
|
{
|
|
16024
16347
|
className: "dshdb-input dshdb-qfilter-input dshdb-pattern-input",
|
|
16025
16348
|
"aria-label": t2("console.keyPattern"),
|
|
16026
|
-
title: "
|
|
16027
|
-
placeholder: "
|
|
16349
|
+
title: t2("redis.scanTitle"),
|
|
16350
|
+
placeholder: t2("redis.patternPlaceholder"),
|
|
16028
16351
|
value: pattern,
|
|
16029
16352
|
spellCheck: false,
|
|
16030
16353
|
onChange: (event) => setPattern(event.target.value),
|
|
@@ -16039,7 +16362,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16039
16362
|
{
|
|
16040
16363
|
type: "button",
|
|
16041
16364
|
className: "dshdb-row-action",
|
|
16042
|
-
title: "
|
|
16365
|
+
title: t2("redis.clearPattern"),
|
|
16043
16366
|
"aria-label": t2("console.clearKeyPattern"),
|
|
16044
16367
|
onClick: () => {
|
|
16045
16368
|
setPattern("*");
|
|
@@ -16049,7 +16372,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16049
16372
|
children: "×"
|
|
16050
16373
|
}
|
|
16051
16374
|
),
|
|
16052
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "dshdb-qmeta", title: "
|
|
16375
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "dshdb-qmeta", title: t2("redis.onlyTtlTitle"), children: [
|
|
16053
16376
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16054
16377
|
"input",
|
|
16055
16378
|
{
|
|
@@ -16063,15 +16386,15 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16063
16386
|
}
|
|
16064
16387
|
}
|
|
16065
16388
|
),
|
|
16066
|
-
"
|
|
16389
|
+
t2("redis.onlyTtl")
|
|
16067
16390
|
] }),
|
|
16068
16391
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16069
16392
|
"input",
|
|
16070
16393
|
{
|
|
16071
16394
|
className: "dshdb-input dshdb-qfilter-input",
|
|
16072
16395
|
"aria-label": t2("console.filterKeys"),
|
|
16073
|
-
title: "
|
|
16074
|
-
placeholder: "
|
|
16396
|
+
title: t2("redis.filterKeysTitle"),
|
|
16397
|
+
placeholder: t2("redis.filterKeysPlaceholder"),
|
|
16075
16398
|
value: keyFilter,
|
|
16076
16399
|
onChange: (event) => setKeyFilter(event.target.value),
|
|
16077
16400
|
onKeyDown: (event) => {
|
|
@@ -16084,7 +16407,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16084
16407
|
{
|
|
16085
16408
|
type: "button",
|
|
16086
16409
|
className: "dshdb-row-action",
|
|
16087
|
-
title: "
|
|
16410
|
+
title: t2("redis.clearKeyFilter"),
|
|
16088
16411
|
"aria-label": t2("console.clearKeyFilter"),
|
|
16089
16412
|
onClick: () => setKeyFilter(""),
|
|
16090
16413
|
children: "×"
|
|
@@ -16102,7 +16425,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16102
16425
|
void loadKeys(false, event.target.value);
|
|
16103
16426
|
},
|
|
16104
16427
|
children: [
|
|
16105
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "
|
|
16428
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: t2("redis.allTypes") }),
|
|
16106
16429
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "string", children: "string" }),
|
|
16107
16430
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "list", children: "list" }),
|
|
16108
16431
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "set", children: "set" }),
|
|
@@ -16112,7 +16435,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16112
16435
|
]
|
|
16113
16436
|
}
|
|
16114
16437
|
),
|
|
16115
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { size: "sm", onClick: () => void loadKeys(false), loading: scanning, children: "
|
|
16438
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { size: "sm", onClick: () => void loadKeys(false), loading: scanning, children: t2("redis.scan") }),
|
|
16116
16439
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16117
16440
|
Button,
|
|
16118
16441
|
{
|
|
@@ -16120,15 +16443,15 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16120
16443
|
variant: "ghost",
|
|
16121
16444
|
onClick: () => void loadKeys(true),
|
|
16122
16445
|
disabled: scan === null || scan.cursor === "0" || scanning || scanQuery === null || scanQuery.pattern !== (pattern.trim() === "" ? "*" : pattern.trim()) || scanQuery.type !== scanType,
|
|
16123
|
-
title: scan === null ? "
|
|
16124
|
-
children: "
|
|
16446
|
+
title: scan === null ? t2("redis.scanFirst") : t2("redis.continueTitle"),
|
|
16447
|
+
children: t2("redis.continue")
|
|
16125
16448
|
}
|
|
16126
16449
|
),
|
|
16127
16450
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "dshdb-qmeta", children: [
|
|
16128
|
-
scan === null ? "" : ttlOnly || keyFilter.trim() !== "" ?
|
|
16451
|
+
scan === null ? "" : ttlOnly || keyFilter.trim() !== "" ? t2("redis.scanCount", { visible: formatCount(visibleKeys.length), total: formatCount(scan.keys.length) }) : t2("redis.keysCount", { n: formatCount(scan.keys.length) }),
|
|
16129
16452
|
scanMs === null ? "" : ` · ${formatMs(scanMs)}`,
|
|
16130
|
-
scan !== null && scan.cursor === "0" && scan.keys.length > 0 ? "
|
|
16131
|
-
scan !== null && scan.cursor !== "0" && scanQuery !== null && (scanQuery.pattern !== (pattern.trim() === "" ? "*" : pattern.trim()) || scanQuery.type !== scanType) ? "
|
|
16453
|
+
scan !== null && scan.cursor === "0" && scan.keys.length > 0 ? t2("redis.allLoaded") : "",
|
|
16454
|
+
scan !== null && scan.cursor !== "0" && scanQuery !== null && (scanQuery.pattern !== (pattern.trim() === "" ? "*" : pattern.trim()) || scanQuery.type !== scanType) ? t2("redis.conditionChanged") : ""
|
|
16132
16455
|
] }),
|
|
16133
16456
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16134
16457
|
Button,
|
|
@@ -16136,9 +16459,9 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16136
16459
|
size: "sm",
|
|
16137
16460
|
variant: "ghost",
|
|
16138
16461
|
disabled: visibleKeys.length === 0,
|
|
16139
|
-
title: "
|
|
16140
|
-
onClick: () => void copyText(visibleKeys.map((info) => info.key).join("\n")).then(noteCopied(
|
|
16141
|
-
children: "
|
|
16462
|
+
title: t2("redis.copyKeysTitle"),
|
|
16463
|
+
onClick: () => void copyText(visibleKeys.map((info) => info.key).join("\n")).then(noteCopied(t2("redis.copyKeysCount", { n: formatCount(visibleKeys.length) }))),
|
|
16464
|
+
children: t2("redis.copyKeys")
|
|
16142
16465
|
}
|
|
16143
16466
|
),
|
|
16144
16467
|
exportNote !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", role: "status", children: exportNote }) : null
|
|
@@ -16160,7 +16483,7 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16160
16483
|
setValueError(null);
|
|
16161
16484
|
retry();
|
|
16162
16485
|
},
|
|
16163
|
-
children: "
|
|
16486
|
+
children: t2("redis.retry")
|
|
16164
16487
|
}
|
|
16165
16488
|
),
|
|
16166
16489
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -16168,11 +16491,11 @@ function ConsoleBody({ initialConnectionId, initialSchema, initialSql }) {
|
|
|
16168
16491
|
{
|
|
16169
16492
|
size: "sm",
|
|
16170
16493
|
variant: "ghost",
|
|
16171
|
-
title: "
|
|
16494
|
+
title: t2("redis.copyError"),
|
|
16172
16495
|
onClick: () => void copyText(
|
|
16173
16496
|
valueError.detail === void 0 ? valueError.message : valueError.message + String.fromCharCode(10) + valueError.detail
|
|
16174
16497
|
),
|
|
16175
|
-
children: "
|
|
16498
|
+
children: t2("redis.copy")
|
|
16176
16499
|
}
|
|
16177
16500
|
)
|
|
16178
16501
|
] }),
|
|
@@ -16183,23 +16506,23 @@ ${valueError.detail}` : ""
|
|
|
16183
16506
|
]
|
|
16184
16507
|
}
|
|
16185
16508
|
) : null,
|
|
16186
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: value === null ? "dshdb-grid-wrap" : "dshdb-grid-wrap dshdb-redis-keys", children: scan === null || visibleKeys.length === 0 && !ttlOnly && keyFilter.trim() === "" ? scanning ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dshdb-empty", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Loading, { size: 16, label: "
|
|
16509
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: value === null ? "dshdb-grid-wrap" : "dshdb-grid-wrap dshdb-redis-keys", children: scan === null || visibleKeys.length === 0 && !ttlOnly && keyFilter.trim() === "" ? scanning ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dshdb-empty", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Loading, { size: 16, label: t2("redis.scanningDb") }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EmptyState, { icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DatabaseIcon, { size: 22 }), title: t2("redis.emptyMatch"), description: scanType === "" ? pattern : `${pattern} · ${t2("redis.type")} ${scanType}` }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16187
16510
|
KeyGrid,
|
|
16188
16511
|
{
|
|
16189
16512
|
keys: visibleKeys,
|
|
16190
16513
|
selectedKey,
|
|
16191
|
-
emptyText: keyFilter.trim() !== "" ? "
|
|
16514
|
+
emptyText: keyFilter.trim() !== "" ? t2("redis.noKeyword") : ttlOnly ? t2("redis.noTtl") : pattern.trim() === "" && scanType === "" ? t2("redis.emptyDb") : t2("redis.emptyMatch"),
|
|
16192
16515
|
onSelect: pickKey
|
|
16193
16516
|
}
|
|
16194
16517
|
) }),
|
|
16195
16518
|
value !== null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RedisValuePanel, { value, onRefresh: refreshValueClick, refreshing: valueRefreshing }) : null,
|
|
16196
16519
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "dshdb-qfilter", children: [
|
|
16197
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qfilter-label", children: "
|
|
16520
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qfilter-label", children: t2("redis.command") }),
|
|
16198
16521
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16199
16522
|
"input",
|
|
16200
16523
|
{
|
|
16201
16524
|
className: "dshdb-input dshdb-qfilter-input dshdb-command-input",
|
|
16202
|
-
placeholder: "
|
|
16525
|
+
placeholder: t2("redis.commandPlaceholder"),
|
|
16203
16526
|
"aria-label": t2("console.redisCommand"),
|
|
16204
16527
|
value: command,
|
|
16205
16528
|
spellCheck: false,
|
|
@@ -16263,8 +16586,8 @@ ${valueError.detail}` : ""
|
|
|
16263
16586
|
setCaretPos(0);
|
|
16264
16587
|
},
|
|
16265
16588
|
disabled: command === "",
|
|
16266
|
-
title:
|
|
16267
|
-
children: "
|
|
16589
|
+
title: t2("redis.clearCommand", { binding: shortcutLabel("redis.clear") }),
|
|
16590
|
+
children: t2("redis.clear")
|
|
16268
16591
|
}
|
|
16269
16592
|
),
|
|
16270
16593
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -16276,16 +16599,16 @@ ${valueError.detail}` : ""
|
|
|
16276
16599
|
"aria-expanded": historyOpen,
|
|
16277
16600
|
onClick: () => setHistoryOpen((open) => !open),
|
|
16278
16601
|
disabled: history.length === 0,
|
|
16279
|
-
children: "
|
|
16602
|
+
children: t2("redis.history")
|
|
16280
16603
|
}
|
|
16281
16604
|
),
|
|
16282
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { size: "sm", variant: "primary", onClick: () => void runCommand(), loading: commandRunning, children: "
|
|
16605
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { size: "sm", variant: "primary", onClick: () => void runCommand(), loading: commandRunning, children: t2("redis.run") })
|
|
16283
16606
|
] }),
|
|
16284
16607
|
commandResult !== null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
16285
16608
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "dshdb-console-value", title: commandResult.command, children: redisValueText(commandResult.value) }),
|
|
16286
16609
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "dshdb-qmeta", style: { marginTop: 4 }, children: [
|
|
16287
16610
|
formatMs(commandResult.elapsedMs),
|
|
16288
|
-
commandResult.readOnly ? "" : "
|
|
16611
|
+
commandResult.readOnly ? "" : t2("redis.writeCommand"),
|
|
16289
16612
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16290
16613
|
Button,
|
|
16291
16614
|
{
|
|
@@ -16296,8 +16619,8 @@ ${valueError.detail}` : ""
|
|
|
16296
16619
|
if (ok) resultFlash.flash(true);
|
|
16297
16620
|
});
|
|
16298
16621
|
},
|
|
16299
|
-
title: resultFlash.copied ? "
|
|
16300
|
-
children: resultFlash.copied ? "
|
|
16622
|
+
title: resultFlash.copied ? t2("redis.copiedResultTitle") : t2("redis.copyResultTitle"),
|
|
16623
|
+
children: resultFlash.copied ? t2("redis.copiedResult") : t2("redis.copyResult")
|
|
16301
16624
|
}
|
|
16302
16625
|
)
|
|
16303
16626
|
] })
|
|
@@ -16416,7 +16739,7 @@ ${valueError.detail}` : ""
|
|
|
16416
16739
|
}
|
|
16417
16740
|
)
|
|
16418
16741
|
] }),
|
|
16419
|
-
suggestions !== null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dshdb-complete", id: `${completeId}-list`, role: "listbox", "aria-label": t2("console.completionAria"), children: suggestionItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-complete-empty", children: "
|
|
16742
|
+
suggestions !== null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dshdb-complete", id: `${completeId}-list`, role: "listbox", "aria-label": t2("console.completionAria"), children: suggestionItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-complete-empty", children: t2("console.noCandidates") }) : suggestionItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
16420
16743
|
"button",
|
|
16421
16744
|
{
|
|
16422
16745
|
type: "button",
|
|
@@ -16432,7 +16755,7 @@ ${valueError.detail}` : ""
|
|
|
16432
16755
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-complete-name", children: item.name }),
|
|
16433
16756
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "dshdb-complete-meta", children: [
|
|
16434
16757
|
item.detail !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-complete-detail", children: item.detail }) : null,
|
|
16435
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-complete-kind", children: item.kind === "column" ? "
|
|
16758
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-complete-kind", children: item.kind === "column" ? t2("console.kindColumn") : item.kind === "table" ? t2("console.kindTable") : item.kind === "schema" ? t2("console.kindDatabase") : item.kind === "function" ? t2("console.kindFunction") : item.kind === "alias" ? t2("console.kindAlias") : item.kind === "snippet" ? t2("console.kindSnippet") : t2("console.kindKeyword") })
|
|
16436
16759
|
] })
|
|
16437
16760
|
]
|
|
16438
16761
|
},
|
|
@@ -16534,32 +16857,29 @@ ${valueError.detail}` : ""
|
|
|
16534
16857
|
setBase("");
|
|
16535
16858
|
},
|
|
16536
16859
|
children: scriptResults.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: index, children: [
|
|
16537
|
-
"
|
|
16538
|
-
|
|
16539
|
-
" 条 · ",
|
|
16860
|
+
t2("console.statementN", { n: index + 1 }),
|
|
16861
|
+
" · ",
|
|
16540
16862
|
formatCount(item.rows.length),
|
|
16541
|
-
"
|
|
16863
|
+
" ",
|
|
16864
|
+
t2("table.rows"),
|
|
16865
|
+
" · ",
|
|
16542
16866
|
formatMs(item.elapsedMs)
|
|
16543
16867
|
] }, index))
|
|
16544
16868
|
}
|
|
16545
16869
|
) : null,
|
|
16546
16870
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qbar-spacer" }),
|
|
16547
|
-
selectedRows.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.
|
|
16548
|
-
"已选 ",
|
|
16549
|
-
selectedRows.size,
|
|
16550
|
-
" 行"
|
|
16551
|
-
] }) : null,
|
|
16871
|
+
selectedRows.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: t2("console.selectedRows", { n: selectedRows.size }) }) : null,
|
|
16552
16872
|
exportNote !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", role: "status", children: exportNote }) : null,
|
|
16553
16873
|
exporting ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16554
16874
|
"button",
|
|
16555
16875
|
{
|
|
16556
16876
|
type: "button",
|
|
16557
16877
|
className: "dshdb-pager-btn",
|
|
16558
|
-
title: "
|
|
16878
|
+
title: t2("console.stopExport"),
|
|
16559
16879
|
onClick: () => {
|
|
16560
16880
|
exportCancelled.current = true;
|
|
16561
16881
|
},
|
|
16562
|
-
children: "
|
|
16882
|
+
children: t2("console.cancelExport")
|
|
16563
16883
|
}
|
|
16564
16884
|
) : null,
|
|
16565
16885
|
multiProgress !== null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -16567,20 +16887,16 @@ ${valueError.detail}` : ""
|
|
|
16567
16887
|
{
|
|
16568
16888
|
bare: true,
|
|
16569
16889
|
className: "dshdb-qmeta",
|
|
16570
|
-
label:
|
|
16890
|
+
label: t2("console.executing", { index: multiProgress.index, total: multiProgress.total })
|
|
16571
16891
|
}
|
|
16572
16892
|
) : null,
|
|
16573
16893
|
multiNote !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: multiNote }) : null,
|
|
16574
|
-
selectedRun ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qmeta", children: "
|
|
16575
|
-
tx === "open" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "warn", children: "
|
|
16894
|
+
selectedRun ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qmeta", children: t2("console.selectedRun") }) : null,
|
|
16895
|
+
tx === "open" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "warn", children: t2("console.txOpen") }) : null,
|
|
16576
16896
|
txNote !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: txNote }) : null,
|
|
16577
|
-
base !== "" && !allRows ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qmeta", children: "
|
|
16578
|
-
pageFallback ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "warn", title: "
|
|
16579
|
-
result !== null && result.truncated ? /* @__PURE__ */ (0, import_jsx_runtime19.
|
|
16580
|
-
"结果已截断,仅取回 ",
|
|
16581
|
-
formatCount(rows.length),
|
|
16582
|
-
" 行"
|
|
16583
|
-
] }) : null
|
|
16897
|
+
base !== "" && !allRows ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qmeta", children: t2("console.pageable") }) : null,
|
|
16898
|
+
pageFallback ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "warn", title: t2("console.pageOutTitle"), children: t2("console.pageOut") }) : null,
|
|
16899
|
+
result !== null && result.truncated ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "warn", title: t2("console.truncatedTitle"), children: t2("console.truncated", { n: formatCount(rows.length) }) }) : null
|
|
16584
16900
|
] }),
|
|
16585
16901
|
historyOpen ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16586
16902
|
HistoryPanel,
|
|
@@ -16612,14 +16928,14 @@ ${valueError.detail}` : ""
|
|
|
16612
16928
|
{
|
|
16613
16929
|
size: "sm",
|
|
16614
16930
|
variant: "ghost",
|
|
16615
|
-
title: "
|
|
16931
|
+
title: t2("redis.copyError"),
|
|
16616
16932
|
onClick: () => {
|
|
16617
16933
|
void copyText(
|
|
16618
16934
|
failure.detail === void 0 ? failure.message : `${failure.message}
|
|
16619
16935
|
${failure.detail}`
|
|
16620
16936
|
);
|
|
16621
16937
|
},
|
|
16622
|
-
children: "
|
|
16938
|
+
children: t2("redis.copy")
|
|
16623
16939
|
}
|
|
16624
16940
|
)
|
|
16625
16941
|
] }),
|
|
@@ -16634,7 +16950,7 @@ ${failure.detail}` : ""
|
|
|
16634
16950
|
result !== null && rows.length > 0 ? planText !== null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "dshdb-plan-text", "aria-label": t2("console.planTextAria"), children: planText }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16635
16951
|
DataGrid,
|
|
16636
16952
|
{
|
|
16637
|
-
label: "
|
|
16953
|
+
label: t2("console.queryResult"),
|
|
16638
16954
|
columns: shownColumns,
|
|
16639
16955
|
rows: shownRows,
|
|
16640
16956
|
offset,
|
|
@@ -16649,7 +16965,7 @@ ${failure.detail}` : ""
|
|
|
16649
16965
|
selectedRows,
|
|
16650
16966
|
onToggleRow: selectRow,
|
|
16651
16967
|
onToggleAllRows: toggleAllRows,
|
|
16652
|
-
emptyText: rowFilter.trim() !== "" && visibleRows.length > 0 && filteredRows.length === 0 ? "
|
|
16968
|
+
emptyText: rowFilter.trim() !== "" && visibleRows.length > 0 && filteredRows.length === 0 ? t2("console.noFilteredRows") : t2("console.noRowsReturned")
|
|
16653
16969
|
}
|
|
16654
16970
|
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dshdb-grid-wrap", children: result === null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16655
16971
|
EmptyState,
|
|
@@ -16662,19 +16978,19 @@ ${failure.detail}` : ""
|
|
|
16662
16978
|
EmptyState,
|
|
16663
16979
|
{
|
|
16664
16980
|
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TerminalIcon, { size: 22 }),
|
|
16665
|
-
title: typeof result.updateCount === "number" ? "
|
|
16666
|
-
description: typeof result.updateCount === "number" ?
|
|
16981
|
+
title: typeof result.updateCount === "number" ? t2("console.affectedRows") : t2("console.noAffectedRows"),
|
|
16982
|
+
description: typeof result.updateCount === "number" ? t2("console.rowsAffected", { n: formatCount(result.updateCount) }) : result.sql
|
|
16667
16983
|
}
|
|
16668
16984
|
) }),
|
|
16669
16985
|
result !== null && rows.length > 0 ? plan === null ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "dshdb-pager", children: [
|
|
16670
|
-
running ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: "
|
|
16986
|
+
running ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: t2("table.querying") }) : null,
|
|
16671
16987
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-pager-sql", title: result.sql, children: result.sql }),
|
|
16672
16988
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16673
16989
|
"button",
|
|
16674
16990
|
{
|
|
16675
16991
|
type: "button",
|
|
16676
16992
|
className: "dshdb-pager-btn",
|
|
16677
|
-
title: "
|
|
16993
|
+
title: t2("console.copyExecutedSql"),
|
|
16678
16994
|
"aria-label": t2("console.copyExecutedSql"),
|
|
16679
16995
|
onClick: () => void copyText(result.sql),
|
|
16680
16996
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopyIcon, { size: 12 })
|
|
@@ -16688,7 +17004,7 @@ ${failure.detail}` : ""
|
|
|
16688
17004
|
ref: filterRef,
|
|
16689
17005
|
className: "dshdb-input dshdb-qfilter-input",
|
|
16690
17006
|
"aria-label": t2("console.filterResults"),
|
|
16691
|
-
placeholder: "
|
|
17007
|
+
placeholder: t2("console.filterResults"),
|
|
16692
17008
|
value: rowFilter,
|
|
16693
17009
|
disabled: running,
|
|
16694
17010
|
onChange: (event) => setRowFilter(event.target.value),
|
|
@@ -16704,7 +17020,7 @@ ${failure.detail}` : ""
|
|
|
16704
17020
|
{
|
|
16705
17021
|
type: "button",
|
|
16706
17022
|
className: "dshdb-row-action",
|
|
16707
|
-
title: "
|
|
17023
|
+
title: t2("console.clearFilter"),
|
|
16708
17024
|
"aria-label": t2("console.clearFilter"),
|
|
16709
17025
|
onClick: () => setRowFilter(""),
|
|
16710
17026
|
children: "×"
|
|
@@ -16721,7 +17037,7 @@ ${failure.detail}` : ""
|
|
|
16721
17037
|
PagerButton,
|
|
16722
17038
|
{
|
|
16723
17039
|
label: "|◀",
|
|
16724
|
-
title: "
|
|
17040
|
+
title: t2("table.first"),
|
|
16725
17041
|
onClick: () => goPage(0),
|
|
16726
17042
|
disabled: !hasPrevious || running || allRows
|
|
16727
17043
|
}
|
|
@@ -16730,7 +17046,7 @@ ${failure.detail}` : ""
|
|
|
16730
17046
|
PagerButton,
|
|
16731
17047
|
{
|
|
16732
17048
|
label: "◀",
|
|
16733
|
-
title: "
|
|
17049
|
+
title: t2("table.previous"),
|
|
16734
17050
|
onClick: () => goPage(Math.max(page - 1, 0)),
|
|
16735
17051
|
disabled: !hasPrevious || running || allRows
|
|
16736
17052
|
}
|
|
@@ -16748,7 +17064,7 @@ ${failure.detail}` : ""
|
|
|
16748
17064
|
min: 1,
|
|
16749
17065
|
inputMode: "numeric",
|
|
16750
17066
|
"aria-label": t2("console.page"),
|
|
16751
|
-
title: "
|
|
17067
|
+
title: t2("table.page"),
|
|
16752
17068
|
value: pageDraft,
|
|
16753
17069
|
disabled: running || allRows,
|
|
16754
17070
|
onChange: (event) => setPageDraft(event.target.value),
|
|
@@ -16765,7 +17081,7 @@ ${failure.detail}` : ""
|
|
|
16765
17081
|
"select",
|
|
16766
17082
|
{
|
|
16767
17083
|
className: "dshdb-select dshdb-select-inline dshdb-pager-size",
|
|
16768
|
-
"aria-label": "
|
|
17084
|
+
"aria-label": t2("table.rowsPerPage"),
|
|
16769
17085
|
value: String(pageSize),
|
|
16770
17086
|
disabled: running,
|
|
16771
17087
|
onChange: (event) => {
|
|
@@ -16776,26 +17092,22 @@ ${failure.detail}` : ""
|
|
|
16776
17092
|
},
|
|
16777
17093
|
children: [
|
|
16778
17094
|
PAGE_SIZES.map((size) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: size, children: formatCount(size) }, size)),
|
|
16779
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: ALL_PAGE_SIZE, title:
|
|
17095
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: ALL_PAGE_SIZE, title: t2("console.allLimitTitle", { n: formatCount(ALL_ROWS) }), children: t2("table.allRows") })
|
|
16780
17096
|
]
|
|
16781
17097
|
}
|
|
16782
17098
|
),
|
|
16783
|
-
allRows ? /* @__PURE__ */ (0, import_jsx_runtime19.
|
|
16784
|
-
"上限 ",
|
|
16785
|
-
formatCount(ALL_ROWS),
|
|
16786
|
-
" 行"
|
|
16787
|
-
] }) : null,
|
|
17099
|
+
allRows ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-qmeta", children: t2("console.allLimit", { n: formatCount(ALL_ROWS) }) }) : null,
|
|
16788
17100
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
16789
17101
|
PagerButton,
|
|
16790
17102
|
{
|
|
16791
17103
|
label: "▶",
|
|
16792
|
-
title: "
|
|
17104
|
+
title: t2("table.next"),
|
|
16793
17105
|
onClick: () => goPage(page + 1),
|
|
16794
17106
|
disabled: !hasNext || running || allRows
|
|
16795
17107
|
}
|
|
16796
17108
|
)
|
|
16797
17109
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "dshdb-pager", children: [
|
|
16798
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: "
|
|
17110
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tag, { tone: "business", children: t2("console.plan") }),
|
|
16799
17111
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-pager-sql", title: plan.statements.join("\n"), children: plan.statements[plan.statements.length - 1] ?? result.sql }),
|
|
16800
17112
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dshdb-pager-spacer" }),
|
|
16801
17113
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -16804,11 +17116,11 @@ ${failure.detail}` : ""
|
|
|
16804
17116
|
size: "sm",
|
|
16805
17117
|
variant: "ghost",
|
|
16806
17118
|
disabled: planCopyText === null,
|
|
16807
|
-
title: planText === null ? "
|
|
17119
|
+
title: planText === null ? t2("console.copyPlanTable") : t2("console.copyPlanText"),
|
|
16808
17120
|
onClick: () => {
|
|
16809
17121
|
if (planCopyText !== null) void copyText(planCopyText);
|
|
16810
17122
|
},
|
|
16811
|
-
children: "
|
|
17123
|
+
children: t2("console.copyPlan")
|
|
16812
17124
|
}
|
|
16813
17125
|
),
|
|
16814
17126
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -16821,7 +17133,7 @@ ${failure.detail}` : ""
|
|
|
16821
17133
|
setResult(resultBeforePlan.current);
|
|
16822
17134
|
resultBeforePlan.current = null;
|
|
16823
17135
|
},
|
|
16824
|
-
children: "
|
|
17136
|
+
children: t2("console.closePlan")
|
|
16825
17137
|
}
|
|
16826
17138
|
)
|
|
16827
17139
|
] }) : null
|
|
@@ -17193,7 +17505,7 @@ function TableGrid({ params }) {
|
|
|
17193
17505
|
const editableColumns = description?.columns ?? [];
|
|
17194
17506
|
const keyColumns = editableColumns.filter((column) => column.primaryKey === true);
|
|
17195
17507
|
const effectiveKey = keyColumns.length > 0 ? keyColumns : editableColumns;
|
|
17196
|
-
const canMutate = connection !== null && connection.readOnly !== true && objectKind === "table" && description !== null
|
|
17508
|
+
const canMutate = connection !== null && connection.readOnly !== true && objectKind === "table" && description !== null;
|
|
17197
17509
|
const selectedIndex = selectedRows.size === 1 ? [...selectedRows][0] : void 0;
|
|
17198
17510
|
const selectedRow = selectedIndex === void 0 ? void 0 : displayRows[selectedIndex];
|
|
17199
17511
|
const rowValue = (column, row) => {
|
|
@@ -17208,14 +17520,16 @@ function TableGrid({ params }) {
|
|
|
17208
17520
|
setNewCell({ rowIndex: pendingNew.length, column: first.name, value: "" });
|
|
17209
17521
|
setPendingNew((previous) => [...previous, {}]);
|
|
17210
17522
|
};
|
|
17211
|
-
const startCellEdit = (rowIndex, column) => {
|
|
17523
|
+
const startCellEdit = (0, import_react24.useCallback)((rowIndex, column) => {
|
|
17212
17524
|
if (!canMutate || pendingDeletes.has(rowIndex)) return;
|
|
17213
17525
|
const row = displayRows[rowIndex];
|
|
17214
17526
|
if (row === void 0) return;
|
|
17215
|
-
const
|
|
17527
|
+
const index = displayColumns.findIndex((entry) => entry.name === column.name);
|
|
17528
|
+
const loaded = index < 0 ? null : row[index] ?? null;
|
|
17529
|
+
const current = pendingUpdates[rowIndex]?.[column.name] ?? loaded;
|
|
17216
17530
|
setRowError("");
|
|
17217
17531
|
setCellEdit({ rowIndex, column: column.name, value: current === null ? "" : String(current) });
|
|
17218
|
-
};
|
|
17532
|
+
}, [canMutate, displayColumns, displayRows, pendingDeletes, pendingUpdates]);
|
|
17219
17533
|
const updateCell = (value) => {
|
|
17220
17534
|
setCellEdit((previous) => previous === null ? previous : { ...previous, value });
|
|
17221
17535
|
};
|
|
@@ -17532,11 +17846,11 @@ function TableGrid({ params }) {
|
|
|
17532
17846
|
disabled: filters[cell.column.name] === void 0,
|
|
17533
17847
|
run: () => {
|
|
17534
17848
|
setColumnFilter(cell.column, void 0);
|
|
17535
|
-
|
|
17849
|
+
applyRef.current({ page: 0 });
|
|
17536
17850
|
}
|
|
17537
17851
|
}
|
|
17538
17852
|
],
|
|
17539
|
-
[connection, displayColumns, displayRows, filters, pageSize, params.schema, params.table]
|
|
17853
|
+
[canMutate, connection, displayColumns, displayRows, filters, pageSize, params.schema, params.table, pendingDeletes, startCellEdit]
|
|
17540
17854
|
);
|
|
17541
17855
|
const hasPrevious = page > 0;
|
|
17542
17856
|
const lastPage = total === void 0 ? void 0 : Math.max(Math.ceil(total / pageSize) - 1, 0);
|
|
@@ -18290,7 +18604,17 @@ ${error.detail}` : ""
|
|
|
18290
18604
|
deletedRows: pendingDeletes,
|
|
18291
18605
|
editedCells: editedCell,
|
|
18292
18606
|
pendingCellValue: pendingCell,
|
|
18293
|
-
...
|
|
18607
|
+
...cellEdit === null ? {} : {
|
|
18608
|
+
cellEdit: {
|
|
18609
|
+
rowIndex: cellEdit.rowIndex,
|
|
18610
|
+
column: cellEdit.column,
|
|
18611
|
+
value: cellEdit.value,
|
|
18612
|
+
onChange: updateCell,
|
|
18613
|
+
onCommit: commitCell,
|
|
18614
|
+
onCancel: cancelCell
|
|
18615
|
+
}
|
|
18616
|
+
},
|
|
18617
|
+
...canMutate ? { onCellDoubleClick: startCellEdit } : {}
|
|
18294
18618
|
}
|
|
18295
18619
|
),
|
|
18296
18620
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "dshdb-pager", children: [
|
|
@@ -18538,9 +18862,33 @@ function ShortcutRow(props) {
|
|
|
18538
18862
|
function SettingsView(props) {
|
|
18539
18863
|
const t2 = useI18n();
|
|
18540
18864
|
const [draft, setDraft] = (0, import_react25.useState)(props.settings);
|
|
18865
|
+
const saved = (0, import_react25.useRef)(JSON.stringify(props.settings));
|
|
18866
|
+
const pending = (0, import_react25.useRef)(null);
|
|
18867
|
+
const saveRef = (0, import_react25.useRef)(props.onSave);
|
|
18868
|
+
saveRef.current = props.onSave;
|
|
18541
18869
|
(0, import_react25.useEffect)(() => {
|
|
18870
|
+
const serialized = JSON.stringify(props.settings);
|
|
18871
|
+
if (serialized === saved.current) return;
|
|
18872
|
+
saved.current = serialized;
|
|
18542
18873
|
setDraft(props.settings);
|
|
18543
18874
|
}, [props.settings]);
|
|
18875
|
+
(0, import_react25.useEffect)(() => {
|
|
18876
|
+
const serialized = JSON.stringify(draft);
|
|
18877
|
+
if (serialized === saved.current) {
|
|
18878
|
+
pending.current = null;
|
|
18879
|
+
return;
|
|
18880
|
+
}
|
|
18881
|
+
pending.current = draft;
|
|
18882
|
+
const timer = window.setTimeout(() => {
|
|
18883
|
+
saved.current = serialized;
|
|
18884
|
+
pending.current = null;
|
|
18885
|
+
saveRef.current(draft);
|
|
18886
|
+
}, 350);
|
|
18887
|
+
return () => window.clearTimeout(timer);
|
|
18888
|
+
}, [draft]);
|
|
18889
|
+
(0, import_react25.useEffect)(() => () => {
|
|
18890
|
+
if (pending.current !== null) saveRef.current(pending.current);
|
|
18891
|
+
}, []);
|
|
18544
18892
|
const update = (key, value) => {
|
|
18545
18893
|
setDraft((previous) => ({ ...previous, [key]: value }));
|
|
18546
18894
|
};
|
|
@@ -18571,12 +18919,12 @@ function SettingsView(props) {
|
|
|
18571
18919
|
update("toolbarActions", next);
|
|
18572
18920
|
};
|
|
18573
18921
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "dshdb-scroll dshdb-scroll-thin", style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
18922
|
+
props.saving ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-muted", style: { padding: "2px 0" }, children: t2("settings.saving") }) : null,
|
|
18574
18923
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
18575
18924
|
Panel,
|
|
18576
18925
|
{
|
|
18577
18926
|
title: t2("settings.querySecurity"),
|
|
18578
18927
|
collapsible: true,
|
|
18579
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "primary", loading: props.saving, onClick: () => props.onSave(draft), children: t2("settings.save") }),
|
|
18580
18928
|
bodyClassName: "dshdb-panel-body-pad",
|
|
18581
18929
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "dshdb-form", children: [
|
|
18582
18930
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "dshdb-form-grid", children: [
|
|
@@ -18648,10 +18996,7 @@ function SettingsView(props) {
|
|
|
18648
18996
|
title: t2("settings.shortcuts"),
|
|
18649
18997
|
collapsible: true,
|
|
18650
18998
|
defaultOpen: false,
|
|
18651
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime22.
|
|
18652
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => update("keybindings", {}), children: t2("settings.restore") }),
|
|
18653
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "primary", loading: props.saving, onClick: () => props.onSave(draft), children: t2("settings.save") })
|
|
18654
|
-
] }),
|
|
18999
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-inline", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => update("keybindings", {}), children: t2("settings.restore") }) }),
|
|
18655
19000
|
bodyClassName: "dshdb-panel-body-pad",
|
|
18656
19001
|
children: [
|
|
18657
19002
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-muted", style: { fontSize: 11.5, lineHeight: 1.6 }, children: t2("shortcut.hint") }),
|
|
@@ -18681,10 +19026,7 @@ function SettingsView(props) {
|
|
|
18681
19026
|
title: t2("settings.toolbar"),
|
|
18682
19027
|
collapsible: true,
|
|
18683
19028
|
defaultOpen: false,
|
|
18684
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime22.
|
|
18685
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => update("toolbarActions", []), children: t2("settings.restore") }),
|
|
18686
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "primary", loading: props.saving, onClick: () => props.onSave(draft), children: t2("settings.save") })
|
|
18687
|
-
] }),
|
|
19029
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-inline", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => update("toolbarActions", []), children: t2("settings.restore") }) }),
|
|
18688
19030
|
bodyClassName: "dshdb-panel-body-pad",
|
|
18689
19031
|
children: [
|
|
18690
19032
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-muted", style: { fontSize: 11.5, lineHeight: 1.6 }, children: t2("settings.toolbarHint") }),
|
|
@@ -18725,7 +19067,6 @@ function SettingsView(props) {
|
|
|
18725
19067
|
title: t2("settings.console"),
|
|
18726
19068
|
collapsible: true,
|
|
18727
19069
|
defaultOpen: false,
|
|
18728
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "primary", loading: props.saving, onClick: () => props.onSave(draft), children: t2("settings.save") }),
|
|
18729
19070
|
bodyClassName: "dshdb-panel-body-pad",
|
|
18730
19071
|
children: [
|
|
18731
19072
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-list", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -18746,10 +19087,7 @@ function SettingsView(props) {
|
|
|
18746
19087
|
title: t2("settings.consoleToolbar"),
|
|
18747
19088
|
collapsible: true,
|
|
18748
19089
|
defaultOpen: false,
|
|
18749
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime22.
|
|
18750
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => update("consoleActions", []), children: t2("settings.restore") }),
|
|
18751
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "primary", loading: props.saving, onClick: () => props.onSave(draft), children: t2("settings.save") })
|
|
18752
|
-
] }),
|
|
19090
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-inline", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "ghost", onClick: () => update("consoleActions", []), children: t2("settings.restore") }) }),
|
|
18753
19091
|
bodyClassName: "dshdb-panel-body-pad",
|
|
18754
19092
|
children: [
|
|
18755
19093
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "dshdb-muted", style: { fontSize: 11.5, lineHeight: 1.6 }, children: t2("settings.consoleToolbarHint") }),
|