@@ -30,7 +30,10 @@ import { PageSpinner } from '@postgres.ai/shared/components/PageSpinner'
30
30
import { Spinner } from '@postgres.ai/shared/components/Spinner'
31
31
import { icons } from '@postgres.ai/shared/styles/icons'
32
32
import { GatewayLink } from '@postgres.ai/shared/components/GatewayLink'
33
- import { ClassesType , RefluxTypes } from '@postgres.ai/platform/src/components/types'
33
+ import {
34
+ ClassesType ,
35
+ RefluxTypes ,
36
+ } from '@postgres.ai/platform/src/components/types'
34
37
35
38
import Store from '../../stores/store'
36
39
import Actions from '../../actions/actions'
@@ -80,8 +83,7 @@ interface CommandDataProps {
80
83
username : string
81
84
useremail : string
82
85
project_name : string
83
- project_label : string
84
- project_label_or_name : string
86
+ project_id : number
85
87
joe_session_id : number
86
88
id : number
87
89
}
@@ -115,7 +117,15 @@ interface JoeHistoryState {
115
117
[ id : number ] : boolean
116
118
} [ ]
117
119
} | null
118
- projects : { isProcessing : boolean ; error : boolean } | null
120
+ projects : {
121
+ isProcessing : boolean
122
+ error : boolean
123
+ data : {
124
+ id : number
125
+ alias : string
126
+ name : string
127
+ } [ ]
128
+ } | null
119
129
} | null
120
130
}
121
131
@@ -220,7 +230,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
220
230
221
231
this . buildFilter ( )
222
232
223
- this . unsubscribe = ( Store . listen as RefluxTypes [ " listen" ] ) ( function ( ) {
233
+ this . unsubscribe = ( Store . listen as RefluxTypes [ ' listen' ] ) ( function ( ) {
224
234
const auth = this . data && this . data . auth ? this . data . auth : null
225
235
const commands =
226
236
this . data && this . data . commands ? this . data . commands : null
@@ -501,11 +511,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
501
511
}
502
512
503
513
getProject ( command : CommandDataProps ) {
504
- return (
505
- command [ 'project_label_or_name' ] ||
506
- command [ 'project_label' ] ||
507
- command [ 'project_name' ]
508
- )
514
+ return command [ 'project_name' ]
509
515
}
510
516
511
517
getChannel ( command : CommandDataProps ) {
@@ -591,6 +597,8 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
591
597
}
592
598
593
599
const commandStore = this . state . data . commands || null
600
+ const projectsStore = this . state . data . projects || null
601
+ const projects = projectsStore ?. data || [ ]
594
602
const commands = commandStore ?. data || [ ]
595
603
596
604
const isFilterAvailable =
@@ -775,6 +783,9 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
775
783
< TableBody >
776
784
{ commands . map ( ( c : CommandDataProps ) => {
777
785
if ( c ) {
786
+ const project = projects ?. find ( project => project . id === c [ 'project_id' ] ) ;
787
+ const projectAlias = project ?. alias || project ?. name || '' ;
788
+
778
789
return (
779
790
< TableRow
780
791
hover = { false }
@@ -783,7 +794,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
783
794
onClick = { ( event ) => {
784
795
this . onCommandClick (
785
796
event ,
786
- this . getProject ( c ) ,
797
+ projectAlias ,
787
798
this . getSessionId ( c ) ,
788
799
c . id ,
789
800
)
0 commit comments