@@ -9,7 +9,7 @@ import Tree from '../Tree';
99import Iconfont from '@/components/Iconfont' ;
1010import LoadingContent from '@/components/Loading/LoadingContent' ;
1111import { TreeNodeType } from '@/constants/tree' ;
12- import { ITreeNode } from '@/typings/tree'
12+ import { ITreeNode } from '@/typings/tree' ;
1313import { useReducerContext } from '../../index' ;
1414import { workspaceActionType } from '../../context' ;
1515interface IProps {
@@ -19,15 +19,25 @@ interface IProps {
1919export default memo < IProps > ( function WorkspaceLeft ( props ) {
2020 const { className } = props ;
2121
22- return < div className = { classnames ( styles . box , className ) } >
23- < div className = { styles . header } >
24- < RenderSelectDatabase > </ RenderSelectDatabase >
22+ return (
23+ < div className = { classnames ( styles . box , className ) } >
24+ < div className = { styles . header } >
25+ < RenderSelectDatabase > </ RenderSelectDatabase >
26+ </ div >
27+ < div className = { styles . save_box } > Save</ div >
28+ < Divider />
29+ < RenderTableBox > </ RenderTableBox >
2530 </ div >
31+ << < < << < HEAD
2632 < RenderSaveBox > </ RenderSaveBox >
2733 < Divider / >
2834 < RenderTableBox > </ RenderTableBox >
2935 < / d i v >
3036} )
37+ === === =
38+ ) ;
39+ } ) ;
40+ > >>> >>> 92 bbbb7a2c26113765f2a43d9fb6eaa27db66463
3141
3242interface Option {
3343 value : number ;
@@ -49,18 +59,18 @@ function RenderSelectDatabase() {
4959 pageNo : 1 ,
5060 pageSize : 999 ,
5161 } ;
52- treeConfig [ TreeNodeType . DATA_SOURCES ] . getChildren ! ( p ) . then ( res => {
62+ treeConfig [ TreeNodeType . DATA_SOURCES ] . getChildren ! ( p ) . then ( ( res ) => {
5363 let newOptions : any = res . map ( ( t ) => {
5464 return {
5565 label : t . name ,
5666 value : t . key ,
5767 type : TreeNodeType . DATA_SOURCE ,
5868 isLeaf : false ,
59- databaseType : t . extraParams ?. databaseType
69+ databaseType : t . extraParams ?. databaseType ,
6070 } ;
6171 } ) ;
6272 setOptions ( newOptions ) ;
63- } )
73+ } ) ;
6474 }
6575
6676 const onChange : any = ( valueArr : any , selectedOptions : any ) => {
@@ -74,36 +84,36 @@ function RenderSelectDatabase() {
7484 databaseSourceName : labelArr [ 0 ] ,
7585 databaseName : labelArr [ 1 ] ,
7686 schemaName : labelArr [ 2 ] ,
77- databaseType : selectedOptions [ 0 ] . databaseType
78- }
87+ databaseType : selectedOptions [ 0 ] . databaseType ,
88+ } ;
7989
8090 dispatch ( {
8191 type : workspaceActionType . CURRENT_WORKSPACE_DATA ,
82- payload : currentWorkspaceData
92+ payload : currentWorkspaceData ,
8393 } ) ;
8494 } ;
8595
8696 // 及联loadData
8797 const loadData = ( selectedOptions : any ) => {
8898 if ( selectedOptions . length > 1 ) {
89- return
99+ return ;
90100 }
91101
92102 const targetOption = selectedOptions [ 0 ] ;
93103 treeConfig [ TreeNodeType . DATA_SOURCE ] . getChildren ! ( {
94- id : targetOption . value
95- } ) . then ( res => {
104+ id : targetOption . value ,
105+ } ) . then ( ( res ) => {
96106 let newOptions = res . map ( ( t ) => {
97107 return {
98108 label : t . name ,
99109 value : t . key ,
100110 type : TreeNodeType . DATABASE ,
101- databaseType : t . extraParams ?. databaseType
111+ databaseType : t . extraParams ?. databaseType ,
102112 } ;
103113 } ) ;
104114 targetOption . children = newOptions ;
105115 setOptions ( [ ...( options || [ ] ) ] ) ;
106- } )
116+ } ) ;
107117
108118 // TODO:根据后端字段 如果有SCHEMAS再去查询SCHEMAS
109119 // if (targetOption.type === TreeNodeType.SCHEMAS) {
@@ -122,7 +132,6 @@ function RenderSelectDatabase() {
122132 // })
123133 // } else {
124134 // }
125-
126135 } ;
127136
128137 const dropdownRender = ( menus : React . ReactNode ) => (
@@ -134,7 +143,7 @@ function RenderSelectDatabase() {
134143
135144 function renderCurrentSelected ( ) {
136145 const { databaseName, schemaName, databaseSourceName } = currentWorkspaceData ;
137- const currentSelectedArr = [ databaseSourceName , databaseName , schemaName ] . filter ( t => t ) ;
146+ const currentSelectedArr = [ databaseSourceName , databaseName , schemaName ] . filter ( ( t ) => t ) ;
138147 return currentSelectedArr . join ( '/' ) ;
139148 }
140149
@@ -147,16 +156,17 @@ function RenderSelectDatabase() {
147156 loadData = { loadData }
148157 bordered = { false }
149158 dropdownRender = { dropdownRender }
159+ placeholder = { 'xxxxxxx' }
150160 >
151161 < div className = { styles . current_database } >
152- < div className = { styles . name } >
153- { renderCurrentSelected ( ) }
154- </ div >
162+ < div className = { styles . name } > { renderCurrentSelected ( ) } </ div >
155163 < Iconfont code = "" />
156164 </ div >
157165 </ Cascader >
158166 < div className = { styles . other_operations } >
159- < div className = { styles . icon_box } > < Iconfont code = '' /> </ div >
167+ < div className = { styles . icon_box } >
168+ < Iconfont code = "" />
169+ </ div >
160170 </ div >
161171 </ div >
162172 ) ;
@@ -169,22 +179,30 @@ function RenderTableBox() {
169179
170180 useEffect ( ( ) => {
171181 getInitialData ( ) ;
172- } , [ currentWorkspaceData ] )
182+ } , [ currentWorkspaceData ] ) ;
173183
174184 function getInitialData ( ) {
175185 treeConfig [ TreeNodeType . TABLES ] . getChildren ! ( {
176186 pageNo : 1 ,
177187 pageSize : 999 ,
178188 ...currentWorkspaceData ,
179- extraParams : currentWorkspaceData
180- } ) . then ( res => {
189+ extraParams : currentWorkspaceData ,
190+ } ) . then ( ( res ) => {
181191 setInitialData ( res ) ;
182- } )
192+ } ) ;
183193 }
184194
195+ << < < << < HEAD
185196 return < div className = { styles . table_box } >
186197 < Tree className = { styles . tree } initialData = { initialData } > </ Tree >
187198 </ div >
199+ =======
200+ return (
201+ < div className = { styles . table_box } >
202+ < Tree className = { styles . tree } initialData = { initialData } > </ Tree >
203+ </ div >
204+ );
205+ >>> >>> > 92 bbbb7a2c26113765f2a43d9fb6eaa27db66463
188206}
189207
190208function RenderSaveBox ( ) {
0 commit comments