@@ -35,7 +35,10 @@ import {
35
35
DEFAULT_DATA_SOURCE_NAME ,
36
36
DEFAULT_DATA_SOURCE_TYPE ,
37
37
} from '../../../../../common/constants/data_sources' ;
38
- import { observabilityLogsID } from '../../../../../common/constants/shared' ;
38
+ import {
39
+ observabilityLogsID ,
40
+ observabilityTracesNewNavID ,
41
+ } from '../../../../../common/constants/shared' ;
39
42
import { TRACE_ANALYTICS_DATE_FORMAT } from '../../../../../common/constants/trace_analytics' ;
40
43
import { setNavBreadCrumbs } from '../../../../../common/utils/set_nav_bread_crumbs' ;
41
44
import { coreRefs } from '../../../../framework/core_refs' ;
@@ -80,6 +83,7 @@ export function ServiceView(props: ServiceViewProps) {
80
83
const location = useLocation ( ) ;
81
84
const [ isServiceOverviewLoading , setIsServiceOverviewLoading ] = useState ( false ) ;
82
85
const [ isServicesDataLoading , setIsServicesDataLoading ] = useState ( false ) ;
86
+ const newNavigation = coreRefs . chrome ?. navGroup . getNavGroupEnabled ( ) ;
83
87
84
88
useEffect ( ( ) => {
85
89
try {
@@ -165,7 +169,25 @@ export function ServiceView(props: ServiceViewProps) {
165
169
inverted : false ,
166
170
disabled : false ,
167
171
} ) ;
168
- location . assign ( '#/traces' ) ;
172
+
173
+ const tracesPath = '#/traces' ;
174
+ const dataSourceId = props . dataSourceMDSId [ 0 ] ?. id || '' ;
175
+ const urlParts = window . location . href . split ( '?' ) ;
176
+ const queryParams =
177
+ urlParts . length > 1 ? new URLSearchParams ( urlParts [ 1 ] ) : new URLSearchParams ( ) ;
178
+
179
+ const modeParam = queryParams . get ( 'mode' ) || '' ;
180
+ const modeQuery = modeParam ? `&mode=${ encodeURIComponent ( modeParam ) } ` : '' ;
181
+
182
+ if ( newNavigation ) {
183
+ coreRefs . application ?. navigateToApp ( observabilityTracesNewNavID , {
184
+ path : `${ tracesPath } ?datasourceId=${ encodeURIComponent ( dataSourceId ) } ${ modeQuery } ` ,
185
+ } ) ;
186
+ } else {
187
+ window . location . assign (
188
+ `${ tracesPath } ?datasourceId=${ encodeURIComponent ( dataSourceId ) } ${ modeQuery } `
189
+ ) ;
190
+ }
169
191
} ;
170
192
171
193
useEffect ( ( ) => {
0 commit comments