Skip to content

Commit f2fa140

Browse files
Add Endpoint section for service runs on the run details page
Show service readiness status with waiting states and the endpoint URL once the service is up and probes (if configured) have passed. Replaces the inline service URL in the General section. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 33d88b4 commit f2fa140

2 files changed

Lines changed: 52 additions & 13 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React, { FC } from 'react';
2+
3+
import { Alert, Box, Container, Header, Link, SpaceBetween } from 'components';
4+
5+
import { getRunProbeStatuses } from 'libs/run';
6+
7+
import { getRunListItemServiceUrl } from '../../../List/helpers';
8+
9+
export const ConnectToServiceRun: FC<{ run: IRun }> = ({ run }) => {
10+
const serviceUrl = getRunListItemServiceUrl(run);
11+
const probeStatuses = getRunProbeStatuses(run);
12+
const hasProbes = probeStatuses.length > 0;
13+
const allProbesReady = hasProbes && probeStatuses.every((s) => s === 'success');
14+
const serviceReady = run.status === 'running' && (!hasProbes || allProbesReady) && serviceUrl;
15+
16+
return (
17+
<Container>
18+
<Header variant="h2">Endpoint</Header>
19+
20+
{run.status !== 'running' && (
21+
<SpaceBetween size="s">
22+
<Box />
23+
<Alert type="info">Waiting for the service to start.</Alert>
24+
</SpaceBetween>
25+
)}
26+
27+
{run.status === 'running' && !serviceReady && (
28+
<SpaceBetween size="s">
29+
<Box />
30+
<Alert type="info">Waiting for the service to become ready.</Alert>
31+
</SpaceBetween>
32+
)}
33+
34+
{serviceReady && (
35+
<SpaceBetween size="s">
36+
<Box />
37+
<Alert type="success">
38+
The service is ready at{' '}
39+
<Link href={serviceUrl} external>
40+
{serviceUrl}
41+
</Link>
42+
</Alert>
43+
</SpaceBetween>
44+
)}
45+
</Container>
46+
);
47+
};

frontend/src/pages/Runs/Details/RunDetails/index.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import {
2929
getRunListItemRegion,
3030
getRunListItemResources,
3131
getRunListItemSchedule,
32-
getRunListItemServiceUrl,
3332
getRunListItemSpot,
3433
} from '../../List/helpers';
3534
import { EventsList } from '../Events/List';
3635
import { JobList } from '../Jobs/List';
3736
import { ConnectToRunWithDevEnvConfiguration } from './ConnectToRunWithDevEnvConfiguration';
37+
import { ConnectToServiceRun } from './ConnectToServiceRun';
3838

3939
export const RunDetails = () => {
4040
const { t } = useTranslation();
@@ -47,7 +47,6 @@ export const RunDetails = () => {
4747
id: paramRunId,
4848
});
4949

50-
const serviceUrl = runData ? getRunListItemServiceUrl(runData) : null;
5150
const schedule = runData ? getRunListItemSchedule(runData) : null;
5251
const nextTriggeredAt = runData ? runData.next_triggered_at : null;
5352

@@ -191,17 +190,6 @@ export const RunDetails = () => {
191190
</div>
192191
</ColumnLayout>
193192

194-
{serviceUrl && (
195-
<ColumnLayout columns={1} variant="text-grid">
196-
<div>
197-
<Box variant="awsui-key-label">{t('projects.run.service_url')}</Box>
198-
<div>
199-
<a href={serviceUrl}>{serviceUrl}</a>
200-
</div>
201-
</div>
202-
</ColumnLayout>
203-
)}
204-
205193
{schedule && (
206194
<ColumnLayout columns={4} variant="text-grid">
207195
<div>
@@ -220,6 +208,10 @@ export const RunDetails = () => {
220208
<ConnectToRunWithDevEnvConfiguration run={runData} />
221209
)}
222210

211+
{runData.run_spec.configuration.type === 'service' && !runIsStopped(runData.status) && (
212+
<ConnectToServiceRun run={runData} />
213+
)}
214+
223215
{runData.jobs.length > 1 && (
224216
<JobList
225217
projectName={paramProjectName}

0 commit comments

Comments
 (0)