@@ -15,7 +15,7 @@ import CreatableSelect from 'react-select/creatable';
15
15
import { FaClipboardList , FaExternalLinkAlt , FaThumbsDown , FaThumbsUp } from 'react-icons/fa' ;
16
16
import { Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from '../../common/table' ;
17
17
import { Chip } from '../../common/chip' ;
18
- import { Link , useParams } from 'react-router-dom' ;
18
+ import { Link } from 'react-router-dom' ;
19
19
import { useMutation , useQuery } from 'react-query' ;
20
20
import { Loading } from '../../common/loading' ;
21
21
import {
@@ -28,6 +28,7 @@ import {
28
28
import { classNames } from '../../../utils/tailwind' ;
29
29
import { DateTimeDisplay } from '../../common/dates' ;
30
30
import { Drawer } from '../../common/drawer' ;
31
+ import { useLocationParams } from '../../../utils' ;
31
32
32
33
export const InlineAppView = ( props : {
33
34
projectId : string ;
@@ -47,7 +48,11 @@ export const InlineAppView = (props: {
47
48
allowAnnotations = { false }
48
49
restrictTabs = { [ 'data' , 'code' , 'reproduce' , 'insights' , 'graph' ] }
49
50
disableNavigateSteps = { false }
50
- forceCurrentActionIndex = { props . sequenceID }
51
+ forceCurrentActionIndex = { {
52
+ sequenceId : props . sequenceID ,
53
+ appId : props . appId ,
54
+ partitionKey : props . partitionKey
55
+ } }
51
56
partitionKey = { props . partitionKey }
52
57
forceFullScreen = { true }
53
58
/>
@@ -95,7 +100,6 @@ export const AnnotationsView = (props: {
95
100
setCurrentEditingAnnotationContext,
96
101
setCurrentHoverIndex,
97
102
setCurrentSelectedIndex,
98
- currentSelectedIndex,
99
103
createAnnotation,
100
104
updateAnnotation,
101
105
refreshAnnotationData
@@ -170,14 +174,24 @@ export const AnnotationsView = (props: {
170
174
annotations = { props . allAnnotations }
171
175
onClick = { ( annotation ) => {
172
176
// TODO -- ensure that the indices are aligned/set correctly
173
- setCurrentSelectedIndex ( annotation . step_sequence_id ) ;
177
+ setCurrentSelectedIndex ( {
178
+ sequenceId : annotation . step_sequence_id ,
179
+ appId : props . appId ,
180
+ partitionKey : props . partitionKey
181
+ } ) ;
174
182
} }
175
183
onHover = { ( annotation ) => {
176
- setCurrentHoverIndex ( annotation . step_sequence_id ) ;
184
+ setCurrentHoverIndex ( {
185
+ sequenceId : annotation . step_sequence_id ,
186
+ appId : props . appId ,
187
+ partitionKey : props . partitionKey
188
+ } ) ;
177
189
} }
178
190
displayProjectLevelAnnotationsLink = { true } // we want to link back to the project level view
179
191
projectId = { props . projectId }
180
- highlightedSequence = { currentSelectedIndex }
192
+ highlightedSequence = {
193
+ currentEditingAnnotationContext ? currentEditingAnnotationContext . sequenceId : undefined
194
+ }
181
195
/>
182
196
</ div >
183
197
) ;
@@ -717,6 +731,8 @@ export const AnnotationsTable = (props: {
717
731
{ props . allowInlineEdit && (
718
732
< TableCell className = "align-top" >
719
733
< AnnotateButton
734
+ appID = { annotation . app_id }
735
+ partitionKey = { annotation . partition_key }
720
736
sequenceID = { annotation . step_sequence_id }
721
737
spanID = { annotation . span_id || undefined }
722
738
existingAnnotation = { annotation }
@@ -964,12 +980,16 @@ const ObservationForm = (props: {
964
980
type AnnnotationDataPointerWithValue = AnnotationDataPointer & { value : string } ;
965
981
966
982
export const AnnotateButton = ( props : {
983
+ appID : string ;
984
+ partitionKey : string | null ;
967
985
sequenceID : number ;
968
986
spanID ?: string ;
969
987
attribute ?: string ; // TODO -- consider whether we want to remove, we generally annotate at the step level
970
988
// But we might want to prepopulate the attribute if we are annotating a specific attribute (in the observations field)
971
989
existingAnnotation : AnnotationOut | undefined ;
972
990
setCurrentEditingAnnotationContext : ( context : {
991
+ appId : string ;
992
+ partitionKey : string | null ;
973
993
sequenceId : number ;
974
994
attributeName : string | undefined ;
975
995
spanId : string | null ;
@@ -983,6 +1003,8 @@ export const AnnotateButton = (props: {
983
1003
className = "hover:scale-125 h-4 w-4"
984
1004
onClick = { ( e ) => {
985
1005
props . setCurrentEditingAnnotationContext ( {
1006
+ appId : props . appID ,
1007
+ partitionKey : props . partitionKey ,
986
1008
sequenceId : props . sequenceID ,
987
1009
attributeName : props . attribute ,
988
1010
spanId : props . spanID || null ,
@@ -1187,7 +1209,7 @@ const AnnotationEditCreateForm = (props: {
1187
1209
* @returns
1188
1210
*/
1189
1211
export const AnnotationsViewContainer = ( ) => {
1190
- const { projectId } = useParams ( ) ;
1212
+ const { projectId } = useLocationParams ( ) ;
1191
1213
const { data : backendSpec } = useQuery ( [ 'backendSpec' ] , ( ) =>
1192
1214
DefaultService . getAppSpecApiV0MetadataAppSpecGet ( ) . then ( ( response ) => {
1193
1215
return response ;
0 commit comments