Skip to content

Commit 51e3d67

Browse files
committed
[UI] Run wizard parsing yaml
1 parent 353777b commit 51e3d67

3 files changed

Lines changed: 6 additions & 15 deletions

File tree

frontend/src/pages/Runs/CreateDevEnvironment/helpers/getRunSpecFromYaml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const getRunSpecFromYaml = async (yaml: string) => {
4141

4242
const { name, ...otherFields } = parsedYaml;
4343

44-
const runSpec: Omit<TRunSpec, 'ssh_key_pub'> = {
44+
const runSpec: TRunSpec = {
4545
run_name: name as string,
4646
configuration: {} as TDevEnvironmentConfiguration,
4747
};

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IRunEnvironmentFormValues } from './types';
2424
import styles from './styles.module.scss';
2525

2626
const requiredFieldError = 'This is required field';
27-
const namesFieldError = 'Only latin characters, dashes, underscores, and digits';
27+
const namesFieldError = 'Only latin characters, dashes, and digits';
2828

2929
const ideOptions = [
3030
{
@@ -39,7 +39,7 @@ const ideOptions = [
3939

4040
const envValidationSchema = yup.object({
4141
offer: yup.object().required(requiredFieldError),
42-
name: yup.string().matches(/^[a-zA-Z0-9-_]+$/, namesFieldError),
42+
name: yup.string().matches(/^[a-z][a-z0-9-]{1,40}$/, namesFieldError),
4343
ide: yup.string().required(requiredFieldError),
4444
config_yaml: yup.string().required(requiredFieldError),
4545
});
@@ -196,10 +196,7 @@ export const CreateDevEnvironment: React.FC = () => {
196196
const requestParams: TRunApplyRequestParams = {
197197
project_name: selectedProject ?? '',
198198
plan: {
199-
run_spec: {
200-
...runSpec,
201-
ssh_key_pub: 'dummy',
202-
},
199+
run_spec: runSpec,
203200
},
204201
force: false,
205202
};

frontend/src/types/run.d.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,12 @@ declare type TDevEnvironmentConfiguration = {
107107
schedule?: { cron: string | string[] };
108108
fleets?: string[];
109109
tags?: object;
110-
ssh_key_pub: string;
111110
};
112111

113112
declare type TRunSpec = {
114113
run_name: string;
115114
configuration: TDevEnvironmentConfiguration;
116-
ssh_key_pub: string;
115+
ssh_key_pub?: string;
117116
};
118117
declare type TRunApplyRequestParams = {
119118
project_name: string;
@@ -240,11 +239,6 @@ declare interface IJob {
240239
job_submissions: IJobSubmission[];
241240
}
242241

243-
declare interface IDevEnvironmentConfiguration {
244-
type: 'dev-environment';
245-
priority?: number | null;
246-
}
247-
248242
declare interface ITaskConfiguration {
249243
type: 'task';
250244
priority?: number | null;
@@ -256,7 +250,7 @@ declare interface IServiceConfiguration {
256250
priority?: number | null;
257251
}
258252
declare interface IRunSpec {
259-
configuration: IDevEnvironmentConfiguration | ITaskConfiguration | IServiceConfiguration;
253+
configuration: TDevEnvironmentConfiguration | ITaskConfiguration | IServiceConfiguration;
260254
configuration_path: string;
261255
repo_code_hash?: string;
262256
repo_id: string;

0 commit comments

Comments
 (0)