dsh-workbench-host 0.0.0-stage → 0.7.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/LICENSE +21 -0
- package/README.md +26 -2
- package/client/client.js +2177 -0
- package/cordis.patch.yml +5 -0
- package/lib/actions/action-output.js +25 -0
- package/lib/actions/actions.js +499 -0
- package/lib/actions/capabilities.js +299 -0
- package/lib/actions/task-targets.js +75 -0
- package/lib/core/db.d.ts +6 -0
- package/lib/core/db.js +72 -0
- package/lib/core/index.d.ts +4 -0
- package/lib/core/index.js +4 -0
- package/lib/core/repo.d.ts +43 -0
- package/lib/core/repo.js +116 -0
- package/lib/core/schema.d.ts +7 -0
- package/lib/core/schema.js +65 -0
- package/lib/index.js +411 -0
- package/lib/infra/audit.js +373 -0
- package/lib/infra/backup.js +263 -0
- package/lib/infra/network.js +466 -0
- package/lib/infra/search.js +83 -0
- package/lib/infra/zip.js +217 -0
- package/lib/sync/sync-conflicts.js +37 -0
- package/lib/sync/sync-incoming.js +56 -0
- package/lib/sync/sync-types.js +1 -0
- package/lib/sync/sync-values.js +22 -0
- package/lib/sync/sync.js +550 -0
- package/lib/types/host-types.js +1 -0
- package/package.json +61 -4
package/client/client.js
ADDED
|
@@ -0,0 +1,2177 @@
|
|
|
1
|
+
// 由 scripts/build-addon-clients.mjs 生成;请修改对应 client/client.src.cjs 后重新构建。
|
|
2
|
+
window.__ModuleLoader__ = window.__ModuleLoader__ || { modules: {}, load: function (m) { this.modules[m.id] = m.factory; } };
|
|
3
|
+
window.__ModuleLoader__.load({
|
|
4
|
+
id: "dsh-workbench-host",
|
|
5
|
+
factory: function (require) {
|
|
6
|
+
var module = { exports: {} };
|
|
7
|
+
var exports = module.exports;
|
|
8
|
+
"use strict";
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
try {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw mod = 0, e;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// packages/shell/client/locale.cjs
|
|
19
|
+
var require_locale = __commonJS({
|
|
20
|
+
"packages/shell/client/locale.cjs"(exports2, module2) {
|
|
21
|
+
"use strict";
|
|
22
|
+
var LOCALE2 = {
|
|
23
|
+
zh: {
|
|
24
|
+
nav: "\u5DE5\u4F5C\u53F0",
|
|
25
|
+
title: "\u5DE5\u4F5C\u53F0",
|
|
26
|
+
tagline: "\u79BB\u7EBF\u4F18\u5148 \xB7 \u4E1A\u52A1\u63D2\u4EF6\u7531 DSH \u5B89\u88C5",
|
|
27
|
+
tab_account: "\u8D26\u53F7\u4E0E\u540C\u6B65",
|
|
28
|
+
tab_addons: "\u5B50\u63D2\u4EF6",
|
|
29
|
+
tab_backup: "\u6570\u636E\u5907\u4EFD",
|
|
30
|
+
backup_desc: "\u6309\u6A21\u5757\u5BFC\u51FA\u6216\u5BFC\u5165\u672C\u5730\u6570\u636E\uFF1B\u5BFC\u5165\u53EA\u5408\u5E76\uFF0C\u4E0D\u5220\u9664\u5DF2\u6709\u6570\u636E",
|
|
31
|
+
backup_modules: "\u9009\u62E9\u8981\u5BFC\u51FA\u7684\u6A21\u5757",
|
|
32
|
+
backup_export_result: "\u5BFC\u51FA\u7ED3\u679C",
|
|
33
|
+
backup_select_all: "\u5168\u9009",
|
|
34
|
+
backup_clear: "\u6E05\u7A7A",
|
|
35
|
+
backup_export: "\u5BFC\u51FA\u5907\u4EFD",
|
|
36
|
+
backup_import: "\u5BFC\u5165\u5907\u4EFD",
|
|
37
|
+
backup_exporting: "\u6B63\u5728\u5BFC\u51FA\u2026",
|
|
38
|
+
backup_importing: "\u6B63\u5728\u5BFC\u5165\u2026",
|
|
39
|
+
backup_no_modules: "\u5F53\u524D\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684\u6A21\u5757",
|
|
40
|
+
backup_select_required: "\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u6A21\u5757",
|
|
41
|
+
backup_import_result: "\u5BFC\u5165\u7ED3\u679C",
|
|
42
|
+
backup_summary: "\u6C47\u603B",
|
|
43
|
+
backup_detail: "\u6A21\u5757\u660E\u7EC6",
|
|
44
|
+
backup_status: "\u72B6\u6001",
|
|
45
|
+
backup_imported: "\u5BFC\u5165",
|
|
46
|
+
backup_skipped: "\u8DF3\u8FC7",
|
|
47
|
+
backup_failed: "\u5931\u8D25",
|
|
48
|
+
backup_ok: "\u6210\u529F",
|
|
49
|
+
backup_partial: "\u90E8\u5206\u6210\u529F",
|
|
50
|
+
backup_failed_status: "\u5931\u8D25",
|
|
51
|
+
backup_skipped_status: "\u8DF3\u8FC7",
|
|
52
|
+
backup_exported_at: "\u5BFC\u51FA\u65F6\u95F4",
|
|
53
|
+
backup_shell_version: "\u58F3\u7248\u672C",
|
|
54
|
+
backup_format: "\u5907\u4EFD\u683C\u5F0F",
|
|
55
|
+
backup_incompatible: "\u5907\u4EFD\u683C\u5F0F\u7248\u672C\u4E0D\u517C\u5BB9\uFF0C\u8BF7\u5347\u7EA7\u5DE5\u4F5C\u53F0\u540E\u518D\u5BFC\u5165",
|
|
56
|
+
backup_invalid: "\u5907\u4EFD\u6587\u4EF6\u65E0\u6548",
|
|
57
|
+
backup_file_hint: "\u652F\u6301 .zip \u5907\u4EFD\u5305",
|
|
58
|
+
backup_download_started: "\u5DF2\u5F00\u59CB\u4E0B\u8F7D\u5907\u4EFD",
|
|
59
|
+
backup_import_done: "\u5BFC\u5165\u5B8C\u6210",
|
|
60
|
+
backup_export_failed: "\u5BFC\u51FA\u5931\u8D25",
|
|
61
|
+
backup_import_failed: "\u5BFC\u5165\u5931\u8D25",
|
|
62
|
+
backup_no_import: "\u672A\u5B9E\u73B0\u5BFC\u5165",
|
|
63
|
+
backup_no_export: "\u672A\u5B9E\u73B0\u5BFC\u51FA",
|
|
64
|
+
backup_refresh: "\u91CD\u65B0\u8BFB\u53D6\u6A21\u5757",
|
|
65
|
+
backup_cap_export: "\u53EF\u5BFC\u51FA",
|
|
66
|
+
backup_cap_import: "\u53EF\u5BFC\u5165",
|
|
67
|
+
backup_dup_policy: "\u91CD\u590D ID \u65F6",
|
|
68
|
+
backup_dup_newest: "\u4EE5\u65F6\u95F4\u6700\u65B0\u4E3A\u4E3B",
|
|
69
|
+
backup_dup_skip: "\u4FDD\u7559\u672C\u5730\uFF08\u8DF3\u8FC7\uFF09",
|
|
70
|
+
backup_dup_overwrite: "\u7528\u5907\u4EFD\u8986\u76D6",
|
|
71
|
+
backup_dup_hint: "\u5BFC\u5165\u65F6\u5BF9\u540C ID \u8BB0\u5F55\u7684\u5904\u7406\u65B9\u5F0F",
|
|
72
|
+
backup_policy: "\u7B56\u7565",
|
|
73
|
+
back_home: "\u8FD4\u56DE\u9996\u9875",
|
|
74
|
+
open: "\u6253\u5F00",
|
|
75
|
+
manage: "\u5DE5\u4F5C\u53F0\u7BA1\u7406",
|
|
76
|
+
home_hint: "\u70B9\u5F00\u5361\u7247\u8FDB\u5165\u4E1A\u52A1\u63D2\u4EF6\uFF1B\u5B89\u88C5\u4E0E\u5378\u8F7D\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u91CC",
|
|
77
|
+
search_placeholder: "\u641C\u7D22\u4EFB\u52A1\u3001\u6807\u7B7E\u3001\u7AD9\u70B9\u3001\u8FDE\u63A5\u5668\u5185\u5BB9\u2026\uFF08\u2318K\uFF09",
|
|
78
|
+
searching: "\u641C\u7D22\u4E2D\u2026",
|
|
79
|
+
search_none: "\u6CA1\u6709\u547D\u4E2D",
|
|
80
|
+
search_partial: "\u90E8\u5206\u57DF\u641C\u7D22\u5931\u8D25",
|
|
81
|
+
account_desc: "\u767B\u5F55\u4E91\u7AEF\u8D26\u53F7\uFF0C\u5907\u4EFD\u4E0E\u540C\u6B65\u6570\u636E",
|
|
82
|
+
tab_audit: "\u5BA1\u8BA1\u65E5\u5FD7",
|
|
83
|
+
audit_desc: "\u672C\u673A\u884C\u4E3A\u8D26\u672C\uFF1A\u8C01\u5728\u4F55\u65F6\u8C03\u7528\u4E86\u54EA\u4E2A action\u3001\u6210\u529F\u4E0E\u5426\uFF1B\u5BC6\u7801\u4E0E token \u7B49\u53C2\u6570\u5DF2\u8131\u654F",
|
|
84
|
+
audit_filters: "\u7B5B\u9009",
|
|
85
|
+
audit_action_prefix: "action \u524D\u7F00",
|
|
86
|
+
audit_actor: "\u5165\u53E3",
|
|
87
|
+
audit_ok: "\u7ED3\u679C",
|
|
88
|
+
audit_all: "\u5168\u90E8",
|
|
89
|
+
audit_ok_only: "\u53EA\u770B\u6210\u529F",
|
|
90
|
+
audit_fail_only: "\u53EA\u770B\u5931\u8D25",
|
|
91
|
+
audit_q: "\u5173\u952E\u5B57",
|
|
92
|
+
audit_since: "\u8D77\u59CB\u65E5\u671F",
|
|
93
|
+
audit_until: "\u7ED3\u675F\u65E5\u671F",
|
|
94
|
+
audit_search: "\u67E5\u8BE2",
|
|
95
|
+
audit_refresh: "\u5237\u65B0",
|
|
96
|
+
audit_empty: "\u5F53\u524D\u7B5B\u9009\u65E0\u8BB0\u5F55",
|
|
97
|
+
audit_load_failed: "\u8BFB\u53D6\u5BA1\u8BA1\u65E5\u5FD7\u5931\u8D25",
|
|
98
|
+
audit_time: "\u65F6\u95F4",
|
|
99
|
+
audit_action: "action",
|
|
100
|
+
audit_target: "\u76EE\u6807",
|
|
101
|
+
audit_duration: "\u8017\u65F6",
|
|
102
|
+
audit_detail: "\u53C2\u6570\u4E0E\u7ED3\u679C",
|
|
103
|
+
audit_error: "\u9519\u8BEF",
|
|
104
|
+
audit_active: "\u7B5B\u9009\u4E2D",
|
|
105
|
+
audit_clear: "\u6E05\u9664\u7B5B\u9009",
|
|
106
|
+
audit_loading: "\u67E5\u8BE2\u4E2D\u2026",
|
|
107
|
+
audit_page_size: "\u6BCF\u9875\u6761\u6570",
|
|
108
|
+
audit_stats: "\u8FD1 30 \u5929\uFF08\u4E0D\u53D7\u4E0A\u65B9\u7B5B\u9009\u5F71\u54CD\uFF09",
|
|
109
|
+
audit_total: "\u5171",
|
|
110
|
+
audit_failed: "\u5931\u8D25",
|
|
111
|
+
audit_prev: "\u4E0A\u4E00\u9875",
|
|
112
|
+
audit_next: "\u4E0B\u4E00\u9875",
|
|
113
|
+
audit_page: "\u9875",
|
|
114
|
+
audit_retention: "\u9ED8\u8BA4\u4FDD\u7559 90 \u5929\uFF1B\u53EF\u7528 audit.prune \u8C03\u6574\u4FDD\u7559\u671F",
|
|
115
|
+
audit_reads_hint: "\u53EA\u8BFB action \u9ED8\u8BA4\u4E0D\u8BB0\uFF1Bmeta.audit.recordReads=1 \u65F6\u8BB0\u5F55",
|
|
116
|
+
addons_desc: "\u5B89\u88C5\u3001\u5347\u7EA7\u6216\u5378\u8F7D\u5B50\u63D2\u4EF6",
|
|
117
|
+
no_views: "\u8BE5\u5B50\u63D2\u4EF6\u6CA1\u6709\u6CE8\u518C\u754C\u9762",
|
|
118
|
+
addon_loading: "\u6B63\u5728\u52A0\u8F7D\u5B50\u63D2\u4EF6\u754C\u9762\u2026",
|
|
119
|
+
addon_unavailable: "\u5B50\u63D2\u4EF6\u754C\u9762\u4E0D\u53EF\u7528",
|
|
120
|
+
views: "\u4E2A\u89C6\u56FE",
|
|
121
|
+
addons_installed: "\u5DF2\u5B89\u88C5\u7684\u5B50\u63D2\u4EF6",
|
|
122
|
+
addons_cloud: "\u4E91\u7AEF\u76EE\u5F55",
|
|
123
|
+
install: "\u5B89\u88C5",
|
|
124
|
+
upgrade: "\u5347\u7EA7",
|
|
125
|
+
installed: "\u5DF2\u5B89\u88C5",
|
|
126
|
+
uninstall: "\u5378\u8F7D",
|
|
127
|
+
confirm_uninstall: "\u786E\u8BA4\u5378\u8F7D",
|
|
128
|
+
installing: "\u6B63\u5728\u5B89\u88C5\u2026",
|
|
129
|
+
refresh: "\u5237\u65B0\u76EE\u5F55",
|
|
130
|
+
no_installed: "\u8FD8\u6CA1\u6709\u5B89\u88C5\u4E1A\u52A1\u63D2\u4EF6\u2014\u2014\u5728 DSH \u63D2\u4EF6\u7BA1\u7406\u91CC\u5B89\u88C5\u4EFB\u52A1\u8BB0\u5F55\u3001\u6807\u7B7E\u6216\u7AD9\u70B9",
|
|
131
|
+
no_catalog: "\u4E91\u7AEF\u76EE\u5F55\u4E3A\u7A7A\u6216\u4E0D\u53EF\u8FBE",
|
|
132
|
+
catalog_loading: "\u6B63\u5728\u8BFB\u53D6\u4E91\u7AEF\u76EE\u5F55\u2026",
|
|
133
|
+
cached_notice: "\u4E91\u7AEF\u4E0D\u53EF\u8FBE\uFF0C\u663E\u793A\u4E0A\u6B21\u7F13\u5B58\u7684\u76EE\u5F55",
|
|
134
|
+
install_failed: "\u5B89\u88C5\u5931\u8D25",
|
|
135
|
+
uninstall_failed: "\u5378\u8F7D\u5931\u8D25",
|
|
136
|
+
load_failed: "\u5BA2\u6237\u7AEF\u52A0\u8F7D\u5931\u8D25",
|
|
137
|
+
data_kept: "\u5378\u8F7D\u53EA\u5220\u4EE3\u7801\uFF0C\u6570\u636E\u4FDD\u7559\uFF1B\u91CD\u88C5\u540E\u6570\u636E\u4ECD\u5728",
|
|
138
|
+
addon_error: "\u52A0\u8F7D\u5F02\u5E38",
|
|
139
|
+
source_cloud: "\u4E91\u7AEF",
|
|
140
|
+
source_local: "\u672C\u5730\u76EE\u5F55",
|
|
141
|
+
version: "\u7248\u672C",
|
|
142
|
+
latest: "\u6700\u65B0",
|
|
143
|
+
shell_version: "\u58F3\u7248\u672C",
|
|
144
|
+
delete: "\u5220\u9664",
|
|
145
|
+
login: "\u767B\u5F55",
|
|
146
|
+
signup: "\u6CE8\u518C",
|
|
147
|
+
email: "\u90AE\u7BB1",
|
|
148
|
+
password: "\u5BC6\u7801",
|
|
149
|
+
logout: "\u9000\u51FA\u767B\u5F55",
|
|
150
|
+
logged_in_as: "\u5DF2\u767B\u5F55",
|
|
151
|
+
not_logged_in: "\u672A\u767B\u5F55\u2014\u2014\u6570\u636E\u4EC5\u5B58\u672C\u673A SQLite",
|
|
152
|
+
sync_now: "\u7ACB\u5373\u540C\u6B65",
|
|
153
|
+
sync_pushed: "\u63A8\u9001",
|
|
154
|
+
sync_pulled: "\u62C9\u53D6",
|
|
155
|
+
device_name: "\u672C\u8BBE\u5907",
|
|
156
|
+
sync_status: "\u540C\u6B65\u72B6\u6001",
|
|
157
|
+
sync_last: "\u4E0A\u6B21\u540C\u6B65",
|
|
158
|
+
sync_never: "\u5C1A\u672A\u540C\u6B65",
|
|
159
|
+
sync_conflicts: "\u51B2\u7A81",
|
|
160
|
+
sync_failed_tables: "\u5931\u8D25\u7684\u8868",
|
|
161
|
+
sync_clock: "\u65F6\u949F\u504F\u79FB",
|
|
162
|
+
sync_no_conflicts: "\u6CA1\u6709\u5F85\u5904\u7406\u7684\u51B2\u7A81",
|
|
163
|
+
sync_conflict_hint: "\u540C\u4E00\u884C\u5728\u672C\u5730\u548C\u4E91\u7AEF\u90FD\u88AB\u4FEE\u6539\uFF0C\u9009\u62E9\u4FDD\u7559\u54EA\u4E2A\u7248\u672C",
|
|
164
|
+
sync_keep_local: "\u4FDD\u7559\u672C\u5730",
|
|
165
|
+
sync_keep_server: "\u91C7\u7528\u4E91\u7AEF",
|
|
166
|
+
sync_dismiss: "\u5FFD\u7565",
|
|
167
|
+
sync_resolve_failed: "\u51B2\u7A81\u5904\u7406\u5931\u8D25",
|
|
168
|
+
sync_ok: "\u540C\u6B65\u5B8C\u6210",
|
|
169
|
+
sync_partial: "\u90E8\u5206\u8868\u540C\u6B65\u5931\u8D25",
|
|
170
|
+
cloud_status: "\u4E91\u7AEF\u8FDE\u63A5\u72B6\u6001",
|
|
171
|
+
cloud_checking: "\u68C0\u67E5\u4E91\u7AEF\u2026",
|
|
172
|
+
cloud_checking_hint: "\u6B63\u5728\u68C0\u67E5\u4E91\u7AEF\u8FDE\u63A5",
|
|
173
|
+
cloud_local: "\u672C\u5730\u6A21\u5F0F",
|
|
174
|
+
cloud_local_hint: "\u672A\u767B\u5F55\u4E91\u7AEF\uFF1B\u6570\u636E\u53EA\u4FDD\u5B58\u5728\u672C\u673A\uFF0C\u4ECD\u53EF\u6B63\u5E38\u4F7F\u7528",
|
|
175
|
+
cloud_syncing: "\u6B63\u5728\u540C\u6B65\u2026",
|
|
176
|
+
cloud_syncing_hint: "\u6B63\u5728\u4E0E\u4E91\u7AEF\u540C\u6B65\u6570\u636E",
|
|
177
|
+
cloud_online: "\u4E91\u7AEF\u5DF2\u8FDE\u63A5",
|
|
178
|
+
cloud_online_hint: "\u8D26\u53F7\u5DF2\u8FDE\u63A5\uFF0C\u6570\u636E\u4F1A\u81EA\u52A8\u540C\u6B65",
|
|
179
|
+
cloud_offline: "\u4E91\u7AEF\u8FDE\u63A5\u5931\u8D25",
|
|
180
|
+
cloud_offline_hint: "\u65E0\u6CD5\u8FDE\u63A5\u5230\u4E91\u7AEF\uFF1B\u672C\u5730\u6570\u636E\u4ECD\u53EF\u6B63\u5E38\u4F7F\u7528",
|
|
181
|
+
cloud_never: "\u7B49\u5F85\u9996\u6B21\u540C\u6B65",
|
|
182
|
+
cloud_never_hint: "\u5DF2\u767B\u5F55\u4E91\u7AEF\uFF0C\u6B63\u5728\u7B49\u5F85\u9996\u8F6E\u540C\u6B65",
|
|
183
|
+
cloud_sync_failed: "\u540C\u6B65\u5F02\u5E38",
|
|
184
|
+
cloud_sync_failed_hint: "\u4E91\u7AEF\u53EF\u8FDE\u63A5\uFF0C\u4F46\u4E0A\u6B21\u540C\u6B65\u672A\u5B8C\u5168\u6210\u529F",
|
|
185
|
+
cloud_open: "\u6253\u5F00\u8D26\u53F7\u4E0E\u540C\u6B65",
|
|
186
|
+
record_label: "\u8BB0\u5F55\u6A21\u5F0F",
|
|
187
|
+
record_on: "\u8BB0\u5F55\u4E2D",
|
|
188
|
+
record_off: "\u8BB0\u5F55",
|
|
189
|
+
record_on_title: "\u672C\u4F1A\u8BDD\u8BB0\u5F55\u6A21\u5F0F\u5DF2\u5F00\u542F\uFF0C\u70B9\u51FB\u5173\u95ED",
|
|
190
|
+
record_off_title: "\u5F00\u542F\u540E\u628A\u5B8C\u6210\u7684\u53EF\u4EA4\u4ED8\u5185\u5BB9\u8BB0\u5230\u5DE5\u4F5C\u53F0\uFF08\u4EC5\u672C\u4F1A\u8BDD\uFF09",
|
|
191
|
+
record_busy: "\u5207\u6362\u4E2D",
|
|
192
|
+
record_error: "\u5207\u6362\u5931\u8D25",
|
|
193
|
+
record_failed_short: "\u8BB0\u5F55\u5931\u8D25"
|
|
194
|
+
},
|
|
195
|
+
en: {
|
|
196
|
+
nav: "Workbench",
|
|
197
|
+
title: "Workbench",
|
|
198
|
+
tagline: "Offline-first \xB7 addons installed by DSH",
|
|
199
|
+
tab_account: "Account & Sync",
|
|
200
|
+
tab_addons: "Addons",
|
|
201
|
+
tab_backup: "Data backup",
|
|
202
|
+
backup_desc: "Export or import local data per module; import merges and never deletes existing rows",
|
|
203
|
+
backup_modules: "Modules to export",
|
|
204
|
+
backup_export_result: "Export result",
|
|
205
|
+
backup_select_all: "Select all",
|
|
206
|
+
backup_clear: "Clear",
|
|
207
|
+
backup_export: "Export backup",
|
|
208
|
+
backup_import: "Import backup",
|
|
209
|
+
backup_exporting: "Exporting\u2026",
|
|
210
|
+
backup_importing: "Importing\u2026",
|
|
211
|
+
backup_no_modules: "No exportable modules",
|
|
212
|
+
backup_select_required: "Select at least one module",
|
|
213
|
+
backup_import_result: "Import result",
|
|
214
|
+
backup_summary: "Summary",
|
|
215
|
+
backup_detail: "Module details",
|
|
216
|
+
backup_status: "Status",
|
|
217
|
+
backup_imported: "imported",
|
|
218
|
+
backup_skipped: "skipped",
|
|
219
|
+
backup_failed: "failed",
|
|
220
|
+
backup_ok: "ok",
|
|
221
|
+
backup_partial: "partial",
|
|
222
|
+
backup_failed_status: "failed",
|
|
223
|
+
backup_skipped_status: "skipped",
|
|
224
|
+
backup_exported_at: "Exported at",
|
|
225
|
+
backup_shell_version: "Shell version",
|
|
226
|
+
backup_format: "Format",
|
|
227
|
+
backup_incompatible: "Backup format is incompatible; update the workbench before importing",
|
|
228
|
+
backup_invalid: "Invalid backup file",
|
|
229
|
+
backup_file_hint: "Supports .zip backups",
|
|
230
|
+
backup_download_started: "Backup download started",
|
|
231
|
+
backup_import_done: "Import finished",
|
|
232
|
+
backup_export_failed: "Export failed",
|
|
233
|
+
backup_import_failed: "Import failed",
|
|
234
|
+
backup_no_import: "Import not implemented",
|
|
235
|
+
backup_no_export: "Export not implemented",
|
|
236
|
+
backup_refresh: "Reload modules",
|
|
237
|
+
backup_cap_export: "export",
|
|
238
|
+
backup_cap_import: "import",
|
|
239
|
+
backup_dup_policy: "On duplicate ID",
|
|
240
|
+
backup_dup_newest: "Keep newest by time",
|
|
241
|
+
backup_dup_skip: "Keep local (skip)",
|
|
242
|
+
backup_dup_overwrite: "Overwrite with backup",
|
|
243
|
+
backup_dup_hint: "How to handle rows with the same ID on import",
|
|
244
|
+
backup_policy: "Policy",
|
|
245
|
+
back_home: "Back to home",
|
|
246
|
+
open: "Open",
|
|
247
|
+
manage: "Manage",
|
|
248
|
+
home_hint: "Open a card to enter a domain; install or remove plugins in DSH",
|
|
249
|
+
search_placeholder: "Search tasks, tags, sites, connector items\u2026 (\u2318K)",
|
|
250
|
+
searching: "Searching\u2026",
|
|
251
|
+
search_none: "No matches",
|
|
252
|
+
search_partial: "Some domains failed",
|
|
253
|
+
account_desc: "Sign in to back up and sync your data",
|
|
254
|
+
tab_audit: "Audit log",
|
|
255
|
+
audit_desc: "A local ledger of who called which action and how it went; passwords and tokens are redacted",
|
|
256
|
+
audit_filters: "Filters",
|
|
257
|
+
audit_action_prefix: "Action prefix",
|
|
258
|
+
audit_actor: "Actor",
|
|
259
|
+
audit_ok: "Result",
|
|
260
|
+
audit_all: "All",
|
|
261
|
+
audit_ok_only: "Succeeded",
|
|
262
|
+
audit_fail_only: "Failed",
|
|
263
|
+
audit_q: "Keyword",
|
|
264
|
+
audit_since: "Since",
|
|
265
|
+
audit_until: "Until",
|
|
266
|
+
audit_search: "Search",
|
|
267
|
+
audit_refresh: "Refresh",
|
|
268
|
+
audit_empty: "No audit records match",
|
|
269
|
+
audit_load_failed: "Failed to load the audit log",
|
|
270
|
+
audit_time: "Time",
|
|
271
|
+
audit_action: "Action",
|
|
272
|
+
audit_target: "Target",
|
|
273
|
+
audit_duration: "Duration",
|
|
274
|
+
audit_detail: "Arguments & result",
|
|
275
|
+
audit_error: "Error",
|
|
276
|
+
audit_active: "Filtering",
|
|
277
|
+
audit_clear: "Clear filters",
|
|
278
|
+
audit_loading: "Loading\u2026",
|
|
279
|
+
audit_page_size: "Records per page",
|
|
280
|
+
audit_stats: "Last 30 days (unaffected by filters)",
|
|
281
|
+
audit_total: "total",
|
|
282
|
+
audit_failed: "failed",
|
|
283
|
+
audit_prev: "Previous",
|
|
284
|
+
audit_next: "Next",
|
|
285
|
+
audit_page: "page",
|
|
286
|
+
audit_retention: "Retained for 90 days by default; adjust with audit.prune",
|
|
287
|
+
audit_reads_hint: "Read-only actions are not recorded unless meta.audit.recordReads=1",
|
|
288
|
+
addons_desc: "Install, update or uninstall addons",
|
|
289
|
+
no_views: "This addon has no UI",
|
|
290
|
+
addon_loading: "Loading addon UI\u2026",
|
|
291
|
+
addon_unavailable: "Addon UI unavailable",
|
|
292
|
+
views: "views",
|
|
293
|
+
addons_installed: "Installed addons",
|
|
294
|
+
addons_cloud: "Cloud catalog",
|
|
295
|
+
install: "Install",
|
|
296
|
+
upgrade: "Update",
|
|
297
|
+
installed: "Installed",
|
|
298
|
+
uninstall: "Uninstall",
|
|
299
|
+
confirm_uninstall: "Confirm uninstall",
|
|
300
|
+
installing: "Installing\u2026",
|
|
301
|
+
refresh: "Refresh catalog",
|
|
302
|
+
no_installed: "No domains yet \u2014 install Tasks, Tags or Sites from DSH plugins",
|
|
303
|
+
no_catalog: "Catalog is empty or unreachable",
|
|
304
|
+
catalog_loading: "Loading catalog\u2026",
|
|
305
|
+
cached_notice: "Cloud unreachable \u2014 showing the cached catalog",
|
|
306
|
+
install_failed: "Install failed",
|
|
307
|
+
uninstall_failed: "Uninstall failed",
|
|
308
|
+
load_failed: "client failed to load",
|
|
309
|
+
data_kept: "Uninstall removes code only; data is kept and reappears after reinstall",
|
|
310
|
+
addon_error: "load error",
|
|
311
|
+
source_cloud: "cloud",
|
|
312
|
+
source_local: "local dir",
|
|
313
|
+
version: "version",
|
|
314
|
+
latest: "latest",
|
|
315
|
+
shell_version: "shell",
|
|
316
|
+
delete: "Delete",
|
|
317
|
+
login: "Login",
|
|
318
|
+
signup: "Sign up",
|
|
319
|
+
email: "Email",
|
|
320
|
+
password: "Password",
|
|
321
|
+
logout: "Log out",
|
|
322
|
+
logged_in_as: "Signed in",
|
|
323
|
+
not_logged_in: "Not signed in \u2014 data stays local",
|
|
324
|
+
sync_now: "Sync now",
|
|
325
|
+
sync_pushed: "pushed",
|
|
326
|
+
sync_pulled: "pulled",
|
|
327
|
+
device_name: "This device",
|
|
328
|
+
sync_status: "Sync status",
|
|
329
|
+
sync_last: "Last sync",
|
|
330
|
+
sync_never: "Never synced",
|
|
331
|
+
sync_conflicts: "Conflicts",
|
|
332
|
+
sync_failed_tables: "Failed tables",
|
|
333
|
+
sync_clock: "Clock offset",
|
|
334
|
+
sync_no_conflicts: "No pending conflicts",
|
|
335
|
+
sync_conflict_hint: "The same row changed locally and remotely; choose which version to keep",
|
|
336
|
+
sync_keep_local: "Keep local",
|
|
337
|
+
sync_keep_server: "Use remote",
|
|
338
|
+
sync_dismiss: "Dismiss",
|
|
339
|
+
sync_resolve_failed: "Failed to resolve conflict",
|
|
340
|
+
sync_ok: "Sync complete",
|
|
341
|
+
sync_partial: "Some tables failed",
|
|
342
|
+
cloud_status: "Cloud connection",
|
|
343
|
+
cloud_checking: "Checking cloud\u2026",
|
|
344
|
+
cloud_checking_hint: "Checking the cloud connection",
|
|
345
|
+
cloud_local: "Local only",
|
|
346
|
+
cloud_local_hint: "Not signed in; data stays on this device",
|
|
347
|
+
cloud_syncing: "Syncing\u2026",
|
|
348
|
+
cloud_syncing_hint: "Syncing data with the cloud",
|
|
349
|
+
cloud_online: "Cloud connected",
|
|
350
|
+
cloud_online_hint: "Signed in; data syncs automatically",
|
|
351
|
+
cloud_offline: "Cloud unreachable",
|
|
352
|
+
cloud_offline_hint: "Cannot reach the cloud; local data still works",
|
|
353
|
+
cloud_never: "Waiting for first sync",
|
|
354
|
+
cloud_never_hint: "Signed in; waiting for the first sync",
|
|
355
|
+
cloud_sync_failed: "Sync issue",
|
|
356
|
+
cloud_sync_failed_hint: "Cloud is reachable but the last sync did not fully succeed",
|
|
357
|
+
cloud_open: "Open Account & Sync",
|
|
358
|
+
record_label: "Record mode",
|
|
359
|
+
record_on: "Recording",
|
|
360
|
+
record_off: "Record",
|
|
361
|
+
record_on_title: "Record mode is on for this session; click to turn it off",
|
|
362
|
+
record_off_title: "Record finished deliverables to the workbench (this session only)",
|
|
363
|
+
record_busy: "Switching",
|
|
364
|
+
record_error: "Switch failed",
|
|
365
|
+
record_failed_short: "Failed"
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
module2.exports = LOCALE2;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// packages/shell/client/styles.cjs
|
|
373
|
+
var require_styles = __commonJS({
|
|
374
|
+
"packages/shell/client/styles.cjs"(exports2, module2) {
|
|
375
|
+
"use strict";
|
|
376
|
+
var CSS2 = [
|
|
377
|
+
".wb-root{--wb-line:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wb-surface:var(--dsw-alias-bg-layer-1,color-mix(in oklab,currentColor 4%,transparent));display:flex;flex-direction:column;height:100%;box-sizing:border-box;overflow:auto;color:inherit;font-size:13px;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-2,color-mix(in oklab,currentColor 4%,transparent)));padding:24px 28px}",
|
|
378
|
+
".wb-inner{display:flex;flex-direction:column;gap:16px;width:100%;max-width:1040px;margin:0 auto}",
|
|
379
|
+
".wb-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}",
|
|
380
|
+
".wb-hero h2{margin:0;font-size:18px;font-weight:650;letter-spacing:.2px}",
|
|
381
|
+
".wb-tag{font-size:12px;opacity:.62;margin-top:4px;display:block;line-height:1.5}",
|
|
382
|
+
".wb-cloud{display:inline-flex;align-items:center;gap:7px;max-width:100%;padding:6px 11px;border:1px solid var(--wb-line);border-radius:999px;background:var(--wb-surface);color:inherit;font:inherit;font-size:12px;line-height:1.2;cursor:pointer;white-space:nowrap;transition:border-color .15s ease,background .15s ease}",
|
|
383
|
+
".wb-cloud:hover{border-color:var(--dsw-alias-brand-primary,#11a89b)}",
|
|
384
|
+
".wb-cloud:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#11a89b);outline-offset:2px}",
|
|
385
|
+
".wb-cloud-dot{width:7px;height:7px;border-radius:50%;background:currentColor;opacity:.4;flex:none}",
|
|
386
|
+
".wb-cloud.local{opacity:.7}",
|
|
387
|
+
".wb-cloud.on .wb-cloud-dot{background:var(--dsw-alias-state-success-primary,#18a058);opacity:1;box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-state-success-primary,#18a058) 16%,transparent)}",
|
|
388
|
+
".wb-cloud.off{border-color:color-mix(in oklab,var(--dsw-alias-state-error-primary,#e5484d) 35%,var(--wb-line));background:color-mix(in oklab,var(--dsw-alias-state-error-primary,#e5484d) 5%,var(--wb-surface))}",
|
|
389
|
+
".wb-cloud.off .wb-cloud-dot{background:var(--dsw-alias-state-error-primary,#e5484d);opacity:1}",
|
|
390
|
+
".wb-cloud.warn{border-color:color-mix(in oklab,var(--dsw-alias-state-warn-primary,#d48806) 35%,var(--wb-line))}",
|
|
391
|
+
".wb-cloud.warn .wb-cloud-dot{background:var(--dsw-alias-state-warn-primary,#d48806);opacity:1}",
|
|
392
|
+
".wb-cloud.syncing .wb-cloud-dot{background:var(--dsw-alias-brand-primary,#11a89b);opacity:1;animation:wb-cloud-pulse 1.2s ease-in-out infinite}",
|
|
393
|
+
"@keyframes wb-cloud-pulse{0%,100%{box-shadow:0 0 0 0 color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 0%,transparent)}50%{box-shadow:0 0 0 4px color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 18%,transparent)}}",
|
|
394
|
+
"@media (prefers-reduced-motion:reduce){.wb-cloud.syncing .wb-cloud-dot{animation:none}}",
|
|
395
|
+
".wb-tabs{display:flex;gap:6px;border-bottom:1px solid var(--wb-line);margin-bottom:2px}",
|
|
396
|
+
".wb-tab{border:none;background:transparent;color:inherit;opacity:.6;padding:9px 14px;cursor:pointer;font-size:13px;border-bottom:2px solid transparent;margin-bottom:-1px;transition:opacity .15s ease,border-color .15s ease}",
|
|
397
|
+
".wb-tab:hover{opacity:.9}",
|
|
398
|
+
".wb-tab.on{opacity:1;border-bottom-color:var(--dsw-alias-brand-primary,#11a89b);font-weight:600}",
|
|
399
|
+
".wb-card{background:var(--wb-surface);border:1px solid var(--wb-line);border-radius:12px;padding:14px 16px}",
|
|
400
|
+
".wb-form{display:flex;gap:8px;align-items:center;background:var(--wb-surface);border:1px solid var(--wb-line);border-radius:12px;padding:10px;flex-wrap:wrap}",
|
|
401
|
+
".wb-input,.wb-select{background:transparent;color:inherit;border:1px solid var(--wb-line);border-radius:8px;padding:8px 11px;font-size:13px;outline:none;transition:border-color .15s ease}",
|
|
402
|
+
".wb-input:focus,.wb-select:focus{border-color:var(--dsw-alias-brand-primary,#11a89b)}",
|
|
403
|
+
".wb-btn{background:var(--dsw-alias-brand-primary,#11a89b);color:var(--dsw-alias-label-primary-inverted,#fff);border:none;border-radius:8px;padding:8px 16px;cursor:pointer;font-size:13px;font-weight:600;transition:filter .15s ease}",
|
|
404
|
+
".wb-btn:hover{filter:brightness(1.08)}",
|
|
405
|
+
".wb-btn:disabled{opacity:.55;cursor:default;filter:none}",
|
|
406
|
+
".wb-btn.ghost{background:transparent;border:1px solid var(--wb-line);color:inherit;font-weight:400;opacity:.8}",
|
|
407
|
+
".wb-btn.danger{background:transparent;border:1px solid var(--dsw-alias-state-error-primary,#e5484d);color:var(--dsw-alias-state-error-primary,#e5484d);font-weight:500}",
|
|
408
|
+
".wb-sec{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:2px 0 0}",
|
|
409
|
+
".wb-sec h3{margin:0;font-size:13px;font-weight:650;letter-spacing:.2px}",
|
|
410
|
+
".wb-sec .wb-hint{font-size:11.5px;opacity:.5}",
|
|
411
|
+
".wb-addon{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:12px 14px;border:1px solid var(--wb-line);border-radius:10px;background:var(--wb-surface)}",
|
|
412
|
+
".wb-addon+.wb-addon{margin-top:8px}",
|
|
413
|
+
".wb-addon-main{min-width:0;display:flex;flex-direction:column;gap:2px}",
|
|
414
|
+
".wb-addon-title{font-weight:600;font-size:13.5px}",
|
|
415
|
+
".wb-addon-meta{font-size:11.5px;opacity:.52;margin-top:3px;line-height:1.5;word-break:break-word}",
|
|
416
|
+
".wb-addon-desc{font-size:12px;opacity:.66;margin-top:2px;line-height:1.5}",
|
|
417
|
+
".wb-actions{display:flex;gap:6px;align-items:center;flex:none;flex-wrap:wrap;justify-content:flex-end}",
|
|
418
|
+
".wb-badge{font-size:10.5px;padding:2px 7px;border-radius:999px;border:1px solid var(--wb-line);opacity:.7;margin-left:6px;white-space:nowrap}",
|
|
419
|
+
".wb-err{font-size:12px;color:var(--dsw-alias-state-error-primary,#e5484d);margin-top:4px;line-height:1.5;word-break:break-word}",
|
|
420
|
+
".wb-msg{font-size:12.5px;opacity:.55;padding:20px 0;text-align:center;line-height:1.6}",
|
|
421
|
+
".wb-empty-cta{padding:26px 14px}",
|
|
422
|
+
".wb-stack{display:flex;flex-direction:column;gap:10px}",
|
|
423
|
+
".wb-home-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(236px,1fr));gap:12px}",
|
|
424
|
+
".wb-home-card{display:flex;flex-direction:column;gap:6px;text-align:left;background:var(--wb-surface);border:1px solid var(--wb-line);border-radius:14px;padding:16px 16px 14px;color:inherit;font:inherit;cursor:pointer;transition:transform .12s ease,border-color .12s ease,background .12s ease}",
|
|
425
|
+
".wb-home-card:hover{border-color:var(--dsw-alias-brand-primary,#11a89b);transform:translateY(-1px)}",
|
|
426
|
+
".wb-home-card:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#11a89b);outline-offset:2px}",
|
|
427
|
+
".wb-home-top{display:flex;align-items:center;justify-content:space-between;gap:8px}",
|
|
428
|
+
".wb-home-icon{width:34px;height:34px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 14%,transparent);color:var(--dsw-alias-brand-primary,#11a89b);font-size:16px;font-weight:650;flex:none}",
|
|
429
|
+
".wb-home-title{font-size:14px;font-weight:650;margin-top:4px;line-height:1.4}",
|
|
430
|
+
".wb-home-desc{font-size:12px;opacity:.62;line-height:1.55;min-height:34px}",
|
|
431
|
+
".wb-home-card.dim{opacity:.72}",
|
|
432
|
+
".wb-home-grid.manage{margin-top:2px}",
|
|
433
|
+
".wb-wide{max-width:1280px}",
|
|
434
|
+
".wb-page-head{display:flex;flex-direction:column;gap:8px;padding-bottom:2px}",
|
|
435
|
+
".wb-page-top{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}",
|
|
436
|
+
".wb-back{border:1px solid var(--wb-line);background:transparent;color:inherit;border-radius:8px;padding:6px 11px;cursor:pointer;font:inherit;font-size:12px;opacity:.75;display:inline-flex;align-items:center;gap:5px}",
|
|
437
|
+
".wb-back:hover{opacity:1;border-color:var(--dsw-alias-brand-primary,#11a89b)}",
|
|
438
|
+
".wb-page-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
439
|
+
".wb-page-title h2{margin:0;font-size:19px;font-weight:650;letter-spacing:.2px}",
|
|
440
|
+
".wb-page-desc{font-size:12px;opacity:.6;line-height:1.5}",
|
|
441
|
+
".wb-page-tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid var(--wb-line)}",
|
|
442
|
+
".wb-page-loading{display:flex;flex-direction:column;gap:8px;align-items:flex-start}",
|
|
443
|
+
".wb-grow{flex:1;min-width:0}",
|
|
444
|
+
// 全屏页铺满整个窗口(inset:0),但根节点必须声明 -webkit-app-region:no-drag:
|
|
445
|
+
// macOS 的宿主 chrome 把顶部条带标成 drag 区,Electron 按图层几何计算拖拽区,
|
|
446
|
+
// 覆盖在 drag 区上的元素若不声明 no-drag,点击会被当成拖窗口,
|
|
447
|
+
// 「返回首页」按钮就永远收不到 click。工具栏空白段再恢复 drag(按钮另有 no-drag 规则)。
|
|
448
|
+
".wb-immersive{position:fixed;inset:0;z-index:700;height:100vh;box-sizing:border-box;padding:0;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1,#faf7ea));backdrop-filter:saturate(1.05) blur(10px);overflow:hidden;-webkit-app-region:no-drag}",
|
|
449
|
+
".wb-immersive-bar{position:relative;display:flex;align-items:center;gap:10px;padding:calc(9px + var(--dsh-frame-top-clearance,0px)) 22px 9px;border-bottom:1px solid var(--wb-line);flex:none;background:transparent;-webkit-app-region:no-drag}",
|
|
450
|
+
".wb-immersive-bar .wb-immersive-title{cursor:default;user-select:none}",
|
|
451
|
+
".wb-immersive-bar button,.wb-immersive-bar a,.wb-immersive-bar input,.wb-immersive-bar select,.wb-immersive-bar textarea,.wb-immersive-bar [role=button]{-webkit-app-region:no-drag}",
|
|
452
|
+
".wb-immersive-title{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:600;opacity:.85}",
|
|
453
|
+
".wb-immersive-title .wb-home-icon{width:24px;height:24px;border-radius:7px;font-size:12px}",
|
|
454
|
+
".wb-immersive-main{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:18px 24px 24px}",
|
|
455
|
+
".wb-immersive-main>.wb-inner{max-width:none}",
|
|
456
|
+
"@media (max-width:760px){.wb-root{padding:16px}.wb-home-grid{grid-template-columns:1fr}.wb-page-title h2{font-size:17px}.wb-immersive-bar{padding:calc(8px + var(--dsh-frame-top-clearance,0px)) 14px 8px}.wb-immersive-main{padding:14px 16px 20px}.wb-immersive-title span:not(.wb-home-icon):not(.wb-badge){display:none}}",
|
|
457
|
+
".wb-backup{display:flex;flex-direction:column;gap:14px}",
|
|
458
|
+
".wb-backup-item{display:flex;flex-direction:column}",
|
|
459
|
+
".wb-backup-row{display:flex;align-items:flex-start;gap:10px;padding:11px 13px;border:1px solid var(--wb-line);border-radius:10px;background:var(--wb-surface)}",
|
|
460
|
+
".wb-backup-row.open{border-radius:10px 10px 0 0}",
|
|
461
|
+
".wb-backup-row-main{display:flex;align-items:flex-start;gap:10px;flex:1;min-width:0;cursor:pointer}",
|
|
462
|
+
".wb-backup-row input{margin-top:3px;accent-color:var(--dsw-alias-brand-primary,#11a89b)}",
|
|
463
|
+
".wb-backup-gear{flex:none;width:28px;height:28px;border-radius:8px;border:1px solid transparent;background:transparent;color:inherit;opacity:.5;cursor:pointer;font-size:14px;line-height:1;display:inline-flex;align-items:center;justify-content:center;padding:0;margin-top:-3px}",
|
|
464
|
+
".wb-backup-gear:hover,.wb-backup-gear.active{opacity:1;border-color:var(--wb-line);background:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 10%,transparent)}",
|
|
465
|
+
".wb-backup-config{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:9px 13px 11px;border:1px solid var(--wb-line);border-top:none;border-radius:0 0 10px 10px;margin-top:-1px;background:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 5%,var(--wb-surface))}",
|
|
466
|
+
".wb-backup-config-label{font-size:12px;font-weight:600;opacity:.8}",
|
|
467
|
+
".wb-backup-config .wb-select{padding:6px 9px;font-size:12px;background:var(--wb-surface)}",
|
|
468
|
+
".wb-backup-main{min-width:0;display:flex;flex-direction:column;gap:2px}",
|
|
469
|
+
".wb-backup-name{font-weight:600;font-size:13px}",
|
|
470
|
+
".wb-backup-meta{font-size:11.5px;opacity:.52;line-height:1.5}",
|
|
471
|
+
".wb-backup-table-list{display:flex;flex-direction:column;gap:1px}",
|
|
472
|
+
".wb-backup-table{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;line-height:1.8;opacity:.62;white-space:nowrap}",
|
|
473
|
+
".wb-backup-result-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0;border-top:1px solid var(--wb-line)}",
|
|
474
|
+
".wb-backup-result-row:first-of-type{border-top:0;padding-top:0}",
|
|
475
|
+
".wb-backup-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
|
|
476
|
+
".wb-backup-note{font-size:12px;opacity:.6;line-height:1.55}",
|
|
477
|
+
".wb-backup-report{display:flex;flex-direction:column;gap:8px}",
|
|
478
|
+
".wb-audit-filters{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-top:10px}",
|
|
479
|
+
".wb-audit-field{display:flex;flex:1 1 150px;min-width:0;flex-direction:column;gap:5px;font-size:12px}",
|
|
480
|
+
".wb-audit-field .wb-input,.wb-audit-field .wb-select{width:100%;min-width:0;box-sizing:border-box;height:36px;padding:6px 9px;font-size:12px}",
|
|
481
|
+
".wb-audit-summary{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:12px;font-size:12px;overflow-wrap:anywhere}",
|
|
482
|
+
".wb-audit-summary span{min-width:0}.wb-audit-row:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#11a89b);outline-offset:-2px}",
|
|
483
|
+
"@media(max-width:480px){.wb-audit-field{flex-basis:100%}.wb-audit-pager{flex-wrap:wrap}.wb-audit-filters .wb-btn{flex:1}}",
|
|
484
|
+
".wb-audit-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
485
|
+
".wb-audit-table th{text-align:left;font-weight:600;opacity:.6;padding:6px 8px;border-bottom:1px solid var(--wb-line);white-space:nowrap}",
|
|
486
|
+
".wb-audit-table td{padding:7px 8px;border-bottom:1px solid var(--wb-line);vertical-align:top}",
|
|
487
|
+
".wb-audit-row{cursor:pointer}",
|
|
488
|
+
".wb-audit-row:hover td{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 5%,transparent)}",
|
|
489
|
+
".wb-audit-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}",
|
|
490
|
+
".wb-audit-ok{color:#1a9c6a;font-weight:600}",
|
|
491
|
+
".wb-audit-fail{color:#d0483c;font-weight:600}",
|
|
492
|
+
".wb-audit-dim{opacity:.55}",
|
|
493
|
+
".wb-audit-pre{white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.6;background:color-mix(in oklab,var(--wb-line) 18%,transparent);border-radius:8px;padding:9px 11px;margin:6px 0 4px}",
|
|
494
|
+
".wb-audit-pager{display:flex;align-items:center;gap:10px;margin-top:12px}",
|
|
495
|
+
".wb-backup-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
496
|
+
".wb-backup-table th,.wb-backup-table td{text-align:left;padding:7px 8px;border-bottom:1px solid var(--wb-line);vertical-align:top}",
|
|
497
|
+
".wb-backup-table th{font-weight:600;opacity:.66;font-size:11.5px}",
|
|
498
|
+
".wb-backup-table td.num{white-space:nowrap;opacity:.8}",
|
|
499
|
+
".wb-backup-status{font-weight:600}",
|
|
500
|
+
".wb-backup-status.ok{color:var(--dsw-alias-state-success-primary,#18a058)}",
|
|
501
|
+
".wb-backup-status.partial{color:var(--dsw-alias-state-warn-primary,#d48806)}",
|
|
502
|
+
".wb-backup-status.failed{color:var(--dsw-alias-state-error-primary,#e5484d)}",
|
|
503
|
+
".wb-backup-status.skipped{opacity:.55}",
|
|
504
|
+
".wb-backup-file{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}",
|
|
505
|
+
".wb-sync-status{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;opacity:.7;margin-top:10px;line-height:1.6}",
|
|
506
|
+
".wb-sync-status b{font-weight:600;opacity:.9}",
|
|
507
|
+
".wb-conflict{display:flex;align-items:center;gap:10px;justify-content:space-between;flex-wrap:wrap;padding:9px 0;border-top:1px solid var(--wb-line);font-size:12px}",
|
|
508
|
+
".wb-conflict:first-of-type{border-top:0;padding-top:0}",
|
|
509
|
+
".wb-conflict-main{min-width:0;display:flex;flex-direction:column;gap:2px}",
|
|
510
|
+
".wb-conflict-meta{font-size:11px;opacity:.55;word-break:break-word}",
|
|
511
|
+
".wb-conflict-actions{display:flex;gap:6px;flex:none}",
|
|
512
|
+
".wb-record-pill{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border:1px solid var(--wb-line,var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent)));border-radius:999px;background:color-mix(in oklab,currentColor 3%,transparent);color:inherit;cursor:pointer;font:inherit;font-size:12px;line-height:1;opacity:.62;white-space:nowrap;transition:opacity .15s ease,border-color .15s ease,background .15s ease}",
|
|
513
|
+
".wb-record-pill:hover{opacity:.95;border-color:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 35%,var(--wb-line,var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent))))}",
|
|
514
|
+
".wb-record-pill.on{opacity:1;border-color:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 45%,transparent);background:color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 10%,transparent)}",
|
|
515
|
+
".wb-record-pill:disabled{opacity:.4;cursor:default}",
|
|
516
|
+
".wb-record-pill.err{opacity:1;border-color:var(--dsw-alias-state-error-primary,#e5484d);color:var(--dsw-alias-state-error-primary,#e5484d)}",
|
|
517
|
+
".wb-record-pill.err .wb-record-dot{background:currentColor;opacity:1}",
|
|
518
|
+
".wb-record-dot{width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.5;flex:none}",
|
|
519
|
+
".wb-record-pill.on .wb-record-dot{background:var(--dsw-alias-brand-primary,#11a89b);opacity:1;box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,#11a89b) 18%,transparent)}",
|
|
520
|
+
".wb-search-wrap{position:relative;display:flex;flex-direction:column;gap:6px}",
|
|
521
|
+
".wb-search-bar{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--wb-line);border-radius:10px;background:var(--wb-surface)}",
|
|
522
|
+
".wb-search-bar:focus-within{border-color:var(--dsw-alias-brand-primary,#11a89b)}",
|
|
523
|
+
".wb-search-icon{opacity:.55;font-size:15px;line-height:1}",
|
|
524
|
+
".wb-search-input{flex:1;min-width:0;border:0;background:transparent;color:inherit;font:inherit;font-size:13px;outline:none}",
|
|
525
|
+
".wb-search-kbd{font-size:11px;opacity:.5;border:1px solid var(--wb-line);border-radius:5px;padding:1px 5px}",
|
|
526
|
+
".wb-search-panel{position:absolute;top:100%;left:0;right:0;z-index:40;margin-top:6px;max-height:340px;overflow:auto;border:1px solid var(--wb-line);border-radius:10px;background:var(--dsw-alias-bg-layer-1,var(--wb-surface));box-shadow:0 12px 32px rgba(0,0,0,.18);padding:6px}",
|
|
527
|
+
".wb-search-hit{display:flex;gap:10px;align-items:flex-start;width:100%;text-align:left;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:12px;padding:7px 8px;cursor:pointer}",
|
|
528
|
+
".wb-search-hit:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
529
|
+
".wb-search-domain{flex:none;min-width:52px;font-size:11px;opacity:.6;padding-top:2px}",
|
|
530
|
+
".wb-search-hit-main{display:flex;flex-direction:column;gap:2px;min-width:0}",
|
|
531
|
+
".wb-search-hit-title{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
532
|
+
".wb-search-hit-snippet{opacity:.65;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}",
|
|
533
|
+
".wb-search-empty{padding:12px;font-size:12px;opacity:.65;text-align:center}",
|
|
534
|
+
// ── 统一 UI 设计系统:所有业务插件共享的 token 与基础件 ──
|
|
535
|
+
// 插件各自写过 --wb-border/--wb-accent 等变量但没有宿主兜底,导致大量 #2563eb、#fff 硬编码在深色模式下失效。
|
|
536
|
+
".wb-root{--wb-border:var(--wb-line);--wb-card:var(--dsw-alias-bg-layer-1,var(--dsw-alias-bg-layer-2,#fff));--wb-surface:var(--dsw-alias-bg-layer-1,var(--dsw-alias-bg-layer-2,#fff));--wb-accent:var(--dsw-alias-brand-primary,#11a89b);--wb-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 58%,transparent));--wb-ok:var(--dsw-alias-state-success-primary,#18a058);--wb-warn:var(--dsw-alias-state-warn-primary,var(--dsw-alias-state-warning-primary,#d48806));--wb-danger:var(--dsw-alias-state-error-primary,#e5484d);--wb-radius-card:14px;--wb-space-md:14px}",
|
|
537
|
+
".wb-root *{scrollbar-width:thin;scrollbar-color:color-mix(in oklab,currentColor 22%,transparent) transparent}",
|
|
538
|
+
".wb-root ::-webkit-scrollbar{width:10px;height:10px}.wb-root ::-webkit-scrollbar-thumb{background:color-mix(in oklab,currentColor 18%,transparent);border-radius:999px;border:2px solid transparent;background-clip:padding-box}",
|
|
539
|
+
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page){width:100%;max-width:none;margin:0;padding:0;gap:16px;box-sizing:border-box}",
|
|
540
|
+
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page) h2{font-size:20px;line-height:1.3;font-weight:680;letter-spacing:-.02em;margin:0}",
|
|
541
|
+
".wb-root :is(.wbc-sub,.wba-sub,.wbct-sub,.wbca-sub,.wbm-sub,.wbv-muted,.wbct-muted,.wbc-muted,.wba-muted,.wbca-muted,.wbm-muted){font-size:12.5px;line-height:1.55;color:var(--wb-muted)}",
|
|
542
|
+
".wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page) > :is(.wbc-head,.wba-head,.wbct-head,.wbca-head,.wbm-head){padding-bottom:12px;border-bottom:1px solid var(--wb-border);align-items:flex-start}",
|
|
543
|
+
".wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-card,.wbct-panel){background:var(--wb-card);border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);padding:16px;box-shadow:0 1px 2px color-mix(in oklab,#000 4%,transparent);transition:border-color .15s ease,box-shadow .15s ease}",
|
|
544
|
+
".wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-card):hover{border-color:color-mix(in oklab,var(--wb-accent) 32%,var(--wb-border));box-shadow:0 2px 14px color-mix(in oklab,#000 6%,transparent)}",
|
|
545
|
+
".wb-root :is(.wbc-grid,.wbv-grid,.wba-grid,.wbct-grid,.wbca-grid,.wbm-grid){gap:12px}",
|
|
546
|
+
".wb-root :is(.wbc-kpi,.wbv-kpi,.wba-kpi,.wbct-kpi,.wbca-kpi,.wbm-kpi){font-size:26px;line-height:1.15;font-weight:680;letter-spacing:-.03em;font-variant-numeric:tabular-nums}",
|
|
547
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn){min-height:32px;padding:0 12px;border-radius:8px;border:1px solid var(--wb-border);background:var(--wb-card);color:inherit;font:inherit;font-size:12.5px;font-weight:500;line-height:1;display:inline-flex;align-items:center;justify-content:center;gap:5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease,transform .12s ease}",
|
|
548
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):hover:not(:disabled){background:color-mix(in oklab,var(--wb-accent) 8%,var(--wb-card));border-color:color-mix(in oklab,var(--wb-accent) 45%,var(--wb-border))}",
|
|
549
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):active:not(:disabled){transform:translateY(1px)}",
|
|
550
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):disabled{opacity:.45;cursor:not-allowed}",
|
|
551
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):is(.primary,.on){background:var(--wb-accent);border-color:var(--wb-accent);color:var(--dsw-alias-label-primary-inverted,#fff);font-weight:600}",
|
|
552
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn).primary:hover:not(:disabled){filter:brightness(1.06)}",
|
|
553
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):is(.danger){color:var(--wb-danger);border-color:color-mix(in oklab,var(--wb-danger) 40%,transparent);background:transparent}",
|
|
554
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn).danger:hover:not(:disabled){background:color-mix(in oklab,var(--wb-danger) 8%,var(--wb-card));border-color:var(--wb-danger)}",
|
|
555
|
+
".wb-root :is(.wbc-btn,.wbv-btn,.wba-btn,.wbct-btn,.wbca-btn,.wbm-btn):focus-visible,.wb-root :is(.wbc-input,.wbv input,.wbc-field input,.wbc-field select,.wbc-field textarea,.wba-field input,.wba-field select,.wba-field textarea,.wbct-input,.wbct-field input,.wbca-input,.wbca-field input,.wbm-input,.wbm-field input,.wbm-field select,.wbm-field textarea):focus-visible{outline:2px solid color-mix(in oklab,var(--wb-accent) 55%,transparent);outline-offset:2px}",
|
|
556
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field){gap:6px;font-size:12px}",
|
|
557
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) > :is(.wbc-label,.wbv-label,.wba-label,.wbct-label,.wbca-label,.wbm-label){font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--wb-muted);opacity:1}",
|
|
558
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) :is(input,select,textarea),.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input){min-height:34px;padding:7px 10px;border:1px solid var(--wb-border);border-radius:8px;background:color-mix(in oklab,var(--wb-card) 92%,transparent);color:inherit;font:inherit;font-size:12.5px;box-sizing:border-box;transition:border-color .12s ease,box-shadow .12s ease}",
|
|
559
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) :is(input,select,textarea):hover,.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input):hover{border-color:color-mix(in oklab,currentColor 26%,var(--wb-border))}",
|
|
560
|
+
".wb-root :is(.wbc-field,.wbv-field,.wba-field,.wbct-field,.wbca-field,.wbm-field) :is(input,select,textarea):focus,.wb-root :is(.wbc-input,.wbct-input,.wbca-input,.wbm-input):focus{border-color:var(--wb-accent);box-shadow:0 0 0 3px color-mix(in oklab,var(--wb-accent) 14%,transparent);outline:none}",
|
|
561
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table){width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px}",
|
|
562
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) th{text-align:left;font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--wb-muted);padding:9px 10px;border-bottom:1px solid var(--wb-border);white-space:nowrap;background:color-mix(in oklab,currentColor 3%,transparent)}",
|
|
563
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) td{padding:10px;border-bottom:1px solid color-mix(in oklab,var(--wb-border) 70%,transparent);vertical-align:top}",
|
|
564
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) tbody tr{transition:background .12s ease}",
|
|
565
|
+
".wb-root :is(.wbc-table,.wbv-table,.wba-table,.wbct-table,.wbca-table,.wbm-table) tbody tr:hover{background:color-mix(in oklab,var(--wb-accent) 4%,transparent)}",
|
|
566
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill){display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;border:1px solid var(--wb-border);background:color-mix(in oklab,currentColor 5%,transparent);color:inherit;font-size:11px;font-weight:500;line-height:1.5;white-space:nowrap}",
|
|
567
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill).ok{color:var(--wb-ok);border-color:color-mix(in oklab,var(--wb-ok) 35%,transparent);background:color-mix(in oklab,var(--wb-ok) 10%,transparent)}",
|
|
568
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill).warn{color:var(--wb-warn);border-color:color-mix(in oklab,var(--wb-warn) 35%,transparent);background:color-mix(in oklab,var(--wb-warn) 10%,transparent)}",
|
|
569
|
+
".wb-root :is(.wbc-pill,.wbv-pill,.wba-pill,.wbct-pill,.wbca-pill,.wbm-pill):is(.error,.bad){color:var(--wb-danger);border-color:color-mix(in oklab,var(--wb-danger) 35%,transparent);background:color-mix(in oklab,var(--wb-danger) 10%,transparent)}",
|
|
570
|
+
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-notice){padding:10px 12px;border:1px solid color-mix(in oklab,var(--wb-accent) 24%,var(--wb-border));border-left:3px solid var(--wb-accent);border-radius:8px;background:color-mix(in oklab,var(--wb-accent) 6%,var(--wb-card));color:inherit;font-size:12.5px;line-height:1.55}",
|
|
571
|
+
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-notice).error{border-color:color-mix(in oklab,var(--wb-danger) 30%,var(--wb-border));border-left-color:var(--wb-danger);background:color-mix(in oklab,var(--wb-danger) 7%,var(--wb-card))}",
|
|
572
|
+
".wb-root :is(.wbc-notice,.wbv-notice,.wba-notice,.wbct-notice,.wbca-notice,.wbm-notice).ok{border-color:color-mix(in oklab,var(--wb-ok) 30%,var(--wb-border));border-left-color:var(--wb-ok);background:color-mix(in oklab,var(--wb-ok) 7%,var(--wb-card))}",
|
|
573
|
+
".wb-root :is(.wbc-empty,.wbv-empty,.wba-empty,.wbct-empty,.wbca-empty,.wbm-empty){padding:42px 20px;border:1px dashed var(--wb-border);border-radius:var(--wb-radius-card);background:color-mix(in oklab,currentColor 2%,transparent);color:var(--wb-muted);font-size:12.5px;line-height:1.6}",
|
|
574
|
+
".wb-root :is(.wbc-json,.wbv-code,.wba-json,.wbct-json,.wbca-json,.wbm-json){margin:0;padding:12px;border:1px solid var(--wb-border);border-radius:10px;background:color-mix(in oklab,currentColor 4%,transparent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.6;max-height:260px;overflow:auto}",
|
|
575
|
+
".wb-root :is(.wbc-table-wrap,.wba-table-wrap,.wbct-table-wrap,.wbca-table-wrap,.wbm-table-wrap){overflow:auto;border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);background:var(--wb-card)}",
|
|
576
|
+
".wb-root :is(.wbc-table-wrap,.wba-table-wrap,.wbct-table-wrap,.wbca-table-wrap,.wbm-table-wrap) :is(.wbc-table,.wba-table,.wbct-table,.wbca-table,.wbm-table){border:0}",
|
|
577
|
+
".wb-root .wba-pills{display:flex;flex-wrap:wrap;gap:6px}",
|
|
578
|
+
".wb-root .wba-list{display:flex;flex-direction:column;gap:8px}",
|
|
579
|
+
".wb-root .wba-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
580
|
+
".wb-root .wba-kv{display:grid;grid-template-columns:minmax(96px,auto) minmax(0,1fr);gap:6px 12px;font-size:12px}",
|
|
581
|
+
".wb-root .wba-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px}",
|
|
582
|
+
".wb-root .wba-card-num{font-size:22px;font-weight:700;font-variant-numeric:tabular-nums}",
|
|
583
|
+
".wb-root .wbct-list{display:flex;flex-direction:column;gap:8px}",
|
|
584
|
+
".wb-root .wb-home-icon svg{display:block}",
|
|
585
|
+
".wb-root :is(.wba-panel,.wbca-panel,.wbm-panel,.wbc-panel){margin-top:4px;padding:18px;border:1px solid color-mix(in oklab,var(--wb-accent) 28%,var(--wb-border));border-radius:var(--wb-radius-card);background:var(--wb-card);box-shadow:0 10px 36px color-mix(in oklab,#000 8%,transparent)}",
|
|
586
|
+
".wb-root :is(.wba-panel,.wbca-panel,.wbm-panel,.wbc-panel) > h3{font-size:15px;font-weight:650;margin:0 0 12px}",
|
|
587
|
+
".wb-root :is(.wba-code,.wbca-code,.wbm-code,.wbc-code){font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;resize:vertical;min-height:90px}",
|
|
588
|
+
".wb-root :is(.wba-input,.wbca-input,.wbm-input,.wbc-input){min-height:34px}",
|
|
589
|
+
".wb-root .wbct-panel{margin-top:2px;border-color:color-mix(in oklab,var(--wb-accent) 30%,var(--wb-border))}",
|
|
590
|
+
".wb-root .wbct-pills{display:flex;flex-wrap:wrap;gap:8px 16px;padding:4px 0}",
|
|
591
|
+
".wb-root .wbct-check{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;cursor:pointer}",
|
|
592
|
+
".wb-root .wbct-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.6;resize:vertical}",
|
|
593
|
+
".wb-root .wbm-list-row{transition:background .12s ease}.wb-root .wbm-list-row:hover{background:color-mix(in oklab,var(--wb-accent) 5%,transparent)}",
|
|
594
|
+
".wb-root .wbm-body{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:13px;line-height:1.75;margin:10px 0 0;max-height:60vh;overflow:auto}",
|
|
595
|
+
".wb-root .wbv-notice{color:inherit}.wb-root .wbv-pill{background:color-mix(in oklab,currentColor 5%,transparent);color:inherit}",
|
|
596
|
+
".wb-root .wbv-pill.ok{background:color-mix(in oklab,var(--wb-ok) 10%,transparent);color:var(--wb-ok)}",
|
|
597
|
+
".wb-root .wbv-pill.warn{background:color-mix(in oklab,var(--wb-warn) 10%,transparent);color:var(--wb-warn)}",
|
|
598
|
+
".wb-root .wbv-pill.bad{background:color-mix(in oklab,var(--wb-danger) 10%,transparent);color:var(--wb-danger)}",
|
|
599
|
+
".wb-root .wbc-wrap>.wbc-head,.wb-root .wba-wrap>.wba-head,.wb-root .wbct-wrap>.wbct-head,.wb-root .wbca-wrap>.wbca-head,.wb-root .wbm-page>.wbm-head{margin-bottom:0}",
|
|
600
|
+
".wb-root :is(.wbc-row,.wba-row,.wbct-row,.wbca-row,.wbm-row){gap:8px}",
|
|
601
|
+
// 首页与导航视觉
|
|
602
|
+
".wb-root .wb-inner{gap:18px;max-width:1120px}",
|
|
603
|
+
".wb-root .wb-hero{padding:6px 2px 2px;align-items:center}",
|
|
604
|
+
".wb-root .wb-hero h2{font-size:24px;font-weight:700;letter-spacing:-.02em}",
|
|
605
|
+
".wb-root .wb-tag{font-size:12.5px;opacity:.58;margin-top:6px}",
|
|
606
|
+
".wb-root .wb-home-grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:14px}",
|
|
607
|
+
".wb-root .wb-home-card{position:relative;min-height:142px;padding:18px;border-radius:16px;background:var(--wb-card);box-shadow:0 1px 2px color-mix(in oklab,#000 3%,transparent);transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease}",
|
|
608
|
+
".wb-root .wb-home-card:hover{transform:translateY(-2px);border-color:color-mix(in oklab,var(--wb-accent) 50%,var(--wb-border));box-shadow:0 10px 28px color-mix(in oklab,#000 10%,transparent)}",
|
|
609
|
+
".wb-root .wb-home-card .wb-home-icon{background:color-mix(in oklab,var(--wb-accent) 7%,var(--wb-card));border-color:color-mix(in oklab,var(--wb-accent) 12%,var(--wb-border))}",
|
|
610
|
+
".wb-root .wb-home-icon{width:38px;height:38px;border-radius:11px;background:color-mix(in oklab,var(--wb-accent) 13%,transparent);color:var(--wb-accent);font-size:16px;font-weight:700;box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--wb-accent) 16%,transparent)}",
|
|
611
|
+
".wb-root .wb-home-title{font-size:15px;font-weight:660;margin-top:8px}",
|
|
612
|
+
".wb-root .wb-home-desc{font-size:12px;line-height:1.55;opacity:.62;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;min-height:56px}",
|
|
613
|
+
".wb-root .wb-home-card .wb-badge{background:color-mix(in oklab,currentColor 5%,transparent);border:1px solid color-mix(in oklab,currentColor 8%,transparent);opacity:.72;font-variant-numeric:tabular-nums}",
|
|
614
|
+
".wb-root .wb-home-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto;padding-top:8px;font-size:11.5px;color:var(--wb-muted);border-top:1px solid color-mix(in oklab,var(--wb-border) 65%,transparent)}",
|
|
615
|
+
".wb-root .wb-home-foot b{font-weight:600;color:var(--wb-accent)}",
|
|
616
|
+
".wb-root .wb-immersive-bar{background:color-mix(in oklab,var(--wb-card) 86%,transparent);backdrop-filter:saturate(1.15) blur(14px);box-shadow:0 1px 0 var(--wb-line)}",
|
|
617
|
+
".wb-root .wb-page-tabs{gap:2px;padding:2px 0}",
|
|
618
|
+
".wb-root .wb-tab{border-radius:8px 8px 0 0;padding:9px 13px;font-weight:500}",
|
|
619
|
+
".wb-root .wb-tab.on{background:color-mix(in oklab,var(--wb-accent) 7%,transparent)}",
|
|
620
|
+
// 邮件三栏:账户栏 / 列表 / 阅读
|
|
621
|
+
".wb-root .wbm-layout{display:grid;grid-template-columns:220px minmax(0,1fr);gap:14px;align-items:start;min-height:420px}",
|
|
622
|
+
".wb-root .wbm-layout.has-detail{grid-template-columns:210px minmax(260px,.9fr) minmax(0,1.1fr)}",
|
|
623
|
+
".wb-root .wbm-rail{display:flex;flex-direction:column;gap:10px;min-width:0}",
|
|
624
|
+
".wb-root .wbm-rail-card{display:flex;flex-direction:column;gap:10px;padding:14px}",
|
|
625
|
+
".wb-root .wbm-rail-title{font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--wb-muted)}",
|
|
626
|
+
".wb-root .wbm-rail-stats{display:flex;gap:10px;flex-wrap:wrap;font-size:11.5px;color:var(--wb-muted)}",
|
|
627
|
+
".wb-root .wbm-rail-stats b{font-size:15px;color:inherit;font-variant-numeric:tabular-nums;margin-right:2px}",
|
|
628
|
+
".wb-root .wbm-rail-tip{font-size:11.5px;line-height:1.55;color:var(--wb-muted);opacity:.8;padding:0 4px}",
|
|
629
|
+
".wb-root .wbm-pane{border:1px solid var(--wb-border);border-radius:var(--wb-radius-card);background:var(--wb-card);min-width:0;overflow:hidden;display:flex;flex-direction:column;max-height:calc(100vh - 250px)}",
|
|
630
|
+
".wb-root .wbm-pane-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:11px 14px;border-bottom:1px solid var(--wb-border);font-size:12px;background:color-mix(in oklab,currentColor 2%,transparent)}",
|
|
631
|
+
".wb-root .wbm-list{display:flex;flex-direction:column;overflow:auto;min-height:0}",
|
|
632
|
+
".wb-root .wbm-list-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:start;text-align:left;border:0;border-bottom:1px solid color-mix(in oklab,var(--wb-border) 65%,transparent);background:transparent;color:inherit;font:inherit;padding:11px 14px;cursor:pointer;transition:background .12s ease}",
|
|
633
|
+
".wb-root .wbm-list-row:last-child{border-bottom:0}",
|
|
634
|
+
".wb-root .wbm-list-row:hover{background:color-mix(in oklab,var(--wb-accent) 5%,transparent)}",
|
|
635
|
+
".wb-root .wbm-list-row.on{background:color-mix(in oklab,var(--wb-accent) 9%,transparent);box-shadow:inset 3px 0 0 var(--wb-accent)}",
|
|
636
|
+
".wb-root .wbm-list-row .wbm-dot{width:7px;height:7px;border-radius:50%;margin-top:6px;background:color-mix(in oklab,currentColor 22%,transparent)}",
|
|
637
|
+
".wb-root .wbm-list-row.unread .wbm-dot{background:var(--wb-accent);box-shadow:0 0 0 3px color-mix(in oklab,var(--wb-accent) 15%,transparent)}",
|
|
638
|
+
".wb-root .wbm-list-row.unread .wbm-subject{font-weight:700}",
|
|
639
|
+
".wb-root .wbm-subject{display:block;font-size:12.5px;font-weight:560;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
640
|
+
".wb-root .wbm-snippet{display:block;font-size:11.5px;line-height:1.5;color:var(--wb-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:2px}",
|
|
641
|
+
".wb-root .wbm-list-row .wbm-time{font-size:11px;white-space:nowrap;color:var(--wb-muted);padding-top:2px}",
|
|
642
|
+
".wb-root .wbm-detailpane{overflow:auto}",
|
|
643
|
+
".wb-root .wbm-detail-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--wb-border);background:color-mix(in oklab,currentColor 2%,transparent)}",
|
|
644
|
+
".wb-root .wbm-detail-title{display:flex;flex-direction:column;gap:4px;min-width:0}",
|
|
645
|
+
".wb-root .wbm-detail-title strong{font-size:15px;line-height:1.4;overflow-wrap:anywhere}",
|
|
646
|
+
".wb-root .wbm-detail-meta{display:flex;gap:16px;flex-wrap:wrap;padding:10px 16px;font-size:11.5px;color:var(--wb-muted);border-bottom:1px solid color-mix(in oklab,var(--wb-border) 65%,transparent)}",
|
|
647
|
+
".wb-root .wbm-detailpane .wbm-body{padding:0 16px 18px;margin:0}",
|
|
648
|
+
"@media (max-width:980px){.wb-root .wbm-layout,.wb-root .wbm-layout.has-detail{grid-template-columns:180px minmax(0,1fr)}.wb-root .wbm-layout.has-detail .wbm-detailpane{grid-column:1/-1;max-height:none}}",
|
|
649
|
+
"@media (max-width:760px){.wb-root :is(.wbc-wrap,.wbv,.wba-wrap,.wbct-wrap,.wbca-wrap,.wbm-wrap,.wbm-page){padding:16px 14px 28px;gap:14px}.wb-root .wb-hero h2{font-size:20px}.wb-root .wb-home-card{min-height:0;padding:16px}.wb-root :is(.wbc-card,.wbv-card,.wba-card,.wbct-card,.wbca-card,.wbm-card,.wbct-panel){padding:14px;border-radius:12px}.wb-root .wbm-layout,.wb-root .wbm-layout.has-detail{grid-template-columns:1fr}.wb-root .wbm-pane{max-height:none}.wb-root .wbm-rail{order:2}}",
|
|
650
|
+
// 全宽模块页:去掉两侧留白,并把视图标签并入唯一的一层顶栏。
|
|
651
|
+
".wb-root .wb-inner{max-width:none}",
|
|
652
|
+
".wb-root .wb-immersive-main{padding:16px 22px 24px}",
|
|
653
|
+
".wb-root .wb-immersive-main>.wb-inner{max-width:none;width:100%;padding:0}",
|
|
654
|
+
".wb-root .wb-immersive-bar{padding:calc(8px + var(--dsh-frame-top-clearance,0px)) 18px 8px;background:var(--wb-card);box-shadow:none;border-bottom:1px solid var(--wb-line);-webkit-app-region:no-drag}",
|
|
655
|
+
".wb-root .wb-immersive-bar .wb-page-tabs{border-bottom:0;margin:0 0 0 auto;padding:0;flex-wrap:nowrap;overflow-x:auto;max-width:min(72vw,980px);scrollbar-width:none}",
|
|
656
|
+
".wb-root .wb-immersive-bar .wb-page-tabs::-webkit-scrollbar{display:none}",
|
|
657
|
+
".wb-root .wb-immersive-bar .wb-tab{padding:6px 10px;white-space:nowrap}",
|
|
658
|
+
"@media (max-width:760px){.wb-root .wb-immersive-bar{flex-wrap:nowrap;padding:calc(6px + var(--dsh-frame-top-clearance,0px)) 12px 6px}.wb-root .wb-immersive-bar .wb-page-tabs{max-width:none}.wb-root .wb-immersive-title{display:none}}",
|
|
659
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-bar{padding-top:8px;padding-left:max(88px,calc(12px + var(--dsh-frame-leading-clearance,0px)))}",
|
|
660
|
+
// 顶栏分左右两区:左区标题+版本,右区标签,两区贴边。
|
|
661
|
+
".wb-root .wb-immersive-bar{justify-content:space-between;gap:16px}",
|
|
662
|
+
".wb-root .wb-immersive-left{display:flex;align-items:center;gap:10px;min-width:0;flex:0 1 auto}",
|
|
663
|
+
".wb-root .wb-immersive-bar .wb-grow{display:none}",
|
|
664
|
+
".wb-root .wb-immersive-bar .wb-immersive-left .wb-back{margin-right:0}",
|
|
665
|
+
".wb-root .wb-immersive-icon{display:none}",
|
|
666
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-bar{position:relative}",
|
|
667
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:9px;background:var(--wb-card);border:1px solid var(--wb-border);color:var(--wb-accent);z-index:1}",
|
|
668
|
+
"html[data-platform=darwin] .wb-root .wb-immersive-icon svg{width:17px;height:17px}",
|
|
669
|
+
".wb-root .wb-immersive-bar .wb-immersive-title{flex:0 0 auto;min-width:0}",
|
|
670
|
+
".wb-root .wb-immersive-bar .wb-immersive-title>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
671
|
+
".wb-root .wb-immersive-bar .wb-page-tabs{margin:0;flex:0 1 auto;min-width:0;max-width:none;justify-content:flex-start;gap:4px}",
|
|
672
|
+
".wb-root .wb-immersive-bar .wb-tab{flex:0 0 auto;min-width:0;justify-content:center;text-align:center;padding:6px 10px}"
|
|
673
|
+
].join("\n");
|
|
674
|
+
module2.exports = CSS2;
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
// packages/shell/client/system-tabs.cjs
|
|
679
|
+
var require_system_tabs = __commonJS({
|
|
680
|
+
"packages/shell/client/system-tabs.cjs"(exports2, module2) {
|
|
681
|
+
"use strict";
|
|
682
|
+
module2.exports = function createSystemTabs(react2, jsx2, useApi2) {
|
|
683
|
+
function AccountTab2(props) {
|
|
684
|
+
var t = props.t;
|
|
685
|
+
var api = useApi2();
|
|
686
|
+
var st = react2.useState(null);
|
|
687
|
+
var me = st[0];
|
|
688
|
+
var setMe = st[1];
|
|
689
|
+
var st2 = react2.useState({ email: "", password: "", signup: false });
|
|
690
|
+
var form = st2[0];
|
|
691
|
+
var setForm = st2[1];
|
|
692
|
+
var st3 = react2.useState("");
|
|
693
|
+
var msg = st3[0];
|
|
694
|
+
var setMsg = st3[1];
|
|
695
|
+
var st4 = react2.useState(false);
|
|
696
|
+
var syncing = st4[0];
|
|
697
|
+
var setSyncing = st4[1];
|
|
698
|
+
var st5 = react2.useState(null);
|
|
699
|
+
var syncStatus = st5[0];
|
|
700
|
+
var setSyncStatus = st5[1];
|
|
701
|
+
var st6 = react2.useState([]);
|
|
702
|
+
var conflicts = st6[0];
|
|
703
|
+
var setConflicts = st6[1];
|
|
704
|
+
function refreshSync() {
|
|
705
|
+
api.get("/sync/status").then(function(r) {
|
|
706
|
+
if (r && r.ok) setSyncStatus(r);
|
|
707
|
+
});
|
|
708
|
+
api.get("/sync/conflicts?limit=20").then(function(r) {
|
|
709
|
+
setConflicts(r && Array.isArray(r.conflicts) ? r.conflicts : []);
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
function refresh() {
|
|
713
|
+
api.get("/account").then(function(r) {
|
|
714
|
+
setMe(r);
|
|
715
|
+
if (r && r.logged_in) refreshSync();
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
react2.useEffect(function() {
|
|
719
|
+
refresh();
|
|
720
|
+
}, []);
|
|
721
|
+
react2.useEffect(function() {
|
|
722
|
+
if (!me || !me.logged_in) return void 0;
|
|
723
|
+
var es = new EventSource("/workbench/api/events");
|
|
724
|
+
function onSync() {
|
|
725
|
+
refreshSync();
|
|
726
|
+
}
|
|
727
|
+
es.addEventListener("sync-done", onSync);
|
|
728
|
+
es.addEventListener("sync-status", onSync);
|
|
729
|
+
return function() {
|
|
730
|
+
es.close();
|
|
731
|
+
};
|
|
732
|
+
}, [me && me.logged_in]);
|
|
733
|
+
function submit() {
|
|
734
|
+
api.post("/account/login", { email: form.email, password: form.password, signup: form.signup }).then(function(r) {
|
|
735
|
+
setMsg(r.ok ? "" : r.error || "failed");
|
|
736
|
+
refresh();
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
function resolve(id, action) {
|
|
740
|
+
api.post("/sync/conflicts/" + id + "/resolve", { action }).then(function(r) {
|
|
741
|
+
if (!r || !r.ok) setMsg(t("sync_resolve_failed"));
|
|
742
|
+
refreshSync();
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
if (!me) return jsx2.jsx("div", { className: "wb-card", children: jsx2.jsx("span", { className: "wb-msg", children: "\u2026" }) });
|
|
746
|
+
if (!me.logged_in) {
|
|
747
|
+
return jsx2.jsxs("div", { className: "wb-card", children: [
|
|
748
|
+
jsx2.jsx("div", { className: "wb-msg", style: { marginBottom: 10 }, children: t("not_logged_in") }),
|
|
749
|
+
jsx2.jsxs("div", { className: "wb-form", children: [
|
|
750
|
+
jsx2.jsx("input", { className: "wb-input", placeholder: t("email"), value: form.email, onChange: function(e) {
|
|
751
|
+
setForm(Object.assign({}, form, { email: e.target.value }));
|
|
752
|
+
} }),
|
|
753
|
+
jsx2.jsx("input", { className: "wb-input", type: "password", placeholder: t("password"), value: form.password, onChange: function(e) {
|
|
754
|
+
setForm(Object.assign({}, form, { password: e.target.value }));
|
|
755
|
+
}, onKeyDown: function(e) {
|
|
756
|
+
if (e.key === "Enter") submit();
|
|
757
|
+
} }),
|
|
758
|
+
jsx2.jsx("label", { className: "wb-msg", children: jsx2.jsxs("span", { children: [
|
|
759
|
+
jsx2.jsx("input", { type: "checkbox", checked: form.signup, onChange: function(e) {
|
|
760
|
+
setForm(Object.assign({}, form, { signup: e.target.checked }));
|
|
761
|
+
} }),
|
|
762
|
+
" ",
|
|
763
|
+
t("signup")
|
|
764
|
+
] }) }),
|
|
765
|
+
jsx2.jsx("button", { className: "wb-btn", onClick: submit, children: form.signup ? t("signup") : t("login") })
|
|
766
|
+
] }),
|
|
767
|
+
msg ? jsx2.jsx("div", { className: "wb-err", style: { marginTop: 8 }, children: msg }) : null
|
|
768
|
+
] });
|
|
769
|
+
}
|
|
770
|
+
var failed = syncStatus && Array.isArray(syncStatus.failed_tables) ? syncStatus.failed_tables : [];
|
|
771
|
+
return jsx2.jsxs("div", { className: "wb-stack", children: [
|
|
772
|
+
jsx2.jsxs("div", { className: "wb-card", children: [
|
|
773
|
+
jsx2.jsxs("div", { children: [t("logged_in_as"), " ", me.user ? me.user.email : "", " (", t("device_name"), ")"] }),
|
|
774
|
+
jsx2.jsxs("div", { className: "wb-form", style: { marginTop: 10 }, children: [
|
|
775
|
+
jsx2.jsx("button", { className: "wb-btn", disabled: syncing, onClick: function() {
|
|
776
|
+
setSyncing(true);
|
|
777
|
+
api.post("/sync/now").then(function(r) {
|
|
778
|
+
setSyncing(false);
|
|
779
|
+
if (r && r.ok && Array.isArray(r.failed_tables) && r.failed_tables.length) {
|
|
780
|
+
setMsg(t("sync_partial") + ": " + r.failed_tables.join(", "));
|
|
781
|
+
} else {
|
|
782
|
+
setMsg(r && r.ok ? t("sync_ok") + " \xB7 " + t("sync_pushed") + " " + r.pushed + " \xB7 " + t("sync_pulled") + " " + r.pulled : r && r.error || "fail");
|
|
783
|
+
}
|
|
784
|
+
refreshSync();
|
|
785
|
+
});
|
|
786
|
+
}, children: syncing ? "\u2026" : t("sync_now") }),
|
|
787
|
+
jsx2.jsx("button", { className: "wb-btn ghost", onClick: function() {
|
|
788
|
+
api.post("/account/logout").then(refresh);
|
|
789
|
+
}, children: t("logout") })
|
|
790
|
+
] }),
|
|
791
|
+
msg ? jsx2.jsx("div", { className: "wb-msg", style: { marginTop: 8 }, children: msg }) : null,
|
|
792
|
+
syncStatus ? jsx2.jsxs("div", { className: "wb-sync-status", children: [
|
|
793
|
+
jsx2.jsxs("span", { children: [t("sync_last"), ": ", jsx2.jsx("b", { children: syncStatus.last_sync_at ? new Date(syncStatus.last_sync_at).toLocaleString() : t("sync_never") })] }),
|
|
794
|
+
jsx2.jsxs("span", { children: [t("sync_conflicts"), ": ", jsx2.jsx("b", { children: syncStatus.conflicts || 0 })] }),
|
|
795
|
+
failed.length ? jsx2.jsxs("span", { children: [t("sync_failed_tables"), ": ", jsx2.jsx("b", { children: failed.join(", ") })] }) : null,
|
|
796
|
+
syncStatus.clock_offset ? jsx2.jsxs("span", { children: [t("sync_clock"), ": ", jsx2.jsx("b", { children: syncStatus.clock_offset + "ms" })] }) : null
|
|
797
|
+
] }) : null
|
|
798
|
+
] }),
|
|
799
|
+
jsx2.jsxs("div", { className: "wb-card", children: [
|
|
800
|
+
jsx2.jsxs("div", { className: "wb-sec", children: [
|
|
801
|
+
jsx2.jsx("h3", { children: t("sync_conflicts") + " (" + conflicts.length + ")" }),
|
|
802
|
+
jsx2.jsx("span", { className: "wb-hint", children: t("sync_conflict_hint") })
|
|
803
|
+
] }),
|
|
804
|
+
conflicts.length ? conflicts.map(function(c) {
|
|
805
|
+
return jsx2.jsxs("div", { className: "wb-conflict", children: [
|
|
806
|
+
jsx2.jsxs("div", { className: "wb-conflict-main", children: [
|
|
807
|
+
jsx2.jsx("div", { children: (c.table_name || "") + " \xB7 " + (c.row_id || "") }),
|
|
808
|
+
jsx2.jsx("div", { className: "wb-conflict-meta", children: (c.kind || "") + (c.server_updated_at ? " \xB7 " + new Date(c.server_updated_at).toLocaleString() : "") })
|
|
809
|
+
] }),
|
|
810
|
+
jsx2.jsxs("div", { className: "wb-conflict-actions", children: [
|
|
811
|
+
jsx2.jsx("button", { className: "wb-btn ghost", onClick: function() {
|
|
812
|
+
resolve(c.id, "keep_local");
|
|
813
|
+
}, children: t("sync_keep_local") }),
|
|
814
|
+
jsx2.jsx("button", { className: "wb-btn ghost", onClick: function() {
|
|
815
|
+
resolve(c.id, "keep_server");
|
|
816
|
+
}, children: t("sync_keep_server") }),
|
|
817
|
+
jsx2.jsx("button", { className: "wb-btn ghost", onClick: function() {
|
|
818
|
+
resolve(c.id, "dismiss");
|
|
819
|
+
}, children: t("sync_dismiss") })
|
|
820
|
+
] })
|
|
821
|
+
] }, c.id);
|
|
822
|
+
}) : jsx2.jsx("div", { className: "wb-msg", children: t("sync_no_conflicts") })
|
|
823
|
+
] })
|
|
824
|
+
] });
|
|
825
|
+
}
|
|
826
|
+
function BackupTab2(props) {
|
|
827
|
+
var t = props.t;
|
|
828
|
+
var lang = props.lang;
|
|
829
|
+
var addons = props.addons || [];
|
|
830
|
+
var exportable = addons.filter(function(a2) {
|
|
831
|
+
return a2 && a2.backup && a2.backup.export;
|
|
832
|
+
});
|
|
833
|
+
var idsKey = exportable.map(function(a2) {
|
|
834
|
+
return a2.id;
|
|
835
|
+
}).join(",");
|
|
836
|
+
var st = react2.useState({});
|
|
837
|
+
var selected = st[0];
|
|
838
|
+
var setSelected = st[1];
|
|
839
|
+
var st2 = react2.useState("");
|
|
840
|
+
var busy = st2[0];
|
|
841
|
+
var setBusy = st2[1];
|
|
842
|
+
var st3 = react2.useState("");
|
|
843
|
+
var msg = st3[0];
|
|
844
|
+
var setMsg = st3[1];
|
|
845
|
+
var st4 = react2.useState(null);
|
|
846
|
+
var report = st4[0];
|
|
847
|
+
var setReport = st4[1];
|
|
848
|
+
var st5 = react2.useState(null);
|
|
849
|
+
var exported = st5[0];
|
|
850
|
+
var setExported = st5[1];
|
|
851
|
+
var st6 = react2.useState({});
|
|
852
|
+
var policies = st6[0];
|
|
853
|
+
var setPolicies = st6[1];
|
|
854
|
+
var st7 = react2.useState({});
|
|
855
|
+
var openConfig = st7[0];
|
|
856
|
+
var setOpenConfig = st7[1];
|
|
857
|
+
var fileRef = react2.useRef(null);
|
|
858
|
+
react2.useEffect(function() {
|
|
859
|
+
setSelected(function(prev) {
|
|
860
|
+
var next = {};
|
|
861
|
+
var changed = false;
|
|
862
|
+
exportable.forEach(function(a2) {
|
|
863
|
+
if (prev[a2.id]) next[a2.id] = true;
|
|
864
|
+
else next[a2.id] = true;
|
|
865
|
+
if (!prev[a2.id]) changed = true;
|
|
866
|
+
});
|
|
867
|
+
Object.keys(prev).forEach(function(id) {
|
|
868
|
+
if (!exportable.some(function(a2) {
|
|
869
|
+
return a2.id === id;
|
|
870
|
+
})) changed = true;
|
|
871
|
+
});
|
|
872
|
+
return changed ? next : prev;
|
|
873
|
+
});
|
|
874
|
+
}, [idsKey]);
|
|
875
|
+
var allSelected = exportable.length > 0 && exportable.every(function(a2) {
|
|
876
|
+
return selected[a2.id];
|
|
877
|
+
});
|
|
878
|
+
function toggle(id) {
|
|
879
|
+
var next = Object.assign({}, selected);
|
|
880
|
+
next[id] = !next[id];
|
|
881
|
+
setSelected(next);
|
|
882
|
+
}
|
|
883
|
+
function selectAll(flag) {
|
|
884
|
+
var next = {};
|
|
885
|
+
exportable.forEach(function(a2) {
|
|
886
|
+
next[a2.id] = flag;
|
|
887
|
+
});
|
|
888
|
+
setSelected(next);
|
|
889
|
+
}
|
|
890
|
+
function policyOf(id) {
|
|
891
|
+
return policies[id] || "newest";
|
|
892
|
+
}
|
|
893
|
+
function policyLabel(policy) {
|
|
894
|
+
if (policy === "skip") return t("backup_dup_skip");
|
|
895
|
+
if (policy === "overwrite") return t("backup_dup_overwrite");
|
|
896
|
+
return t("backup_dup_newest");
|
|
897
|
+
}
|
|
898
|
+
function setPolicy(id, value) {
|
|
899
|
+
setPolicies(function(prev) {
|
|
900
|
+
var next = Object.assign({}, prev);
|
|
901
|
+
next[id] = value;
|
|
902
|
+
return next;
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
function toggleConfig(id) {
|
|
906
|
+
setOpenConfig(function(prev) {
|
|
907
|
+
var next = Object.assign({}, prev);
|
|
908
|
+
next[id] = !next[id];
|
|
909
|
+
return next;
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
function statusLabel(status) {
|
|
913
|
+
if (status === "ok") return t("backup_ok");
|
|
914
|
+
if (status === "partial") return t("backup_partial");
|
|
915
|
+
if (status === "skipped") return t("backup_skipped_status");
|
|
916
|
+
return t("backup_failed_status");
|
|
917
|
+
}
|
|
918
|
+
function doExport() {
|
|
919
|
+
if (busy) return;
|
|
920
|
+
var chosen = exportable.filter(function(a2) {
|
|
921
|
+
return selected[a2.id];
|
|
922
|
+
});
|
|
923
|
+
var ids = chosen.map(function(a2) {
|
|
924
|
+
return a2.id;
|
|
925
|
+
});
|
|
926
|
+
if (!ids.length) {
|
|
927
|
+
setMsg(t("backup_select_required"));
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
setBusy("export");
|
|
931
|
+
setMsg("");
|
|
932
|
+
setReport(null);
|
|
933
|
+
setExported(null);
|
|
934
|
+
var url = "/workbench/api/backup/export?modules=" + ids.map(encodeURIComponent).join(",");
|
|
935
|
+
fetch(url).then(function(r) {
|
|
936
|
+
if (!r.ok) {
|
|
937
|
+
return r.json().catch(function() {
|
|
938
|
+
return {};
|
|
939
|
+
}).then(function(j) {
|
|
940
|
+
throw new Error(j && j.error || "HTTP " + r.status);
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
var cd = r.headers.get("content-disposition") || "";
|
|
944
|
+
var m = /filename="?([^";]+)"?/.exec(cd);
|
|
945
|
+
var name = m ? m[1] : "dsh-workbench-backup.zip";
|
|
946
|
+
return r.blob().then(function(blob) {
|
|
947
|
+
var href = URL.createObjectURL(blob);
|
|
948
|
+
var a2 = document.createElement("a");
|
|
949
|
+
a2.href = href;
|
|
950
|
+
a2.download = name;
|
|
951
|
+
document.body.appendChild(a2);
|
|
952
|
+
a2.click();
|
|
953
|
+
a2.remove();
|
|
954
|
+
setTimeout(function() {
|
|
955
|
+
URL.revokeObjectURL(href);
|
|
956
|
+
}, 1500);
|
|
957
|
+
setMsg(t("backup_download_started"));
|
|
958
|
+
var rows = [];
|
|
959
|
+
chosen.forEach(function(a3) {
|
|
960
|
+
var tables = a3.tables || [];
|
|
961
|
+
if (!tables.length) rows.push({ id: a3.id + ":*", table: "\u2014", module: a3.title || a3.id, version: a3.version });
|
|
962
|
+
tables.forEach(function(table) {
|
|
963
|
+
rows.push({ id: a3.id + ":" + table, table, module: a3.title || a3.id, version: a3.version });
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
setExported(rows);
|
|
967
|
+
});
|
|
968
|
+
}).catch(function(e) {
|
|
969
|
+
setMsg(t("backup_export_failed") + ": " + String(e && e.message || e));
|
|
970
|
+
}).then(function() {
|
|
971
|
+
setBusy("");
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function doImport(ev) {
|
|
975
|
+
var file = ev.target.files && ev.target.files[0];
|
|
976
|
+
ev.target.value = "";
|
|
977
|
+
if (!file || busy) return;
|
|
978
|
+
setBusy("import");
|
|
979
|
+
setMsg("");
|
|
980
|
+
setReport(null);
|
|
981
|
+
var policyMap = {};
|
|
982
|
+
exportable.forEach(function(a2) {
|
|
983
|
+
policyMap[a2.id] = policyOf(a2.id);
|
|
984
|
+
});
|
|
985
|
+
fetch("/workbench/api/backup/import", { method: "POST", headers: { "content-type": "application/zip", "x-wb-backup-policy": JSON.stringify(policyMap) }, body: file }).then(function(r) {
|
|
986
|
+
if (r.status === 422) {
|
|
987
|
+
return r.json().catch(function() {
|
|
988
|
+
return {};
|
|
989
|
+
}).then(function() {
|
|
990
|
+
setMsg(t("backup_incompatible"));
|
|
991
|
+
return null;
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
return r.json().catch(function() {
|
|
995
|
+
return null;
|
|
996
|
+
}).then(function(j) {
|
|
997
|
+
if (!r.ok) throw new Error(j && j.error || "HTTP " + r.status);
|
|
998
|
+
if (!j) throw new Error(t("backup_invalid"));
|
|
999
|
+
setReport(j);
|
|
1000
|
+
setMsg(j.ok ? t("backup_import_done") : t("backup_import_result"));
|
|
1001
|
+
return j;
|
|
1002
|
+
});
|
|
1003
|
+
}).catch(function(e) {
|
|
1004
|
+
setMsg(t("backup_import_failed") + ": " + String(e && e.message || e));
|
|
1005
|
+
}).then(function() {
|
|
1006
|
+
setBusy("");
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
function moduleCaps(a2) {
|
|
1010
|
+
var caps = [];
|
|
1011
|
+
if (a2.backup && a2.backup.export) caps.push(t("backup_cap_export"));
|
|
1012
|
+
if (a2.backup && a2.backup.import) caps.push(t("backup_cap_import"));
|
|
1013
|
+
return caps.join(" \xB7 ");
|
|
1014
|
+
}
|
|
1015
|
+
return jsx2.jsxs("div", { className: "wb-backup", children: [
|
|
1016
|
+
jsx2.jsxs("div", { className: "wb-card", children: [
|
|
1017
|
+
jsx2.jsxs("div", { className: "wb-sec", children: [
|
|
1018
|
+
jsx2.jsx("h3", { children: t("backup_modules") }),
|
|
1019
|
+
jsx2.jsxs("div", { className: "wb-backup-actions", children: [
|
|
1020
|
+
jsx2.jsx("button", { className: "wb-btn ghost", disabled: !exportable.length, onClick: function() {
|
|
1021
|
+
selectAll(true);
|
|
1022
|
+
}, children: t("backup_select_all") }),
|
|
1023
|
+
jsx2.jsx("button", { className: "wb-btn ghost", disabled: !exportable.length, onClick: function() {
|
|
1024
|
+
selectAll(false);
|
|
1025
|
+
}, children: t("backup_clear") })
|
|
1026
|
+
] })
|
|
1027
|
+
] }),
|
|
1028
|
+
exportable.length ? jsx2.jsx("div", { className: "wb-stack", style: { marginTop: 10 }, children: exportable.map(function(a2) {
|
|
1029
|
+
var open = !!openConfig[a2.id];
|
|
1030
|
+
return jsx2.jsxs(react2.Fragment, { children: [
|
|
1031
|
+
jsx2.jsxs("div", { className: "wb-backup-row" + (open ? " open" : ""), children: [
|
|
1032
|
+
jsx2.jsxs("label", { className: "wb-backup-row-main", children: [
|
|
1033
|
+
jsx2.jsx("input", { type: "checkbox", checked: !!selected[a2.id], onChange: function() {
|
|
1034
|
+
toggle(a2.id);
|
|
1035
|
+
} }),
|
|
1036
|
+
jsx2.jsxs("span", { className: "wb-backup-main", children: [
|
|
1037
|
+
jsx2.jsxs("span", { className: "wb-backup-name", children: [a2.title || a2.id, jsx2.jsx("span", { className: "wb-badge", children: "v" + (a2.version || "?") })] }),
|
|
1038
|
+
jsx2.jsx("span", { className: "wb-backup-meta", children: moduleCaps(a2) }),
|
|
1039
|
+
a2.description ? jsx2.jsx("span", { className: "wb-backup-meta", children: a2.description }) : null
|
|
1040
|
+
] })
|
|
1041
|
+
] }),
|
|
1042
|
+
jsx2.jsx("button", {
|
|
1043
|
+
type: "button",
|
|
1044
|
+
className: "wb-backup-gear" + (open ? " active" : ""),
|
|
1045
|
+
title: t("backup_dup_policy"),
|
|
1046
|
+
"aria-label": t("backup_dup_policy"),
|
|
1047
|
+
"aria-expanded": open,
|
|
1048
|
+
onClick: function() {
|
|
1049
|
+
toggleConfig(a2.id);
|
|
1050
|
+
},
|
|
1051
|
+
children: "\u2699"
|
|
1052
|
+
})
|
|
1053
|
+
] }),
|
|
1054
|
+
open ? jsx2.jsxs("div", { className: "wb-backup-config", children: [
|
|
1055
|
+
jsx2.jsx("span", { className: "wb-backup-config-label", children: t("backup_dup_policy") }),
|
|
1056
|
+
jsx2.jsx("select", {
|
|
1057
|
+
className: "wb-select",
|
|
1058
|
+
value: policyOf(a2.id),
|
|
1059
|
+
onChange: function(e) {
|
|
1060
|
+
setPolicy(a2.id, e.target.value);
|
|
1061
|
+
},
|
|
1062
|
+
children: [
|
|
1063
|
+
jsx2.jsx("option", { value: "newest", children: t("backup_dup_newest") }),
|
|
1064
|
+
jsx2.jsx("option", { value: "skip", children: t("backup_dup_skip") }),
|
|
1065
|
+
jsx2.jsx("option", { value: "overwrite", children: t("backup_dup_overwrite") })
|
|
1066
|
+
]
|
|
1067
|
+
}),
|
|
1068
|
+
jsx2.jsx("span", { className: "wb-backup-note", children: t("backup_dup_hint") })
|
|
1069
|
+
] }) : null
|
|
1070
|
+
] }, a2.id);
|
|
1071
|
+
}) }) : jsx2.jsx("div", { className: "wb-msg", children: t("backup_no_modules") }),
|
|
1072
|
+
jsx2.jsxs("div", { className: "wb-backup-actions", style: { marginTop: 12 }, children: [
|
|
1073
|
+
jsx2.jsx("button", { className: "wb-btn", disabled: !!busy || !exportable.length, onClick: doExport, children: busy === "export" ? t("backup_exporting") : t("backup_export") }),
|
|
1074
|
+
jsx2.jsx("button", { className: "wb-btn ghost", disabled: !!busy, onClick: function() {
|
|
1075
|
+
if (fileRef.current) fileRef.current.click();
|
|
1076
|
+
}, children: busy === "import" ? t("backup_importing") : t("backup_import") }),
|
|
1077
|
+
jsx2.jsx("span", { className: "wb-backup-note", children: t("backup_file_hint") })
|
|
1078
|
+
] }),
|
|
1079
|
+
jsx2.jsx("input", { ref: fileRef, type: "file", accept: ".zip,application/zip", className: "wb-backup-file", onChange: doImport }),
|
|
1080
|
+
msg ? jsx2.jsx("div", { className: "wb-msg", style: { textAlign: "left", padding: "10px 0 0", opacity: 0.8 }, children: msg }) : null
|
|
1081
|
+
] }),
|
|
1082
|
+
exported ? jsx2.jsxs("div", { className: "wb-card wb-backup-report", children: [
|
|
1083
|
+
jsx2.jsxs("div", { className: "wb-sec", children: [
|
|
1084
|
+
jsx2.jsx("h3", { children: t("backup_export_result") }),
|
|
1085
|
+
jsx2.jsx("span", { className: "wb-hint", children: t("backup_download_started") })
|
|
1086
|
+
] }),
|
|
1087
|
+
jsx2.jsx("div", { className: "wb-stack", children: exported.map(function(a2) {
|
|
1088
|
+
return jsx2.jsxs("div", { className: "wb-backup-result-row", children: [
|
|
1089
|
+
jsx2.jsx("span", { className: "wb-backup-table", children: a2.table }),
|
|
1090
|
+
jsx2.jsxs("span", { className: "wb-backup-meta", children: [a2.module, jsx2.jsx("span", { className: "wb-badge", children: "v" + (a2.version || "?") })] })
|
|
1091
|
+
] }, a2.id);
|
|
1092
|
+
}) })
|
|
1093
|
+
] }) : null,
|
|
1094
|
+
report ? jsx2.jsxs("div", { className: "wb-card wb-backup-report", children: [
|
|
1095
|
+
jsx2.jsxs("div", { className: "wb-sec", children: [
|
|
1096
|
+
jsx2.jsx("h3", { children: t("backup_import_result") }),
|
|
1097
|
+
jsx2.jsxs("span", { className: "wb-hint", children: [
|
|
1098
|
+
t("backup_summary"),
|
|
1099
|
+
": ",
|
|
1100
|
+
t("backup_ok") + " " + report.summary.ok + " \xB7 ",
|
|
1101
|
+
t("backup_partial") + " " + report.summary.partial + " \xB7 ",
|
|
1102
|
+
t("backup_failed") + " " + report.summary.failed + " \xB7 ",
|
|
1103
|
+
t("backup_skipped") + " " + report.summary.skipped
|
|
1104
|
+
] })
|
|
1105
|
+
] }),
|
|
1106
|
+
jsx2.jsxs("div", { className: "wb-backup-meta", children: [
|
|
1107
|
+
t("backup_exported_at") + ": " + (report.exportedAt || "?"),
|
|
1108
|
+
" \xB7 " + t("backup_shell_version") + ": " + (report.shellVersion || "?"),
|
|
1109
|
+
" \xB7 " + t("backup_format") + ": v" + report.formatVersion
|
|
1110
|
+
] }),
|
|
1111
|
+
jsx2.jsx("table", { className: "wb-backup-table", children: [
|
|
1112
|
+
jsx2.jsxs("thead", { children: [
|
|
1113
|
+
jsx2.jsxs("tr", { children: [
|
|
1114
|
+
jsx2.jsx("th", { children: t("backup_detail") }),
|
|
1115
|
+
jsx2.jsx("th", { children: t("backup_status") }),
|
|
1116
|
+
jsx2.jsx("th", { children: t("backup_policy") }),
|
|
1117
|
+
jsx2.jsx("th", { children: t("backup_imported") }),
|
|
1118
|
+
jsx2.jsx("th", { children: t("backup_skipped") }),
|
|
1119
|
+
jsx2.jsx("th", { children: t("backup_failed") })
|
|
1120
|
+
] })
|
|
1121
|
+
] }),
|
|
1122
|
+
jsx2.jsxs("tbody", { children: (report.results || []).map(function(r) {
|
|
1123
|
+
return jsx2.jsxs("tr", { children: [
|
|
1124
|
+
jsx2.jsxs("td", { children: [
|
|
1125
|
+
jsx2.jsx("div", { children: r.title || r.id }),
|
|
1126
|
+
r.message ? jsx2.jsx("div", { className: "wb-backup-meta", children: r.message }) : null
|
|
1127
|
+
] }),
|
|
1128
|
+
jsx2.jsx("td", { children: jsx2.jsx("span", { className: "wb-backup-status " + r.status, children: statusLabel(r.status) }) }),
|
|
1129
|
+
jsx2.jsx("td", { className: "wb-backup-meta", children: policyLabel(r.policy) }),
|
|
1130
|
+
jsx2.jsx("td", { className: "num", children: r.imported || 0 }),
|
|
1131
|
+
jsx2.jsx("td", { className: "num", children: r.skipped || 0 }),
|
|
1132
|
+
jsx2.jsx("td", { className: "num", children: r.failed || 0 })
|
|
1133
|
+
] }, r.id);
|
|
1134
|
+
}) })
|
|
1135
|
+
] })
|
|
1136
|
+
] }) : null
|
|
1137
|
+
] });
|
|
1138
|
+
}
|
|
1139
|
+
function AuditTab2(props) {
|
|
1140
|
+
var t = props.t;
|
|
1141
|
+
var fst = react2.useState({ action: "", actor: "", ok: "", q: "", since: "", until: "" });
|
|
1142
|
+
var filters = fst[0];
|
|
1143
|
+
var setFilters = fst[1];
|
|
1144
|
+
var pst = react2.useState(1);
|
|
1145
|
+
var page = pst[0];
|
|
1146
|
+
var setPage = pst[1];
|
|
1147
|
+
var zst = react2.useState(50);
|
|
1148
|
+
var pageSize = zst[0];
|
|
1149
|
+
var setPageSize = zst[1];
|
|
1150
|
+
var dst = react2.useState(null);
|
|
1151
|
+
var data = dst[0];
|
|
1152
|
+
var setData = dst[1];
|
|
1153
|
+
var sst = react2.useState(null);
|
|
1154
|
+
var stats = sst[0];
|
|
1155
|
+
var setStats = sst[1];
|
|
1156
|
+
var bst = react2.useState(false);
|
|
1157
|
+
var busy = bst[0];
|
|
1158
|
+
var setBusy = bst[1];
|
|
1159
|
+
var est = react2.useState("");
|
|
1160
|
+
var err = est[0];
|
|
1161
|
+
var setErr = est[1];
|
|
1162
|
+
var ost = react2.useState(null);
|
|
1163
|
+
var openId = ost[0];
|
|
1164
|
+
var setOpenId = ost[1];
|
|
1165
|
+
var latest = react2.useRef(0);
|
|
1166
|
+
var currentFilters = react2.useRef(filters);
|
|
1167
|
+
function query(p, size, filters2) {
|
|
1168
|
+
var qs = new URLSearchParams();
|
|
1169
|
+
if (filters2.action) qs.set("actionPrefix", filters2.action);
|
|
1170
|
+
if (filters2.actor) qs.set("actor", filters2.actor);
|
|
1171
|
+
if (filters2.ok !== "") qs.set("ok", filters2.ok);
|
|
1172
|
+
if (filters2.q) qs.set("q", filters2.q);
|
|
1173
|
+
if (filters2.since) qs.set("since", filters2.since);
|
|
1174
|
+
if (filters2.until) qs.set("until", filters2.until);
|
|
1175
|
+
qs.set("page", String(p));
|
|
1176
|
+
qs.set("pageSize", String(size || pageSize));
|
|
1177
|
+
qs.set("stats", "1");
|
|
1178
|
+
qs.set("rangeDays", "30");
|
|
1179
|
+
return qs.toString();
|
|
1180
|
+
}
|
|
1181
|
+
function load(p, size, selected) {
|
|
1182
|
+
var request = ++latest.current;
|
|
1183
|
+
setData(null);
|
|
1184
|
+
setOpenId(null);
|
|
1185
|
+
setPage(p || page);
|
|
1186
|
+
setBusy(true);
|
|
1187
|
+
setErr("");
|
|
1188
|
+
fetch("/workbench/api/audit?" + query(p || page, size, selected || currentFilters.current)).then(function(r) {
|
|
1189
|
+
return r.json();
|
|
1190
|
+
}).then(function(j) {
|
|
1191
|
+
if (request !== latest.current) return;
|
|
1192
|
+
if (!j || j.ok === false) throw new Error(j && j.error || t("audit_load_failed"));
|
|
1193
|
+
setData(j);
|
|
1194
|
+
setStats(j.stats || null);
|
|
1195
|
+
setPage(j.page || 1);
|
|
1196
|
+
}).catch(function(e) {
|
|
1197
|
+
if (request === latest.current) setErr(String(e && e.message || e));
|
|
1198
|
+
}).then(function() {
|
|
1199
|
+
if (request === latest.current) setBusy(false);
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
react2.useEffect(function() {
|
|
1203
|
+
load(1);
|
|
1204
|
+
return function() {
|
|
1205
|
+
latest.current++;
|
|
1206
|
+
};
|
|
1207
|
+
}, []);
|
|
1208
|
+
function applyFilters(next) {
|
|
1209
|
+
currentFilters.current = next;
|
|
1210
|
+
setFilters(next);
|
|
1211
|
+
load(1, pageSize, next);
|
|
1212
|
+
}
|
|
1213
|
+
function field(key, value) {
|
|
1214
|
+
applyFilters(Object.assign({}, currentFilters.current, { [key]: value }));
|
|
1215
|
+
}
|
|
1216
|
+
function clearFilters() {
|
|
1217
|
+
applyFilters({ action: "", actor: "", ok: "", q: "", since: "", until: "" });
|
|
1218
|
+
}
|
|
1219
|
+
function search() {
|
|
1220
|
+
load(1);
|
|
1221
|
+
}
|
|
1222
|
+
function setSize(n) {
|
|
1223
|
+
var size = Math.max(10, Math.min(200, Number(n) || 50));
|
|
1224
|
+
setPageSize(size);
|
|
1225
|
+
load(1, size);
|
|
1226
|
+
}
|
|
1227
|
+
function fmtTime(ms) {
|
|
1228
|
+
try {
|
|
1229
|
+
var d = new Date(Number(ms));
|
|
1230
|
+
return d.toLocaleString();
|
|
1231
|
+
} catch (e) {
|
|
1232
|
+
return String(ms);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
function shortJson(text, limit) {
|
|
1236
|
+
if (!text) return "";
|
|
1237
|
+
return String(text).length > (limit || 400) ? String(text).slice(0, limit || 400) + "\u2026" : String(text);
|
|
1238
|
+
}
|
|
1239
|
+
var active = Object.keys(filters).filter(function(key) {
|
|
1240
|
+
return filters[key] !== "";
|
|
1241
|
+
});
|
|
1242
|
+
var labels = { action: "audit_action_prefix", actor: "audit_actor", ok: "audit_ok", q: "audit_q", since: "audit_since", until: "audit_until" };
|
|
1243
|
+
function labeled(key, control) {
|
|
1244
|
+
return jsx2.jsxs("label", { className: "wb-audit-field", children: [jsx2.jsx("span", { children: t(labels[key]) }), control] }, key);
|
|
1245
|
+
}
|
|
1246
|
+
var summary = active.map(function(key) {
|
|
1247
|
+
return t(labels[key]) + "=" + (key === "ok" ? t(filters.ok === "true" ? "audit_ok_only" : "audit_fail_only") : filters[key]);
|
|
1248
|
+
}).join(" \xB7 ");
|
|
1249
|
+
var records = data && data.records || [];
|
|
1250
|
+
var total = data ? data.total : 0;
|
|
1251
|
+
var totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
1252
|
+
var statsText = stats ? t("audit_stats") + "\uFF1A" + totalOf(stats) + " \xB7 " + t("audit_failed") + " " + (stats.failed || 0) : "";
|
|
1253
|
+
function totalOf(s) {
|
|
1254
|
+
return t("audit_total") + " " + (s.total || 0);
|
|
1255
|
+
}
|
|
1256
|
+
return jsx2.jsxs(react2.Fragment, { children: [
|
|
1257
|
+
jsx2.jsxs("div", { className: "wb-card", children: [
|
|
1258
|
+
jsx2.jsxs("div", { className: "wb-sec", children: [
|
|
1259
|
+
jsx2.jsx("h3", { children: t("audit_filters") }),
|
|
1260
|
+
jsx2.jsx("span", { className: "wb-hint", children: statsText })
|
|
1261
|
+
] }),
|
|
1262
|
+
jsx2.jsxs("form", { className: "wb-audit-filters", onSubmit: function(e) {
|
|
1263
|
+
e.preventDefault();
|
|
1264
|
+
search();
|
|
1265
|
+
}, children: [
|
|
1266
|
+
labeled("action", jsx2.jsx("input", { className: "wb-input", placeholder: t("audit_action_prefix"), value: filters.action, onChange: function(e) {
|
|
1267
|
+
field("action", e.target.value);
|
|
1268
|
+
} })),
|
|
1269
|
+
labeled("actor", jsx2.jsx("select", { className: "wb-select", "aria-label": t("audit_actor"), value: filters.actor, onChange: function(e) {
|
|
1270
|
+
field("actor", e.target.value);
|
|
1271
|
+
}, children: [
|
|
1272
|
+
jsx2.jsx("option", { value: "", children: t("audit_all") + " \xB7 " + t("audit_actor") }),
|
|
1273
|
+
jsx2.jsx("option", { value: "agent", children: "agent" }),
|
|
1274
|
+
jsx2.jsx("option", { value: "ui", children: "ui" }),
|
|
1275
|
+
jsx2.jsx("option", { value: "sync", children: "sync" })
|
|
1276
|
+
] })),
|
|
1277
|
+
labeled("ok", jsx2.jsx("select", { className: "wb-select", "aria-label": t("audit_ok"), value: filters.ok, onChange: function(e) {
|
|
1278
|
+
field("ok", e.target.value);
|
|
1279
|
+
}, children: [
|
|
1280
|
+
jsx2.jsx("option", { value: "", children: t("audit_all") + " \xB7 " + t("audit_ok") }),
|
|
1281
|
+
jsx2.jsx("option", { value: "true", children: t("audit_ok_only") }),
|
|
1282
|
+
jsx2.jsx("option", { value: "false", children: t("audit_fail_only") })
|
|
1283
|
+
] })),
|
|
1284
|
+
labeled("q", jsx2.jsx("input", { className: "wb-input", placeholder: t("audit_q"), value: filters.q, onChange: function(e) {
|
|
1285
|
+
field("q", e.target.value);
|
|
1286
|
+
} })),
|
|
1287
|
+
labeled("since", jsx2.jsx("input", { className: "wb-input", type: "date", title: t("audit_since"), value: filters.since, onChange: function(e) {
|
|
1288
|
+
field("since", e.target.value);
|
|
1289
|
+
} })),
|
|
1290
|
+
labeled("until", jsx2.jsx("input", { className: "wb-input", type: "date", title: t("audit_until"), value: filters.until, onChange: function(e) {
|
|
1291
|
+
field("until", e.target.value);
|
|
1292
|
+
} })),
|
|
1293
|
+
jsx2.jsx("button", { className: "wb-btn", type: "submit", disabled: busy, children: busy ? "\u2026" : t("audit_search") }),
|
|
1294
|
+
jsx2.jsx("button", { className: "wb-btn ghost", type: "button", disabled: busy, onClick: function() {
|
|
1295
|
+
load(page);
|
|
1296
|
+
}, children: t("audit_refresh") })
|
|
1297
|
+
] }),
|
|
1298
|
+
jsx2.jsxs("div", { className: "wb-audit-summary", role: "status", "aria-live": "polite", children: [
|
|
1299
|
+
jsx2.jsx("span", { children: (summary ? t("audit_active") + "\uFF1A" + summary : t("audit_all")) + " \xB7 " + (busy ? t("audit_loading") : err ? t("audit_load_failed") : t("audit_total") + " " + total) }),
|
|
1300
|
+
active.length ? jsx2.jsx("button", { type: "button", className: "wb-btn ghost", onClick: clearFilters, children: t("audit_clear") }) : null
|
|
1301
|
+
] }),
|
|
1302
|
+
err ? jsx2.jsx("div", { className: "wb-err", style: { marginTop: 10 }, children: err }) : null,
|
|
1303
|
+
jsx2.jsx("div", { className: "wb-hint", style: { marginTop: 10 }, children: t("audit_reads_hint") + " \xB7 " + t("audit_retention") })
|
|
1304
|
+
] }),
|
|
1305
|
+
jsx2.jsxs("div", { className: "wb-card", children: [
|
|
1306
|
+
jsx2.jsxs("div", { className: "wb-sec", children: [
|
|
1307
|
+
jsx2.jsx("h3", { children: t("tab_audit") }),
|
|
1308
|
+
jsx2.jsx("span", { className: "wb-hint", children: (busy ? t("audit_loading") : err ? t("audit_load_failed") : t("audit_total") + " " + total) + " \xB7 " + page + " / " + totalPages + " " + t("audit_page") })
|
|
1309
|
+
] }),
|
|
1310
|
+
records.length ? jsx2.jsx("div", { style: { overflowX: "auto" }, children: jsx2.jsxs("table", { className: "wb-audit-table", children: [
|
|
1311
|
+
jsx2.jsx("thead", { children: jsx2.jsxs("tr", { children: [
|
|
1312
|
+
jsx2.jsx("th", { children: t("audit_time") }),
|
|
1313
|
+
jsx2.jsx("th", { children: t("audit_actor") }),
|
|
1314
|
+
jsx2.jsx("th", { children: t("audit_action") }),
|
|
1315
|
+
jsx2.jsx("th", { children: t("audit_ok") }),
|
|
1316
|
+
jsx2.jsx("th", { children: t("audit_target") }),
|
|
1317
|
+
jsx2.jsx("th", { children: t("audit_duration") })
|
|
1318
|
+
] }) }),
|
|
1319
|
+
jsx2.jsx("tbody", { children: records.map(function(r) {
|
|
1320
|
+
var open = openId === r.id;
|
|
1321
|
+
return jsx2.jsxs(react2.Fragment, { children: [
|
|
1322
|
+
jsx2.jsxs("tr", { className: "wb-audit-row", tabIndex: 0, "aria-expanded": open, onKeyDown: function(e) {
|
|
1323
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1324
|
+
e.preventDefault();
|
|
1325
|
+
setOpenId(open ? null : r.id);
|
|
1326
|
+
}
|
|
1327
|
+
}, onClick: function() {
|
|
1328
|
+
setOpenId(open ? null : r.id);
|
|
1329
|
+
}, children: [
|
|
1330
|
+
jsx2.jsx("td", { className: "wb-audit-mono", children: fmtTime(r.at) }),
|
|
1331
|
+
jsx2.jsx("td", { children: jsx2.jsx("span", { className: "wb-badge", children: r.actor }) }),
|
|
1332
|
+
jsx2.jsx("td", { className: "wb-audit-mono", children: r.action }),
|
|
1333
|
+
jsx2.jsx("td", { children: r.ok ? jsx2.jsx("span", { className: "wb-audit-ok", children: "\u2713" }) : jsx2.jsx("span", { className: "wb-audit-fail", children: "\u2717" }) }),
|
|
1334
|
+
jsx2.jsx("td", { className: "wb-audit-mono wb-audit-dim", children: r.target || "\u2014" }),
|
|
1335
|
+
jsx2.jsx("td", { className: "wb-audit-dim", children: (r.durationMs || 0) + " ms" })
|
|
1336
|
+
] }),
|
|
1337
|
+
open ? jsx2.jsx("tr", { children: jsx2.jsx("td", { colSpan: 6, children: jsx2.jsxs("div", { children: [
|
|
1338
|
+
r.error ? jsx2.jsxs("div", { children: [jsx2.jsx("div", { className: "wb-audit-dim", children: t("audit_error") }), jsx2.jsx("div", { className: "wb-audit-pre", children: r.error })] }) : null,
|
|
1339
|
+
jsx2.jsxs("div", { children: [jsx2.jsx("div", { className: "wb-audit-dim", children: t("audit_detail") + " \xB7 id=" + r.id }), jsx2.jsx("div", { className: "wb-audit-pre", children: shortJson(r.args, 1200) || "{}" }), r.result ? jsx2.jsx("div", { className: "wb-audit-pre", children: shortJson(r.result, 1200) }) : null] })
|
|
1340
|
+
] }) }) }) : null
|
|
1341
|
+
] }, r.id);
|
|
1342
|
+
}) })
|
|
1343
|
+
] }) }) : jsx2.jsxs("div", { className: "wb-msg", children: [busy ? t("audit_loading") : err ? t("audit_load_failed") : t("audit_empty"), !busy && !err && active.length ? jsx2.jsx("button", { className: "wb-btn ghost", onClick: clearFilters, children: t("audit_clear") }) : null] }),
|
|
1344
|
+
jsx2.jsxs("div", { className: "wb-audit-pager", children: [
|
|
1345
|
+
jsx2.jsx("button", { className: "wb-btn ghost", disabled: busy || page <= 1, onClick: function() {
|
|
1346
|
+
load(page - 1);
|
|
1347
|
+
}, children: t("audit_prev") }),
|
|
1348
|
+
jsx2.jsx("button", { className: "wb-btn ghost", disabled: busy || page >= totalPages, onClick: function() {
|
|
1349
|
+
load(page + 1);
|
|
1350
|
+
}, children: t("audit_next") }),
|
|
1351
|
+
jsx2.jsx("select", { className: "wb-select", "aria-label": t("audit_page_size"), value: String(pageSize), onChange: function(e) {
|
|
1352
|
+
setSize(e.target.value);
|
|
1353
|
+
}, children: [20, 50, 100, 200].map(function(n) {
|
|
1354
|
+
return jsx2.jsx("option", { value: String(n), children: n + " / " + t("audit_page") }, n);
|
|
1355
|
+
}) })
|
|
1356
|
+
] })
|
|
1357
|
+
] })
|
|
1358
|
+
] });
|
|
1359
|
+
}
|
|
1360
|
+
return { AccountTab: AccountTab2, BackupTab: BackupTab2, AuditTab: AuditTab2 };
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
|
|
1365
|
+
// packages/shell/client/view-tabs.cjs
|
|
1366
|
+
var require_view_tabs = __commonJS({
|
|
1367
|
+
"packages/shell/client/view-tabs.cjs"(exports2, module2) {
|
|
1368
|
+
"use strict";
|
|
1369
|
+
module2.exports = function createViewTabs(react2, pickTitle2) {
|
|
1370
|
+
var h2 = react2.createElement;
|
|
1371
|
+
return function ViewTabs2(props) {
|
|
1372
|
+
if (props.views.length < 2) return null;
|
|
1373
|
+
return h2("div", { className: "wb-page-tabs" }, props.views.map(function(view) {
|
|
1374
|
+
var title = pickTitle2(view.title, props.lang) || view.id;
|
|
1375
|
+
var on = props.activeView && view.id === props.activeView.id;
|
|
1376
|
+
var Icon = typeof view.icon === "function" ? view.icon : null;
|
|
1377
|
+
return h2("button", {
|
|
1378
|
+
key: view.id,
|
|
1379
|
+
type: "button",
|
|
1380
|
+
className: "wb-tab" + (on ? " on" : ""),
|
|
1381
|
+
"aria-label": title,
|
|
1382
|
+
onClick: function() {
|
|
1383
|
+
props.go("addon:" + props.addonId + ":" + view.id);
|
|
1384
|
+
}
|
|
1385
|
+
}, Icon ? h2("span", {
|
|
1386
|
+
"aria-hidden": true,
|
|
1387
|
+
style: { display: "inline-flex", verticalAlign: "middle", marginRight: 6 }
|
|
1388
|
+
}, h2(Icon, { size: 14, strokeWidth: 2, "aria-hidden": true })) : null, title);
|
|
1389
|
+
}));
|
|
1390
|
+
};
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
|
|
1395
|
+
// packages/shell/client/view-outlet.cjs
|
|
1396
|
+
var require_view_outlet = __commonJS({
|
|
1397
|
+
"packages/shell/client/view-outlet.cjs"(exports2, module2) {
|
|
1398
|
+
"use strict";
|
|
1399
|
+
var React = require("react");
|
|
1400
|
+
var h2 = React.createElement;
|
|
1401
|
+
function Slot(props) {
|
|
1402
|
+
var root = React.useRef(null), scroll = React.useRef([]);
|
|
1403
|
+
React.useLayoutEffect(function() {
|
|
1404
|
+
if (!props.active) return;
|
|
1405
|
+
var positions = scroll.current.slice();
|
|
1406
|
+
function restore() {
|
|
1407
|
+
positions.forEach(function(p) {
|
|
1408
|
+
p.node.scrollTop = p.top;
|
|
1409
|
+
p.node.scrollLeft = p.left;
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
restore();
|
|
1413
|
+
var frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame(restore) : null;
|
|
1414
|
+
function remember() {
|
|
1415
|
+
var positions2 = [], node = root.current;
|
|
1416
|
+
while (node) {
|
|
1417
|
+
positions2.push({ node, top: node.scrollTop, left: node.scrollLeft });
|
|
1418
|
+
node = node.parentElement;
|
|
1419
|
+
}
|
|
1420
|
+
scroll.current = positions2;
|
|
1421
|
+
}
|
|
1422
|
+
document.addEventListener("scroll", remember, true);
|
|
1423
|
+
return function() {
|
|
1424
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
1425
|
+
document.removeEventListener("scroll", remember, true);
|
|
1426
|
+
};
|
|
1427
|
+
}, [props.active]);
|
|
1428
|
+
return h2(
|
|
1429
|
+
"div",
|
|
1430
|
+
{ ref: root, hidden: !props.active, "data-view-id": props.view.id },
|
|
1431
|
+
h2(props.view.component, Object.assign({}, props.viewProps, { active: props.active }))
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
module2.exports = function ViewOutlet2(props) {
|
|
1435
|
+
var kept = React.useRef({});
|
|
1436
|
+
if (props.view.keepAlive) kept.current[props.view.id] = props;
|
|
1437
|
+
var entries = Object.keys(kept.current).map(function(id) {
|
|
1438
|
+
return kept.current[id];
|
|
1439
|
+
});
|
|
1440
|
+
if (!props.view.keepAlive) entries.push(props);
|
|
1441
|
+
return h2(React.Fragment, null, entries.map(function(entry) {
|
|
1442
|
+
return h2(Slot, { key: entry.view.id, view: entry.view, viewProps: entry.viewProps, active: entry.view.id === props.view.id });
|
|
1443
|
+
}));
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
|
|
1448
|
+
// packages/shell/client/client.src.cjs
|
|
1449
|
+
var react = require("react");
|
|
1450
|
+
var jsx = require("react/jsx-runtime");
|
|
1451
|
+
var h = react.createElement;
|
|
1452
|
+
var NS = "workbench";
|
|
1453
|
+
var LOCALE = require_locale();
|
|
1454
|
+
var CSS = require_styles();
|
|
1455
|
+
var registry = /* @__PURE__ */ new Map();
|
|
1456
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
1457
|
+
var apiCache = /* @__PURE__ */ new Map();
|
|
1458
|
+
var addonState = { addons: [], loaded: false, shellVersion: "" };
|
|
1459
|
+
var storeListeners = /* @__PURE__ */ new Set();
|
|
1460
|
+
var cloudStatusListeners = /* @__PURE__ */ new Set();
|
|
1461
|
+
var recordModes = {};
|
|
1462
|
+
var recordListeners = /* @__PURE__ */ new Set();
|
|
1463
|
+
var stream = null;
|
|
1464
|
+
var lastAddonError = null;
|
|
1465
|
+
function setRecordMode(sessionId, enabled) {
|
|
1466
|
+
if (!sessionId) return;
|
|
1467
|
+
recordModes[sessionId] = !!enabled;
|
|
1468
|
+
recordListeners.forEach(function(fn) {
|
|
1469
|
+
try {
|
|
1470
|
+
fn(sessionId, !!enabled);
|
|
1471
|
+
} catch (e) {
|
|
1472
|
+
console.error(e);
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
function notifyStore() {
|
|
1477
|
+
storeListeners.forEach(function(fn) {
|
|
1478
|
+
try {
|
|
1479
|
+
fn();
|
|
1480
|
+
} catch (e) {
|
|
1481
|
+
console.error(e);
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
function notifyCloudStatus() {
|
|
1486
|
+
cloudStatusListeners.forEach(function(fn) {
|
|
1487
|
+
try {
|
|
1488
|
+
fn();
|
|
1489
|
+
} catch (e) {
|
|
1490
|
+
console.error(e);
|
|
1491
|
+
}
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
function broadcast(payload) {
|
|
1495
|
+
listeners.forEach(function(fn) {
|
|
1496
|
+
try {
|
|
1497
|
+
fn(payload);
|
|
1498
|
+
} catch (e) {
|
|
1499
|
+
console.error(e);
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
function apiFor(id) {
|
|
1504
|
+
var cached = apiCache.get(id);
|
|
1505
|
+
if (cached) return cached;
|
|
1506
|
+
var api = {
|
|
1507
|
+
call: function(action, args) {
|
|
1508
|
+
var targetId = id;
|
|
1509
|
+
var name = String(action || "");
|
|
1510
|
+
var dot = name.indexOf(".");
|
|
1511
|
+
if (dot > 0) {
|
|
1512
|
+
var hinted = "wb-addon-" + name.slice(0, dot);
|
|
1513
|
+
if (hinted !== id && registry.has(hinted)) targetId = hinted;
|
|
1514
|
+
}
|
|
1515
|
+
return fetch("/workbench/api/domains/" + encodeURIComponent(targetId) + "/actions/" + encodeURIComponent(action), {
|
|
1516
|
+
method: "POST",
|
|
1517
|
+
headers: { "content-type": "application/json" },
|
|
1518
|
+
body: JSON.stringify(args || {})
|
|
1519
|
+
}).then(function(r) {
|
|
1520
|
+
return r.json();
|
|
1521
|
+
}).catch(function(e) {
|
|
1522
|
+
return { ok: false, error: String(e && e.message || e) };
|
|
1523
|
+
});
|
|
1524
|
+
},
|
|
1525
|
+
// 只读 schema 快照:宿主 /workbench/api/schema 与 actions.list(detail=true) 同源,
|
|
1526
|
+
// 供工作台 Action 页渲染运行时注册;不走 action 执行链路,也不会产生审计记录。
|
|
1527
|
+
schema: function(domain) {
|
|
1528
|
+
var q = domain ? "?domain=" + encodeURIComponent(domain) : "";
|
|
1529
|
+
return fetch("/workbench/api/schema" + q).then(function(r) {
|
|
1530
|
+
return r.json();
|
|
1531
|
+
}).catch(function(e) {
|
|
1532
|
+
return { ok: false, error: String(e && e.message || e) };
|
|
1533
|
+
});
|
|
1534
|
+
},
|
|
1535
|
+
subscribe: function(fn) {
|
|
1536
|
+
listeners.add(fn);
|
|
1537
|
+
return function() {
|
|
1538
|
+
listeners.delete(fn);
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
apiCache.set(id, api);
|
|
1543
|
+
return api;
|
|
1544
|
+
}
|
|
1545
|
+
function registerAddon(mod) {
|
|
1546
|
+
if (!mod || typeof mod.id !== "string" || !Array.isArray(mod.views)) {
|
|
1547
|
+
console.error("[dsh-workbench] registerAddon \u53C2\u6570\u4E0D\u5408\u6CD5", mod);
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
registry.set(mod.id, mod);
|
|
1551
|
+
notifyStore();
|
|
1552
|
+
}
|
|
1553
|
+
function setAddons(list) {
|
|
1554
|
+
addonState.addons = Array.isArray(list) ? list : [];
|
|
1555
|
+
addonState.loaded = true;
|
|
1556
|
+
var alive = {};
|
|
1557
|
+
addonState.addons.forEach(function(a2) {
|
|
1558
|
+
alive[a2.id] = a2;
|
|
1559
|
+
});
|
|
1560
|
+
registry.forEach(function(_m, id) {
|
|
1561
|
+
if (!alive[id]) registry.delete(id);
|
|
1562
|
+
});
|
|
1563
|
+
notifyStore();
|
|
1564
|
+
}
|
|
1565
|
+
function refreshAddons() {
|
|
1566
|
+
return fetch("/workbench/api/domains").then(function(r) {
|
|
1567
|
+
return r.json();
|
|
1568
|
+
}).then(function(j) {
|
|
1569
|
+
if (j && j.domains) {
|
|
1570
|
+
addonState.shellVersion = j.shellVersion || addonState.shellVersion;
|
|
1571
|
+
setAddons(j.domains);
|
|
1572
|
+
}
|
|
1573
|
+
return j;
|
|
1574
|
+
}).catch(function(e) {
|
|
1575
|
+
console.warn("[dsh-workbench] \u8BFB\u53D6\u4E1A\u52A1\u63D2\u4EF6\u5931\u8D25", e);
|
|
1576
|
+
return null;
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function ensureStream() {
|
|
1580
|
+
if (stream) return;
|
|
1581
|
+
stream = new EventSource("/workbench/api/events");
|
|
1582
|
+
stream.addEventListener("domains-changed", function(e) {
|
|
1583
|
+
try {
|
|
1584
|
+
setAddons(JSON.parse(e.data));
|
|
1585
|
+
} catch (err) {
|
|
1586
|
+
console.warn(err);
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
stream.addEventListener("domain-event", function(e) {
|
|
1590
|
+
try {
|
|
1591
|
+
broadcast(JSON.parse(e.data));
|
|
1592
|
+
} catch (err) {
|
|
1593
|
+
console.warn(err);
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
stream.addEventListener("record-mode", function(e) {
|
|
1597
|
+
try {
|
|
1598
|
+
var payload = JSON.parse(e.data);
|
|
1599
|
+
if (payload && payload.sessionId) setRecordMode(payload.sessionId, payload.enabled);
|
|
1600
|
+
} catch (err) {
|
|
1601
|
+
console.warn(err);
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
stream.addEventListener("sync-done", notifyCloudStatus);
|
|
1605
|
+
stream.addEventListener("account-changed", notifyCloudStatus);
|
|
1606
|
+
}
|
|
1607
|
+
function useAddonStore() {
|
|
1608
|
+
var st = react.useState(0);
|
|
1609
|
+
var bump = st[1];
|
|
1610
|
+
react.useEffect(function() {
|
|
1611
|
+
ensureStream();
|
|
1612
|
+
var fn = function() {
|
|
1613
|
+
bump(function(x) {
|
|
1614
|
+
return x + 1;
|
|
1615
|
+
});
|
|
1616
|
+
};
|
|
1617
|
+
storeListeners.add(fn);
|
|
1618
|
+
if (!addonState.loaded) refreshAddons();
|
|
1619
|
+
return function() {
|
|
1620
|
+
storeListeners.delete(fn);
|
|
1621
|
+
};
|
|
1622
|
+
}, []);
|
|
1623
|
+
return addonState;
|
|
1624
|
+
}
|
|
1625
|
+
window.__WB_HOST__ = {
|
|
1626
|
+
react,
|
|
1627
|
+
jsx,
|
|
1628
|
+
h,
|
|
1629
|
+
registerAddon,
|
|
1630
|
+
get addons() {
|
|
1631
|
+
return addonState.addons;
|
|
1632
|
+
},
|
|
1633
|
+
error: function() {
|
|
1634
|
+
return lastAddonError;
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
function useApi() {
|
|
1638
|
+
var base = "/workbench/api";
|
|
1639
|
+
return react.useMemo(function() {
|
|
1640
|
+
return {
|
|
1641
|
+
get: function(p) {
|
|
1642
|
+
return fetch(base + p).then(function(r) {
|
|
1643
|
+
return r.json();
|
|
1644
|
+
});
|
|
1645
|
+
},
|
|
1646
|
+
post: function(p, b) {
|
|
1647
|
+
return fetch(base + p, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(b || {}) }).then(function(r) {
|
|
1648
|
+
return r.json();
|
|
1649
|
+
});
|
|
1650
|
+
},
|
|
1651
|
+
del: function(p) {
|
|
1652
|
+
return fetch(base + p, { method: "DELETE" }).then(function(r) {
|
|
1653
|
+
return r.json();
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
}, []);
|
|
1658
|
+
}
|
|
1659
|
+
function useCloudStatus() {
|
|
1660
|
+
var api = useApi();
|
|
1661
|
+
var st = react.useState(null);
|
|
1662
|
+
var status = st[0];
|
|
1663
|
+
var setStatus = st[1];
|
|
1664
|
+
react.useEffect(function() {
|
|
1665
|
+
var alive = true;
|
|
1666
|
+
function load() {
|
|
1667
|
+
api.get("/sync/status").then(function(r) {
|
|
1668
|
+
if (alive && r && r.ok) setStatus(r);
|
|
1669
|
+
}).catch(function() {
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
load();
|
|
1673
|
+
var timer = setInterval(load, 15e3);
|
|
1674
|
+
function onVisible() {
|
|
1675
|
+
if (typeof document !== "undefined" && document.visibilityState === "visible") load();
|
|
1676
|
+
}
|
|
1677
|
+
if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisible);
|
|
1678
|
+
cloudStatusListeners.add(load);
|
|
1679
|
+
return function() {
|
|
1680
|
+
alive = false;
|
|
1681
|
+
clearInterval(timer);
|
|
1682
|
+
if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisible);
|
|
1683
|
+
cloudStatusListeners.delete(load);
|
|
1684
|
+
};
|
|
1685
|
+
}, [api]);
|
|
1686
|
+
return status;
|
|
1687
|
+
}
|
|
1688
|
+
function cloudView(status, t) {
|
|
1689
|
+
if (!status) return { kind: "local", label: t("cloud_checking"), hint: t("cloud_checking_hint") };
|
|
1690
|
+
var failed = Array.isArray(status.failed_tables) ? status.failed_tables : [];
|
|
1691
|
+
if (!status.logged_in) return { kind: "local", label: t("cloud_local"), hint: t("cloud_local_hint") };
|
|
1692
|
+
if (status.running) return { kind: "syncing", label: t("cloud_syncing"), hint: t("cloud_syncing_hint") };
|
|
1693
|
+
if (status.cloud && status.cloud.reachable === false) return { kind: "off", label: t("cloud_offline"), hint: t("cloud_offline_hint") };
|
|
1694
|
+
if (!status.last_sync_at) return { kind: "warn", label: t("cloud_never"), hint: t("cloud_never_hint") };
|
|
1695
|
+
if (status.last_sync_ok === false || failed.length) return { kind: "warn", label: t("cloud_sync_failed"), hint: t("cloud_sync_failed_hint") };
|
|
1696
|
+
return { kind: "on", label: t("cloud_online"), hint: t("cloud_online_hint") };
|
|
1697
|
+
}
|
|
1698
|
+
function cloudTitle(view, status, t) {
|
|
1699
|
+
var parts = [view.hint];
|
|
1700
|
+
if (status && status.logged_in) {
|
|
1701
|
+
parts.push(t("sync_last") + ": " + (status.last_sync_at ? new Date(status.last_sync_at).toLocaleString() : t("sync_never")));
|
|
1702
|
+
if (status.conflicts) parts.push(t("sync_conflicts") + ": " + status.conflicts);
|
|
1703
|
+
var failed = Array.isArray(status.failed_tables) ? status.failed_tables : [];
|
|
1704
|
+
if (failed.length) parts.push(t("sync_failed_tables") + ": " + failed.join(", "));
|
|
1705
|
+
if (status.last_sync_error) parts.push(status.last_sync_error);
|
|
1706
|
+
if (status.cloud && status.cloud.error) parts.push(status.cloud.error);
|
|
1707
|
+
}
|
|
1708
|
+
return parts.join(" \xB7 ");
|
|
1709
|
+
}
|
|
1710
|
+
function CloudStatusPill(props) {
|
|
1711
|
+
var t = props.t;
|
|
1712
|
+
var status = useCloudStatus();
|
|
1713
|
+
var view = cloudView(status, t);
|
|
1714
|
+
var title = cloudTitle(view, status, t);
|
|
1715
|
+
return jsx.jsxs("button", {
|
|
1716
|
+
type: "button",
|
|
1717
|
+
className: "wb-cloud " + view.kind,
|
|
1718
|
+
onClick: props.onOpen,
|
|
1719
|
+
title,
|
|
1720
|
+
"aria-label": t("cloud_status") + ": " + view.label + " \u2014 " + view.hint + " \xB7 " + t("cloud_open"),
|
|
1721
|
+
"data-cloud-state": view.kind,
|
|
1722
|
+
children: [
|
|
1723
|
+
jsx.jsx("span", { className: "wb-cloud-dot" }),
|
|
1724
|
+
jsx.jsx("span", { className: "wb-cloud-label", children: view.label })
|
|
1725
|
+
]
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
function pickTitle(title, lang) {
|
|
1729
|
+
if (!title) return "";
|
|
1730
|
+
if (typeof title === "string") return title;
|
|
1731
|
+
return title[lang] || title.zh || title.en || "";
|
|
1732
|
+
}
|
|
1733
|
+
function currentLang() {
|
|
1734
|
+
var raw = document && document.documentElement && document.documentElement.lang || typeof navigator !== "undefined" && navigator.language || "zh";
|
|
1735
|
+
return String(raw).toLowerCase().indexOf("zh") === 0 ? "zh" : "en";
|
|
1736
|
+
}
|
|
1737
|
+
var systemTabs = require_system_tabs()(react, jsx, useApi);
|
|
1738
|
+
var AccountTab = systemTabs.AccountTab;
|
|
1739
|
+
var BackupTab = systemTabs.BackupTab;
|
|
1740
|
+
var AuditTab = systemTabs.AuditTab;
|
|
1741
|
+
var ViewTabs = require_view_tabs()(react, pickTitle);
|
|
1742
|
+
var ViewOutlet = require_view_outlet();
|
|
1743
|
+
function ensureCss() {
|
|
1744
|
+
if (typeof document === "undefined") return;
|
|
1745
|
+
if (document.getElementById("wb-css")) return;
|
|
1746
|
+
var s = document.createElement("style");
|
|
1747
|
+
s.id = "wb-css";
|
|
1748
|
+
s.setAttribute("data-plugin-css", NS);
|
|
1749
|
+
s.textContent = CSS;
|
|
1750
|
+
document.head.appendChild(s);
|
|
1751
|
+
}
|
|
1752
|
+
function SearchPanel(props) {
|
|
1753
|
+
var api = props.api;
|
|
1754
|
+
var st = react.useState("");
|
|
1755
|
+
var rs = react.useState([]);
|
|
1756
|
+
var bs = react.useState(false);
|
|
1757
|
+
var es = react.useState("");
|
|
1758
|
+
var os = react.useState(false);
|
|
1759
|
+
var inputRef = react.useRef(null);
|
|
1760
|
+
var q = st[0];
|
|
1761
|
+
var results = rs[0];
|
|
1762
|
+
var loading = bs[0];
|
|
1763
|
+
var error = es[0];
|
|
1764
|
+
var open = os[0];
|
|
1765
|
+
var t = props.t;
|
|
1766
|
+
react.useEffect(function() {
|
|
1767
|
+
function onKey(e) {
|
|
1768
|
+
if ((e.metaKey || e.ctrlKey) && String(e.key).toLowerCase() === "k") {
|
|
1769
|
+
e.preventDefault();
|
|
1770
|
+
os[1](true);
|
|
1771
|
+
setTimeout(function() {
|
|
1772
|
+
if (inputRef.current) inputRef.current.focus();
|
|
1773
|
+
}, 0);
|
|
1774
|
+
}
|
|
1775
|
+
if (e.key === "Escape") os[1](false);
|
|
1776
|
+
}
|
|
1777
|
+
document.addEventListener("keydown", onKey);
|
|
1778
|
+
return function() {
|
|
1779
|
+
document.removeEventListener("keydown", onKey);
|
|
1780
|
+
};
|
|
1781
|
+
}, []);
|
|
1782
|
+
react.useEffect(function() {
|
|
1783
|
+
var text = String(q || "").trim();
|
|
1784
|
+
if (!text) {
|
|
1785
|
+
rs[1]([]);
|
|
1786
|
+
es[1]("");
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
var alive = true;
|
|
1790
|
+
bs[1](true);
|
|
1791
|
+
es[1]("");
|
|
1792
|
+
var timer = setTimeout(function() {
|
|
1793
|
+
api.post("/domains/wb-shell/actions/search.query", { q: text, limit: 20 }).then(function(j) {
|
|
1794
|
+
if (!alive) return;
|
|
1795
|
+
var data = j && j.result || j || {};
|
|
1796
|
+
rs[1](data.items || []);
|
|
1797
|
+
if (data.partial) es[1](t("search_partial") + ": " + (data.failed || []).join("\u3001"));
|
|
1798
|
+
}).catch(function(e) {
|
|
1799
|
+
if (alive) es[1](String(e && e.message || e));
|
|
1800
|
+
}).then(function() {
|
|
1801
|
+
if (alive) bs[1](false);
|
|
1802
|
+
});
|
|
1803
|
+
}, 220);
|
|
1804
|
+
return function() {
|
|
1805
|
+
alive = false;
|
|
1806
|
+
clearTimeout(timer);
|
|
1807
|
+
};
|
|
1808
|
+
}, [q]);
|
|
1809
|
+
function pick(hit) {
|
|
1810
|
+
os[1](false);
|
|
1811
|
+
st[1]("");
|
|
1812
|
+
if (hit.url) {
|
|
1813
|
+
window.open(hit.url, "_blank", "noopener,noreferrer");
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
var addon = (props.addons || []).filter(function(a2) {
|
|
1817
|
+
return a2.id === hit.domainId;
|
|
1818
|
+
})[0];
|
|
1819
|
+
if (addon) props.go("addon:" + addon.id + ":" + (hit.view || ""));
|
|
1820
|
+
}
|
|
1821
|
+
return jsx.jsxs("div", { className: "wb-search-wrap", children: [
|
|
1822
|
+
jsx.jsxs("div", { className: "wb-search-bar", children: [
|
|
1823
|
+
jsx.jsx("span", { className: "wb-search-icon", children: "\u2315" }),
|
|
1824
|
+
jsx.jsx("input", {
|
|
1825
|
+
ref: inputRef,
|
|
1826
|
+
className: "wb-search-input",
|
|
1827
|
+
value: q,
|
|
1828
|
+
placeholder: t("search_placeholder"),
|
|
1829
|
+
onFocus: function() {
|
|
1830
|
+
os[1](true);
|
|
1831
|
+
},
|
|
1832
|
+
onChange: function(e) {
|
|
1833
|
+
st[1](e.target.value);
|
|
1834
|
+
os[1](true);
|
|
1835
|
+
},
|
|
1836
|
+
onKeyDown: function(e) {
|
|
1837
|
+
if (e.key === "Enter" && results.length) pick(results[0]);
|
|
1838
|
+
}
|
|
1839
|
+
}),
|
|
1840
|
+
jsx.jsx("kbd", { className: "wb-search-kbd", children: "\u2318K" })
|
|
1841
|
+
] }),
|
|
1842
|
+
open && String(q || "").trim() ? jsx.jsxs("div", { className: "wb-search-panel", children: [
|
|
1843
|
+
loading ? jsx.jsx("div", { className: "wb-search-empty", children: t("searching") }) : null,
|
|
1844
|
+
error ? jsx.jsx("div", { className: "wb-search-empty", children: error }) : null,
|
|
1845
|
+
!loading && !error && results.length === 0 ? jsx.jsx("div", { className: "wb-search-empty", children: t("search_none") }) : null,
|
|
1846
|
+
results.map(function(hit) {
|
|
1847
|
+
var addon = (props.addons || []).filter(function(a2) {
|
|
1848
|
+
return a2.id === hit.domainId;
|
|
1849
|
+
})[0];
|
|
1850
|
+
var title = addon ? addon.title || addon.id : hit.domainId;
|
|
1851
|
+
return jsx.jsxs("button", { type: "button", className: "wb-search-hit", onClick: function() {
|
|
1852
|
+
pick(hit);
|
|
1853
|
+
}, children: [
|
|
1854
|
+
jsx.jsx("span", { className: "wb-search-domain", children: title }),
|
|
1855
|
+
jsx.jsxs("span", { className: "wb-search-hit-main", children: [
|
|
1856
|
+
jsx.jsx("span", { className: "wb-search-hit-title", children: hit.title }),
|
|
1857
|
+
hit.snippet ? jsx.jsx("span", { className: "wb-search-hit-snippet", children: hit.snippet }) : null
|
|
1858
|
+
] })
|
|
1859
|
+
] }, hit.domainId + ":" + hit.id);
|
|
1860
|
+
})
|
|
1861
|
+
] }) : null
|
|
1862
|
+
] });
|
|
1863
|
+
}
|
|
1864
|
+
function WorkbenchPage(props) {
|
|
1865
|
+
var t = props.t;
|
|
1866
|
+
var store = useAddonStore();
|
|
1867
|
+
var rs = react.useState("home");
|
|
1868
|
+
var route = rs[0];
|
|
1869
|
+
var setRoute = rs[1];
|
|
1870
|
+
var navigation = react.useState({});
|
|
1871
|
+
var viewParams = navigation[0];
|
|
1872
|
+
var lang = currentLang();
|
|
1873
|
+
var api = useApi();
|
|
1874
|
+
react.useEffect(function() {
|
|
1875
|
+
ensureCss();
|
|
1876
|
+
}, []);
|
|
1877
|
+
var addons = (store.addons || []).filter(function(a2) {
|
|
1878
|
+
return a2 && a2.enabled;
|
|
1879
|
+
});
|
|
1880
|
+
var currentAddon = null;
|
|
1881
|
+
if (route.indexOf("addon:") === 0) {
|
|
1882
|
+
var parts = route.split(":");
|
|
1883
|
+
var wanted = parts[1] || "";
|
|
1884
|
+
addons.forEach(function(a2) {
|
|
1885
|
+
if (a2.id === wanted) currentAddon = a2;
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
var mod = currentAddon ? registry.get(currentAddon.id) : null;
|
|
1889
|
+
var clientViews = mod && Array.isArray(mod.views) ? mod.views : [];
|
|
1890
|
+
var manifestViews = currentAddon && Array.isArray(currentAddon.views) ? currentAddon.views : [];
|
|
1891
|
+
var viewList = clientViews.length ? clientViews : manifestViews;
|
|
1892
|
+
var wantedView = route.indexOf("addon:") === 0 ? route.split(":")[2] || "" : "";
|
|
1893
|
+
var activeView = null;
|
|
1894
|
+
viewList.forEach(function(v) {
|
|
1895
|
+
if (v.id === wantedView) activeView = v;
|
|
1896
|
+
});
|
|
1897
|
+
if (!activeView && viewList.length) activeView = viewList[0];
|
|
1898
|
+
function go(next, params) {
|
|
1899
|
+
navigation[1](params || {});
|
|
1900
|
+
setRoute(next);
|
|
1901
|
+
}
|
|
1902
|
+
function navigateView(viewId, params) {
|
|
1903
|
+
if (currentAddon && viewList.some(function(v) {
|
|
1904
|
+
return v.id === viewId;
|
|
1905
|
+
})) {
|
|
1906
|
+
go("addon:" + currentAddon.id + ":" + viewId, params);
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
function cardIcon(id, title) {
|
|
1910
|
+
var m = registry.get(id) || registry.get("wb-addon-" + id);
|
|
1911
|
+
if (m && m.icon) return h(m.icon, { size: 18, strokeWidth: 1.9, "aria-hidden": "true" });
|
|
1912
|
+
return String(title || "?").slice(0, 1);
|
|
1913
|
+
}
|
|
1914
|
+
function openAddon(a2) {
|
|
1915
|
+
var m = registry.get(a2.id);
|
|
1916
|
+
var v = m && m.views && m.views[0] || a2.views && a2.views[0] || null;
|
|
1917
|
+
go("addon:" + a2.id + ":" + (v && v.id ? v.id : ""));
|
|
1918
|
+
}
|
|
1919
|
+
function pageHead(title, desc) {
|
|
1920
|
+
return jsx.jsxs("div", { className: "wb-page-head", children: [
|
|
1921
|
+
jsx.jsx("div", { className: "wb-page-top", children: [
|
|
1922
|
+
jsx.jsx("button", { className: "wb-back", onClick: function() {
|
|
1923
|
+
go("home");
|
|
1924
|
+
}, children: "\u2190 " + t("back_home") })
|
|
1925
|
+
] }),
|
|
1926
|
+
jsx.jsxs("div", { className: "wb-page-title", children: [
|
|
1927
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(a.id, title) }),
|
|
1928
|
+
jsx.jsx("h2", { children: title })
|
|
1929
|
+
] }),
|
|
1930
|
+
desc ? jsx.jsx("div", { className: "wb-page-desc", children: desc }) : null
|
|
1931
|
+
] });
|
|
1932
|
+
}
|
|
1933
|
+
function addonCard(a2) {
|
|
1934
|
+
var m = registry.get(a2.id);
|
|
1935
|
+
var v = m && m.views && m.views[0] || a2.views && a2.views[0] || null;
|
|
1936
|
+
var title = a2.title || pickTitle(v && v.title, lang) || a2.id;
|
|
1937
|
+
var count = m && m.views ? m.views.length : a2.views ? a2.views.length : 0;
|
|
1938
|
+
return jsx.jsxs("button", { type: "button", className: "wb-home-card" + (a2.error ? " dim" : ""), onClick: function() {
|
|
1939
|
+
openAddon(a2);
|
|
1940
|
+
}, children: [
|
|
1941
|
+
jsx.jsxs("div", { className: "wb-home-top", children: [
|
|
1942
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(a2.id, a2.title || title) }),
|
|
1943
|
+
jsx.jsx("span", { className: "wb-badge", children: "v" + (a2.version || "?") })
|
|
1944
|
+
] }),
|
|
1945
|
+
jsx.jsx("div", { className: "wb-home-title", children: title }),
|
|
1946
|
+
jsx.jsx("div", { className: "wb-home-desc", children: a2.description || (count > 1 ? count + " " + t("views") : "") }),
|
|
1947
|
+
a2.error ? jsx.jsx("div", { className: "wb-err", children: t("addon_error") + ": " + a2.error }) : null,
|
|
1948
|
+
jsx.jsxs("div", { className: "wb-home-foot", children: [
|
|
1949
|
+
jsx.jsx("span", { children: count ? count + " " + t("views") : "" }),
|
|
1950
|
+
jsx.jsx("b", { children: t("open") + " \u2192" })
|
|
1951
|
+
] })
|
|
1952
|
+
] }, a2.id);
|
|
1953
|
+
}
|
|
1954
|
+
function systemCard(key, icon, title, desc) {
|
|
1955
|
+
return jsx.jsxs("button", { type: "button", className: "wb-home-card", onClick: function() {
|
|
1956
|
+
go(key);
|
|
1957
|
+
}, children: [
|
|
1958
|
+
jsx.jsxs("div", { className: "wb-home-top", children: [
|
|
1959
|
+
jsx.jsx("span", { className: "wb-home-icon", children: cardIcon(key, icon) })
|
|
1960
|
+
] }),
|
|
1961
|
+
jsx.jsx("div", { className: "wb-home-title", children: title }),
|
|
1962
|
+
jsx.jsx("div", { className: "wb-home-desc", children: desc }),
|
|
1963
|
+
jsx.jsxs("div", { className: "wb-home-foot", children: [
|
|
1964
|
+
jsx.jsx("span", { children: "" }),
|
|
1965
|
+
jsx.jsx("b", { children: t("open") + " \u2192" })
|
|
1966
|
+
] })
|
|
1967
|
+
] }, key);
|
|
1968
|
+
}
|
|
1969
|
+
if (route === "backup") {
|
|
1970
|
+
return jsx.jsxs("div", { className: "wb-root", children: [
|
|
1971
|
+
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [pageHead(t("tab_backup"), t("backup_desc")), jsx.jsx(BackupTab, { t, lang, addons })] })
|
|
1972
|
+
] });
|
|
1973
|
+
}
|
|
1974
|
+
if (route === "audit") {
|
|
1975
|
+
return jsx.jsxs("div", { className: "wb-root", children: [
|
|
1976
|
+
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [pageHead(t("tab_audit"), t("audit_desc")), jsx.jsx(AuditTab, { t })] })
|
|
1977
|
+
] });
|
|
1978
|
+
}
|
|
1979
|
+
if (route === "account") {
|
|
1980
|
+
return jsx.jsxs("div", { className: "wb-root", children: [
|
|
1981
|
+
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [pageHead(t("tab_account"), t("account_desc")), jsx.jsx(AccountTab, { t })] })
|
|
1982
|
+
] });
|
|
1983
|
+
}
|
|
1984
|
+
if (currentAddon) {
|
|
1985
|
+
var canRender = activeView && typeof activeView.component === "function";
|
|
1986
|
+
var addonTitle = currentAddon.title || pickTitle(activeView && activeView.title, lang) || currentAddon.id;
|
|
1987
|
+
return jsx.jsxs("div", { className: "wb-root wb-immersive", children: [
|
|
1988
|
+
jsx.jsxs("div", { className: "wb-immersive-bar", children: [
|
|
1989
|
+
jsx.jsxs("div", { className: "wb-immersive-left", children: [
|
|
1990
|
+
jsx.jsx("span", { className: "wb-immersive-icon", children: cardIcon(currentAddon.id, addonTitle) }),
|
|
1991
|
+
jsx.jsx("button", { className: "wb-back", onClick: function() {
|
|
1992
|
+
go("home");
|
|
1993
|
+
}, children: "\u2190 " + t("back_home") }),
|
|
1994
|
+
jsx.jsx(ViewTabs, { views: viewList, activeView, addonId: currentAddon.id, lang, go })
|
|
1995
|
+
] }),
|
|
1996
|
+
jsx.jsxs("div", { className: "wb-immersive-title", children: [
|
|
1997
|
+
jsx.jsx("span", { children: addonTitle }),
|
|
1998
|
+
jsx.jsx("span", { className: "wb-badge", children: "v" + (currentAddon.version || "?") })
|
|
1999
|
+
] })
|
|
2000
|
+
] }),
|
|
2001
|
+
jsx.jsxs("div", { className: "wb-immersive-main", children: [
|
|
2002
|
+
jsx.jsxs("div", { className: "wb-inner wb-wide", children: [
|
|
2003
|
+
currentAddon.error ? jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-err", children: t("addon_error") + ": " + currentAddon.error }) }) : canRender ? jsx.jsx(ViewOutlet, { view: activeView, viewProps: { api: apiFor(currentAddon.id), lang, addonId: currentAddon.id, t, viewParams, onNavigate: navigateView } }, currentAddon.id) : !viewList.length ? jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-msg", children: t("no_views") }) }) : jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-page-loading", children: jsx.jsx("div", { className: "wb-msg", style: { padding: "4px 0" }, children: lastAddonError ? t("addon_unavailable") + " \xB7 " + lastAddonError : t("addon_loading") }) }) })
|
|
2004
|
+
] })
|
|
2005
|
+
] })
|
|
2006
|
+
] });
|
|
2007
|
+
}
|
|
2008
|
+
return jsx.jsxs("div", { className: "wb-root", children: [
|
|
2009
|
+
jsx.jsxs("div", { className: "wb-inner", children: [
|
|
2010
|
+
jsx.jsxs("div", { className: "wb-hero", children: [
|
|
2011
|
+
jsx.jsxs("div", { children: [jsx.jsx("h2", { children: t("title") }), jsx.jsx("span", { className: "wb-tag", children: t("tagline") })] }),
|
|
2012
|
+
jsx.jsx(CloudStatusPill, { t, onOpen: function() {
|
|
2013
|
+
go("account");
|
|
2014
|
+
} })
|
|
2015
|
+
] }),
|
|
2016
|
+
jsx.jsx(SearchPanel, { api, addons, go, t }),
|
|
2017
|
+
addons.length ? jsx.jsx("div", { className: "wb-home-grid", children: addons.map(addonCard) }) : jsx.jsx("div", { className: "wb-card", children: jsx.jsx("div", { className: "wb-msg wb-empty-cta", children: t("no_installed") }) }),
|
|
2018
|
+
jsx.jsxs("div", { className: "wb-sec", children: [
|
|
2019
|
+
jsx.jsx("h3", { children: t("manage") }),
|
|
2020
|
+
jsx.jsx("span", { className: "wb-hint", children: t("home_hint") })
|
|
2021
|
+
] }),
|
|
2022
|
+
jsx.jsxs("div", { className: "wb-home-grid manage", children: [
|
|
2023
|
+
systemCard("backup", "backup", t("tab_backup"), t("backup_desc")),
|
|
2024
|
+
systemCard("audit", "audit", t("tab_audit"), t("audit_desc")),
|
|
2025
|
+
systemCard("account", "account", t("tab_account"), t("account_desc"))
|
|
2026
|
+
] })
|
|
2027
|
+
] })
|
|
2028
|
+
] });
|
|
2029
|
+
}
|
|
2030
|
+
var RecordToggle = function(props) {
|
|
2031
|
+
var sid = props && props.sessionId;
|
|
2032
|
+
var st = react.useState(false);
|
|
2033
|
+
var on = st[0];
|
|
2034
|
+
var setOn = st[1];
|
|
2035
|
+
var bst = react.useState(false);
|
|
2036
|
+
var busy = bst[0];
|
|
2037
|
+
var setBusy = bst[1];
|
|
2038
|
+
var est = react.useState("");
|
|
2039
|
+
var err = est[0];
|
|
2040
|
+
var setErr = est[1];
|
|
2041
|
+
var t = props && props.t;
|
|
2042
|
+
react.useEffect(function() {
|
|
2043
|
+
if (!sid) return;
|
|
2044
|
+
var fn = function(changed, value) {
|
|
2045
|
+
if (changed === sid) setOn(!!value);
|
|
2046
|
+
};
|
|
2047
|
+
recordListeners.add(fn);
|
|
2048
|
+
ensureStream();
|
|
2049
|
+
fetch("/workbench/api/record?sessionId=" + encodeURIComponent(sid)).then(function(r) {
|
|
2050
|
+
return r.json();
|
|
2051
|
+
}).then(function(j) {
|
|
2052
|
+
if (j && j.ok) setRecordMode(sid, !!j.enabled);
|
|
2053
|
+
}).catch(function() {
|
|
2054
|
+
});
|
|
2055
|
+
return function() {
|
|
2056
|
+
recordListeners.delete(fn);
|
|
2057
|
+
};
|
|
2058
|
+
}, [sid]);
|
|
2059
|
+
function toggle() {
|
|
2060
|
+
if (!sid || busy) return;
|
|
2061
|
+
setBusy(true);
|
|
2062
|
+
setErr("");
|
|
2063
|
+
fetch("/workbench/api/record", {
|
|
2064
|
+
method: "POST",
|
|
2065
|
+
headers: { "content-type": "application/json" },
|
|
2066
|
+
body: JSON.stringify({ sessionId: sid, enabled: !on })
|
|
2067
|
+
}).then(function(r) {
|
|
2068
|
+
return r.json();
|
|
2069
|
+
}).then(function(j) {
|
|
2070
|
+
if (!j || !j.ok) throw new Error(j && j.error || "request failed");
|
|
2071
|
+
setRecordMode(sid, !!j.enabled);
|
|
2072
|
+
}).catch(function(e) {
|
|
2073
|
+
var msg = String(e && e.message || e);
|
|
2074
|
+
setErr(msg);
|
|
2075
|
+
try {
|
|
2076
|
+
console.warn("[dsh-workbench] record toggle failed:", msg);
|
|
2077
|
+
} catch (_) {
|
|
2078
|
+
}
|
|
2079
|
+
}).then(function() {
|
|
2080
|
+
setBusy(false);
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
if (!sid) return null;
|
|
2084
|
+
var label = busy ? t("record_busy") : err ? t("record_failed_short") : on ? t("record_on") : t("record_off");
|
|
2085
|
+
var title = err ? t("record_error") + ": " + err : on ? t("record_on_title") : t("record_off_title");
|
|
2086
|
+
return h(
|
|
2087
|
+
"button",
|
|
2088
|
+
{
|
|
2089
|
+
type: "button",
|
|
2090
|
+
className: "wb-record-pill" + (on ? " on" : "") + (err ? " err" : ""),
|
|
2091
|
+
onClick: toggle,
|
|
2092
|
+
disabled: busy,
|
|
2093
|
+
title,
|
|
2094
|
+
"aria-label": t("record_label") + ": " + label,
|
|
2095
|
+
"aria-pressed": on ? "true" : "false"
|
|
2096
|
+
},
|
|
2097
|
+
h("span", { className: "wb-record-dot" }),
|
|
2098
|
+
h("span", { className: "wb-record-label", children: label })
|
|
2099
|
+
);
|
|
2100
|
+
};
|
|
2101
|
+
var exports_ = {
|
|
2102
|
+
name: NS,
|
|
2103
|
+
inject: ["slots", "locale", "theme"],
|
|
2104
|
+
apply: function(ctx) {
|
|
2105
|
+
try {
|
|
2106
|
+
ensureCss();
|
|
2107
|
+
var PanellistIcon = function() {
|
|
2108
|
+
return h(
|
|
2109
|
+
"svg",
|
|
2110
|
+
{ width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round" },
|
|
2111
|
+
h("rect", { x: 3, y: 3, width: 7, height: 7, rx: 1 }),
|
|
2112
|
+
h("rect", { x: 14, y: 3, width: 7, height: 7, rx: 1 }),
|
|
2113
|
+
h("rect", { x: 3, y: 14, width: 7, height: 7, rx: 1 }),
|
|
2114
|
+
h("rect", { x: 14, y: 14, width: 7, height: 7, rx: 1 })
|
|
2115
|
+
);
|
|
2116
|
+
};
|
|
2117
|
+
ctx.effect(function() {
|
|
2118
|
+
return ctx.locale.register(NS, LOCALE);
|
|
2119
|
+
}, "wb-locale");
|
|
2120
|
+
var t = ctx.locale.bind(NS);
|
|
2121
|
+
ctx.slots.inject("sidebar.panellist", function() {
|
|
2122
|
+
return ctx.slots.register(
|
|
2123
|
+
{ name: "sidebar.panellist", id: NS, order: 62, label: function() {
|
|
2124
|
+
return t("nav");
|
|
2125
|
+
} },
|
|
2126
|
+
function() {
|
|
2127
|
+
return h(PanellistIcon, {});
|
|
2128
|
+
}
|
|
2129
|
+
);
|
|
2130
|
+
});
|
|
2131
|
+
ctx.slots.inject("main", function() {
|
|
2132
|
+
return ctx.slots.register(
|
|
2133
|
+
{ name: "main", key: NS, locale: NS, inject: function() {
|
|
2134
|
+
return { t };
|
|
2135
|
+
} },
|
|
2136
|
+
function() {
|
|
2137
|
+
try {
|
|
2138
|
+
return jsx.jsx(WorkbenchPage, { t });
|
|
2139
|
+
} catch (e) {
|
|
2140
|
+
window.__wbSlotErr = String(e && e.stack || e);
|
|
2141
|
+
throw e;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
);
|
|
2145
|
+
});
|
|
2146
|
+
ctx.slots.inject("settings.plugins.tab", function() {
|
|
2147
|
+
return ctx.slots.register(
|
|
2148
|
+
{ name: "settings.plugins.tab", id: NS, order: 65, label: function() {
|
|
2149
|
+
return t("nav");
|
|
2150
|
+
}, locale: NS, inject: function() {
|
|
2151
|
+
return { t };
|
|
2152
|
+
} },
|
|
2153
|
+
function() {
|
|
2154
|
+
return h(WorkbenchPage, { t });
|
|
2155
|
+
}
|
|
2156
|
+
);
|
|
2157
|
+
});
|
|
2158
|
+
ctx.slots.inject("conversation.input.left", function() {
|
|
2159
|
+
return ctx.slots.register(
|
|
2160
|
+
{ name: "conversation.input.left", id: NS + "-record", order: 40, label: function() {
|
|
2161
|
+
return t("record_label");
|
|
2162
|
+
} },
|
|
2163
|
+
function(props) {
|
|
2164
|
+
return h(RecordToggle, { sessionId: props && props.sessionId, t });
|
|
2165
|
+
}
|
|
2166
|
+
);
|
|
2167
|
+
});
|
|
2168
|
+
} catch (e) {
|
|
2169
|
+
console.error("[dsh-workbench] apply crashed:", e, e && e.stack);
|
|
2170
|
+
throw e;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
};
|
|
2174
|
+
module.exports = exports_;
|
|
2175
|
+
return module.exports;
|
|
2176
|
+
},
|
|
2177
|
+
});
|