ronds-metadata 1.3.72 → 1.3.73

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/es/api/index.js CHANGED
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import { guid, md5 } from '../utils';
11
11
  import { addInterceptor, HttpHelper } from '../framework/http';
12
12
  var http = new HttpHelper();
13
- var token = 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkMyMTJFMjI1NTcwNjRDQTE3M0U2NjkxRjM4QzFDOEEyIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE3MjM4NzU4OTksImV4cCI6MTcyNDEzNTA5OSwiaXNzIjoiaHR0cDovL2ZhYmlvOjk5OTkvc3VwZXJjYXJlY29yZSIsImF1ZCI6ImVwbSIsImNsaWVudF9pZCI6ImVwbSIsInN1YiI6IjNhMTIxZDJiLWYwZDUtZDQ3OC0xN2Q3LWQwODEwZDgzZDViMSIsImF1dGhfdGltZSI6MTcyMzg3NTg5OSwiaWRwIjoibG9jYWwiLCJuYW1lIjoicGhtIiwiZW1haWwiOiJwaG1AYWJwLmlvIiwicm9sZSI6WyJhZG1pbiIsInBobV9hZG1pbiJdLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9naXZlbm5hbWUiOiJwaG3ov5Dnu7TotKblj7ciLCJwaG9uZV9udW1iZXIiOiIxMzYwMDAwMDAwMCIsInBob25lX251bWJlcl92ZXJpZmllZCI6IlRydWUiLCJlbWFpbF92ZXJpZmllZCI6IlRydWUiLCJpYXQiOjE3MjM4NzU4OTksInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsImVwbSIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.OK10CQsLVqkRSPEnpQKH_mJU9PbVug0ok4rb6C9EaG2g3-j6GvRhx4_4uPpbE3Y2vBRetkITUh3yccFeoh8kROKUJtr_9HT-W-jULSjfwZN9yd_GJFV1rL3fGEpoUZUqeUEoCvKifgB-8A_N_IN-utk5jzyD-gpKo9jUZySpPsd7JBzA_G_DGV-5vO-lXUJsBySDxt0S3NplnX1A17Pqoxh0ihLL1tlJ-mblSaX8lqWVrEbgBEjpU7Do1siSrZN_zaSBMLneCRkExQULwIWHq0z1agAxhO60YlSdTl78KfF9B_rgQFtkW8a6BZNOvyCwix95lDeedZj-uF2uym84Fg';
13
+ var token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkMyMTJFMjI1NTcwNjRDQTE3M0U2NjkxRjM4QzFDOEEyIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE3MjQxNDAxNzYsImV4cCI6MTcyNDM5OTM3NiwiaXNzIjoiaHR0cDovL2ZhYmlvOjk5OTkvc3VwZXJjYXJlY29yZSIsImF1ZCI6ImVwbSIsImNsaWVudF9pZCI6ImVwbSIsInN1YiI6IjNhMTIxZDJiLWYwZDUtZDQ3OC0xN2Q3LWQwODEwZDgzZDViMSIsImF1dGhfdGltZSI6MTcyNDE0MDE3NiwiaWRwIjoibG9jYWwiLCJuYW1lIjoicGhtIiwiZW1haWwiOiJwaG1AYWJwLmlvIiwicm9sZSI6WyJhZG1pbiIsInBobV9hZG1pbiJdLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9naXZlbm5hbWUiOiJwaG3ov5Dnu7TotKblj7ciLCJwaG9uZV9udW1iZXIiOiIxMzYwMDAwMDAwMCIsInBob25lX251bWJlcl92ZXJpZmllZCI6IlRydWUiLCJlbWFpbF92ZXJpZmllZCI6IlRydWUiLCJpYXQiOjE3MjQxNDAxNzYsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsImVwbSIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.UbzQuknIHc6bHvyF-ph0NlqenAOCxUjlt1Q0DkPhX9BJkKMetIgo1HL9Dv0wJV1m7J5nkha7kqFM4lfnTXlZEn-hJdkse96C-NLfR4lrRedgrljhfqnwyCPZm0RbEOLsLAAKNN8Ib7m4NJ-4glgqO_ZdEMa4eZIY9WKSWDLsuyyMSyaXNGWzFf5aHGolIy4RguJ_NXzOJgZfsln3V9iaxSc7g2XXtn4gVIK-Pqw33Ig6_gpATd6hGFj0eBbZ6RMQPc-BNQ4H9JDvGuURIUsOAvcct2U36N1avB1qf9NKECFC4CoWR4CArcZJl-s5p2uCopcYe2d4alZqQofOzrei1Q';
14
14
  addInterceptor(function (httpClient) {
15
15
  httpClient.interceptors.request.use(function (_config) {
16
16
  if (!_config.headers) {
@@ -34,10 +34,14 @@ var MapTable = function MapTable(props) {
34
34
  _React$useState10 = _slicedToArray(_React$useState9, 2),
35
35
  output = _React$useState10[0],
36
36
  setOutput = _React$useState10[1];
37
- var _React$useState11 = React.useState(),
37
+ var _React$useState11 = React.useState(false),
38
38
  _React$useState12 = _slicedToArray(_React$useState11, 2),
39
- disableArray = _React$useState12[0],
40
- setDisableArray = _React$useState12[1];
39
+ isDataCome = _React$useState12[0],
40
+ setIsDataCome = _React$useState12[1];
41
+ var _React$useState13 = React.useState(),
42
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
43
+ disableArray = _React$useState14[0],
44
+ setDisableArray = _React$useState14[1];
41
45
  var sourceEditableStreamRef = React.useRef();
42
46
  var targetEditableStreamRef = React.useRef();
43
47
  var _React$useContext = React.useContext(MetadataFormContext),
@@ -106,14 +110,17 @@ var MapTable = function MapTable(props) {
106
110
  }
107
111
  }, [disableArray]);
108
112
  React.useEffect(function () {
109
- var values = form.getFieldsValue().mapTable;
110
- values.dataSource && setTableDataSource(values.dataSource);
111
- values.dataTarget && setTableDataTarget(values.dataTarget);
112
- values.options && setOptions(values.options);
113
- if (!disableArray && values.dataSource && values.dataTarget) {
114
- var _values$dataSource, _values$dataTarget;
115
- var valueArray = new Array(Math.min((_values$dataSource = values.dataSource) === null || _values$dataSource === void 0 ? void 0 : _values$dataSource.length, (_values$dataTarget = values.dataTarget) === null || _values$dataTarget === void 0 ? void 0 : _values$dataTarget.length)).fill(true);
116
- setDisableArray(valueArray);
113
+ if (!isDataCome) {
114
+ var values = form.getFieldsValue().mapTable;
115
+ values.dataSource && setTableDataSource(values.dataSource);
116
+ values.dataTarget && setTableDataTarget(values.dataTarget);
117
+ values.options && setOptions(values.options);
118
+ if (!disableArray && values.dataSource && values.dataTarget) {
119
+ var _values$dataSource, _values$dataTarget;
120
+ var valueArray = new Array(Math.min((_values$dataSource = values.dataSource) === null || _values$dataSource === void 0 ? void 0 : _values$dataSource.length, (_values$dataTarget = values.dataTarget) === null || _values$dataTarget === void 0 ? void 0 : _values$dataTarget.length)).fill(true);
121
+ setDisableArray(valueArray);
122
+ }
123
+ setIsDataCome(true);
117
124
  }
118
125
  }, [form.getFieldsValue()]);
119
126
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -301,6 +301,15 @@ var SourceConfig = function SourceConfig(props) {
301
301
  url: '/dataset-web/source/cascade/data/v2'
302
302
  };
303
303
  break;
304
+ case 'PgSql':
305
+ return {};
306
+ break;
307
+ case 'Minio':
308
+ return {};
309
+ break;
310
+ case 'SqlServer':
311
+ return {};
312
+ break;
304
313
  default:
305
314
  return null;
306
315
  }
@@ -316,6 +325,15 @@ var SourceConfig = function SourceConfig(props) {
316
325
  url: '/dataset-web/source/cascade/data/v2'
317
326
  };
318
327
  break;
328
+ case 'PgSql':
329
+ return {};
330
+ break;
331
+ case 'Minio':
332
+ return {};
333
+ break;
334
+ case 'SqlServer':
335
+ return {};
336
+ break;
319
337
  default:
320
338
  return null;
321
339
  }
@@ -415,11 +433,11 @@ var SourceConfig = function SourceConfig(props) {
415
433
  case 0:
416
434
  setDefaultSource(val);
417
435
  if (!isSource) {
418
- _context4.next = 13;
436
+ _context4.next = 16;
419
437
  break;
420
438
  }
421
439
  _context4.t0 = source;
422
- _context4.next = _context4.t0 === 'Kafka' ? 5 : 11;
440
+ _context4.next = _context4.t0 === 'Kafka' ? 5 : _context4.t0 === 'PgSql' ? 11 : _context4.t0 === 'Minio' ? 12 : _context4.t0 === 'SqlServer' ? 13 : 14;
423
441
  break;
424
442
  case 5:
425
443
  _context4.t1 = setTopicOpts;
@@ -428,23 +446,35 @@ var SourceConfig = function SourceConfig(props) {
428
446
  case 8:
429
447
  _context4.t2 = _context4.sent;
430
448
  (0, _context4.t1)(_context4.t2);
431
- return _context4.abrupt("break", 11);
449
+ return _context4.abrupt("break", 14);
432
450
  case 11:
433
- _context4.next = 22;
434
- break;
451
+ return _context4.abrupt("break", 14);
452
+ case 12:
453
+ return _context4.abrupt("break", 14);
435
454
  case 13:
436
- _context4.t3 = source;
437
- _context4.next = _context4.t3 === 'Cassandra' ? 16 : 22;
455
+ return _context4.abrupt("break", 14);
456
+ case 14:
457
+ _context4.next = 28;
438
458
  break;
439
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:
440
464
  _context4.t4 = setKeyspaceOpts;
441
- _context4.next = 19;
465
+ _context4.next = 22;
442
466
  return getHttpOptions(keyspaceHttp);
443
- case 19:
467
+ case 22:
444
468
  _context4.t5 = _context4.sent;
445
469
  (0, _context4.t4)(_context4.t5);
446
- return _context4.abrupt("break", 22);
447
- case 22:
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:
448
478
  case "end":
449
479
  return _context4.stop();
450
480
  }
@@ -11,8 +11,6 @@ import { EyeOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icon
11
11
  import Split from '../../../Split';
12
12
  import SqlEdit from '../../../JsonEdit';
13
13
  var SparkSqlTable = function SparkSqlTable(props) {
14
- // const { extraDico, initSql, dataSource, onSearch, value, onChange } = props;
15
- // const [searchValue, setSearchValue] = React.useState<any>();
16
14
  var extraDico = props.extraDico,
17
15
  value = props.value,
18
16
  onChange = props.onChange;
@@ -90,7 +88,7 @@ var SparkSqlTable = function SparkSqlTable(props) {
90
88
  }, [value]);
91
89
  return /*#__PURE__*/React.createElement("div", {
92
90
  style: {
93
- border: '2px solid #bbbbbb',
91
+ border: '2px solid #bebebe',
94
92
  height: '500px'
95
93
  }
96
94
  }, /*#__PURE__*/React.createElement(Split, {
@@ -108,7 +106,8 @@ var SparkSqlTable = function SparkSqlTable(props) {
108
106
  }, /*#__PURE__*/React.createElement("span", {
109
107
  style: {
110
108
  display: 'flex',
111
- flexWrap: 'nowrap'
109
+ flexWrap: 'nowrap',
110
+ alignItems: 'center'
112
111
  }
113
112
  }, tr('视图'), " ", /*#__PURE__*/React.createElement(_Input, {
114
113
  style: {
@@ -122,7 +121,8 @@ var SparkSqlTable = function SparkSqlTable(props) {
122
121
  style: {
123
122
  display: 'flex',
124
123
  overflowX: 'auto',
125
- flexWrap: 'nowrap'
124
+ flexWrap: 'nowrap',
125
+ alignItems: 'center'
126
126
  }
127
127
  }, tr('已选'), ' ', selected && selected.map(function (p) {
128
128
  return /*#__PURE__*/React.createElement(_Input, {
@@ -177,7 +177,7 @@ var SparkSqlTable = function SparkSqlTable(props) {
177
177
  },
178
178
  value: (_item$alias = item.alias) !== null && _item$alias !== void 0 ? _item$alias : "tbl".concat(idx + 1),
179
179
  onChange: function onChange(val) {
180
- return onListChange(val, idx, 'alias');
180
+ onListChange(val, idx, 'alias');
181
181
  }
182
182
  })), /*#__PURE__*/React.createElement("span", null, tr('输出视图'), ' ', /*#__PURE__*/React.createElement(_Input, {
183
183
  style: {
@@ -191,7 +191,8 @@ var SparkSqlTable = function SparkSqlTable(props) {
191
191
  }
192
192
  }))), /*#__PURE__*/React.createElement("div", {
193
193
  style: {
194
- maxHeight: '80px',
194
+ maxHeight: '100px',
195
+ minHeight: '80px',
195
196
  overflowY: 'auto'
196
197
  }
197
198
  }, /*#__PURE__*/React.createElement(SqlEdit, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.72",
4
+ "version": "1.3.73",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- interface ISourceConfigNewProps {
3
- configType: string;
4
- sourceHttp?: any[];
5
- sourceEnums?: any[];
6
- targetHttp?: any[];
7
- targetEnums?: any[];
8
- }
9
- declare const SourceConfigNew: (props: ISourceConfigNewProps) => React.JSX.Element;
10
- export default SourceConfigNew;
@@ -1,649 +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 { 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
- };