ronds-metadata 1.3.77 → 1.3.78

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,821 +0,0 @@
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 { deepClone } from '../../../../utils';
26
- import { MetadataFormContext } from '../../interface';
27
- var SourceConfig = function SourceConfig(props) {
28
- var configType = props.configType;
29
- var isTarget = configType === 'target';
30
- var isSource = configType === 'source';
31
- var marginStyle = {
32
- marginBottom: '8px',
33
- width: '100%',
34
- height: '100%'
35
- };
36
- var _React$useState = React.useState(),
37
- _React$useState2 = _slicedToArray(_React$useState, 2),
38
- source = _React$useState2[0],
39
- setSource = _React$useState2[1];
40
- var _React$useState3 = React.useState(),
41
- _React$useState4 = _slicedToArray(_React$useState3, 2),
42
- defaultSource = _React$useState4[0],
43
- setDefaultSource = _React$useState4[1];
44
- var _React$useContext = React.useContext(MetadataFormContext),
45
- form = _React$useContext.form;
46
- var dataSourceOpts = isSource ? [{
47
- value: 'Kafka',
48
- label: 'Kafka'
49
- }, {
50
- value: 'PgSql',
51
- label: 'PgSql'
52
- }, {
53
- value: 'Minio',
54
- label: 'Minio'
55
- }, {
56
- value: 'SqlServer',
57
- label: 'SqlServer'
58
- }] : [{
59
- value: 'Cassandra',
60
- label: 'Cassandra'
61
- }, {
62
- value: 'PgSql',
63
- label: 'PgSql'
64
- }, {
65
- value: 'Minio',
66
- label: 'Minio'
67
- }, {
68
- value: 'SqlServer',
69
- label: 'SqlServer'
70
- }];
71
- // kafka source
72
- var _React$useState5 = React.useState(),
73
- _React$useState6 = _slicedToArray(_React$useState5, 2),
74
- autoOffsetReset = _React$useState6[0],
75
- setAutoOffsetReset = _React$useState6[1];
76
- var _React$useState7 = React.useState(),
77
- _React$useState8 = _slicedToArray(_React$useState7, 2),
78
- batchDuration = _React$useState8[0],
79
- setBatchDuration = _React$useState8[1];
80
- var _React$useState9 = React.useState([]),
81
- _React$useState10 = _slicedToArray(_React$useState9, 2),
82
- topics = _React$useState10[0],
83
- setTopics = _React$useState10[1];
84
- // sql source
85
- var _React$useState11 = React.useState(),
86
- _React$useState12 = _slicedToArray(_React$useState11, 2),
87
- fetchSize = _React$useState12[0],
88
- setFetchSize = _React$useState12[1];
89
- var _React$useState13 = React.useState(),
90
- _React$useState14 = _slicedToArray(_React$useState13, 2),
91
- sql = _React$useState14[0],
92
- setSql = _React$useState14[1];
93
- // minio source
94
- var streamRef = React.useRef();
95
- var columns = [{
96
- title: 'sheetName',
97
- key: 'sheetName',
98
- dataIndex: 'sheetName',
99
- editable: true,
100
- type: 'text'
101
- }, {
102
- title: 'header',
103
- key: 'header',
104
- dataIndex: 'header',
105
- editable: true,
106
- type: 'text'
107
- }];
108
- var _React$useState15 = React.useState([]),
109
- _React$useState16 = _slicedToArray(_React$useState15, 2),
110
- list = _React$useState16[0],
111
- setList = _React$useState16[1];
112
- var listRef = React.useRef([]);
113
- var onAddRow = function onAddRow() {
114
- var _list = listRef.current;
115
- var newRow = {
116
- sheetName: '',
117
- header: ''
118
- };
119
- _list.push(newRow);
120
- streamRef.current.next({
121
- type: 'editRowKey',
122
- payload: {
123
- _rowKey_: _list.length - 1
124
- }
125
- });
126
- setList(_toConsumableArray(_list));
127
- listRef.current = _list;
128
- };
129
- var onRowConfirm = function onRowConfirm(record) {
130
- var _list = listRef.current;
131
- _list[record.rowIdx] = _objectSpread(_objectSpread({}, _list[record.rowIdx]), record.allValues);
132
- setList(_toConsumableArray(_list));
133
- listRef.current = _list;
134
- };
135
- var onRowDelete = function onRowDelete(record) {
136
- var _list = listRef.current;
137
- _list.splice(record._rowKey_, 1);
138
- setList(_toConsumableArray(_list));
139
- listRef.current = _list;
140
- };
141
- // cassandra target
142
- var _React$useState17 = React.useState(),
143
- _React$useState18 = _slicedToArray(_React$useState17, 2),
144
- keyspace = _React$useState18[0],
145
- setKeyspace = _React$useState18[1];
146
- var _React$useState19 = React.useState(),
147
- _React$useState20 = _slicedToArray(_React$useState19, 2),
148
- dtname = _React$useState20[0],
149
- setDtname = _React$useState20[1];
150
- // pgsql target
151
- var _React$useState21 = React.useState(),
152
- _React$useState22 = _slicedToArray(_React$useState21, 2),
153
- schema = _React$useState22[0],
154
- setSchema = _React$useState22[1];
155
- var _React$useState23 = React.useState(),
156
- _React$useState24 = _slicedToArray(_React$useState23, 2),
157
- dbname = _React$useState24[0],
158
- setDbname = _React$useState24[1];
159
- // minio target
160
- var _React$useState25 = React.useState(),
161
- _React$useState26 = _slicedToArray(_React$useState25, 2),
162
- filePath = _React$useState26[0],
163
- setFilePath = _React$useState26[1];
164
- // http 调用接口
165
- var pageRef = React.useRef(1);
166
- var totalRef = React.useRef();
167
- var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
168
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(http, pid, page) {
169
- var _res2, _res3, _res4;
170
- var server, _url, source, levelTwo, res, watchValues, _res, resGet;
171
- return _regeneratorRuntime.wrap(function _callee$(_context) {
172
- while (1) switch (_context.prev = _context.next) {
173
- case 0:
174
- server = new MetadataService();
175
- _url = pid || pid === '' ? http === null || http === void 0 ? void 0 : http.url.replace('{pid}', pid) : http === null || http === void 0 ? void 0 : http.url;
176
- _url = page ? http === null || http === void 0 ? void 0 : http.url.replace('{page}', page) : _url;
177
- if (!((http === null || http === void 0 ? void 0 : http.watch) && !http.watch.includes(','))) {
178
- _context.next = 11;
179
- break;
180
- }
181
- source = form.getFieldsValue()[http.watch];
182
- _url = _url.replace('{watch}', source);
183
- _context.next = 8;
184
- return server.GetEnumDataByUrl(_url, http === null || http === void 0 ? void 0 : 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)), {
185
- source: source
186
- } || {}) : source);
187
- case 8:
188
- res = _context.sent;
189
- _context.next = 23;
190
- break;
191
- case 11:
192
- if (!((http === null || http === void 0 ? void 0 : http.watch) && http.watch.includes(','))) {
193
- _context.next = 20;
194
- break;
195
- }
196
- watchValues = http.watch.split(',');
197
- source = form.getFieldsValue()[watchValues[0]];
198
- levelTwo = form.getFieldsValue()[watchValues[1]];
199
- _context.next = 17;
200
- return server.GetEnumDataByUrl(_url, http === null || http === void 0 ? void 0 : 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)), {
201
- source: source,
202
- levelTwo: levelTwo
203
- } || {}) : {
204
- source: source,
205
- levelTwo: levelTwo
206
- });
207
- case 17:
208
- res = _context.sent;
209
- _context.next = 23;
210
- break;
211
- case 20:
212
- _context.next = 22;
213
- return server.GetEnumDataByUrl(_url, http === null || http === void 0 ? void 0 : 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)), {
214
- source: source
215
- } || {}) : source);
216
- case 22:
217
- res = _context.sent;
218
- case 23:
219
- _res = ((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.total) ? (_res3 = res) === null || _res3 === void 0 ? void 0 : _res3.list : res;
220
- totalRef.current = (_res4 = res) === null || _res4 === void 0 ? void 0 : _res4.total;
221
- if (!(_res && _res.length > 0)) {
222
- _context.next = 36;
223
- break;
224
- }
225
- if (!((http === null || http === void 0 ? void 0 : http.isCascader) && (http === null || http === void 0 ? void 0 : http.url.indexOf('{pid}')) === -1)) {
226
- _context.next = 28;
227
- break;
228
- }
229
- return _context.abrupt("return", _res);
230
- case 28:
231
- if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
232
- _context.next = 30;
233
- break;
234
- }
235
- return _context.abrupt("return", _res);
236
- case 30:
237
- if (!(http === null || http === void 0 ? void 0 : http.isTreeSelect)) {
238
- _context.next = 32;
239
- break;
240
- }
241
- return _context.abrupt("return", _res);
242
- case 32:
243
- resGet = _res.map(function (it) {
244
- if (http === null || http === void 0 ? void 0 : http.isCascader) {
245
- return {
246
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
247
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
248
- isLeaf: it['isLeaf'] ? it['isLeaf'] : false
249
- };
250
- } else {
251
- return {
252
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
253
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
254
- disabled: false
255
- };
256
- }
257
- });
258
- return _context.abrupt("return", resGet);
259
- case 36:
260
- console.warn("".concat(_url, " is not return success result"));
261
- return _context.abrupt("return", []);
262
- case 38:
263
- case "end":
264
- return _context.stop();
265
- }
266
- }, _callee);
267
- }));
268
- return function (_x, _x2, _x3) {
269
- return _ref.apply(this, arguments);
270
- };
271
- }(), []);
272
- var getHttpOptions = /*#__PURE__*/function () {
273
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(httpValue) {
274
- var valueOpts;
275
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
276
- while (1) switch (_context2.prev = _context2.next) {
277
- case 0:
278
- _context2.next = 2;
279
- return getEnumDataByUrl(deepClone(httpValue), '', (httpValue === null || httpValue === void 0 ? void 0 : httpValue.isPagination) && pageRef.current);
280
- case 2:
281
- valueOpts = _context2.sent;
282
- return _context2.abrupt("return", valueOpts);
283
- case 4:
284
- case "end":
285
- return _context2.stop();
286
- }
287
- }, _callee2);
288
- }));
289
- return function getHttpOptions(_x4) {
290
- return _ref2.apply(this, arguments);
291
- };
292
- }();
293
- var getDefaultHttpConfig4Source = function getDefaultHttpConfig4Source(val) {
294
- switch (val) {
295
- case 'Kafka':
296
- return {
297
- method: 'post',
298
- body: '{"type":"Kafka","level":1}',
299
- value: 'name',
300
- key: 'config',
301
- url: '/dataset-web/source/cascade/data/v2'
302
- };
303
- break;
304
- case 'PgSql':
305
- return {};
306
- break;
307
- case 'Minio':
308
- return {};
309
- break;
310
- case 'SqlServer':
311
- return {};
312
- break;
313
- default:
314
- return null;
315
- }
316
- };
317
- var getDefaultHttpConfig4Target = function getDefaultHttpConfig4Target(val) {
318
- switch (val) {
319
- case 'Cassandra':
320
- return {
321
- method: 'post',
322
- body: '{"type":"Cassandra","level":1}',
323
- value: 'name',
324
- key: 'config',
325
- url: '/dataset-web/source/cascade/data/v2'
326
- };
327
- break;
328
- case 'PgSql':
329
- return {};
330
- break;
331
- case 'Minio':
332
- return {};
333
- break;
334
- case 'SqlServer':
335
- return {};
336
- break;
337
- default:
338
- return null;
339
- }
340
- };
341
- // 来源选项值
342
- var _React$useState27 = React.useState(),
343
- _React$useState28 = _slicedToArray(_React$useState27, 2),
344
- defaultSourceOpts = _React$useState28[0],
345
- setDefaultSourceOpts = _React$useState28[1];
346
- var topicHttp = {
347
- method: 'post',
348
- body: '{"type":"Kafka","level":2}',
349
- value: 'name',
350
- watch: 'defaultSource',
351
- key: 'dfSourceId',
352
- url: '/dataset-web/source/cascade/data/v2'
353
- };
354
- var _React$useState29 = React.useState(),
355
- _React$useState30 = _slicedToArray(_React$useState29, 2),
356
- topicOpts = _React$useState30[0],
357
- setTopicOpts = _React$useState30[1];
358
- // 去向选项值
359
- var keyspaceHttp = {
360
- method: 'post',
361
- body: '{"type":"Cassandra","level":2}',
362
- value: 'name',
363
- watch: 'defaultSource',
364
- key: 'name',
365
- url: '/dataset-web/source/cascade/data/v2'
366
- };
367
- var _React$useState31 = React.useState(),
368
- _React$useState32 = _slicedToArray(_React$useState31, 2),
369
- keyspaceOpts = _React$useState32[0],
370
- setKeyspaceOpts = _React$useState32[1];
371
- var dtnameHttp = {
372
- method: 'post',
373
- body: '{"type":"Cassandra","level":3}',
374
- value: 'name',
375
- watch: 'defaultSource,keyspace',
376
- key: 'dfSourceId',
377
- url: '/dataset-web/source/cascade/data/v2'
378
- };
379
- var _React$useState33 = React.useState(),
380
- _React$useState34 = _slicedToArray(_React$useState33, 2),
381
- dtnameOpts = _React$useState34[0],
382
- setDtnameOpts = _React$useState34[1];
383
- // onfunction
384
- var onDataSourceChange = /*#__PURE__*/function () {
385
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(val) {
386
- var _http;
387
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
388
- while (1) switch (_context3.prev = _context3.next) {
389
- case 0:
390
- setSource(val);
391
- _http = isSource ? getDefaultHttpConfig4Source(val) : getDefaultHttpConfig4Target(val);
392
- _context3.t0 = setDefaultSourceOpts;
393
- _context3.next = 5;
394
- return getHttpOptions(_http);
395
- case 5:
396
- _context3.t1 = _context3.sent;
397
- (0, _context3.t0)(_context3.t1);
398
- case 7:
399
- case "end":
400
- return _context3.stop();
401
- }
402
- }, _callee3);
403
- }));
404
- return function onDataSourceChange(_x5) {
405
- return _ref3.apply(this, arguments);
406
- };
407
- }();
408
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
409
- gutter: 16,
410
- style: marginStyle
411
- }, /*#__PURE__*/React.createElement(_Col, {
412
- span: 8
413
- }, /*#__PURE__*/React.createElement(FormItem, {
414
- label: tr('数据源'),
415
- name: 'dataSource',
416
- required: true
417
- }, /*#__PURE__*/React.createElement(_Select, {
418
- value: source,
419
- onChange: onDataSourceChange,
420
- options: dataSourceOpts,
421
- allowClear: true
422
- }))), /*#__PURE__*/React.createElement(_Col, {
423
- span: 8
424
- }, /*#__PURE__*/React.createElement(FormItem, {
425
- name: 'defaultSource',
426
- colon: false
427
- }, /*#__PURE__*/React.createElement(_Select, {
428
- value: defaultSource,
429
- onChange: ( /*#__PURE__*/function () {
430
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(val) {
431
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
432
- while (1) switch (_context4.prev = _context4.next) {
433
- case 0:
434
- setDefaultSource(val);
435
- if (!isSource) {
436
- _context4.next = 16;
437
- break;
438
- }
439
- _context4.t0 = source;
440
- _context4.next = _context4.t0 === 'Kafka' ? 5 : _context4.t0 === 'PgSql' ? 11 : _context4.t0 === 'Minio' ? 12 : _context4.t0 === 'SqlServer' ? 13 : 14;
441
- break;
442
- case 5:
443
- _context4.t1 = setTopicOpts;
444
- _context4.next = 8;
445
- return getHttpOptions(topicHttp);
446
- case 8:
447
- _context4.t2 = _context4.sent;
448
- (0, _context4.t1)(_context4.t2);
449
- return _context4.abrupt("break", 14);
450
- case 11:
451
- return _context4.abrupt("break", 14);
452
- case 12:
453
- return _context4.abrupt("break", 14);
454
- case 13:
455
- return _context4.abrupt("break", 14);
456
- case 14:
457
- _context4.next = 28;
458
- break;
459
- case 16:
460
- _context4.t3 = source;
461
- _context4.next = _context4.t3 === 'Cassandra' ? 19 : _context4.t3 === 'PgSql' ? 25 : _context4.t3 === 'Minio' ? 26 : _context4.t3 === 'SqlServer' ? 27 : 28;
462
- break;
463
- case 19:
464
- _context4.t4 = setKeyspaceOpts;
465
- _context4.next = 22;
466
- return getHttpOptions(keyspaceHttp);
467
- case 22:
468
- _context4.t5 = _context4.sent;
469
- (0, _context4.t4)(_context4.t5);
470
- return _context4.abrupt("break", 28);
471
- case 25:
472
- return _context4.abrupt("break", 28);
473
- case 26:
474
- return _context4.abrupt("break", 28);
475
- case 27:
476
- return _context4.abrupt("break", 28);
477
- case 28:
478
- case "end":
479
- return _context4.stop();
480
- }
481
- }, _callee4);
482
- }));
483
- return function (_x6) {
484
- return _ref4.apply(this, arguments);
485
- };
486
- }()),
487
- options: defaultSourceOpts,
488
- allowClear: true
489
- }))), /*#__PURE__*/React.createElement(_Col, {
490
- span: 8
491
- }, /*#__PURE__*/React.createElement(FormItem, {
492
- colon: false
493
- }, /*#__PURE__*/React.createElement(_Button, {
494
- className: "ml-2",
495
- type: "link",
496
- icon: /*#__PURE__*/React.createElement(LinkOutlined, null),
497
- onClick: function onClick() {}
498
- }, tr('测试连接'))))), isSource && source === 'Kafka' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
499
- gutter: 16,
500
- style: marginStyle
501
- }, /*#__PURE__*/React.createElement(_Col, {
502
- span: 8
503
- }, /*#__PURE__*/React.createElement(FormItem, {
504
- label: tr('主题'),
505
- name: 'topic',
506
- required: true
507
- }, /*#__PURE__*/React.createElement(_Select, {
508
- value: topics,
509
- onChange: function onChange(val) {
510
- return setTopics(val);
511
- },
512
- options: topicOpts,
513
- mode: "multiple",
514
- allowClear: true
515
- }))), /*#__PURE__*/React.createElement(_Col, {
516
- span: 8
517
- }, /*#__PURE__*/React.createElement(FormItem, {
518
- label: tr('消费策略'),
519
- name: 'autoOffsetReset',
520
- required: true
521
- }, /*#__PURE__*/React.createElement(_Select, {
522
- value: autoOffsetReset,
523
- onChange: function onChange(val) {
524
- return setAutoOffsetReset(val);
525
- },
526
- options: [{
527
- value: 'earliest',
528
- label: 'earliest'
529
- }, {
530
- value: 'latest',
531
- label: 'latest'
532
- }],
533
- allowClear: true
534
- })))), /*#__PURE__*/React.createElement(_Row, {
535
- gutter: 16,
536
- style: marginStyle
537
- }, /*#__PURE__*/React.createElement(_Col, {
538
- span: 8
539
- }, /*#__PURE__*/React.createElement(FormItem, {
540
- label: tr('批间隔'),
541
- name: 'batchDuration',
542
- required: true
543
- }, /*#__PURE__*/React.createElement(_Input, {
544
- value: batchDuration,
545
- onChange: function onChange(e) {
546
- var _e$target;
547
- return setBatchDuration(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
548
- }
549
- }))))), isSource && (source === 'PgSql' || source === 'SqlServer') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
550
- gutter: 16,
551
- style: marginStyle
552
- }, /*#__PURE__*/React.createElement(_Col, {
553
- span: 8
554
- }, /*#__PURE__*/React.createElement(FormItem, {
555
- label: tr('数据库'),
556
- name: 'dbname',
557
- required: true
558
- }, /*#__PURE__*/React.createElement(_Select, {
559
- value: dbname,
560
- onChange: function onChange(val) {
561
- return setDbname(val);
562
- },
563
- options: [],
564
- allowClear: true
565
- }))), /*#__PURE__*/React.createElement(_Col, {
566
- span: 8
567
- }, /*#__PURE__*/React.createElement(FormItem, {
568
- label: '模式',
569
- name: 'schema',
570
- required: true
571
- }, /*#__PURE__*/React.createElement(_Select, {
572
- value: schema,
573
- onChange: function onChange(val) {
574
- return setSchema(val);
575
- },
576
- options: [],
577
- allowClear: true
578
- })))), /*#__PURE__*/React.createElement(_Row, {
579
- gutter: 16,
580
- style: marginStyle
581
- }, /*#__PURE__*/React.createElement(_Col, {
582
- span: 8
583
- }, /*#__PURE__*/React.createElement(FormItem, {
584
- label: 'fetch size',
585
- name: 'fetchSize',
586
- required: true
587
- }, /*#__PURE__*/React.createElement(_Input, {
588
- value: fetchSize,
589
- onChange: function onChange(e) {
590
- var _e$target2;
591
- return setFetchSize(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value);
592
- }
593
- }))), /*#__PURE__*/React.createElement(_Col, {
594
- span: 8
595
- }, /*#__PURE__*/React.createElement(FormItem, {
596
- label: 'sql',
597
- name: 'sql',
598
- required: true
599
- }, /*#__PURE__*/React.createElement(_Input, {
600
- value: sql,
601
- onChange: function onChange(e) {
602
- var _e$target3;
603
- return setSql(e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value);
604
- }
605
- }))))), isSource && source === 'Minio' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
606
- gutter: 16,
607
- style: marginStyle
608
- }, /*#__PURE__*/React.createElement(_Col, {
609
- span: 8
610
- }, /*#__PURE__*/React.createElement(FormItem, {
611
- label: tr('上传文件'),
612
- name: 'filepath',
613
- required: true
614
- }, /*#__PURE__*/React.createElement(_Upload, {
615
- customRequest: function customRequest(options) {
616
- setTimeout(function () {
617
- options.onSuccess();
618
- }, 1000);
619
- }
620
- }, /*#__PURE__*/React.createElement(_Button, {
621
- icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
622
- }, tr('上传')))))), /*#__PURE__*/React.createElement(_Row, {
623
- gutter: 16,
624
- style: marginStyle
625
- }, /*#__PURE__*/React.createElement(_Col, {
626
- span: 16
627
- }, /*#__PURE__*/React.createElement(FormItem, {
628
- label: tr('文件信息'),
629
- name: 'headers'
630
- }, /*#__PURE__*/React.createElement(Editable, {
631
- type: "single",
632
- columns: columns,
633
- dataSource: list,
634
- onRowConfirm: onRowConfirm,
635
- onRowDelete: onRowDelete,
636
- getStreamInstance: function getStreamInstance(stream) {
637
- return streamRef.current = stream;
638
- },
639
- onRowClick: function onRowClick(record) {}
640
- }), /*#__PURE__*/React.createElement(_Button, {
641
- type: "dashed",
642
- onClick: onAddRow,
643
- style: {
644
- width: '100%',
645
- marginTop: '2px'
646
- }
647
- }, tr('添加一行')))))), isTarget && source === 'Cassandra' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
648
- gutter: 16,
649
- style: marginStyle
650
- }, /*#__PURE__*/React.createElement(_Col, {
651
- span: 8
652
- }, /*#__PURE__*/React.createElement(FormItem, {
653
- label: tr('键空间'),
654
- name: 'keyspace',
655
- required: true
656
- }, /*#__PURE__*/React.createElement(_Select, {
657
- value: keyspace,
658
- onChange: ( /*#__PURE__*/function () {
659
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(val) {
660
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
661
- while (1) switch (_context5.prev = _context5.next) {
662
- case 0:
663
- setKeyspace(val);
664
- _context5.t0 = setDtnameOpts;
665
- _context5.next = 4;
666
- return getHttpOptions(dtnameHttp);
667
- case 4:
668
- _context5.t1 = _context5.sent;
669
- (0, _context5.t0)(_context5.t1);
670
- case 6:
671
- case "end":
672
- return _context5.stop();
673
- }
674
- }, _callee5);
675
- }));
676
- return function (_x7) {
677
- return _ref5.apply(this, arguments);
678
- };
679
- }()),
680
- options: keyspaceOpts,
681
- allowClear: true
682
- }))), /*#__PURE__*/React.createElement(_Col, {
683
- span: 8
684
- }, /*#__PURE__*/React.createElement(FormItem, {
685
- label: tr('数据表'),
686
- name: 'dtname',
687
- required: true
688
- }, /*#__PURE__*/React.createElement(_Select, {
689
- value: dtname,
690
- onChange: function onChange(val) {
691
- return setDtname(val);
692
- },
693
- options: dtnameOpts,
694
- allowClear: true
695
- }))), /*#__PURE__*/React.createElement(_Col, {
696
- span: 8
697
- }, /*#__PURE__*/React.createElement(FormItem, {
698
- colon: false
699
- }, /*#__PURE__*/React.createElement(_Button, {
700
- className: "ml-2",
701
- type: "link",
702
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
703
- onClick: function onClick() {}
704
- }, tr('手动建表')))))), isTarget && (source === 'PgSql' || source === 'SqlServer') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
705
- gutter: 16,
706
- style: marginStyle
707
- }, /*#__PURE__*/React.createElement(_Col, {
708
- span: 8
709
- }, /*#__PURE__*/React.createElement(FormItem, {
710
- label: tr('数据库'),
711
- name: 'dbname',
712
- required: true
713
- }, /*#__PURE__*/React.createElement(_Select, {
714
- value: dbname,
715
- onChange: function onChange(val) {
716
- return setDbname(val);
717
- },
718
- options: [],
719
- allowClear: true
720
- }))), /*#__PURE__*/React.createElement(_Col, {
721
- span: 8
722
- }, /*#__PURE__*/React.createElement(FormItem, {
723
- label: '模式',
724
- name: 'schema',
725
- required: true
726
- }, /*#__PURE__*/React.createElement(_Select, {
727
- value: schema,
728
- onChange: function onChange(val) {
729
- return setSchema(val);
730
- },
731
- options: [],
732
- allowClear: true
733
- })))), /*#__PURE__*/React.createElement(_Row, {
734
- gutter: 16,
735
- style: marginStyle
736
- }, /*#__PURE__*/React.createElement(_Col, {
737
- span: 8
738
- }, /*#__PURE__*/React.createElement(FormItem, {
739
- label: tr('数据表'),
740
- name: 'dtname',
741
- required: true
742
- }, /*#__PURE__*/React.createElement(_Select, {
743
- value: dtname,
744
- onChange: function onChange(val) {
745
- return setDtname(val);
746
- },
747
- options: [],
748
- allowClear: true
749
- }))), /*#__PURE__*/React.createElement(_Col, {
750
- span: 8
751
- }, /*#__PURE__*/React.createElement(FormItem, {
752
- colon: false
753
- }, /*#__PURE__*/React.createElement(_Button, {
754
- className: "ml-2",
755
- type: "link",
756
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
757
- onClick: function onClick() {}
758
- }, tr('手动建表')))))), isTarget && source === 'Minio' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
759
- gutter: 16,
760
- style: marginStyle
761
- }, /*#__PURE__*/React.createElement(_Col, {
762
- span: 16
763
- }, /*#__PURE__*/React.createElement(FormItem, {
764
- label: tr('文件路径'),
765
- name: 'filepath',
766
- required: true
767
- }, /*#__PURE__*/React.createElement(_Input, {
768
- value: filePath,
769
- onChange: function onChange(e) {
770
- return setFilePath(e.target.value);
771
- }
772
- }))))));
773
- };
774
- export default SourceConfig;
775
- var FormItem = function FormItem(props) {
776
- var color = props.color,
777
- _props$labelSpan = props.labelSpan,
778
- labelSpan = _props$labelSpan === void 0 ? 0 : _props$labelSpan,
779
- _props$layout = props.layout,
780
- layout = _props$layout === void 0 ? 'horizontal' : _props$layout,
781
- name = props.name,
782
- label = props.label,
783
- colon = props.colon,
784
- help = props.help,
785
- tooltip = props.tooltip,
786
- _props$required = props.required,
787
- required = _props$required === void 0 ? false : _props$required,
788
- children = props.children,
789
- _props$wrapperSpan = props.wrapperSpan,
790
- wrapperSpan = _props$wrapperSpan === void 0 ? 3 : _props$wrapperSpan;
791
- return /*#__PURE__*/React.createElement(_Form.Item, {
792
- style: {
793
- flex: 1,
794
- paddingRight: '10px'
795
- },
796
- label: /*#__PURE__*/React.createElement("span", {
797
- style: color ? {
798
- color: color
799
- } : {}
800
- }, tr(label)),
801
- labelCol: labelSpan && layout === 'horizontal' ? {
802
- flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
803
- offset: 0
804
- } : undefined,
805
- wrapperCol: labelSpan && wrapperSpan && layout === 'horizontal' ? {
806
- style: {
807
- width: "".concat((wrapperSpan - labelSpan) * 100 / 24, "%")
808
- },
809
- flex: "0 0 ".concat((wrapperSpan - labelSpan) * 100 / 24, "%"),
810
- offset: 0
811
- } : undefined,
812
- name: name,
813
- rules: [{
814
- required: required,
815
- message: "".concat(tr('请输入'), " ").concat(tr(label))
816
- }],
817
- help: tr(help),
818
- tooltip: tr(tooltip),
819
- colon: colon
820
- }, children);
821
- };