@@ -30,7 +30,10 @@ import { PageSpinner } from '@postgres.ai/shared/components/PageSpinner'
3030import { Spinner } from '@postgres.ai/shared/components/Spinner'
3131import { icons } from '@postgres.ai/shared/styles/icons'
3232import { 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'
3437
3538import Store from '../../stores/store'
3639import Actions from '../../actions/actions'
@@ -80,8 +83,7 @@ interface CommandDataProps {
8083 username : string
8184 useremail : string
8285 project_name : string
83- project_label : string
84- project_label_or_name : string
86+ project_id : number
8587 joe_session_id : number
8688 id : number
8789}
@@ -115,7 +117,15 @@ interface JoeHistoryState {
115117 [ id : number ] : boolean
116118 } [ ]
117119 } | 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
119129 } | null
120130}
121131
@@ -220,7 +230,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
220230
221231 this . buildFilter ( )
222232
223- this . unsubscribe = ( Store . listen as RefluxTypes [ " listen" ] ) ( function ( ) {
233+ this . unsubscribe = ( Store . listen as RefluxTypes [ ' listen' ] ) ( function ( ) {
224234 const auth = this . data && this . data . auth ? this . data . auth : null
225235 const commands =
226236 this . data && this . data . commands ? this . data . commands : null
@@ -501,11 +511,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
501511 }
502512
503513 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' ]
509515 }
510516
511517 getChannel ( command : CommandDataProps ) {
@@ -591,6 +597,8 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
591597 }
592598
593599 const commandStore = this . state . data . commands || null
600+ const projectsStore = this . state . data . projects || null
601+ const projects = projectsStore ?. data || [ ]
594602 const commands = commandStore ?. data || [ ]
595603
596604 const isFilterAvailable =
@@ -775,6 +783,9 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
775783 < TableBody >
776784 { commands . map ( ( c : CommandDataProps ) => {
777785 if ( c ) {
786+ const project = projects ?. find ( project => project . id === c [ 'project_id' ] ) ;
787+ const projectAlias = project ?. alias || project ?. name || '' ;
788+
778789 return (
779790 < TableRow
780791 hover = { false }
@@ -783,7 +794,7 @@ class JoeHistory extends Component<JoeHistoryWithStylesProps, JoeHistoryState> {
783794 onClick = { ( event ) => {
784795 this . onCommandClick (
785796 event ,
786- this . getProject ( c ) ,
797+ projectAlias ,
787798 this . getSessionId ( c ) ,
788799 c . id ,
789800 )
0 commit comments