plugin-document-understanding 1.1.8 → 1.1.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/client/345.17f88ffb846ec69b.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/345.1e0c321d30702aa1.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +6 -6
- package/dist/locale/en-US.json +171 -121
- package/dist/locale/vi-VN.json +171 -121
- package/dist/locale/zh-CN.json +171 -1
- package/dist/server/actions.js +1 -1
- package/dist/server/plugin.js +11 -10
- package/dist/server/services/DocumentUnderstandingService.js +25 -6
- package/dist/server/services/PipelineExecutor.js +8 -32
- package/package.json +46 -49
- package/src/client/index.tsx +7 -1
- package/src/client-v2/components/EndpointsTab.tsx +177 -108
- package/src/client-v2/components/JobsTab.tsx +94 -59
- package/src/client-v2/components/PipelinesTab.tsx +244 -154
- package/src/client-v2/components/PluginSettings.tsx +2 -0
- package/src/client-v2/components/ServiceConfigTab.tsx +56 -39
- package/src/client-v2/types.ts +32 -0
- package/src/locale/en-US.json +171 -121
- package/src/locale/vi-VN.json +171 -121
- package/src/locale/zh-CN.json +171 -1
- package/src/server/__tests__/document-understanding-service.test.ts +82 -0
- package/src/server/__tests__/pipeline-executor.test.ts +55 -33
- package/src/server/actions.ts +176 -176
- package/src/server/plugin.ts +134 -134
- package/src/server/services/DocumentUnderstandingService.ts +29 -7
- package/src/server/services/PipelineExecutor.ts +477 -502
- package/src/server/types.ts +78 -73
- package/dist/client-v2/794.9b984a25b2fc7c14.js +0 -10
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
Badge,
|
|
20
20
|
Alert,
|
|
21
21
|
} from 'antd';
|
|
22
|
+
import type { ColumnsType } from 'antd/es/table';
|
|
22
23
|
import {
|
|
23
24
|
PlusOutlined,
|
|
24
25
|
DeleteOutlined,
|
|
@@ -29,26 +30,37 @@ import {
|
|
|
29
30
|
PlayCircleOutlined,
|
|
30
31
|
ReloadOutlined,
|
|
31
32
|
} from '@ant-design/icons';
|
|
32
|
-
import {
|
|
33
|
+
import { useFlowContext } from '@nocobase/flow-engine';
|
|
34
|
+
import { useT } from '../locale';
|
|
35
|
+
import { EndpointDef, JobState, PipelineDef, PipelineStepDef, errorMessage, unwrapData } from '../types';
|
|
33
36
|
|
|
34
37
|
const { TextArea } = Input;
|
|
35
38
|
const { Panel } = Collapse;
|
|
36
39
|
|
|
37
|
-
const
|
|
38
|
-
pending:
|
|
39
|
-
running:
|
|
40
|
-
polling:
|
|
41
|
-
completed:
|
|
42
|
-
failed:
|
|
43
|
-
timeout:
|
|
40
|
+
const STATUS_COLORS: Record<string, string> = {
|
|
41
|
+
pending: 'default',
|
|
42
|
+
running: 'processing',
|
|
43
|
+
polling: 'processing',
|
|
44
|
+
completed: 'success',
|
|
45
|
+
failed: 'error',
|
|
46
|
+
timeout: 'error',
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
const
|
|
49
|
+
const TERMINAL_STATUSES = ['completed', 'failed', 'timeout'];
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
interface JsonSchemaNode {
|
|
52
|
+
type?: string;
|
|
53
|
+
properties?: Record<string, JsonSchemaNode>;
|
|
54
|
+
default?: unknown;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const isPlainObject = (value: unknown): value is Record<string, unknown> =>
|
|
58
|
+
!!value && typeof value === 'object' && !Array.isArray(value);
|
|
49
59
|
|
|
50
|
-
const
|
|
51
|
-
|
|
60
|
+
const stringifyJson = (value: unknown) => JSON.stringify(value ?? {}, null, 2);
|
|
61
|
+
|
|
62
|
+
const buildDefaultInputFromSchema = (schema: unknown): unknown => {
|
|
63
|
+
if (!isPlainObject(schema)) {
|
|
52
64
|
return {};
|
|
53
65
|
}
|
|
54
66
|
|
|
@@ -56,8 +68,10 @@ const buildDefaultInputFromSchema = (schema: any): any => {
|
|
|
56
68
|
return schema.default;
|
|
57
69
|
}
|
|
58
70
|
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
const node = schema as JsonSchemaNode;
|
|
72
|
+
|
|
73
|
+
if (node.type === 'object' || node.properties) {
|
|
74
|
+
return Object.entries(node.properties || {}).reduce<Record<string, unknown>>((acc, [key, propertySchema]) => {
|
|
61
75
|
const value = buildDefaultInputFromSchema(propertySchema);
|
|
62
76
|
if (value !== undefined) {
|
|
63
77
|
acc[key] = value;
|
|
@@ -66,23 +80,16 @@ const buildDefaultInputFromSchema = (schema: any): any => {
|
|
|
66
80
|
}, {});
|
|
67
81
|
}
|
|
68
82
|
|
|
69
|
-
if (
|
|
83
|
+
if (node.type === 'array') {
|
|
70
84
|
return [];
|
|
71
85
|
}
|
|
72
86
|
|
|
73
87
|
return undefined;
|
|
74
88
|
};
|
|
75
89
|
|
|
76
|
-
const mergeDefaults = (defaults:
|
|
77
|
-
if (
|
|
78
|
-
defaults
|
|
79
|
-
value &&
|
|
80
|
-
typeof defaults === 'object' &&
|
|
81
|
-
typeof value === 'object' &&
|
|
82
|
-
!Array.isArray(defaults) &&
|
|
83
|
-
!Array.isArray(value)
|
|
84
|
-
) {
|
|
85
|
-
return Object.entries(defaults).reduce(
|
|
90
|
+
const mergeDefaults = (defaults: unknown, value: unknown): unknown => {
|
|
91
|
+
if (isPlainObject(defaults) && isPlainObject(value)) {
|
|
92
|
+
return Object.entries(defaults).reduce<Record<string, unknown>>(
|
|
86
93
|
(acc, [key, defaultValue]) => ({
|
|
87
94
|
...acc,
|
|
88
95
|
[key]: mergeDefaults(defaultValue, acc[key]),
|
|
@@ -96,11 +103,12 @@ const mergeDefaults = (defaults: any, value: any): any => {
|
|
|
96
103
|
|
|
97
104
|
/* ─── JSON Editor ───────────────────────────────────────────────── */
|
|
98
105
|
const JsonEditor: React.FC<{
|
|
99
|
-
value?:
|
|
100
|
-
onChange?: (v:
|
|
106
|
+
value?: unknown;
|
|
107
|
+
onChange?: (v: unknown) => void;
|
|
101
108
|
placeholder?: string;
|
|
102
109
|
rows?: number;
|
|
103
110
|
}> = ({ value, onChange, placeholder, rows = 5 }) => {
|
|
111
|
+
const t = useT();
|
|
104
112
|
const [text, setText] = useState('');
|
|
105
113
|
const [error, setError] = useState('');
|
|
106
114
|
|
|
@@ -111,7 +119,7 @@ const JsonEditor: React.FC<{
|
|
|
111
119
|
}
|
|
112
120
|
try {
|
|
113
121
|
setText(typeof value === 'string' ? JSON.stringify(JSON.parse(value), null, 2) : JSON.stringify(value, null, 2));
|
|
114
|
-
} catch
|
|
122
|
+
} catch {
|
|
115
123
|
setText(typeof value === 'string' ? value : '');
|
|
116
124
|
}
|
|
117
125
|
}, [value]);
|
|
@@ -127,7 +135,7 @@ const JsonEditor: React.FC<{
|
|
|
127
135
|
setError('');
|
|
128
136
|
onChange?.(parsed);
|
|
129
137
|
} catch {
|
|
130
|
-
setError('Invalid JSON');
|
|
138
|
+
setError(t('Invalid JSON'));
|
|
131
139
|
}
|
|
132
140
|
};
|
|
133
141
|
|
|
@@ -139,24 +147,31 @@ const JsonEditor: React.FC<{
|
|
|
139
147
|
onChange={(e) => setText(e.target.value)}
|
|
140
148
|
onBlur={handleBlur}
|
|
141
149
|
placeholder={placeholder || '{}'}
|
|
150
|
+
status={error ? 'error' : undefined}
|
|
142
151
|
style={{ fontFamily: 'monospace', fontSize: 12 }}
|
|
143
152
|
/>
|
|
144
|
-
{error &&
|
|
153
|
+
{error && (
|
|
154
|
+
<div role="alert" style={{ color: '#ff4d4f', fontSize: 12 }}>
|
|
155
|
+
{error}
|
|
156
|
+
</div>
|
|
157
|
+
)}
|
|
145
158
|
</div>
|
|
146
159
|
);
|
|
147
160
|
};
|
|
148
161
|
|
|
149
162
|
/* ─── Step Editor ───────────────────────────────────────────────── */
|
|
163
|
+
type StepErrorMode = 'fail' | 'skip' | 'retry';
|
|
164
|
+
|
|
150
165
|
interface StepData {
|
|
151
166
|
_key: string; // client-side key for React
|
|
152
167
|
id?: number;
|
|
153
168
|
stepOrder: number;
|
|
154
169
|
name: string;
|
|
155
170
|
endpointId: number | null;
|
|
156
|
-
inputMapping: Record<string,
|
|
171
|
+
inputMapping: Record<string, unknown> | null;
|
|
157
172
|
outputAlias: string;
|
|
158
|
-
condition:
|
|
159
|
-
onError:
|
|
173
|
+
condition: unknown;
|
|
174
|
+
onError: StepErrorMode;
|
|
160
175
|
retryCount: number;
|
|
161
176
|
}
|
|
162
177
|
|
|
@@ -174,9 +189,11 @@ const emptyStep = (order: number): StepData => ({
|
|
|
174
189
|
|
|
175
190
|
const StepEditor: React.FC<{
|
|
176
191
|
steps: StepData[];
|
|
177
|
-
endpoints:
|
|
192
|
+
endpoints: EndpointDef[];
|
|
178
193
|
onChange: (steps: StepData[]) => void;
|
|
179
194
|
}> = ({ steps, endpoints, onChange }) => {
|
|
195
|
+
const t = useT();
|
|
196
|
+
|
|
180
197
|
const moveStep = (index: number, direction: -1 | 1) => {
|
|
181
198
|
const newSteps = [...steps];
|
|
182
199
|
const target = index + direction;
|
|
@@ -187,9 +204,9 @@ const StepEditor: React.FC<{
|
|
|
187
204
|
onChange(newSteps);
|
|
188
205
|
};
|
|
189
206
|
|
|
190
|
-
const updateStep = (index: number, field:
|
|
207
|
+
const updateStep = <K extends keyof StepData>(index: number, field: K, value: StepData[K]) => {
|
|
191
208
|
const newSteps = [...steps];
|
|
192
|
-
|
|
209
|
+
newSteps[index] = { ...newSteps[index], [field]: value };
|
|
193
210
|
onChange(newSteps);
|
|
194
211
|
};
|
|
195
212
|
|
|
@@ -206,9 +223,9 @@ const StepEditor: React.FC<{
|
|
|
206
223
|
if (steps.length === 0) {
|
|
207
224
|
return (
|
|
208
225
|
<div style={{ textAlign: 'center', padding: '20px 0' }}>
|
|
209
|
-
<Empty description=
|
|
226
|
+
<Empty description={t('No steps yet')} imageStyle={{ height: 40 }} />
|
|
210
227
|
<Button type="dashed" icon={<PlusOutlined />} onClick={addStep} style={{ marginTop: 8 }}>
|
|
211
|
-
Add First Step
|
|
228
|
+
{t('Add First Step')}
|
|
212
229
|
</Button>
|
|
213
230
|
</div>
|
|
214
231
|
);
|
|
@@ -218,7 +235,7 @@ const StepEditor: React.FC<{
|
|
|
218
235
|
<div>
|
|
219
236
|
<Collapse size="small" defaultActiveKey={steps.map((s) => s._key)}>
|
|
220
237
|
{steps.map((step, index) => {
|
|
221
|
-
const ep = endpoints.find((e
|
|
238
|
+
const ep = endpoints.find((e) => e.id === step.endpointId);
|
|
222
239
|
const headerExtra = (
|
|
223
240
|
<Space size={4} onClick={(e) => e.stopPropagation()}>
|
|
224
241
|
<Button
|
|
@@ -226,15 +243,17 @@ const StepEditor: React.FC<{
|
|
|
226
243
|
disabled={index === 0}
|
|
227
244
|
icon={<ArrowUpOutlined />}
|
|
228
245
|
onClick={() => moveStep(index, -1)}
|
|
246
|
+
aria-label={t('Move step up')}
|
|
229
247
|
/>
|
|
230
248
|
<Button
|
|
231
249
|
size="small"
|
|
232
250
|
disabled={index === steps.length - 1}
|
|
233
251
|
icon={<ArrowDownOutlined />}
|
|
234
252
|
onClick={() => moveStep(index, 1)}
|
|
253
|
+
aria-label={t('Move step down')}
|
|
235
254
|
/>
|
|
236
|
-
<Popconfirm title=
|
|
237
|
-
<Button size="small" danger icon={<DeleteOutlined />} />
|
|
255
|
+
<Popconfirm title={t('Remove step?')} okText={t('Delete')} onConfirm={() => removeStep(index)}>
|
|
256
|
+
<Button size="small" danger icon={<DeleteOutlined />} aria-label={t('Remove step?')} />
|
|
238
257
|
</Popconfirm>
|
|
239
258
|
</Space>
|
|
240
259
|
);
|
|
@@ -242,70 +261,88 @@ const StepEditor: React.FC<{
|
|
|
242
261
|
const label = (
|
|
243
262
|
<Space>
|
|
244
263
|
<Badge count={step.stepOrder} style={{ backgroundColor: '#1677ff' }} />
|
|
245
|
-
<span>{step.name || '(unnamed)'}</span>
|
|
264
|
+
<span>{step.name || t('(unnamed)')}</span>
|
|
246
265
|
{ep && <Tag>{ep.name}</Tag>}
|
|
247
266
|
{step.onError === 'skip' && (
|
|
248
|
-
<Tooltip title=
|
|
249
|
-
<Tag color="orange">skip on error</Tag>
|
|
267
|
+
<Tooltip title={t('Step can be skipped on error')}>
|
|
268
|
+
<Tag color="orange">{t('skip on error')}</Tag>
|
|
250
269
|
</Tooltip>
|
|
251
270
|
)}
|
|
252
271
|
{step.condition && (
|
|
253
|
-
<Tooltip title=
|
|
254
|
-
<Tag color="purple">conditional</Tag>
|
|
272
|
+
<Tooltip title={t('Has condition')}>
|
|
273
|
+
<Tag color="purple">{t('conditional')}</Tag>
|
|
255
274
|
</Tooltip>
|
|
256
275
|
)}
|
|
257
276
|
</Space>
|
|
258
277
|
);
|
|
259
278
|
|
|
279
|
+
const nameId = `step-name-${step._key}`;
|
|
280
|
+
const endpointId = `step-endpoint-${step._key}`;
|
|
281
|
+
const aliasId = `step-alias-${step._key}`;
|
|
282
|
+
|
|
260
283
|
return (
|
|
261
284
|
<Panel key={step._key} header={label} extra={headerExtra}>
|
|
262
285
|
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '0 16px' }}>
|
|
263
286
|
<div>
|
|
264
|
-
<label style={{ fontWeight: 500, display: 'block', marginBottom: 4 }}>
|
|
287
|
+
<label htmlFor={nameId} style={{ fontWeight: 500, display: 'block', marginBottom: 4 }}>
|
|
288
|
+
{t('Step Name')} *
|
|
289
|
+
</label>
|
|
265
290
|
<Input
|
|
291
|
+
id={nameId}
|
|
266
292
|
value={step.name}
|
|
267
293
|
onChange={(e) => updateStep(index, 'name', e.target.value)}
|
|
268
294
|
placeholder="OCR, Classify, Extract..."
|
|
269
295
|
/>
|
|
270
296
|
</div>
|
|
271
297
|
<div>
|
|
272
|
-
<label style={{ fontWeight: 500, display: 'block', marginBottom: 4 }}>
|
|
298
|
+
<label htmlFor={endpointId} style={{ fontWeight: 500, display: 'block', marginBottom: 4 }}>
|
|
299
|
+
{t('Endpoint')} *
|
|
300
|
+
</label>
|
|
273
301
|
<Select
|
|
302
|
+
id={endpointId}
|
|
274
303
|
value={step.endpointId}
|
|
275
304
|
onChange={(v) => updateStep(index, 'endpointId', v)}
|
|
276
|
-
placeholder=
|
|
305
|
+
placeholder={t('Select endpoint')}
|
|
277
306
|
style={{ width: '100%' }}
|
|
278
|
-
options={endpoints.map((
|
|
279
|
-
value:
|
|
280
|
-
label: `${
|
|
307
|
+
options={endpoints.map((endpoint) => ({
|
|
308
|
+
value: endpoint.id,
|
|
309
|
+
label: `${endpoint.name} (${endpoint.method} ${endpoint.subpath})`,
|
|
281
310
|
}))}
|
|
282
311
|
/>
|
|
283
312
|
</div>
|
|
284
313
|
<div>
|
|
285
|
-
<label
|
|
286
|
-
|
|
314
|
+
<label
|
|
315
|
+
htmlFor={aliasId}
|
|
316
|
+
style={{ fontWeight: 500, display: 'block', marginBottom: 4, marginTop: 12 }}
|
|
317
|
+
>
|
|
318
|
+
{t('Output Alias')}
|
|
287
319
|
</label>
|
|
288
320
|
<Input
|
|
321
|
+
id={aliasId}
|
|
289
322
|
value={step.outputAlias}
|
|
290
323
|
onChange={(e) => updateStep(index, 'outputAlias', e.target.value)}
|
|
291
324
|
placeholder="ocr_result"
|
|
292
325
|
/>
|
|
293
326
|
<div style={{ color: '#888', fontSize: 11 }}>
|
|
294
|
-
Other steps reference this as: $step[{step.outputAlias || step.stepOrder}].response.field
|
|
327
|
+
{t('Other steps reference this as')}: $step[{step.outputAlias || step.stepOrder}].response.field
|
|
295
328
|
</div>
|
|
296
329
|
</div>
|
|
297
330
|
<div>
|
|
298
|
-
<label style={{ fontWeight: 500, display: 'block', marginBottom: 4, marginTop: 12 }}>
|
|
331
|
+
<label style={{ fontWeight: 500, display: 'block', marginBottom: 4, marginTop: 12 }}>
|
|
332
|
+
{t('On Error')}
|
|
333
|
+
</label>
|
|
299
334
|
<Space>
|
|
300
335
|
<Select
|
|
301
336
|
value={step.onError}
|
|
302
|
-
onChange={(v) => updateStep(index, 'onError', v)}
|
|
337
|
+
onChange={(v: StepErrorMode) => updateStep(index, 'onError', v)}
|
|
303
338
|
style={{ width: 120 }}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
339
|
+
aria-label={t('On Error')}
|
|
340
|
+
options={[
|
|
341
|
+
{ value: 'fail', label: t('Fail') },
|
|
342
|
+
{ value: 'skip', label: t('Skip') },
|
|
343
|
+
{ value: 'retry', label: t('Retry') },
|
|
344
|
+
]}
|
|
345
|
+
/>
|
|
309
346
|
{step.onError === 'retry' && (
|
|
310
347
|
<InputNumber
|
|
311
348
|
value={step.retryCount}
|
|
@@ -314,6 +351,7 @@ const StepEditor: React.FC<{
|
|
|
314
351
|
max={10}
|
|
315
352
|
addonBefore="x"
|
|
316
353
|
style={{ width: 100 }}
|
|
354
|
+
aria-label={t('Retry')}
|
|
317
355
|
/>
|
|
318
356
|
)}
|
|
319
357
|
</Space>
|
|
@@ -322,14 +360,18 @@ const StepEditor: React.FC<{
|
|
|
322
360
|
|
|
323
361
|
<div style={{ marginTop: 12 }}>
|
|
324
362
|
<label style={{ fontWeight: 500, display: 'block', marginBottom: 4 }}>
|
|
325
|
-
Input Mapping (JSON)
|
|
326
|
-
<Tooltip
|
|
363
|
+
{t('Input Mapping (JSON)')}
|
|
364
|
+
<Tooltip
|
|
365
|
+
title={t(
|
|
366
|
+
'Map endpoint input fields. Use $input.field, $step[alias].response.field, $files, or literal values.',
|
|
367
|
+
)}
|
|
368
|
+
>
|
|
327
369
|
<span style={{ fontWeight: 'normal', color: '#888', marginLeft: 6, cursor: 'help' }}>?</span>
|
|
328
370
|
</Tooltip>
|
|
329
371
|
</label>
|
|
330
372
|
<JsonEditor
|
|
331
373
|
value={step.inputMapping}
|
|
332
|
-
onChange={(v) => updateStep(index, 'inputMapping', v)}
|
|
374
|
+
onChange={(v) => updateStep(index, 'inputMapping', v as Record<string, unknown> | null)}
|
|
333
375
|
placeholder='{ "text": "$step[ocr_result].response.text", "lang": "vi" }'
|
|
334
376
|
rows={3}
|
|
335
377
|
/>
|
|
@@ -337,8 +379,8 @@ const StepEditor: React.FC<{
|
|
|
337
379
|
|
|
338
380
|
<div style={{ marginTop: 12 }}>
|
|
339
381
|
<label style={{ fontWeight: 500, display: 'block', marginBottom: 4 }}>
|
|
340
|
-
Condition (optional JSON)
|
|
341
|
-
<Tooltip title='Only run this step if condition matches.
|
|
382
|
+
{t('Condition (optional JSON)')}
|
|
383
|
+
<Tooltip title={t('Only run this step if the condition matches.')}>
|
|
342
384
|
<span style={{ fontWeight: 'normal', color: '#888', marginLeft: 6, cursor: 'help' }}>?</span>
|
|
343
385
|
</Tooltip>
|
|
344
386
|
</label>
|
|
@@ -354,31 +396,49 @@ const StepEditor: React.FC<{
|
|
|
354
396
|
})}
|
|
355
397
|
</Collapse>
|
|
356
398
|
<Button type="dashed" icon={<PlusOutlined />} onClick={addStep} style={{ marginTop: 8, width: '100%' }}>
|
|
357
|
-
Add Step
|
|
399
|
+
{t('Add Step')}
|
|
358
400
|
</Button>
|
|
359
401
|
</div>
|
|
360
402
|
);
|
|
361
403
|
};
|
|
362
404
|
|
|
363
405
|
/* ─── Pipelines Tab ─────────────────────────────────────────────── */
|
|
406
|
+
interface PipelineFormValues {
|
|
407
|
+
name: string;
|
|
408
|
+
description?: string;
|
|
409
|
+
enabled: boolean;
|
|
410
|
+
inputSchema?: unknown;
|
|
411
|
+
outputMapping?: Record<string, unknown> | null;
|
|
412
|
+
}
|
|
413
|
+
|
|
364
414
|
export const PipelinesTab = () => {
|
|
365
|
-
const
|
|
366
|
-
const api =
|
|
367
|
-
const
|
|
368
|
-
const [
|
|
415
|
+
const ctx = useFlowContext();
|
|
416
|
+
const api = ctx.api;
|
|
417
|
+
const t = useT();
|
|
418
|
+
const [pipelines, setPipelines] = useState<PipelineDef[]>([]);
|
|
419
|
+
const [endpoints, setEndpoints] = useState<EndpointDef[]>([]);
|
|
369
420
|
const [loading, setLoading] = useState(false);
|
|
370
421
|
const [visible, setVisible] = useState(false);
|
|
371
|
-
const [form] = Form.useForm();
|
|
422
|
+
const [form] = Form.useForm<PipelineFormValues>();
|
|
372
423
|
const [editingId, setEditingId] = useState<number | null>(null);
|
|
373
424
|
const [steps, setSteps] = useState<StepData[]>([]);
|
|
374
425
|
const [playgroundVisible, setPlaygroundVisible] = useState(false);
|
|
375
|
-
const [playgroundPipeline, setPlaygroundPipeline] = useState<
|
|
426
|
+
const [playgroundPipeline, setPlaygroundPipeline] = useState<PipelineDef | null>(null);
|
|
376
427
|
const [playgroundInput, setPlaygroundInput] = useState('{}');
|
|
377
428
|
const [playgroundInputError, setPlaygroundInputError] = useState('');
|
|
378
|
-
const [playgroundJob, setPlaygroundJob] = useState<
|
|
429
|
+
const [playgroundJob, setPlaygroundJob] = useState<JobState | null>(null);
|
|
379
430
|
const [playgroundRunning, setPlaygroundRunning] = useState(false);
|
|
380
431
|
const playgroundTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
381
432
|
|
|
433
|
+
const statusLabels: Record<string, string> = {
|
|
434
|
+
pending: t('Pending'),
|
|
435
|
+
running: t('Running'),
|
|
436
|
+
polling: t('Polling'),
|
|
437
|
+
completed: t('Completed'),
|
|
438
|
+
failed: t('Failed'),
|
|
439
|
+
timeout: t('Timeout'),
|
|
440
|
+
};
|
|
441
|
+
|
|
382
442
|
const fetchData = useCallback(async () => {
|
|
383
443
|
setLoading(true);
|
|
384
444
|
try {
|
|
@@ -386,8 +446,8 @@ export const PipelinesTab = () => {
|
|
|
386
446
|
api.request({ url: 'docUnderstanding:listPipelines' }),
|
|
387
447
|
api.request({ url: 'docUnderstanding:listEndpoints' }),
|
|
388
448
|
]);
|
|
389
|
-
setPipelines(pRes
|
|
390
|
-
setEndpoints(eRes
|
|
449
|
+
setPipelines(unwrapData<PipelineDef[]>(pRes, []));
|
|
450
|
+
setEndpoints(unwrapData<EndpointDef[]>(eRes, []));
|
|
391
451
|
} finally {
|
|
392
452
|
setLoading(false);
|
|
393
453
|
}
|
|
@@ -412,7 +472,7 @@ export const PipelinesTab = () => {
|
|
|
412
472
|
setVisible(true);
|
|
413
473
|
};
|
|
414
474
|
|
|
415
|
-
const openEdit = (record:
|
|
475
|
+
const openEdit = (record: PipelineDef) => {
|
|
416
476
|
setEditingId(record.id);
|
|
417
477
|
form.setFieldsValue({
|
|
418
478
|
name: record.name,
|
|
@@ -422,15 +482,15 @@ export const PipelinesTab = () => {
|
|
|
422
482
|
outputMapping: record.outputMapping,
|
|
423
483
|
});
|
|
424
484
|
// Convert steps from server format
|
|
425
|
-
const serverSteps = [...(record.steps || [])].sort((a
|
|
485
|
+
const serverSteps = [...(record.steps || [])].sort((a, b) => a.stepOrder - b.stepOrder);
|
|
426
486
|
setSteps(
|
|
427
|
-
serverSteps.map((s
|
|
487
|
+
serverSteps.map((s) => ({
|
|
428
488
|
_key: `srv_${s.id}`,
|
|
429
489
|
id: s.id,
|
|
430
490
|
stepOrder: s.stepOrder,
|
|
431
491
|
name: s.name,
|
|
432
492
|
endpointId: s.endpointId,
|
|
433
|
-
inputMapping: s.inputMapping,
|
|
493
|
+
inputMapping: s.inputMapping ?? null,
|
|
434
494
|
outputAlias: s.outputAlias || '',
|
|
435
495
|
condition: s.condition,
|
|
436
496
|
onError: s.onError || 'fail',
|
|
@@ -446,7 +506,7 @@ export const PipelinesTab = () => {
|
|
|
446
506
|
method: 'POST',
|
|
447
507
|
params: { filterByTk: id },
|
|
448
508
|
});
|
|
449
|
-
message.success('Deleted');
|
|
509
|
+
message.success(t('Deleted'));
|
|
450
510
|
fetchData();
|
|
451
511
|
};
|
|
452
512
|
|
|
@@ -463,10 +523,10 @@ export const PipelinesTab = () => {
|
|
|
463
523
|
url: 'docUnderstanding:getJobStatus',
|
|
464
524
|
params: { filterByTk: jobId },
|
|
465
525
|
});
|
|
466
|
-
const job =
|
|
526
|
+
const job = unwrapData<JobState | null>(res, null);
|
|
467
527
|
setPlaygroundJob(job);
|
|
468
528
|
|
|
469
|
-
if (
|
|
529
|
+
if (job && TERMINAL_STATUSES.includes(job.status)) {
|
|
470
530
|
stopPlaygroundPolling();
|
|
471
531
|
setPlaygroundRunning(false);
|
|
472
532
|
}
|
|
@@ -479,17 +539,17 @@ export const PipelinesTab = () => {
|
|
|
479
539
|
(jobId: number) => {
|
|
480
540
|
stopPlaygroundPolling();
|
|
481
541
|
playgroundTimerRef.current = setInterval(() => {
|
|
482
|
-
fetchPlaygroundJob(jobId).catch((err:
|
|
542
|
+
fetchPlaygroundJob(jobId).catch((err: unknown) => {
|
|
483
543
|
stopPlaygroundPolling();
|
|
484
544
|
setPlaygroundRunning(false);
|
|
485
|
-
message.error(err
|
|
545
|
+
message.error(errorMessage(err) || t('Failed to refresh test job'));
|
|
486
546
|
});
|
|
487
547
|
}, 1500);
|
|
488
548
|
},
|
|
489
|
-
[fetchPlaygroundJob, stopPlaygroundPolling],
|
|
549
|
+
[fetchPlaygroundJob, stopPlaygroundPolling, t],
|
|
490
550
|
);
|
|
491
551
|
|
|
492
|
-
const openPlayground = (record:
|
|
552
|
+
const openPlayground = (record: PipelineDef) => {
|
|
493
553
|
stopPlaygroundPolling();
|
|
494
554
|
setPlaygroundPipeline(record);
|
|
495
555
|
setPlaygroundJob(null);
|
|
@@ -510,13 +570,13 @@ export const PipelinesTab = () => {
|
|
|
510
570
|
const runPlayground = async () => {
|
|
511
571
|
if (!playgroundPipeline) return;
|
|
512
572
|
|
|
513
|
-
let input:
|
|
573
|
+
let input: unknown;
|
|
514
574
|
try {
|
|
515
575
|
const parsedInput = playgroundInput.trim() ? JSON.parse(playgroundInput) : {};
|
|
516
576
|
input = mergeDefaults(buildDefaultInputFromSchema(playgroundPipeline.inputSchema), parsedInput);
|
|
517
577
|
setPlaygroundInputError('');
|
|
518
578
|
} catch {
|
|
519
|
-
setPlaygroundInputError('Invalid JSON input');
|
|
579
|
+
setPlaygroundInputError(t('Invalid JSON input'));
|
|
520
580
|
return;
|
|
521
581
|
}
|
|
522
582
|
|
|
@@ -533,20 +593,19 @@ export const PipelinesTab = () => {
|
|
|
533
593
|
input,
|
|
534
594
|
},
|
|
535
595
|
});
|
|
536
|
-
const
|
|
537
|
-
const jobId = result?.jobId;
|
|
596
|
+
const jobId = unwrapData<{ jobId?: number }>(res, {}).jobId;
|
|
538
597
|
if (!jobId) {
|
|
539
|
-
throw new Error('Pipeline did not return a job ID');
|
|
598
|
+
throw new Error(t('Pipeline did not return a job ID'));
|
|
540
599
|
}
|
|
541
600
|
|
|
542
601
|
const job = await fetchPlaygroundJob(jobId);
|
|
543
|
-
if (!
|
|
602
|
+
if (!job || !TERMINAL_STATUSES.includes(job.status)) {
|
|
544
603
|
startPlaygroundPolling(jobId);
|
|
545
604
|
}
|
|
546
|
-
message.success(
|
|
547
|
-
} catch (err:
|
|
605
|
+
message.success(`${t('Test job started')}: #${jobId}`);
|
|
606
|
+
} catch (err: unknown) {
|
|
548
607
|
setPlaygroundRunning(false);
|
|
549
|
-
message.error(err
|
|
608
|
+
message.error(errorMessage(err) || t('Failed to run pipeline test'));
|
|
550
609
|
}
|
|
551
610
|
};
|
|
552
611
|
|
|
@@ -557,11 +616,11 @@ export const PipelinesTab = () => {
|
|
|
557
616
|
// Validate steps
|
|
558
617
|
for (const step of steps) {
|
|
559
618
|
if (!step.name) {
|
|
560
|
-
message.error('All steps must have a name');
|
|
619
|
+
message.error(t('All steps must have a name'));
|
|
561
620
|
return;
|
|
562
621
|
}
|
|
563
622
|
if (!step.endpointId) {
|
|
564
|
-
message.error(
|
|
623
|
+
message.error(`${t('Step')} "${step.name || step.stepOrder}" ${t('must have an endpoint')}`);
|
|
565
624
|
return;
|
|
566
625
|
}
|
|
567
626
|
}
|
|
@@ -569,7 +628,7 @@ export const PipelinesTab = () => {
|
|
|
569
628
|
// Check alias uniqueness
|
|
570
629
|
const aliases = steps.map((s) => s.outputAlias).filter(Boolean);
|
|
571
630
|
if (new Set(aliases).size !== aliases.length) {
|
|
572
|
-
message.error('Step output aliases must be unique');
|
|
631
|
+
message.error(t('Step output aliases must be unique'));
|
|
573
632
|
return;
|
|
574
633
|
}
|
|
575
634
|
|
|
@@ -602,29 +661,29 @@ export const PipelinesTab = () => {
|
|
|
602
661
|
data: payload,
|
|
603
662
|
});
|
|
604
663
|
}
|
|
605
|
-
message.success('Saved');
|
|
664
|
+
message.success(t('Saved'));
|
|
606
665
|
setVisible(false);
|
|
607
666
|
fetchData();
|
|
608
667
|
} catch {
|
|
609
|
-
//
|
|
668
|
+
// Form validation errors are already surfaced inline by antd.
|
|
610
669
|
}
|
|
611
670
|
};
|
|
612
671
|
|
|
613
|
-
const columns = [
|
|
614
|
-
{ title: 'Name', dataIndex: 'name', width: 200 },
|
|
672
|
+
const columns: ColumnsType<PipelineDef> = [
|
|
673
|
+
{ title: t('Name'), dataIndex: 'name', width: 200 },
|
|
615
674
|
{
|
|
616
|
-
title: 'Steps',
|
|
675
|
+
title: t('Steps'),
|
|
617
676
|
dataIndex: 'steps',
|
|
618
677
|
width: 300,
|
|
619
|
-
render: (stepsArr:
|
|
620
|
-
if (!stepsArr || stepsArr.length === 0) return <Tag>0 steps</Tag>;
|
|
621
|
-
const sorted = [...stepsArr].sort((a
|
|
678
|
+
render: (stepsArr: PipelineStepDef[]) => {
|
|
679
|
+
if (!stepsArr || stepsArr.length === 0) return <Tag>0 {t('steps')}</Tag>;
|
|
680
|
+
const sorted = [...stepsArr].sort((a, b) => a.stepOrder - b.stepOrder);
|
|
622
681
|
return (
|
|
623
682
|
<Space size={2} wrap>
|
|
624
|
-
{sorted.map((s
|
|
683
|
+
{sorted.map((s, i) => (
|
|
625
684
|
<React.Fragment key={s.id}>
|
|
626
685
|
{i > 0 && <span style={{ color: '#ccc' }}>→</span>}
|
|
627
|
-
<Tag>{s.name ||
|
|
686
|
+
<Tag>{s.name || `${t('Step')} ${s.stepOrder}`}</Tag>
|
|
628
687
|
</React.Fragment>
|
|
629
688
|
))}
|
|
630
689
|
</Space>
|
|
@@ -632,29 +691,31 @@ export const PipelinesTab = () => {
|
|
|
632
691
|
},
|
|
633
692
|
},
|
|
634
693
|
{
|
|
635
|
-
title: 'Enabled',
|
|
694
|
+
title: t('Enabled'),
|
|
636
695
|
dataIndex: 'enabled',
|
|
637
696
|
width: 80,
|
|
638
|
-
render: (v: boolean) => (v ? <Tag color="success">Yes</Tag> : <Tag>No</Tag>),
|
|
697
|
+
render: (v: boolean) => (v ? <Tag color="success">{t('Yes')}</Tag> : <Tag>{t('No')}</Tag>),
|
|
639
698
|
},
|
|
640
699
|
{
|
|
641
|
-
title: 'AI Tool',
|
|
700
|
+
title: t('AI Tool'),
|
|
642
701
|
width: 100,
|
|
643
|
-
render: (_:
|
|
702
|
+
render: (_: unknown, record) =>
|
|
644
703
|
record.enabled ? (
|
|
645
|
-
<Tooltip
|
|
704
|
+
<Tooltip
|
|
705
|
+
title={`${t('Registered as')}: doc_understanding.${record.name?.toLowerCase().replace(/[^a-z0-9_]/g, '_')}`}
|
|
706
|
+
>
|
|
646
707
|
<Tag color="blue" icon={<ThunderboltOutlined />}>
|
|
647
|
-
Active
|
|
708
|
+
{t('Active')}
|
|
648
709
|
</Tag>
|
|
649
710
|
</Tooltip>
|
|
650
711
|
) : (
|
|
651
|
-
<Tag>Inactive</Tag>
|
|
712
|
+
<Tag>{t('Inactive')}</Tag>
|
|
652
713
|
),
|
|
653
714
|
},
|
|
654
715
|
{
|
|
655
|
-
title: 'Action',
|
|
716
|
+
title: t('Action'),
|
|
656
717
|
width: 190,
|
|
657
|
-
render: (_:
|
|
718
|
+
render: (_: unknown, record) => (
|
|
658
719
|
<Space>
|
|
659
720
|
<Button
|
|
660
721
|
type="link"
|
|
@@ -662,15 +723,28 @@ export const PipelinesTab = () => {
|
|
|
662
723
|
icon={<PlayCircleOutlined />}
|
|
663
724
|
disabled={!record.enabled}
|
|
664
725
|
onClick={() => openPlayground(record)}
|
|
726
|
+
aria-label={`${t('Test')} ${record.name}`}
|
|
665
727
|
>
|
|
666
|
-
Test
|
|
728
|
+
{t('Test')}
|
|
667
729
|
</Button>
|
|
668
|
-
<Button
|
|
669
|
-
|
|
730
|
+
<Button
|
|
731
|
+
type="link"
|
|
732
|
+
size="small"
|
|
733
|
+
icon={<EditOutlined />}
|
|
734
|
+
onClick={() => openEdit(record)}
|
|
735
|
+
aria-label={`${t('Edit')} ${record.name}`}
|
|
736
|
+
>
|
|
737
|
+
{t('Edit')}
|
|
670
738
|
</Button>
|
|
671
|
-
<Popconfirm title=
|
|
672
|
-
<Button
|
|
673
|
-
|
|
739
|
+
<Popconfirm title={t('Delete this pipeline?')} okText={t('Delete')} onConfirm={() => handleDelete(record.id)}>
|
|
740
|
+
<Button
|
|
741
|
+
type="link"
|
|
742
|
+
size="small"
|
|
743
|
+
danger
|
|
744
|
+
icon={<DeleteOutlined />}
|
|
745
|
+
aria-label={`${t('Delete')} ${record.name}`}
|
|
746
|
+
>
|
|
747
|
+
{t('Delete')}
|
|
674
748
|
</Button>
|
|
675
749
|
</Popconfirm>
|
|
676
750
|
</Space>
|
|
@@ -682,54 +756,60 @@ export const PipelinesTab = () => {
|
|
|
682
756
|
<div>
|
|
683
757
|
<div style={{ marginBottom: 16 }}>
|
|
684
758
|
<Button type="primary" icon={<PlusOutlined />} onClick={openAdd}>
|
|
685
|
-
Add Pipeline
|
|
759
|
+
{t('Add Pipeline')}
|
|
686
760
|
</Button>
|
|
687
761
|
</div>
|
|
688
762
|
<Table rowKey="id" columns={columns} dataSource={pipelines} loading={loading} size="small" />
|
|
689
763
|
|
|
690
764
|
<Modal
|
|
691
|
-
title={editingId ? 'Edit Pipeline' : 'New Pipeline'}
|
|
765
|
+
title={editingId ? t('Edit Pipeline') : t('New Pipeline')}
|
|
692
766
|
open={visible}
|
|
693
767
|
onOk={handleSave}
|
|
694
768
|
onCancel={() => setVisible(false)}
|
|
769
|
+
okText={t('Save')}
|
|
770
|
+
cancelText={t('Cancel')}
|
|
695
771
|
width={800}
|
|
696
772
|
destroyOnClose
|
|
697
773
|
>
|
|
698
774
|
<Form form={form} layout="vertical" preserve={false}>
|
|
699
775
|
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '0 16px' }}>
|
|
700
|
-
<Form.Item name="name" label=
|
|
776
|
+
<Form.Item name="name" label={t('Pipeline Name')} rules={[{ required: true }]}>
|
|
701
777
|
<Input placeholder="full_document_processing" />
|
|
702
778
|
</Form.Item>
|
|
703
|
-
<Form.Item name="enabled" label=
|
|
779
|
+
<Form.Item name="enabled" label={t('Enabled')} valuePropName="checked" initialValue={true}>
|
|
704
780
|
<Switch />
|
|
705
781
|
</Form.Item>
|
|
706
782
|
</div>
|
|
707
|
-
<Form.Item name="description" label=
|
|
708
|
-
<TextArea rows={2} placeholder=
|
|
783
|
+
<Form.Item name="description" label={t('Description')}>
|
|
784
|
+
<TextArea rows={2} placeholder={t('What this pipeline does')} />
|
|
709
785
|
</Form.Item>
|
|
710
786
|
|
|
711
787
|
<Card
|
|
712
|
-
title=
|
|
788
|
+
title={t('Pipeline Steps')}
|
|
713
789
|
size="small"
|
|
714
790
|
style={{ marginBottom: 16 }}
|
|
715
|
-
extra={
|
|
791
|
+
extra={
|
|
792
|
+
<Tag color="blue">
|
|
793
|
+
{steps.length} {t('step(s)')}
|
|
794
|
+
</Tag>
|
|
795
|
+
}
|
|
716
796
|
>
|
|
717
797
|
<StepEditor steps={steps} endpoints={endpoints} onChange={setSteps} />
|
|
718
798
|
</Card>
|
|
719
799
|
|
|
720
800
|
<Collapse size="small" ghost>
|
|
721
|
-
<Panel header=
|
|
801
|
+
<Panel header={t('Advanced: Input Schema & Output Mapping')} key="advanced">
|
|
722
802
|
<Form.Item
|
|
723
803
|
name="inputSchema"
|
|
724
|
-
label=
|
|
725
|
-
help=
|
|
804
|
+
label={t('Input Schema (JSON Schema)')}
|
|
805
|
+
help={t('Defines what input this pipeline accepts. Used by AI tool schema.')}
|
|
726
806
|
>
|
|
727
807
|
<JsonEditor placeholder='{ "type": "object", "properties": { "document_url": { "type": "string" } }, "required": ["document_url"] }' />
|
|
728
808
|
</Form.Item>
|
|
729
809
|
<Form.Item
|
|
730
810
|
name="outputMapping"
|
|
731
|
-
label=
|
|
732
|
-
help=
|
|
811
|
+
label={t('Output Mapping (JSON)')}
|
|
812
|
+
help={t('Map final step results to pipeline output. If empty, all step results are returned.')}
|
|
733
813
|
>
|
|
734
814
|
<JsonEditor placeholder='{ "text": "$step[ocr_result].response.text", "category": "$step[classify].response.category" }' />
|
|
735
815
|
</Form.Item>
|
|
@@ -739,14 +819,14 @@ export const PipelinesTab = () => {
|
|
|
739
819
|
</Modal>
|
|
740
820
|
|
|
741
821
|
<Modal
|
|
742
|
-
title={playgroundPipeline ?
|
|
822
|
+
title={playgroundPipeline ? `${t('Test Playground')}: ${playgroundPipeline.name}` : t('Test Playground')}
|
|
743
823
|
open={playgroundVisible}
|
|
744
824
|
onCancel={closePlayground}
|
|
745
825
|
width={860}
|
|
746
826
|
destroyOnClose
|
|
747
827
|
footer={[
|
|
748
828
|
<Button key="close" onClick={closePlayground}>
|
|
749
|
-
Close
|
|
829
|
+
{t('Close')}
|
|
750
830
|
</Button>,
|
|
751
831
|
playgroundJob?.id && (
|
|
752
832
|
<Button
|
|
@@ -755,7 +835,7 @@ export const PipelinesTab = () => {
|
|
|
755
835
|
disabled={playgroundRunning}
|
|
756
836
|
onClick={() => fetchPlaygroundJob(playgroundJob.id)}
|
|
757
837
|
>
|
|
758
|
-
Refresh
|
|
838
|
+
{t('Refresh')}
|
|
759
839
|
</Button>
|
|
760
840
|
),
|
|
761
841
|
<Button
|
|
@@ -765,14 +845,17 @@ export const PipelinesTab = () => {
|
|
|
765
845
|
loading={playgroundRunning}
|
|
766
846
|
onClick={runPlayground}
|
|
767
847
|
>
|
|
768
|
-
Run test
|
|
848
|
+
{t('Run test')}
|
|
769
849
|
</Button>,
|
|
770
850
|
].filter(Boolean)}
|
|
771
851
|
>
|
|
772
852
|
<div style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)', gap: 16 }}>
|
|
773
853
|
<div>
|
|
774
|
-
<
|
|
854
|
+
<label htmlFor="playground-input" style={{ fontWeight: 500, marginBottom: 6, display: 'block' }}>
|
|
855
|
+
{t('Input JSON')}
|
|
856
|
+
</label>
|
|
775
857
|
<TextArea
|
|
858
|
+
id="playground-input"
|
|
776
859
|
rows={16}
|
|
777
860
|
value={playgroundInput}
|
|
778
861
|
onChange={(e) => {
|
|
@@ -780,6 +863,7 @@ export const PipelinesTab = () => {
|
|
|
780
863
|
if (playgroundInputError) setPlaygroundInputError('');
|
|
781
864
|
}}
|
|
782
865
|
placeholder='{ "document_url": "https://..." }'
|
|
866
|
+
status={playgroundInputError ? 'error' : undefined}
|
|
783
867
|
style={{ fontFamily: 'monospace', fontSize: 12 }}
|
|
784
868
|
/>
|
|
785
869
|
{playgroundInputError && (
|
|
@@ -787,7 +871,7 @@ export const PipelinesTab = () => {
|
|
|
787
871
|
)}
|
|
788
872
|
|
|
789
873
|
<Collapse size="small" ghost style={{ marginTop: 12 }}>
|
|
790
|
-
<Panel header=
|
|
874
|
+
<Panel header={t('Input Schema')} key="schema">
|
|
791
875
|
<pre
|
|
792
876
|
style={{
|
|
793
877
|
background: '#f5f5f5',
|
|
@@ -806,34 +890,40 @@ export const PipelinesTab = () => {
|
|
|
806
890
|
|
|
807
891
|
<div>
|
|
808
892
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 6 }}>
|
|
809
|
-
<span style={{ fontWeight: 500 }}>Result</span>
|
|
893
|
+
<span style={{ fontWeight: 500 }}>{t('Result')}</span>
|
|
810
894
|
{playgroundJob?.status && (
|
|
811
|
-
<Tag color={
|
|
812
|
-
{
|
|
895
|
+
<Tag color={STATUS_COLORS[playgroundJob.status] || 'default'}>
|
|
896
|
+
{statusLabels[playgroundJob.status] || playgroundJob.status}
|
|
813
897
|
</Tag>
|
|
814
898
|
)}
|
|
815
899
|
</div>
|
|
816
900
|
|
|
817
901
|
{!playgroundJob ? (
|
|
818
|
-
<Empty description=
|
|
902
|
+
<Empty description={t('Run a test to see job output')} imageStyle={{ height: 48 }} />
|
|
819
903
|
) : (
|
|
820
904
|
<div>
|
|
821
905
|
<Space style={{ marginBottom: 8 }} wrap>
|
|
822
|
-
<Tag>
|
|
823
|
-
|
|
906
|
+
<Tag>
|
|
907
|
+
{t('Job')} #{playgroundJob.id}
|
|
908
|
+
</Tag>
|
|
909
|
+
{playgroundJob.currentStep && (
|
|
910
|
+
<Tag>
|
|
911
|
+
{t('Step')} {playgroundJob.currentStep}
|
|
912
|
+
</Tag>
|
|
913
|
+
)}
|
|
824
914
|
</Space>
|
|
825
915
|
|
|
826
916
|
{playgroundJob.error && (
|
|
827
917
|
<Alert
|
|
828
918
|
type="error"
|
|
829
919
|
showIcon
|
|
830
|
-
message=
|
|
920
|
+
message={t('Pipeline error')}
|
|
831
921
|
description={<pre style={{ margin: 0, whiteSpace: 'pre-wrap' }}>{playgroundJob.error}</pre>}
|
|
832
922
|
style={{ marginBottom: 12 }}
|
|
833
923
|
/>
|
|
834
924
|
)}
|
|
835
925
|
|
|
836
|
-
<div style={{ fontWeight: 500, marginBottom: 4 }}>Final Result</div>
|
|
926
|
+
<div style={{ fontWeight: 500, marginBottom: 4 }}>{t('Final Result')}</div>
|
|
837
927
|
<pre
|
|
838
928
|
style={{
|
|
839
929
|
background: '#f0f5ff',
|
|
@@ -846,10 +936,10 @@ export const PipelinesTab = () => {
|
|
|
846
936
|
>
|
|
847
937
|
{playgroundJob.finalResult !== undefined && playgroundJob.finalResult !== null
|
|
848
938
|
? stringifyJson(playgroundJob.finalResult)
|
|
849
|
-
: '(not yet available)'}
|
|
939
|
+
: t('(not yet available)')}
|
|
850
940
|
</pre>
|
|
851
941
|
|
|
852
|
-
<div style={{ fontWeight: 500, margin: '12px 0 4px' }}>Step Results</div>
|
|
942
|
+
<div style={{ fontWeight: 500, margin: '12px 0 4px' }}>{t('Step Results')}</div>
|
|
853
943
|
<pre
|
|
854
944
|
style={{
|
|
855
945
|
background: '#f5f5f5',
|