File tree Expand file tree Collapse file tree
blocks/DatabaseTableEditor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export default memo((props: IProps) => {
100100
101101 useEffect ( ( ) => {
102102 if ( tableName ) {
103- getTableDetails ( { } ) ;
103+ getTableDetails ( ) ;
104104 }
105105 getDatabaseFieldTypeList ( ) ;
106106 } , [ ] ) ;
@@ -155,20 +155,23 @@ export default memo((props: IProps) => {
155155 } ) ;
156156 } ;
157157
158- const getTableDetails = ( { tableNameProps } : { tableNameProps ?: string } ) => {
159- if ( ! tableName ) return ;
160- const params = {
161- databaseName,
162- dataSourceId,
163- tableName : tableNameProps || tableName ,
164- schemaName,
165- refresh : true ,
166- } ;
167- sqlService . getTableDetails ( params ) . then ( ( res ) => {
168- const newTableDetails = lodash . cloneDeep ( res ) ;
169- setTableDetails ( newTableDetails || { } ) ;
170- setOldTableDetails ( res ) ;
171- } ) ;
158+ const getTableDetails = ( myParams ?: { tableNameProps ?: string } ) => {
159+ const { tableNameProps } = myParams || { } ;
160+ const myTableName = tableNameProps || tableName ;
161+ if ( myTableName ) {
162+ const params = {
163+ databaseName,
164+ dataSourceId,
165+ tableName : myTableName ,
166+ schemaName,
167+ refresh : true ,
168+ } ;
169+ sqlService . getTableDetails ( params ) . then ( ( res ) => {
170+ const newTableDetails = lodash . cloneDeep ( res ) ;
171+ setTableDetails ( newTableDetails || { } ) ;
172+ setOldTableDetails ( res ) ;
173+ } ) ;
174+ }
172175 } ;
173176
174177 function submit ( ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ interface IProps {
1616 databaseType : DatabaseTypeCode ;
1717 databaseName : string ;
1818 dataSourceId : number ;
19- schemaName : string | undefined ;
19+ schemaName ? : string | null ;
2020 tableName ?: string ;
2121 executeSuccessCallBack : ( ) => void ;
2222 executeSqlApi ?: 'executeUpdateDataSql' ; // 两个地方用到了这个组件,但是两个需要的执行sql的接口不一样
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export interface IExecuteSqlParams {
1515 consoleId ?: number ;
1616 dataSourceId ?: number ;
1717 databaseName ?: string ;
18- schemaName ?: string ;
18+ schemaName ?: string | null ;
1919 tableName ?: string ;
2020 pageNo ?: number ;
2121 pageSize ?: number ;
@@ -192,7 +192,7 @@ const getDatabaseFieldTypeList = createRequest<{
192192const getTableDetails = createRequest < {
193193 dataSourceId : number ;
194194 databaseName : string ;
195- schemaName ?: string ;
195+ schemaName ?: string | null ;
196196 tableName : string ;
197197 refresh : boolean ;
198198} , IEditTableInfo > ( '/api/rdb/table/query' , { method : 'get' } ) ;
You can’t perform that action at this time.
0 commit comments