Skip to content

Commit a2c76cb

Browse files
olgennr4victor
andauthored
[Feature]: Display Assigned Gateway Information on Run Pages (#2438)
* [Feature]: Display Assigned Gateway Information on Run Pages #2410 * Show full service URL as link --------- Co-authored-by: Victor Skvortsov <vds003@gmail.com>
1 parent 9ba84fe commit a2c76cb

File tree

4 files changed

+107
-85
lines changed

4 files changed

+107
-85
lines changed

frontend/src/locale/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@
351351
"artifacts": "Artifacts",
352352
"artifacts_count": "Artifacts",
353353
"hub_user_name": "User",
354+
"service_url": "Service URL",
354355
"statuses": {
355356
"pending": "Pending",
356357
"submitted": "Submitted",

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
getRunListItemPrice,
2323
getRunListItemRegion,
2424
getRunListItemResources,
25+
getRunListItemServiceUrl,
2526
getRunListItemSpot,
2627
} from '../List/helpers';
2728
import { isAvailableAbortingForRun, isAvailableDeletingForRun, isAvailableStoppingForRun } from '../utils';
@@ -46,6 +47,8 @@ export const RunDetails: React.FC = () => {
4647
id: paramRunId,
4748
});
4849

50+
const serviceUrl = runData ? getRunListItemServiceUrl(runData) : null;
51+
4952
useEffect(() => {
5053
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5154
// @ts-ignore
@@ -261,6 +264,17 @@ export const RunDetails: React.FC = () => {
261264
<div>${runData.cost}</div>
262265
</div>
263266
</ColumnLayout>
267+
268+
{serviceUrl && (
269+
<ColumnLayout columns={1} variant="text-grid">
270+
<div>
271+
<Box variant="awsui-key-label">{t('projects.run.service_url')}</Box>
272+
<div>
273+
<a href={serviceUrl}>{serviceUrl}</a>
274+
</div>
275+
</div>
276+
</ColumnLayout>
277+
)}
264278
</Container>
265279

266280
{runData.jobs.length === 1 && (

frontend/src/pages/Runs/List/helpers.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { groupBy as _groupBy } from 'lodash';
22

33
import { finishedJobs } from '../constants';
44
import { getJobStatus } from '../Details/Jobs/List/helpers';
5+
import { getBaseUrl } from 'App/helpers';
56

67
export const getGroupedRunsByProjectAndRepoID = (runs: IRun[]) => {
78
return _groupBy(runs, ({ project_name }) => project_name);
@@ -84,3 +85,9 @@ export const getRunListItemBackend = (run: IRun) => {
8485

8586
return run.latest_job_submission?.job_provisioning_data?.backend ?? '-';
8687
};
88+
89+
export const getRunListItemServiceUrl = (run: IRun) => {
90+
const url = run.service?.url;
91+
if (!url) return null;
92+
return url.startsWith('/') ? `${getBaseUrl()}${url}` : url;
93+
};

frontend/src/types/run.d.ts

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
declare type TRunsRequestParams = {
22
project_name?: IProject['project_name'];
3-
repo_id?: string,
4-
user_name?: string,
5-
only_active?: boolean,
6-
prev_submitted_at?: string,
7-
prev_run_id?: string,
8-
limit?: number,
9-
ascending?: boolean,
3+
repo_id?: string;
4+
user_name?: string;
5+
only_active?: boolean;
6+
prev_submitted_at?: string;
7+
prev_run_id?: string;
8+
limit?: number;
9+
ascending?: boolean;
1010
};
1111

1212
declare type TDeleteRunsRequestParams = {
@@ -30,133 +30,133 @@ declare type TJobStatus =
3030
| 'terminated'
3131
| 'aborted'
3232
| 'failed'
33-
| 'done'
33+
| 'done';
3434

3535
declare type TJobErrorCode =
36-
| "failed_to_start_due_to_no_capacity"
37-
| "interrupted_by_no_capacity"
38-
| "waiting_runner_limit_exceeded"
39-
| "container_exited_with_error"
40-
| "ports_binding_failed"
41-
36+
| 'failed_to_start_due_to_no_capacity'
37+
| 'interrupted_by_no_capacity'
38+
| 'waiting_runner_limit_exceeded'
39+
| 'container_exited_with_error'
40+
| 'ports_binding_failed';
4241

4342
declare interface IAppSpec {
44-
port: number,
45-
app_name: string,
46-
map_to_port?: number,
47-
url_path?: string,
48-
url_query_params?: {[key: string]: string}
43+
port: number;
44+
app_name: string;
45+
map_to_port?: number;
46+
url_path?: string;
47+
url_query_params?: { [key: string]: string };
4948
}
5049

5150
declare interface IJobSpec {
52-
app_specs?: IAppSpec
53-
commands: string[],
54-
env?: {[key: string]: string},
55-
home_dir?: string
56-
image_name: string
57-
job_name: string
58-
job_num: number
59-
max_duration?: number,
60-
working_dir: string
51+
app_specs?: IAppSpec;
52+
commands: string[];
53+
env?: { [key: string]: string };
54+
home_dir?: string;
55+
image_name: string;
56+
job_name: string;
57+
job_num: number;
58+
max_duration?: number;
59+
working_dir: string;
6160
}
6261

6362
declare interface IGpu {
64-
name: string,
65-
memory_mib: number,
63+
name: string;
64+
memory_mib: number;
6665
}
6766

6867
declare interface IDisk {
69-
size_mib: number
68+
size_mib: number;
7069
}
7170

7271
declare interface IResources {
73-
cpus: number,
74-
memory_mib: number
75-
gpus: IGpu[],
76-
spot: boolean,
72+
cpus: number;
73+
memory_mib: number;
74+
gpus: IGpu[];
75+
spot: boolean;
7776

78-
disk?: IDisk,
77+
disk?: IDisk;
7978

80-
description?: string
79+
description?: string;
8180
}
8281

8382
declare interface InstanceType {
84-
name: string,
85-
resources: IResources,
83+
name: string;
84+
resources: IResources;
8685
}
8786

8887
declare interface IJobProvisioningData {
89-
backend: TBackendType,
90-
instance_type: InstanceType,
91-
instance_id: string,
92-
hostname: string,
93-
region: string,
94-
price: number,
95-
username: string,
96-
ssh_port: number,
97-
dockerized: boolean,
98-
backend_data?: string,
88+
backend: TBackendType;
89+
instance_type: InstanceType;
90+
instance_id: string;
91+
hostname: string;
92+
region: string;
93+
price: number;
94+
username: string;
95+
ssh_port: number;
96+
dockerized: boolean;
97+
backend_data?: string;
9998
}
10099

101100
declare interface IJobSubmission {
102-
id: string,
103-
job_provisioning_data?: IJobProvisioningData | null,
104-
error_code?: TJobErrorCode | null,
105-
submission_num: number
106-
status: TJobStatus,
107-
submitted_at: number,
108-
termination_reason?: string | null
109-
termination_reason_message?: string | null
101+
id: string;
102+
job_provisioning_data?: IJobProvisioningData | null;
103+
error_code?: TJobErrorCode | null;
104+
submission_num: number;
105+
status: TJobStatus;
106+
submitted_at: number;
107+
termination_reason?: string | null;
108+
termination_reason_message?: string | null;
110109
}
111110

112111
declare interface IJob {
113-
job_spec: IJobSpec
114-
job_submissions: IJobSubmission[]
112+
job_spec: IJobSpec;
113+
job_submissions: IJobSubmission[];
115114
}
116115

117116
declare interface IDevEnvironmentConfiguration {
118-
type: 'dev-environment'
117+
type: 'dev-environment';
119118
}
120119

121120
declare interface ITaskConfiguration {
122-
type: 'task'
121+
type: 'task';
123122
}
124123

125124
declare interface IServiceConfiguration {
126-
type: 'service'
125+
type: 'service';
126+
gateway: string | null;
127127
}
128128
declare interface IRunSpec {
129-
configuration: IDevEnvironmentConfiguration | ITaskConfiguration | IServiceConfiguration,
130-
configuration_path: string,
131-
repo_code_hash?: string
132-
repo_id: string
133-
run_name?: string,
134-
ssh_key_pub: string
135-
working_dir: string
136-
repo_data: IRemoteRunRepoData | ILocalRunRepoData | VirtualRunRepoData
129+
configuration: IDevEnvironmentConfiguration | ITaskConfiguration | IServiceConfiguration;
130+
configuration_path: string;
131+
repo_code_hash?: string;
132+
repo_id: string;
133+
run_name?: string;
134+
ssh_key_pub: string;
135+
working_dir: string;
136+
repo_data: IRemoteRunRepoData | ILocalRunRepoData | VirtualRunRepoData;
137137
}
138138

139139
declare interface IModel {
140-
name: string
141-
base_url: string
142-
type: string
140+
name: string;
141+
base_url: string;
142+
type: string;
143143
}
144144

145145
declare interface IRunService {
146-
url: string,
147-
model: null | IModel
146+
url: string;
147+
model: null | IModel;
148148
}
149149

150150
declare interface IRun {
151-
id: string,
152-
project_name: string,
153-
user: string,
154-
submitted_at: string,
155-
status: TJobStatus,
156-
error?: string
157-
jobs: IJob[],
158-
run_spec: IRunSpec,
159-
latest_job_submission?: IJobSubmission
160-
cost: number,
151+
id: string;
152+
project_name: string;
153+
user: string;
154+
submitted_at: string;
155+
status: TJobStatus;
156+
error?: string;
157+
jobs: IJob[];
158+
run_spec: IRunSpec;
159+
latest_job_submission?: IJobSubmission;
160+
cost: number;
161161
service: IRunService | null;
162162
}

0 commit comments

Comments
 (0)