@dsh-workbench/shared 0.3.9 → 0.3.11
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/dist/api/dsh-client.d.ts +1 -0
- package/dist/api/dsh.d.ts +18 -0
- package/dist/api/host-write.d.ts +0 -15
- package/dist/api/host-write.js +1 -35
- package/dist/api/unit-board.d.ts +0 -21
- package/dist/api/unit-board.js +1 -45
- package/dist/components/icons.d.ts +0 -6
- package/dist/components/icons.js +0 -12
- package/dist/config/storage.d.ts +0 -4
- package/dist/config/storage.js +0 -11
- package/dist/host/browser-find.js +1 -1
- package/dist/host/browser-read.js +5 -5
- package/dist/host/tool-approval.d.ts +12 -0
- package/dist/host/tool-approval.js +4 -0
- package/dist/i18n/en.js +40 -20
- package/dist/i18n/index.d.ts +41 -21
- package/dist/i18n/zh.d.ts +40 -20
- package/dist/i18n/zh.js +40 -20
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/blocker-action.d.ts +0 -15
- package/dist/lib/blocker-action.js +1 -25
- package/dist/lib/react-types.d.ts +5 -0
- package/dist/lib/react-types.js +1 -0
- package/dist/lib/react.d.ts +14 -13
- package/dist/lib/react.js +11 -11
- package/package.json +1 -1
- package/src/api/dsh-client.ts +4 -1
- package/src/api/dsh.ts +16 -0
- package/src/api/host-write.ts +0 -42
- package/src/api/unit-board.ts +0 -45
- package/src/components/icons.tsx +0 -16
- package/src/config/storage.test.ts +1 -25
- package/src/config/storage.ts +0 -12
- package/src/host/__tests__/browser-find.test.ts +1 -1
- package/src/host/__tests__/browser-read.test.ts +1 -1
- package/src/host/browser-find.ts +1 -1
- package/src/host/browser-read.ts +5 -5
- package/src/host/tool-approval.ts +17 -0
- package/src/i18n/en.ts +42 -20
- package/src/i18n/zh.ts +42 -20
- package/src/index.ts +1 -1
- package/src/lib/blocker-action.ts +0 -27
- package/src/lib/react-types.ts +5 -0
- package/src/lib/react.ts +14 -13
- package/src/api/__tests__/host-write.test.ts +0 -75
- package/src/api/__tests__/unit-board.test.ts +0 -76
- package/src/lib/blocker-action.test.ts +0 -40
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { blockerActionLabel, blockerPending } from './blocker-action.js';
|
|
3
|
-
|
|
4
|
-
const t = (key: string): string => `«${key}»`;
|
|
5
|
-
|
|
6
|
-
const RETRY = { kind: 'retry', label: '重试' } as const;
|
|
7
|
-
const LOGIN = { kind: 'open-url', label: '去登录', url: 'https://cmdb.example/login', inline: true } as const;
|
|
8
|
-
const COPY = { kind: 'copy', label: '复制命令', text: 'opencli cmdb envs' } as const;
|
|
9
|
-
const FIX = { kind: 'run-fix', label: '帮我安装', unit: 'cmdb', fix: 'install' } as const;
|
|
10
|
-
|
|
11
|
-
const idle = { retrying: false, running: null, copied: null } as const;
|
|
12
|
-
|
|
13
|
-
describe('阻断态那颗按钮说什么', () => {
|
|
14
|
-
it('★ 忙的时候「重试」自己说「重试中…」(用户点的就是它)', () => {
|
|
15
|
-
expect(blockerActionLabel(RETRY, { ...idle, retrying: true }, t)).toBe('«blocker.retry.running»');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('不忙就是原文(不假装忙)', () => {
|
|
19
|
-
expect(blockerActionLabel(RETRY, idle, t)).toBe('重试');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('★ 忙的不是重试本身(安装在路上)→ 「重试」不许跟着说「重试中…」', () => {
|
|
23
|
-
expect(blockerActionLabel(RETRY, { ...idle, running: '帮我安装' }, t)).toBe('重试');
|
|
24
|
-
expect(blockerActionLabel(LOGIN, { ...idle, retrying: true }, t)).toBe('去登录');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('安装在路上 → 那颗说「正在执行…」', () => {
|
|
28
|
-
expect(blockerActionLabel(FIX, { ...idle, running: '帮我安装' }, t)).toBe('«blocker.fix.running»');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('复制成功那一下说「已复制」', () => {
|
|
32
|
-
expect(blockerActionLabel(COPY, { ...idle, copied: 'opencli cmdb envs' }, t)).toBe('«env.copied»');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('★ 忙 = 卡片在刷 || 本地动作在跑(少算一半,按钮就又哑了)', () => {
|
|
36
|
-
expect(blockerPending(true, null)).toBe(true);
|
|
37
|
-
expect(blockerPending(false, '帮我安装')).toBe(true);
|
|
38
|
-
expect(blockerPending(false, null)).toBe(false);
|
|
39
|
-
});
|
|
40
|
-
});
|