@@ -10,7 +10,7 @@ const PLACEHOLDER = `配置格式如下
1010
1111{
1212 "connectClusterName": "", // Connect Cluster 名称
13- "configs ": { // 具体配置项
13+ "config ": { // 具体配置项
1414 "name": "",
1515 "connector.class": "",
1616 "tasks.max": 1,
@@ -47,7 +47,7 @@ export default forwardRef((props: any, ref) => {
4747 configs : JSON . stringify (
4848 {
4949 connectClusterName,
50- configs : defaultConfigs ,
50+ config : defaultConfigs ,
5151 } ,
5252 null ,
5353 2
@@ -63,13 +63,13 @@ export default forwardRef((props: any, ref) => {
6363 form . validateFields ( ) . then (
6464 ( data ) => {
6565 const postData = JSON . parse ( data . configs ) ;
66- postData . connectorName = postData . configs . name ;
66+ postData . connectorName = postData . config . name ;
6767 postData . connectClusterId = connectClusters . find ( ( cluster ) => cluster . label === postData . connectClusterName ) . value ;
6868 delete postData . connectClusterName ;
6969
70- Object . entries ( postData . configs ) . forEach ( ( [ key , val ] ) => {
70+ Object . entries ( postData . config ) . forEach ( ( [ key , val ] ) => {
7171 if ( val === null ) {
72- delete postData . configs [ key ] ;
72+ delete postData . config [ key ] ;
7373 }
7474 } ) ;
7575 Utils . put ( api . validateConnectorConfig , postData ) . then (
@@ -198,34 +198,34 @@ export default forwardRef((props: any, ref) => {
198198 }
199199 }
200200
201- if ( ! v . configs || typeof v . configs !== 'object' ) {
202- return Promise . reject ( '内容缺少 configs 字段或字段格式错误' ) ;
201+ if ( ! v . config || typeof v . config !== 'object' ) {
202+ return Promise . reject ( '内容缺少 config 字段或字段格式错误' ) ;
203203 } else {
204204 // 校验 connectorName 字段
205- if ( ! v . configs . name ) {
206- return Promise . reject ( 'configs 字段下缺少 name 项' ) ;
205+ if ( ! v . config . name ) {
206+ return Promise . reject ( 'config 字段下缺少 name 项' ) ;
207207 } else {
208- if ( type === 'edit' && v . configs . name !== defaultConfigs . name ) {
208+ if ( type === 'edit' && v . config . name !== defaultConfigs . name ) {
209209 return Promise . reject ( '编辑模式下不允许修改 name 字段' ) ;
210210 }
211211 }
212- if ( ! v . configs [ 'connector.class' ] ) {
213- return Promise . reject ( 'configs 字段下缺少 connector.class 项' ) ;
214- } else if ( type === 'edit' && v . configs [ 'connector.class' ] !== defaultConfigs [ 'connector.class' ] ) {
212+ if ( ! v . config [ 'connector.class' ] ) {
213+ return Promise . reject ( 'config 字段下缺少 connector.class 项' ) ;
214+ } else if ( type === 'edit' && v . config [ 'connector.class' ] !== defaultConfigs [ 'connector.class' ] ) {
215215 return Promise . reject ( '编辑模式下不允许修改 connector.class 字段' ) ;
216216 }
217217 }
218218
219219 if ( type === 'create' ) {
220220 // 异步校验 connector 名称是否重复 以及 className 是否存在
221221 return Promise . all ( [
222- Utils . request ( api . isConnectorExist ( connectClusterId , v . configs . name ) ) ,
222+ Utils . request ( api . isConnectorExist ( connectClusterId , v . config . name ) ) ,
223223 Utils . request ( api . getConnectorPlugins ( connectClusterId ) ) ,
224224 ] ) . then (
225225 ( [ data , plugins ] : [ any , ConnectorPlugin [ ] ] ) => {
226226 return data ?. exist
227227 ? Promise . reject ( 'name 与已有 Connector 重复' )
228- : plugins . every ( ( plugin ) => plugin . className !== v . configs [ 'connector.class' ] )
228+ : plugins . every ( ( plugin ) => plugin . className !== v . config [ 'connector.class' ] )
229229 ? Promise . reject ( '该 connectCluster 下不存在 connector.class 项配置的插件' )
230230 : Promise . resolve ( ) ;
231231 } ,
0 commit comments