@@ -21,9 +21,9 @@ internal class AppHostRpcTarget(
2121 PublishingActivityProgressReporter activityReporter ,
2222 IHostApplicationLifetime lifetime ,
2323 DistributedApplicationOptions options
24- )
24+ )
2525{
26- public async IAsyncEnumerable < ( string Id , string StatusText , bool IsComplete , bool IsError ) > GetPublishingActivitiesAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken )
26+ public async IAsyncEnumerable < PublishingActivityState > GetPublishingActivitiesAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken )
2727 {
2828 while ( cancellationToken . IsCancellationRequested == false )
2929 {
@@ -36,14 +36,15 @@ DistributedApplicationOptions options
3636 yield break ;
3737 }
3838
39- yield return (
40- publishingActivityStatus . Activity . Id ,
41- publishingActivityStatus . StatusText ,
42- publishingActivityStatus . IsComplete ,
43- publishingActivityStatus . IsError
44- ) ;
39+ yield return new PublishingActivityState
40+ {
41+ Id = publishingActivityStatus . Activity . Id ,
42+ StatusText = publishingActivityStatus . StatusText ,
43+ IsComplete = publishingActivityStatus . IsComplete ,
44+ IsError = publishingActivityStatus . IsError
45+ } ;
4546
46- if ( publishingActivityStatus . Activity . IsPrimary && ( publishingActivityStatus . IsComplete || publishingActivityStatus . IsError ) )
47+ if ( publishingActivityStatus . Activity . IsPrimary && ( publishingActivityStatus . IsComplete || publishingActivityStatus . IsError ) )
4748 {
4849 // If the activity is complete or an error and it is the primary activity,
4950 // we can stop listening for updates.
@@ -52,7 +53,7 @@ DistributedApplicationOptions options
5253 }
5354 }
5455
55- public async IAsyncEnumerable < RpcResourceState > GetResourceStatesAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken )
56+ public async IAsyncEnumerable < RpcResourceState > GetResourceStatesAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken )
5657 {
5758 var resourceEvents = resourceNotificationService . WatchAsync ( cancellationToken ) ;
5859
@@ -69,15 +70,15 @@ public async IAsyncEnumerable<RpcResourceState> GetResourceStatesAsync([Enumerat
6970 logger . LogTrace ( "Resource {Resource} does not have endpoints." , resourceEvent . Resource . Name ) ;
7071 endpoints = Enumerable . Empty < EndpointAnnotation > ( ) ;
7172 }
72-
73+
7374 var endpointUris = endpoints
7475 . Where ( e => e . AllocatedEndpoint != null )
7576 . Select ( e => e . AllocatedEndpoint ! . UriString )
7677 . ToArray ( ) ;
7778
7879 // Compute health status
7980 var healthStatus = CustomResourceSnapshot . ComputeHealthStatus ( resourceEvent . Snapshot . HealthReports , resourceEvent . Snapshot . State ? . Text ) ;
80-
81+
8182 yield return new RpcResourceState
8283 {
8384 Resource = resourceEvent . Resource . Name ,
@@ -103,12 +104,12 @@ public Task<long> PingAsync(long timestamp, CancellationToken cancellationToken)
103104 return Task . FromResult ( timestamp ) ;
104105 }
105106
106- public Task < ( string BaseUrlWithLoginToken , string ? CodespacesUrlWithLoginToken ) > GetDashboardUrlsAsync ( )
107+ public Task < DashboardUrlsState > GetDashboardUrlsAsync ( )
107108 {
108109 return GetDashboardUrlsAsync ( CancellationToken . None ) ;
109110 }
110111
111- public async Task < ( string BaseUrlWithLoginToken , string ? CodespacesUrlWithLoginToken ) > GetDashboardUrlsAsync ( CancellationToken cancellationToken )
112+ public async Task < DashboardUrlsState > GetDashboardUrlsAsync ( CancellationToken cancellationToken )
112113 {
113114 if ( ! options . DashboardEnabled )
114115 {
@@ -134,7 +135,7 @@ await resourceNotificationService.WaitForResourceHealthyAsync(
134135 if ( ! StringUtils . TryGetUriFromDelimitedString ( dashboardOptions . Value . DashboardUrl , ";" , out var dashboardUri ) )
135136 {
136137 logger . LogWarning ( "Dashboard URL could not be parsed from dashboard options." ) ;
137- throw new InvalidOperationException ( "Dashboard URL could not be parsed from dashboard options." ) ;
138+ throw new InvalidOperationException ( "Dashboard URL could not be parsed from dashboard options." ) ;
138139 }
139140
140141 var codespacesUrlRewriter = serviceProvider . GetService < CodespacesUrlRewriter > ( ) ;
@@ -144,11 +145,18 @@ await resourceNotificationService.WaitForResourceHealthyAsync(
144145
145146 if ( baseUrlWithLoginToken == codespacesUrlWithLoginToken )
146147 {
147- return ( baseUrlWithLoginToken , null ) ;
148+ return new DashboardUrlsState
149+ {
150+ BaseUrlWithLoginToken = baseUrlWithLoginToken
151+ } ;
148152 }
149153 else
150154 {
151- return ( baseUrlWithLoginToken , codespacesUrlWithLoginToken ) ;
155+ return new DashboardUrlsState
156+ {
157+ BaseUrlWithLoginToken = baseUrlWithLoginToken ,
158+ CodespacesUrlWithLoginToken = codespacesUrlWithLoginToken
159+ } ;
152160 }
153161 }
154162
@@ -178,4 +186,4 @@ public Task<string[]> GetCapabilitiesAsync(CancellationToken cancellationToken)
178186 } ) ;
179187 }
180188#pragma warning restore CA1822
181- }
189+ }
0 commit comments