@@ -27,6 +27,7 @@ import {
2727 StackDefinition ,
2828} from 'common'
2929
30+ import { stackCraftReplace } from '../../../components/app-routes.js'
3031import { PrerequisiteSummaryChip } from '../../../components/prerequisite-summary-chip.js'
3132import { SecretWarningsCard } from '../../../components/secret-warnings-card.js'
3233import { ServiceStatusIndicator } from '../../../components/service-status-indicator.js'
@@ -55,22 +56,28 @@ type ServiceDetailProps = {
5556export const ServiceDetail = Shade < ServiceDetailProps > ( {
5657 customElementName : 'shade-service-detail' ,
5758 render : ( options ) => {
58- const { props, injector, useState } = options
59+ const { props, injector, useState, useObservable } = options
5960 const locationService = injector . getInstance ( LocationService )
6061 const validTabs : TabId [ ] = [ 'overview' , 'logs' , 'history' , 'files' , 'configuration' ]
61- const hashValue = locationService . onLocationHashChanged . getValue ( ) . replace ( '#' , '' )
62- const searchState = locationService . onDeserializedLocationSearchChanged . getValue ( )
63- const initialTab : TabId = validTabs . includes ( hashValue as TabId )
62+ const [ hashRaw ] = useObservable ( 'locationHash' , locationService . onLocationHashChanged )
63+ const [ searchState ] = useObservable ( 'locationSearch' , locationService . onDeserializedLocationSearchChanged )
64+ const hashValue = hashRaw . replace ( '#' , '' )
65+ const processUid = typeof searchState . processUid === 'string' ? searchState . processUid : undefined
66+ const activeTab : TabId = validTabs . includes ( hashValue as TabId )
6467 ? ( hashValue as TabId )
65- : searchState . edit === true
66- ? 'configuration'
67- : 'overview'
68- const [ activeTab , setActiveTabState ] = useState < TabId > ( 'activeTab' , initialTab )
68+ : processUid
69+ ? 'logs'
70+ : searchState . edit === true
71+ ? 'configuration'
72+ : 'overview'
6973 const [ isConfirmingDelete , setIsConfirmingDelete ] = useState ( 'isConfirmingDelete' , false )
7074
7175 const setActiveTab = ( tab : TabId ) => {
72- locationService . replace ( `${ window . location . pathname } #${ tab } ` )
73- setActiveTabState ( tab )
76+ stackCraftReplace ( injector , {
77+ path : '/stacks/:stackName/services/:serviceId' ,
78+ params : { stackName : props . stackName , serviceId : props . serviceId } ,
79+ hash : tab ,
80+ } )
7481 }
7582
7683 const serviceState = useEntitySync ( options , ServiceDefinition , props . serviceId )
@@ -237,6 +244,7 @@ export const ServiceDetail = Shade<ServiceDetailProps>({
237244 < Tabs
238245 activeKey = { activeTab }
239246 onTabChange = { ( key ) => setActiveTab ( key as TabId ) }
247+ containerStyle = { { flex : '1' , minHeight : '0' } }
240248 tabs = { [
241249 {
242250 header : < span > Overview</ span > ,
@@ -258,7 +266,7 @@ export const ServiceDetail = Shade<ServiceDetailProps>({
258266 {
259267 header : < span > Logs</ span > ,
260268 hash : 'logs' ,
261- component : < LogsTab serviceId = { service . id } stackName = { service . stackName } /> ,
269+ component : < LogsTab serviceId = { service . id } stackName = { service . stackName } processUid = { processUid } /> ,
262270 } ,
263271 {
264272 header : < span > History</ span > ,
0 commit comments