1
1
import AutoScalingRuleEditorModal , {
2
2
COMPARATOR_LABELS ,
3
3
} from '../components/AutoScalingRuleEditorModal' ;
4
+ import BAIJSONViewerModal from '../components/BAIJSONViewerModal' ;
4
5
import CopyableCodeText from '../components/CopyableCodeText' ;
5
6
import EndpointOwnerInfo from '../components/EndpointOwnerInfo' ;
6
7
import EndpointStatusTag from '../components/EndpointStatusTag' ;
@@ -35,10 +36,10 @@ import {
35
36
CheckOutlined ,
36
37
CloseOutlined ,
37
38
DeleteOutlined ,
39
+ ExclamationCircleOutlined ,
38
40
FolderOutlined ,
39
41
LoadingOutlined ,
40
42
PlusOutlined ,
41
- QuestionCircleOutlined ,
42
43
ReloadOutlined ,
43
44
SettingOutlined ,
44
45
SyncOutlined ,
@@ -128,6 +129,8 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
128
129
const [ selectedSessionId , setSelectedSessionId ] = useState < string > ( ) ;
129
130
const isSupportAutoScalingRule =
130
131
baiClient . isManagerVersionCompatibleWith ( '25.1.0' ) ;
132
+
133
+ const [ errorDataForJSONModal , setErrorDataForJSONModal ] = useState < string > ( ) ;
131
134
const { endpoint, endpoint_token_list, endpoint_auto_scaling_rules } =
132
135
useLazyLoadQuery < EndpointDetailPageQuery > (
133
136
graphql `
@@ -201,6 +204,7 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
201
204
traffic_ratio
202
205
endpoint
203
206
status
207
+ error_data
204
208
}
205
209
created_user_email @since(version: "23.09.8")
206
210
...EndpointOwnerInfoFragment
@@ -305,14 +309,6 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
305
309
} ) ;
306
310
} ,
307
311
} ) ;
308
- const openSessionErrorModal = ( session : string ) => {
309
- if ( endpoint === null ) return ;
310
- const { errors } = endpoint || { } ;
311
- const firstMatchedSessionError = errors ?. find (
312
- ( { session_id } ) => session === session_id ,
313
- ) ;
314
- setSelectedSessionErrorForModal ( firstMatchedSessionError || null ) ;
315
- } ;
316
312
317
313
const [
318
314
commitDeleteAutoScalingRuleMutation ,
@@ -964,27 +960,61 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
964
960
title : t ( 'modelService.RouteId' ) ,
965
961
dataIndex : 'routing_id' ,
966
962
fixed : 'left' ,
963
+ render : ( text , row ) => (
964
+ < Typography . Text ellipsis >
965
+ { row . routing_id }
966
+ { ! _ . isEmpty ( row . error_data ) && (
967
+ < Button
968
+ size = "small"
969
+ type = "text"
970
+ icon = { < ExclamationCircleOutlined /> }
971
+ style = { { color : token . colorError } }
972
+ onClick = { ( ) => {
973
+ setErrorDataForJSONModal ( row ?. error_data || ' ' ) ;
974
+ } }
975
+ />
976
+ ) }
977
+ </ Typography . Text >
978
+ ) ,
967
979
} ,
968
980
{
969
981
title : t ( 'modelService.SessionId' ) ,
970
982
dataIndex : 'session' ,
971
983
render : ( sessionId ) => {
972
- return baiClient . supports ( 'session-node' ) ? (
973
- < Typography . Link
974
- onClick = { ( ) => {
975
- setSelectedSessionId ( sessionId ) ;
976
- } }
977
- >
978
- { sessionId }
979
- </ Typography . Link >
980
- ) : (
981
- < Typography . Text > { sessionId } </ Typography . Text >
984
+ const matchedSessionError = endpoint ?. errors ?. find (
985
+ ( sessionError ) => sessionError . session_id === sessionId ,
986
+ ) ;
987
+ return (
988
+ < >
989
+ { baiClient . supports ( 'session-node' ) ? (
990
+ < Typography . Link
991
+ onClick = { ( ) => {
992
+ setSelectedSessionId ( sessionId ) ;
993
+ } }
994
+ >
995
+ { sessionId }
996
+ </ Typography . Link >
997
+ ) : (
998
+ < Typography . Text > { sessionId } </ Typography . Text >
999
+ ) }
1000
+ { matchedSessionError && (
1001
+ < Button
1002
+ size = "small"
1003
+ type = "text"
1004
+ icon = { < ExclamationCircleOutlined /> }
1005
+ style = { { color : token . colorError } }
1006
+ onClick = { ( ) => {
1007
+ setSelectedSessionErrorForModal ( matchedSessionError ) ;
1008
+ } }
1009
+ />
1010
+ ) }
1011
+ </ >
982
1012
) ;
983
1013
} ,
984
1014
} ,
985
1015
{
986
1016
title : t ( 'modelService.Status' ) ,
987
- render : ( _ , row ) =>
1017
+ render : ( text , row ) =>
988
1018
row . status && (
989
1019
< >
990
1020
< Tag
@@ -994,17 +1024,6 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
994
1024
>
995
1025
{ row . status . toUpperCase ( ) }
996
1026
</ Tag >
997
- { row . status === 'FAILED_TO_START' && row . session && (
998
- < Button
999
- size = "small"
1000
- type = "text"
1001
- icon = { < QuestionCircleOutlined /> }
1002
- style = { { color : token . colorTextSecondary } }
1003
- onClick = { ( ) => {
1004
- row . session && openSessionErrorModal ( row . session ) ;
1005
- } }
1006
- />
1007
- ) }
1008
1027
</ >
1009
1028
) ,
1010
1029
} ,
@@ -1067,6 +1086,14 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
1067
1086
setSelectedSessionId ( undefined ) ;
1068
1087
} }
1069
1088
/>
1089
+ < BAIJSONViewerModal
1090
+ open = { ! ! errorDataForJSONModal }
1091
+ title = { t ( 'modelService.RouteError' ) }
1092
+ json = { errorDataForJSONModal }
1093
+ onCancel = { ( ) => {
1094
+ setErrorDataForJSONModal ( undefined ) ;
1095
+ } }
1096
+ />
1070
1097
</ Flex >
1071
1098
) ;
1072
1099
} ;
0 commit comments