fix(in-transit-transfer): 证据文件改由当前站点下载以避免浏览器拦截

This commit is contained in:
hugo committed 2026-10-26 20:28:03 +08:00
1 parent dfd48e08e7
commit 440afe097f
7 files changed
+186 -21

No files matched your search

@@ -9,6 +9,7 @@
* 确认门禁=所选类型每条流都是 ready 或 no_data;混合选择先披露未就绪流再确认;
* 抓取中与未配置不渲染重试,其余状态可重试(ready 亦可强制重抓);
* 证据清单默认只显示最新一份,更早点开后才列出;首行「重新解析」走 reparseCurrentFile,不 emit retry;
单文件下载走 downloadEvidenceFile,不再把预签名地址放进 href;
* 类型选项=props.transferTypes 接口真相(enabled 过滤与排序在后端契约内,
* 前端不过滤),名称 names[locale]→zh-CN→en→code 回退,空列表空态+确认禁用。
*/
@@ -18,6 +19,7 @@ import i18n from '@/i18n';
const transferApiMocks = vi.hoisted(() => ({
listEvidenceFiles: vi.fn(),
downloadEvidenceFile: vi.fn(),
reparseCurrentFile: vi.fn(),
}));
vi.mock('../../api/transfer.api', () => transferApiMocks);
@@ -452,7 +454,7 @@ describe('TransferSourceSelectCard', () => {
expect(list.text()).not.toContain('TRIG-BATCH');
expect(list.get('p').attributes('title')).toContain('outbound_TRIG-BATCH-A629464D_DBS-AWSBI_NA_20261021101739.xlsx');
expect(list.get('p').attributes('title')).toContain('2026-10-21 18:00');
expect(wrapper.get('[data-testid="transfer-evidence-download-25"]').attributes('href')).toBe('https://files.example/current?filename=DBS-AWSBI_20261021_1800.xlsx');
expect(wrapper.get('[data-testid="transfer-evidence-download-25"]').attributes('href')).toBeUndefined();
expect(wrapper.text()).not.toContain('older.xlsx');
expect(wrapper.text()).not.toContain('abc');
const buttons = wrapper.findAll('[data-testid="transfer-evidence-reparse-DBS-AWSBI-inbound"]');
@@ -468,6 +470,23 @@ describe('TransferSourceSelectCard', () => {
expect(wrapper.emitted('reparsed')).toBeTruthy();
});
it('点击下载走站点接口,不打开预签名地址', async () => {
// [断言意图] 下载按钮不再带 MinIO href;点击后按来源、文件和记录类型请求当前站点。
transferApiMocks.listEvidenceFiles.mockResolvedValue([
{ file_id: 25, original_filename: 'CRANE.xlsx', created_at: '2026-10-26T07:00:00', sha256: 'abc', file_size: 10, presigned_url: 'http://192.168.100.192:9000/file', download_url: 'http://192.168.100.192:9000/file?filename=CRANE.xlsx' },
]);
transferApiMocks.downloadEvidenceFile.mockResolvedValue({ blob: new Blob(['xlsx']), filename: 'DBS-AWSBI_20261026_1500.xlsx' });
const wrapper = mount(TransferSourceSelectCard, {
props: { sources: readySources, transferTypes: defaultTransferTypes },
global: { plugins: [i18n] },
});
await wrapper.find('[data-testid="transfer-source-status-DBS-AWSBI"]').trigger('click');
await flushPromises();
await wrapper.get('[data-testid="transfer-evidence-download-25"]').trigger('click');
await flushPromises();
expect(transferApiMocks.downloadEvidenceFile).toHaveBeenCalledWith('DBS-AWSBI', 25, 'inbound');
});
it('按所选类型的 record_kinds 绘制证据流芯片,抓取中无重试,下载按钮为证据文件', async () => {
// [断言意图] 方案 A:状态芯片与重试钮分离。hub_to_hub 两种流各一枚芯片;
// 出站抓取中无 ↻;入站 ↻ 的 aria-label 为「重试入站」。切回只含 inbound 时不出现「出站」。