@@ -34,13 +34,13 @@ const dvaModel = connect(
3434
3535const WorkspaceLeft = memo < IProps > ( function ( props ) {
3636 const { className, workspaceModel, dispatch } = props ;
37- const { curWorkspaceParams } = workspaceModel ;
38-
37+ const { curWorkspaceParams, openConsoleList } = workspaceModel ;
3938
4039 function getConsoleList ( ) {
4140 let p : any = {
4241 pageNo : 1 ,
4342 pageSize : 999 ,
43+ orderByDesc : false ,
4444 tabOpened : ConsoleOpenedStatus . IS_OPEN ,
4545 ...curWorkspaceParams ,
4646 } ;
@@ -60,7 +60,7 @@ const WorkspaceLeft = memo<IProps>(function (props) {
6060 const addConsole = ( params ?: ICreateConsole ) => {
6161 const { dataSourceId, databaseName, schemaName, databaseType } = curWorkspaceParams
6262 let p = {
63- name : `new console` ,
63+ name : `new console${ openConsoleList ?. length || '' } ` ,
6464 ddl : '' ,
6565 dataSourceId : dataSourceId ! ,
6666 databaseName : databaseName ! ,
@@ -70,12 +70,16 @@ const WorkspaceLeft = memo<IProps>(function (props) {
7070 tabOpened : ConsoleOpenedStatus . IS_OPEN ,
7171 }
7272 historyService . saveConsole ( params || p ) . then ( res => {
73+ dispatch ( {
74+ type : 'workspace/setCurConsoleId' ,
75+ payload : res ,
76+ } ) ;
7377 getConsoleList ( ) ;
7478 } )
7579 }
7680
7781 function createConsole ( ) {
78- addConsole ( )
82+ addConsole ( ) ;
7983 }
8084
8185 return (
@@ -214,6 +218,7 @@ const RenderSaveBox = dvaModel(function (props: any) {
214218 payload : {
215219 pageNo : 1 ,
216220 pageSize : 999 ,
221+ orderByDesc : true ,
217222 status : ConsoleStatus . RELEASE ,
218223 ...curWorkspaceParams ,
219224 } ,
@@ -252,14 +257,22 @@ const RenderSaveBox = dvaModel(function (props: any) {
252257 }
253258
254259 function openConsole ( data : IConsole ) {
260+
255261 let p : any = {
256262 id : data . id ,
257263 tabOpened : ConsoleOpenedStatus . IS_OPEN
258264 } ;
259265 historyServer . updateSavedConsole ( p ) . then ( ( res ) => {
266+
267+ dispatch ( {
268+ type : 'workspace/setCurConsoleId' ,
269+ payload : data . id ,
270+ } ) ;
271+
260272 dispatch ( {
261273 type : 'workspace/fetchGetSavedConsole' ,
262274 payload : {
275+ orderByDesc : false ,
263276 tabOpened : ConsoleOpenedStatus . IS_OPEN ,
264277 ...curWorkspaceParams
265278 } ,
@@ -281,6 +294,7 @@ const RenderSaveBox = dvaModel(function (props: any) {
281294 dispatch ( {
282295 type : 'workspace/fetchGetSavedConsole' ,
283296 payload : {
297+ orderByDesc : true ,
284298 tabOpened : ConsoleOpenedStatus . IS_OPEN ,
285299 ...curWorkspaceParams
286300 } ,
@@ -294,8 +308,8 @@ const RenderSaveBox = dvaModel(function (props: any) {
294308 dispatch ( {
295309 type : 'workspace/fetchGetSavedConsole' ,
296310 payload : {
311+ orderByDesc : true ,
297312 status : ConsoleStatus . RELEASE ,
298- orderByDesc : Boolean ,
299313 ...curWorkspaceParams
300314 } ,
301315 callback : ( res : any ) => {
0 commit comments