1- import Http from './Http'
21import { isPlainObj } from '@tap/shared'
2+ import Http from './Http'
33
44export default class MetadataInstances extends Http {
55 constructor ( ) {
66 super ( '/api/MetadataInstances' )
77 }
88 getId ( id , params ) {
9- return this . axios . get ( this . url + '/' + id , { params } )
9+ return this . axios . get ( ` ${ this . url } / ${ id } ` , { params } )
1010 }
1111 patchId ( id , params ) {
12- return this . axios . patch ( this . url + '/' + id , params )
12+ return this . axios . patch ( ` ${ this . url } / ${ id } ` , params )
1313 }
1414 classification ( params ) {
15- return this . axios . patch ( this . url + ' /classifications' , params )
15+ return this . axios . patch ( ` ${ this . url } /classifications` , params )
1616 }
1717 download ( where , type ) {
1818 if ( typeof where === 'object' ) where = JSON . stringify ( where )
19- window . open ( this . url + `/download?where=${ encodeURIComponent ( where ) } &type=${ type } ` )
19+ window . open (
20+ `${ this . url } /download?where=${ encodeURIComponent ( where ) } &type=${ type } ` ,
21+ )
2022 // return this.axios.get(this.url + '/download?where=' + where);
2123 }
2224
2325 dataMap ( params ) {
24- return this . axios . get ( this . url + ' /dataMap' , { params } )
26+ return this . axios . get ( ` ${ this . url } /dataMap` , { params } )
2527 }
2628 schema ( params ) {
27- return this . axios . get ( this . url + ' /schema' , { params } )
29+ return this . axios . get ( ` ${ this . url } /schema` , { params } )
2830 }
2931 tableConnection ( params ) {
30- return this . axios . get ( this . url + ' /tableConnection' , { params } )
32+ return this . axios . get ( ` ${ this . url } /tableConnection` , { params } )
3133 }
3234 upload ( upsert , type , listtags , params ) {
33- return this . axios . post ( `${ this . url } /upload?upsert=${ upsert } &type=${ type } &listtags=${ listtags } ` , params )
35+ return this . axios . post (
36+ `${ this . url } /upload?upsert=${ upsert } &type=${ type } &listtags=${ listtags } ` ,
37+ params ,
38+ )
3439 }
3540 search ( params ) {
36- return this . axios . get ( this . url + ' /search' , { params } )
41+ return this . axios . get ( ` ${ this . url } /search` , { params } )
3742 }
3843 compareHistory ( id , params ) {
39- return this . axios . get ( this . url + ' /compareHistory?id=' + id , params )
44+ return this . axios . get ( ` ${ this . url } /compareHistory?id=${ id } ` , params )
4045 }
4146
4247 /**
@@ -45,8 +50,12 @@ export default class MetadataInstances extends Http {
4550 * @param fields 筛选字段,如果有值,则请求结果只返回fields包含的字段;类型:字符串数组
4651 * @returns {Promise<AxiosResponse<any>> }
4752 */
48- nodeSchema ( nodeId , fields = [ 'fields' , 'indices' ] , nodeConfig ) {
49- return this . axios . get ( this . url + '/node/schema' , {
53+ nodeSchema (
54+ nodeId ,
55+ fields = [ 'fields' , 'indices' , 'constraints' ] ,
56+ nodeConfig ,
57+ ) {
58+ return this . axios . get ( `${ this . url } /node/schema` , {
5059 params : {
5160 nodeId,
5261 fields,
@@ -60,15 +69,24 @@ export default class MetadataInstances extends Http {
6069 */
6170 originalData ( qualified_name , target ) {
6271 if ( target ) {
63- return this . axios . get ( this . url + '/originalData?qualified_name=' + encodeURIComponent ( qualified_name ) + target )
64- } else return this . axios . get ( this . url + '/originalData?qualified_name=' + encodeURIComponent ( qualified_name ) )
72+ return this . axios . get (
73+ `${ this . url } /originalData?qualified_name=${ encodeURIComponent (
74+ qualified_name ,
75+ ) } ${ target } `,
76+ )
77+ } else
78+ return this . axios . get (
79+ `${ this . url } /originalData?qualified_name=${ encodeURIComponent (
80+ qualified_name ,
81+ ) } `,
82+ )
6583 }
6684
6785 get ( params = { } , filter ) {
6886 if ( Array . isArray ( params ) ) {
6987 filter = typeof filter === 'object' ? JSON . stringify ( filter ) : filter
70- let qs = filter ? ' ?filter=' + encodeURIComponent ( filter ) : ''
71- return this . axios . get ( this . url + '/' + params . join ( '/' ) + qs )
88+ const qs = filter ? ` ?filter=${ encodeURIComponent ( filter ) } ` : ''
89+ return this . axios . get ( ` ${ this . url } / ${ params . join ( '/' ) } ${ qs } ` )
7290 }
7391 const config = { params }
7492 if ( isPlainObj ( filter ) ) {
@@ -78,15 +96,17 @@ export default class MetadataInstances extends Http {
7896 }
7997
8098 getTables ( connectionId ) {
81- return this . axios . get ( this . url + ' /tables?connectionId=' + connectionId )
99+ return this . axios . get ( ` ${ this . url } /tables?connectionId=${ connectionId } ` )
82100 }
83101
84102 getTablesValue ( params ) {
85- return this . axios . get ( this . url + ' /tablesValue' , { params } )
103+ return this . axios . get ( ` ${ this . url } /tablesValue` , { params } )
86104 }
87105
88106 getSourceTables ( connectionId ) {
89- return this . axios . get ( this . url + '/tables?connectionId=' + connectionId + '&sourceType=SOURCE' )
107+ return this . axios . get (
108+ `${ this . url } /tables?connectionId=${ connectionId } &sourceType=SOURCE` ,
109+ )
90110 }
91111
92112 /**
@@ -96,75 +116,79 @@ export default class MetadataInstances extends Http {
96116 * @returns {Promise<AxiosResponse<any>> }
97117 */
98118 getMergerNodeParentFields ( taskId , nodeId ) {
99- return this . axios . get ( `${ this . url } /mergerNode/parent/fields?taskId=${ taskId } &nodeId=${ nodeId } ` )
119+ return this . axios . get (
120+ `${ this . url } /mergerNode/parent/fields?taskId=${ taskId } &nodeId=${ nodeId } ` ,
121+ )
100122 }
101123 findTablesById ( id ) {
102- return this . axios . get ( this . url + ' /findTablesById/' + id )
124+ return this . axios . get ( ` ${ this . url } /findTablesById/${ id } ` )
103125 }
104126 findInspect ( data ) {
105- return this . axios . post ( this . url + ' /findInspectPost' , data )
127+ return this . axios . post ( ` ${ this . url } /findInspectPost` , data )
106128 }
107129 //元数据修改
108130 saveTable ( params ) {
109- return this . axios . post ( this . url + ' /migrate/saveTable' , params )
131+ return this . axios . post ( ` ${ this . url } /migrate/saveTable` , params )
110132 }
111133 //元数据修改
112134 resetTable ( params ) {
113- return this . axios . post ( this . url + ' /migrate/reset' , params )
135+ return this . axios . post ( ` ${ this . url } /migrate/reset` , params )
114136 }
115137
116138 //61迭代 新增可以修改目标节点类型 新增接口
117139 changeFields ( params ) {
118- return this . axios . post ( this . url + ' /changeFields' , params )
140+ return this . axios . post ( ` ${ this . url } /changeFields` , params )
119141 }
120142 changeFieldsReset ( params ) {
121- return this . axios . post ( this . url + ' /changeFields/reset' , params )
143+ return this . axios . post ( ` ${ this . url } /changeFields/reset` , params )
122144 }
123145 dataType2TapType ( params ) {
124- return this . axios . post ( this . url + ' /dataType2TapType' , params )
146+ return this . axios . post ( ` ${ this . url } /dataType2TapType` , params )
125147 }
126148 nodeSchemaPage ( params ) {
127- return this . axios . get ( this . url + ' /node/schemaPage' , { params } )
149+ return this . axios . get ( ` ${ this . url } /node/schemaPage` , { params } )
128150 }
129151 tapTables ( params ) {
130- return this . axios . get ( this . url + '/tapTables?filter=' + encodeURIComponent ( params . filter ) )
152+ return this . axios . get (
153+ `${ this . url } /tapTables?filter=${ encodeURIComponent ( params . filter ) } ` ,
154+ )
131155 }
132156 checkTableExist ( params ) {
133- return this . axios . get ( this . url + ' /check/table/exist' , { params } )
157+ return this . axios . get ( ` ${ this . url } /check/table/exist` , { params } )
134158 }
135159 deleteLogicSchema ( taskId , params ) {
136- return this . axios . delete ( this . url + ' /logic/schema/' + taskId , { params } )
160+ return this . axios . delete ( ` ${ this . url } /logic/schema/${ taskId } ` , { params } )
137161 }
138162 pageTables ( params ) {
139- return this . axios . get ( this . url + ' /page-tables' , { params } )
163+ return this . axios . get ( ` ${ this . url } /page-tables` , { params } )
140164 }
141165 pagePartitionTables ( params ) {
142- return this . axios . get ( this . url + ' /partition/page-tables' , { params } )
166+ return this . axios . get ( ` ${ this . url } /partition/page-tables` , { params } )
143167 }
144168 //更新表描述
145169 updateTableDesc ( params ) {
146- return this . axios . post ( this . url + ' /updateTableDesc' , params )
170+ return this . axios . post ( ` ${ this . url } /updateTableDesc` , params )
147171 }
148172 dataTypeCheckMultiple ( params ) {
149- return this . axios . post ( this . url + ' /dataType/checkMultiple' , params )
173+ return this . axios . post ( ` ${ this . url } /dataType/checkMultiple` , params )
150174 }
151175 updateTableFieldDesc ( id , params ) {
152- return this . axios . post ( this . url + ` /updateTableFieldDesc/${ id } `, params )
176+ return this . axios . post ( ` ${ this . url } /updateTableFieldDesc/${ id } `, params )
153177 }
154178 nodeFilterTypeList ( params ) {
155- return this . axios . get ( this . url + ` /node/filterTypeList`, { params } )
179+ return this . axios . get ( ` ${ this . url } /node/filterTypeList`, { params } )
156180 }
157181 // 获取表最新的字段列表
158182 multiTransform ( params ) {
159- return this . axios . post ( this . url + ` /multi/transform`, params )
183+ return this . axios . post ( ` ${ this . url } /multi/transform`, params )
160184 }
161185
162186 getNodeSchemaMapByIds ( params ) {
163- return this . axios . get ( this . url + ` /nodes/schema-map`, { params } )
187+ return this . axios . get ( ` ${ this . url } /nodes/schema-map`, { params } )
164188 }
165189
166190 checkFiledIndex ( params ) {
167- return this . axios . get ( this . url + ` /check/filedIndex`, { params } )
191+ return this . axios . get ( ` ${ this . url } /check/filedIndex`, { params } )
168192 }
169193}
170194export { MetadataInstances }
0 commit comments