ronds-metadata 1.3.65 → 1.3.67
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.js +1 -1
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.d.ts +0 -2
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +70 -13
- package/es/comps/MetadataForm/DataCell/plugin/SourceConfig.d.ts +0 -4
- package/es/comps/MetadataForm/DataCell/plugin/SourceConfig.js +290 -107
- package/es/comps/MetadataForm/DataCell/plugin/SourceConfigNew.d.ts +10 -0
- package/es/comps/MetadataForm/DataCell/plugin/SourceConfigNew.js +649 -0
- package/package.json +1 -1
@@ -0,0 +1,649 @@
|
|
1
|
+
import "antd/es/form/style";
|
2
|
+
import _Form from "antd/es/form";
|
3
|
+
import "antd/es/upload/style";
|
4
|
+
import _Upload from "antd/es/upload";
|
5
|
+
import "antd/es/input/style";
|
6
|
+
import _Input from "antd/es/input";
|
7
|
+
import "antd/es/row/style";
|
8
|
+
import _Row from "antd/es/row";
|
9
|
+
import "antd/es/button/style";
|
10
|
+
import _Button from "antd/es/button";
|
11
|
+
import "antd/es/col/style";
|
12
|
+
import _Col from "antd/es/col";
|
13
|
+
import "antd/es/select/style";
|
14
|
+
import _Select from "antd/es/select";
|
15
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
16
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
17
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
18
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
19
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
20
|
+
import { tr } from '../../../../framework/locale/index';
|
21
|
+
import { LinkOutlined, UploadOutlined, PlusOutlined } from '@ant-design/icons';
|
22
|
+
import React from 'react';
|
23
|
+
import Editable from '../../../Editable/index';
|
24
|
+
import { MetadataService } from '../../../../framework/metadata/MetadataService';
|
25
|
+
import { useAsyncMemo } from '../../../../framework/hooks/use-async-memo';
|
26
|
+
import { deepClone } from '../../../../utils';
|
27
|
+
import useObservable from '../../../../framework/rxjs-hooks/useObservable';
|
28
|
+
import { MetadataFormContext } from '../../interface';
|
29
|
+
var SourceConfigNew = function SourceConfigNew(props) {
|
30
|
+
var configType = props.configType,
|
31
|
+
sourceHttp = props.sourceHttp,
|
32
|
+
sourceEnums = props.sourceEnums,
|
33
|
+
targetHttp = props.targetHttp,
|
34
|
+
targetEnums = props.targetEnums;
|
35
|
+
var isTarget = configType === 'target';
|
36
|
+
var isSource = configType === 'source';
|
37
|
+
var marginStyle = {
|
38
|
+
marginBottom: '8px',
|
39
|
+
width: '100%',
|
40
|
+
height: '100%'
|
41
|
+
};
|
42
|
+
var _React$useState = React.useState(),
|
43
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
44
|
+
source = _React$useState2[0],
|
45
|
+
setSource = _React$useState2[1];
|
46
|
+
var _React$useState3 = React.useState(),
|
47
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
48
|
+
defaultSource = _React$useState4[0],
|
49
|
+
setDefaultSource = _React$useState4[1];
|
50
|
+
var _React$useContext = React.useContext(MetadataFormContext),
|
51
|
+
form = _React$useContext.form;
|
52
|
+
// kafka source
|
53
|
+
var _React$useState5 = React.useState(),
|
54
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
55
|
+
autoOffsetReset = _React$useState6[0],
|
56
|
+
setAutoOffsetReset = _React$useState6[1];
|
57
|
+
var _React$useState7 = React.useState(),
|
58
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
59
|
+
batchDuration = _React$useState8[0],
|
60
|
+
setBatchDuration = _React$useState8[1];
|
61
|
+
var _React$useState9 = React.useState([]),
|
62
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
63
|
+
topics = _React$useState10[0],
|
64
|
+
setTopics = _React$useState10[1];
|
65
|
+
// sql source
|
66
|
+
var _React$useState11 = React.useState(),
|
67
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
68
|
+
fetchSize = _React$useState12[0],
|
69
|
+
setFetchSize = _React$useState12[1];
|
70
|
+
var _React$useState13 = React.useState(),
|
71
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
72
|
+
sql = _React$useState14[0],
|
73
|
+
setSql = _React$useState14[1];
|
74
|
+
// minio source
|
75
|
+
var streamRef = React.useRef();
|
76
|
+
var columns = [{
|
77
|
+
title: 'sheetName',
|
78
|
+
key: 'sheetName',
|
79
|
+
dataIndex: 'sheetName',
|
80
|
+
editable: true,
|
81
|
+
type: 'text'
|
82
|
+
}, {
|
83
|
+
title: 'header',
|
84
|
+
key: 'header',
|
85
|
+
dataIndex: 'header',
|
86
|
+
editable: true,
|
87
|
+
type: 'text'
|
88
|
+
}];
|
89
|
+
var _React$useState15 = React.useState([]),
|
90
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
91
|
+
list = _React$useState16[0],
|
92
|
+
setList = _React$useState16[1];
|
93
|
+
var listRef = React.useRef([]);
|
94
|
+
var onAddRow = function onAddRow() {
|
95
|
+
var _list = listRef.current;
|
96
|
+
var newRow = {
|
97
|
+
sheetName: '',
|
98
|
+
header: ''
|
99
|
+
};
|
100
|
+
_list.push(newRow);
|
101
|
+
streamRef.current.next({
|
102
|
+
type: 'editRowKey',
|
103
|
+
payload: {
|
104
|
+
_rowKey_: _list.length - 1
|
105
|
+
}
|
106
|
+
});
|
107
|
+
setList(_toConsumableArray(_list));
|
108
|
+
listRef.current = _list;
|
109
|
+
};
|
110
|
+
var onRowConfirm = function onRowConfirm(record) {
|
111
|
+
var _list = listRef.current;
|
112
|
+
_list[record.rowIdx] = _objectSpread(_objectSpread({}, _list[record.rowIdx]), record.allValues);
|
113
|
+
setList(_toConsumableArray(_list));
|
114
|
+
listRef.current = _list;
|
115
|
+
};
|
116
|
+
var onRowDelete = function onRowDelete(record) {
|
117
|
+
var _list = listRef.current;
|
118
|
+
_list.splice(record._rowKey_, 1);
|
119
|
+
setList(_toConsumableArray(_list));
|
120
|
+
listRef.current = _list;
|
121
|
+
};
|
122
|
+
// cassandra target
|
123
|
+
var _React$useState17 = React.useState(),
|
124
|
+
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
125
|
+
keyspace = _React$useState18[0],
|
126
|
+
setKeyspace = _React$useState18[1];
|
127
|
+
var _React$useState19 = React.useState(),
|
128
|
+
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
129
|
+
dtname = _React$useState20[0],
|
130
|
+
setDtname = _React$useState20[1];
|
131
|
+
// pgsql target
|
132
|
+
var _React$useState21 = React.useState(),
|
133
|
+
_React$useState22 = _slicedToArray(_React$useState21, 2),
|
134
|
+
schema = _React$useState22[0],
|
135
|
+
setSchema = _React$useState22[1];
|
136
|
+
var _React$useState23 = React.useState(),
|
137
|
+
_React$useState24 = _slicedToArray(_React$useState23, 2),
|
138
|
+
dbname = _React$useState24[0],
|
139
|
+
setDbname = _React$useState24[1];
|
140
|
+
// minio target
|
141
|
+
var _React$useState25 = React.useState(),
|
142
|
+
_React$useState26 = _slicedToArray(_React$useState25, 2),
|
143
|
+
filePath = _React$useState26[0],
|
144
|
+
setFilePath = _React$useState26[1];
|
145
|
+
// http 调用接口
|
146
|
+
// const watchValueRef = React.useRef<string | any>();
|
147
|
+
var pageRef = React.useRef(1);
|
148
|
+
var totalRef = React.useRef();
|
149
|
+
var processSelectOptionsData = function processSelectOptionsData() {
|
150
|
+
var _options = [];
|
151
|
+
var _items = [];
|
152
|
+
var _enum = deepClone(sourceEnums || targetEnums || []);
|
153
|
+
_enum.forEach(function (p) {
|
154
|
+
p.forEach(function (it) {
|
155
|
+
var _it$key;
|
156
|
+
var obj = {
|
157
|
+
label: it.value,
|
158
|
+
value: (_it$key = it === null || it === void 0 ? void 0 : it.key) !== null && _it$key !== void 0 ? _it$key : it === null || it === void 0 ? void 0 : it.value
|
159
|
+
};
|
160
|
+
_items.push(obj);
|
161
|
+
});
|
162
|
+
_options.push(_items);
|
163
|
+
_items = [];
|
164
|
+
});
|
165
|
+
return _options;
|
166
|
+
};
|
167
|
+
var options = React.useMemo(function () {
|
168
|
+
return processSelectOptionsData();
|
169
|
+
}, [sourceEnums, targetEnums]);
|
170
|
+
var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
|
171
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(http, pid, page) {
|
172
|
+
var server, _url, watchValue, res, _res, resGet;
|
173
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
174
|
+
while (1) switch (_context.prev = _context.next) {
|
175
|
+
case 0:
|
176
|
+
server = new MetadataService();
|
177
|
+
_url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
|
178
|
+
_url = page ? http.url.replace('{page}', page) : _url;
|
179
|
+
// if (watchValueRef.current) {
|
180
|
+
// if (typeof watchValueRef.current === 'string') {
|
181
|
+
// _url = _url.replace('{watch}', watchValueRef.current);
|
182
|
+
// }
|
183
|
+
// }
|
184
|
+
// console.log('========================getEnumDataByUrl', _url, watchValueRef.current);
|
185
|
+
// const res = await server.GetEnumDataByUrl(
|
186
|
+
// _url,
|
187
|
+
// http.method,
|
188
|
+
// http?.body && JSON.parse(http?.body) ? { ...JSON.parse(http?.body), ...(watchValueRef.current || {}) } : watchValueRef.current,
|
189
|
+
// );
|
190
|
+
|
191
|
+
if (http.watch) {
|
192
|
+
watchValue = form.getFieldsValue()[http.watch];
|
193
|
+
_url = _url.replace('{watch}', watchValue);
|
194
|
+
}
|
195
|
+
_context.next = 6;
|
196
|
+
return server.GetEnumDataByUrl(_url, http.method, (http === null || http === void 0 ? void 0 : http.body) && JSON.parse(http === null || http === void 0 ? void 0 : http.body) ? _objectSpread(_objectSpread({}, JSON.parse(http === null || http === void 0 ? void 0 : http.body)), {
|
197
|
+
source: watchValue
|
198
|
+
} || {}) : watchValue);
|
199
|
+
case 6:
|
200
|
+
res = _context.sent;
|
201
|
+
_res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
|
202
|
+
totalRef.current = res === null || res === void 0 ? void 0 : res.total;
|
203
|
+
if (!(_res && _res.length > 0)) {
|
204
|
+
_context.next = 20;
|
205
|
+
break;
|
206
|
+
}
|
207
|
+
if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
|
208
|
+
_context.next = 12;
|
209
|
+
break;
|
210
|
+
}
|
211
|
+
return _context.abrupt("return", _res);
|
212
|
+
case 12:
|
213
|
+
if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
|
214
|
+
_context.next = 14;
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
return _context.abrupt("return", _res);
|
218
|
+
case 14:
|
219
|
+
if (!(http === null || http === void 0 ? void 0 : http.isTreeSelect)) {
|
220
|
+
_context.next = 16;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
return _context.abrupt("return", _res);
|
224
|
+
case 16:
|
225
|
+
resGet = _res.map(function (it) {
|
226
|
+
if (http === null || http === void 0 ? void 0 : http.isCascader) {
|
227
|
+
return {
|
228
|
+
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
229
|
+
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
230
|
+
isLeaf: it['isLeaf'] ? it['isLeaf'] : false
|
231
|
+
};
|
232
|
+
} else {
|
233
|
+
return {
|
234
|
+
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
235
|
+
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
236
|
+
disabled: false
|
237
|
+
};
|
238
|
+
}
|
239
|
+
});
|
240
|
+
return _context.abrupt("return", resGet);
|
241
|
+
case 20:
|
242
|
+
console.warn("".concat(_url, " is not return success result"));
|
243
|
+
return _context.abrupt("return", []);
|
244
|
+
case 22:
|
245
|
+
case "end":
|
246
|
+
return _context.stop();
|
247
|
+
}
|
248
|
+
}, _callee);
|
249
|
+
}));
|
250
|
+
return function (_x, _x2, _x3) {
|
251
|
+
return _ref.apply(this, arguments);
|
252
|
+
};
|
253
|
+
}(), []);
|
254
|
+
var httpOptions = useAsyncMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
255
|
+
var _httpOptionsPromises, _httpOptions;
|
256
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
257
|
+
while (1) switch (_context3.prev = _context3.next) {
|
258
|
+
case 0:
|
259
|
+
// const _httpOptions = await Promise.all(
|
260
|
+
// (sourceHttp || targetHttp).map((it: any) => {
|
261
|
+
// if (it && it.url) {
|
262
|
+
// getEnumDataByUrl(deepClone(it), '', it?.isPagination && (pageRef.current as any)).then((res: any) => {
|
263
|
+
// return res;
|
264
|
+
// });
|
265
|
+
// }
|
266
|
+
// return [];
|
267
|
+
// }),
|
268
|
+
// );
|
269
|
+
_httpOptionsPromises = (sourceHttp || targetHttp).map( /*#__PURE__*/function () {
|
270
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(it) {
|
271
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
272
|
+
while (1) switch (_context2.prev = _context2.next) {
|
273
|
+
case 0:
|
274
|
+
if (!(it && it.url)) {
|
275
|
+
_context2.next = 2;
|
276
|
+
break;
|
277
|
+
}
|
278
|
+
return _context2.abrupt("return", getEnumDataByUrl(deepClone(it), '', (it === null || it === void 0 ? void 0 : it.isPagination) && pageRef.current));
|
279
|
+
case 2:
|
280
|
+
return _context2.abrupt("return", []);
|
281
|
+
case 3:
|
282
|
+
case "end":
|
283
|
+
return _context2.stop();
|
284
|
+
}
|
285
|
+
}, _callee2);
|
286
|
+
}));
|
287
|
+
return function (_x4) {
|
288
|
+
return _ref3.apply(this, arguments);
|
289
|
+
};
|
290
|
+
}());
|
291
|
+
_context3.next = 3;
|
292
|
+
return Promise.all(_httpOptionsPromises);
|
293
|
+
case 3:
|
294
|
+
_httpOptions = _context3.sent;
|
295
|
+
return _context3.abrupt("return", _httpOptions);
|
296
|
+
case 5:
|
297
|
+
case "end":
|
298
|
+
return _context3.stop();
|
299
|
+
}
|
300
|
+
}, _callee3);
|
301
|
+
})), [sourceHttp, targetHttp]);
|
302
|
+
var myOptions = React.useMemo(function () {
|
303
|
+
var _options = options;
|
304
|
+
httpOptions && httpOptions.forEach(function (p, i) {
|
305
|
+
if (p && p.length > 0) {
|
306
|
+
_options[i] = p;
|
307
|
+
}
|
308
|
+
});
|
309
|
+
return _options;
|
310
|
+
}, [options, httpOptions]);
|
311
|
+
useObservable(function (p) {
|
312
|
+
// TODO 设置watch值
|
313
|
+
}, []);
|
314
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
315
|
+
gutter: 16,
|
316
|
+
style: marginStyle
|
317
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
318
|
+
span: 8
|
319
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
320
|
+
label: tr('数据源'),
|
321
|
+
name: 'dataSource',
|
322
|
+
required: true
|
323
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
324
|
+
value: source,
|
325
|
+
onChange: function onChange(val) {
|
326
|
+
return setSource(val);
|
327
|
+
},
|
328
|
+
options: myOptions[0],
|
329
|
+
allowClear: true
|
330
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
331
|
+
span: 8
|
332
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
333
|
+
name: 'defaultSource',
|
334
|
+
colon: false
|
335
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
336
|
+
value: defaultSource,
|
337
|
+
onChange: function onChange(val) {
|
338
|
+
setDefaultSource(val);
|
339
|
+
},
|
340
|
+
options: myOptions[1],
|
341
|
+
allowClear: true
|
342
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
343
|
+
span: 8
|
344
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
345
|
+
colon: false
|
346
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
347
|
+
className: "ml-2",
|
348
|
+
type: "link",
|
349
|
+
icon: /*#__PURE__*/React.createElement(LinkOutlined, null),
|
350
|
+
onClick: function onClick() {}
|
351
|
+
}, tr('测试连接'))))), isSource && source === 'Kafka' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
352
|
+
gutter: 16,
|
353
|
+
style: marginStyle
|
354
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
355
|
+
span: 8
|
356
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
357
|
+
label: tr('主题'),
|
358
|
+
name: 'topic',
|
359
|
+
required: true
|
360
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
361
|
+
value: topics,
|
362
|
+
onChange: function onChange(val) {
|
363
|
+
return setTopics(val);
|
364
|
+
},
|
365
|
+
options: myOptions[2],
|
366
|
+
mode: "multiple",
|
367
|
+
allowClear: true
|
368
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
369
|
+
span: 8
|
370
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
371
|
+
label: tr('消费策略'),
|
372
|
+
name: 'autoOffsetReset',
|
373
|
+
required: true
|
374
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
375
|
+
value: autoOffsetReset,
|
376
|
+
onChange: function onChange(val) {
|
377
|
+
return setAutoOffsetReset(val);
|
378
|
+
},
|
379
|
+
options: myOptions[3],
|
380
|
+
allowClear: true
|
381
|
+
})))), /*#__PURE__*/React.createElement(_Row, {
|
382
|
+
gutter: 16,
|
383
|
+
style: marginStyle
|
384
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
385
|
+
span: 8
|
386
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
387
|
+
label: tr('批间隔'),
|
388
|
+
name: 'batchDuration',
|
389
|
+
required: true
|
390
|
+
}, /*#__PURE__*/React.createElement(_Input, {
|
391
|
+
value: batchDuration,
|
392
|
+
onChange: function onChange(e) {
|
393
|
+
var _e$target;
|
394
|
+
return setBatchDuration(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
395
|
+
}
|
396
|
+
}))))), isSource && (source === 'PgSql' || source === 'SqlServer') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
397
|
+
gutter: 16,
|
398
|
+
style: marginStyle
|
399
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
400
|
+
span: 8
|
401
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
402
|
+
label: tr('数据库'),
|
403
|
+
name: 'dbname',
|
404
|
+
required: true
|
405
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
406
|
+
value: dbname,
|
407
|
+
onChange: function onChange(val) {
|
408
|
+
return setDbname(val);
|
409
|
+
},
|
410
|
+
options: myOptions[4],
|
411
|
+
allowClear: true
|
412
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
413
|
+
span: 8
|
414
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
415
|
+
label: '模式',
|
416
|
+
name: 'schema',
|
417
|
+
required: true
|
418
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
419
|
+
value: schema,
|
420
|
+
onChange: function onChange(val) {
|
421
|
+
return setSchema(val);
|
422
|
+
},
|
423
|
+
options: myOptions[5],
|
424
|
+
allowClear: true
|
425
|
+
})))), /*#__PURE__*/React.createElement(_Row, {
|
426
|
+
gutter: 16,
|
427
|
+
style: marginStyle
|
428
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
429
|
+
span: 8
|
430
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
431
|
+
label: 'fetch size',
|
432
|
+
name: 'fetchSize',
|
433
|
+
required: true
|
434
|
+
}, /*#__PURE__*/React.createElement(_Input, {
|
435
|
+
value: fetchSize,
|
436
|
+
onChange: function onChange(e) {
|
437
|
+
var _e$target2;
|
438
|
+
return setFetchSize(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value);
|
439
|
+
}
|
440
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
441
|
+
span: 8
|
442
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
443
|
+
label: 'sql',
|
444
|
+
name: 'sql',
|
445
|
+
required: true
|
446
|
+
}, /*#__PURE__*/React.createElement(_Input, {
|
447
|
+
value: sql,
|
448
|
+
onChange: function onChange(e) {
|
449
|
+
var _e$target3;
|
450
|
+
return setSql(e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value);
|
451
|
+
}
|
452
|
+
}))))), isSource && source === 'Minio' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
453
|
+
gutter: 16,
|
454
|
+
style: marginStyle
|
455
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
456
|
+
span: 8
|
457
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
458
|
+
label: tr('上传文件'),
|
459
|
+
name: 'filepath',
|
460
|
+
required: true
|
461
|
+
}, /*#__PURE__*/React.createElement(_Upload, {
|
462
|
+
customRequest: function customRequest(options) {
|
463
|
+
setTimeout(function () {
|
464
|
+
options.onSuccess();
|
465
|
+
}, 1000);
|
466
|
+
}
|
467
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
468
|
+
icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
|
469
|
+
}, tr('上传')))))), /*#__PURE__*/React.createElement(_Row, {
|
470
|
+
gutter: 16,
|
471
|
+
style: marginStyle
|
472
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
473
|
+
span: 16
|
474
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
475
|
+
label: tr('文件信息'),
|
476
|
+
name: 'headers'
|
477
|
+
}, /*#__PURE__*/React.createElement(Editable, {
|
478
|
+
type: "single",
|
479
|
+
columns: columns,
|
480
|
+
dataSource: list,
|
481
|
+
onRowConfirm: onRowConfirm,
|
482
|
+
onRowDelete: onRowDelete,
|
483
|
+
getStreamInstance: function getStreamInstance(stream) {
|
484
|
+
return streamRef.current = stream;
|
485
|
+
},
|
486
|
+
onRowClick: function onRowClick(record) {}
|
487
|
+
}), /*#__PURE__*/React.createElement(_Button, {
|
488
|
+
type: "dashed",
|
489
|
+
onClick: onAddRow,
|
490
|
+
style: {
|
491
|
+
width: '100%',
|
492
|
+
marginTop: '2px'
|
493
|
+
}
|
494
|
+
}, tr('添加一行')))))), isTarget && source === 'Cassandra' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
495
|
+
gutter: 16,
|
496
|
+
style: marginStyle
|
497
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
498
|
+
span: 8
|
499
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
500
|
+
label: tr('键空间'),
|
501
|
+
name: 'keyspace',
|
502
|
+
required: true
|
503
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
504
|
+
value: keyspace,
|
505
|
+
onChange: function onChange(val) {
|
506
|
+
return setKeyspace(val);
|
507
|
+
},
|
508
|
+
options: myOptions[2],
|
509
|
+
allowClear: true
|
510
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
511
|
+
span: 8
|
512
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
513
|
+
label: tr('数据表'),
|
514
|
+
name: 'dtname',
|
515
|
+
required: true
|
516
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
517
|
+
value: dtname,
|
518
|
+
onChange: function onChange(val) {
|
519
|
+
return setDtname(val);
|
520
|
+
},
|
521
|
+
options: myOptions[3],
|
522
|
+
allowClear: true
|
523
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
524
|
+
span: 8
|
525
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
526
|
+
colon: false
|
527
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
528
|
+
className: "ml-2",
|
529
|
+
type: "link",
|
530
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
531
|
+
onClick: function onClick() {}
|
532
|
+
}, tr('手动建表')))))), isTarget && (source === 'PgSql' || source === 'SqlServer') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
533
|
+
gutter: 16,
|
534
|
+
style: marginStyle
|
535
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
536
|
+
span: 8
|
537
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
538
|
+
label: tr('数据库'),
|
539
|
+
name: 'dbname',
|
540
|
+
required: true
|
541
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
542
|
+
value: dbname,
|
543
|
+
onChange: function onChange(val) {
|
544
|
+
return setDbname(val);
|
545
|
+
},
|
546
|
+
options: myOptions[4],
|
547
|
+
allowClear: true
|
548
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
549
|
+
span: 8
|
550
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
551
|
+
label: '模式',
|
552
|
+
name: 'schema',
|
553
|
+
required: true
|
554
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
555
|
+
value: schema,
|
556
|
+
onChange: function onChange(val) {
|
557
|
+
return setSchema(val);
|
558
|
+
},
|
559
|
+
options: myOptions[5],
|
560
|
+
allowClear: true
|
561
|
+
})))), /*#__PURE__*/React.createElement(_Row, {
|
562
|
+
gutter: 16,
|
563
|
+
style: marginStyle
|
564
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
565
|
+
span: 8
|
566
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
567
|
+
label: tr('数据表'),
|
568
|
+
name: 'dtname',
|
569
|
+
required: true
|
570
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
571
|
+
value: dtname,
|
572
|
+
onChange: function onChange(val) {
|
573
|
+
return setDtname(val);
|
574
|
+
},
|
575
|
+
options: myOptions[6],
|
576
|
+
allowClear: true
|
577
|
+
}))), /*#__PURE__*/React.createElement(_Col, {
|
578
|
+
span: 8
|
579
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
580
|
+
colon: false
|
581
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
582
|
+
className: "ml-2",
|
583
|
+
type: "link",
|
584
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
585
|
+
onClick: function onClick() {}
|
586
|
+
}, tr('手动建表')))))), isTarget && source === 'Minio' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
587
|
+
gutter: 16,
|
588
|
+
style: marginStyle
|
589
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
590
|
+
span: 16
|
591
|
+
}, /*#__PURE__*/React.createElement(FormItem, {
|
592
|
+
label: tr('文件路径'),
|
593
|
+
name: 'filepath',
|
594
|
+
required: true
|
595
|
+
}, /*#__PURE__*/React.createElement(_Input, {
|
596
|
+
value: filePath,
|
597
|
+
onChange: function onChange(e) {
|
598
|
+
return setFilePath(e.target.value);
|
599
|
+
}
|
600
|
+
}))))));
|
601
|
+
};
|
602
|
+
export default SourceConfigNew;
|
603
|
+
var FormItem = function FormItem(props) {
|
604
|
+
var color = props.color,
|
605
|
+
_props$labelSpan = props.labelSpan,
|
606
|
+
labelSpan = _props$labelSpan === void 0 ? 0 : _props$labelSpan,
|
607
|
+
_props$layout = props.layout,
|
608
|
+
layout = _props$layout === void 0 ? 'horizontal' : _props$layout,
|
609
|
+
name = props.name,
|
610
|
+
label = props.label,
|
611
|
+
colon = props.colon,
|
612
|
+
help = props.help,
|
613
|
+
tooltip = props.tooltip,
|
614
|
+
_props$required = props.required,
|
615
|
+
required = _props$required === void 0 ? false : _props$required,
|
616
|
+
children = props.children,
|
617
|
+
_props$wrapperSpan = props.wrapperSpan,
|
618
|
+
wrapperSpan = _props$wrapperSpan === void 0 ? 3 : _props$wrapperSpan;
|
619
|
+
return /*#__PURE__*/React.createElement(_Form.Item, {
|
620
|
+
style: {
|
621
|
+
flex: 1,
|
622
|
+
paddingRight: '10px'
|
623
|
+
},
|
624
|
+
label: /*#__PURE__*/React.createElement("span", {
|
625
|
+
style: color ? {
|
626
|
+
color: color
|
627
|
+
} : {}
|
628
|
+
}, tr(label)),
|
629
|
+
labelCol: labelSpan && layout === 'horizontal' ? {
|
630
|
+
flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
|
631
|
+
offset: 0
|
632
|
+
} : undefined,
|
633
|
+
wrapperCol: labelSpan && wrapperSpan && layout === 'horizontal' ? {
|
634
|
+
style: {
|
635
|
+
width: "".concat((wrapperSpan - labelSpan) * 100 / 24, "%")
|
636
|
+
},
|
637
|
+
flex: "0 0 ".concat((wrapperSpan - labelSpan) * 100 / 24, "%"),
|
638
|
+
offset: 0
|
639
|
+
} : undefined,
|
640
|
+
name: name,
|
641
|
+
rules: [{
|
642
|
+
required: required,
|
643
|
+
message: "".concat(tr('请输入'), " ").concat(tr(label))
|
644
|
+
}],
|
645
|
+
help: tr(help),
|
646
|
+
tooltip: tr(tooltip),
|
647
|
+
colon: colon
|
648
|
+
}, children);
|
649
|
+
};
|