@hyzyn/dsh-docker 0.8.0 → 0.9.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +12 -0
- package/README.md +25 -1
- package/client-src/docker.css +95 -1
- package/client-src/index.js +1883 -534
- package/client-src/log-stream.js +7 -1
- package/client.js +119 -25
- package/lib/docker.d.ts +9 -2
- package/lib/docker.js +8 -3
- package/lib/docker.js.map +1 -1
- package/lib/index.d.ts +18 -0
- package/lib/index.js +303 -162
- package/lib/index.js.map +1 -1
- package/lib/ssh-exec.d.ts +142 -2
- package/lib/ssh-exec.js +549 -12
- package/lib/ssh-exec.js.map +1 -1
- package/package.json +2 -2
- package/scripts/client-smoke.mjs +8 -2
- package/scripts/route-smoke.mjs +15 -0
package/client-src/log-stream.js
CHANGED
|
@@ -30,11 +30,17 @@ export function reconnectTail(initialTail, isReconnect) {
|
|
|
30
30
|
* onEnd?: (payload: Record<string, unknown> | null, controls: { reconnect: () => void }) => void,
|
|
31
31
|
* onError?: (message: string, controls: { close: () => void, reconnect: () => void }) => void,
|
|
32
32
|
* onStatus?: (status: 'connecting' | 'open' | 'reconnecting' | 'closed') => void,
|
|
33
|
+
* t?: (key: string) => string,
|
|
33
34
|
* }} options
|
|
34
35
|
* @returns {{ close: () => void, reconnect: () => void }}
|
|
35
36
|
*/
|
|
36
37
|
export function subscribeLogStream(options) {
|
|
37
38
|
const { buildUrl, tail } = options
|
|
39
|
+
/*
|
|
40
|
+
* 翻译函数由调用方**当参数传进来**(见 docs/i18n.md):目录内联在 client-src/index.js,
|
|
41
|
+
* 兄弟模块 import 它就会成环。没有传(离线冒烟)时退回「键名原样」,不抛错。
|
|
42
|
+
*/
|
|
43
|
+
const t = typeof options.t === 'function' ? options.t : (key) => key
|
|
38
44
|
let source = null
|
|
39
45
|
let closed = false
|
|
40
46
|
let attempt = 0
|
|
@@ -116,7 +122,7 @@ export function subscribeLogStream(options) {
|
|
|
116
122
|
if (source !== next) return
|
|
117
123
|
// 服务端 event:error 是带 data 的 MessageEvent;连接层错误是普通 Event
|
|
118
124
|
if (typeof event.data === 'string' && event.data !== '') {
|
|
119
|
-
let message = '
|
|
125
|
+
let message = t('error.logStream')
|
|
120
126
|
try {
|
|
121
127
|
const payload = JSON.parse(event.data)
|
|
122
128
|
if (payload !== null && typeof payload.message === 'string') message = payload.message
|