Skip to content

Commit b69821a

Browse files
Run wizzard (#3191)
* [UI] Create prototype for creating runs * [UI] Create prototype for creating runs * [UI] Create prototype for creating runs * [UI] Run wizard parsing yaml * [UI] Run wizard parsing yaml * [UI] Run wizard parsing yaml * [UI] Minor edits --------- Co-authored-by: peterschmidt85 <andrey.cheptsov@gmail.com>
1 parent 1e77000 commit b69821a

File tree

23 files changed

+853
-85
lines changed

23 files changed

+853
-85
lines changed

frontend/package-lock.json

Lines changed: 69 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@types/date-fns": "^2.6.0",
4141
"@types/enzyme": "^3.10.18",
4242
"@types/jest": "^29.5.14",
43+
"@types/js-yaml": "^4.0.9",
4344
"@types/lodash": "^4.17.13",
4445
"@types/node": "^22.10.1",
4546
"@types/react": "^18.3.12",
@@ -110,6 +111,7 @@
110111
"css-minimizer-webpack-plugin": "^4.2.2",
111112
"date-fns": "^2.29.3",
112113
"i18next": "^24.0.2",
114+
"js-yaml": "^4.1.0",
113115
"lodash": "^4.17.21",
114116
"openai": "^4.33.1",
115117
"prismjs": "^1.30.0",

frontend/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const API = {
7979
RUNS_DELETE: (projectName: IProject['project_name']) => `${API.PROJECTS.RUNS(projectName)}/delete`,
8080
RUNS_STOP: (projectName: IProject['project_name']) => `${API.PROJECTS.RUNS(projectName)}/stop`,
8181
RUNS_SUBMIT: (projectName: IProject['project_name']) => `${API.PROJECTS.RUNS(projectName)}/submit`,
82+
RUNS_APPLY: (projectName: IProject['project_name']) => `${API.PROJECTS.RUNS(projectName)}/apply`,
8283

8384
// Logs
8485
LOGS: (projectName: IProject['project_name']) => `${API.BASE()}/project/${projectName}/logs/poll`,

frontend/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export { default as Alert } from '@cloudscape-design/components/alert';
22
export type { AlertProps } from '@cloudscape-design/components/alert';
33
export { default as Icon } from '@cloudscape-design/components/icon';
4+
export { default as ButtonDropdown } from '@cloudscape-design/components/button-dropdown';
45
export type { ButtonDropdownProps } from '@cloudscape-design/components/button-dropdown';
56
export { default as AppLayout } from '@cloudscape-design/components/app-layout';
67
export type { AppLayoutProps } from '@cloudscape-design/components/app-layout';

frontend/src/locale/en.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"control_plane": "Control plane",
5252
"refresh": "Refresh",
5353
"quickstart": "Quickstart",
54-
"ask_ai": "Ask AI"
54+
"ask_ai": "Ask AI",
55+
"new": "New"
5556
},
5657

5758
"auth": {
@@ -465,6 +466,24 @@
465466
"size": "Size"
466467
}
467468
},
469+
"runs": {
470+
"dev_env": {
471+
"wizard": {
472+
"title": "New dev environment",
473+
"submit": "Apply",
474+
"offer": "Offer",
475+
"offer_description": "Select an offer for the dev environment.",
476+
"name": "Name",
477+
"name_description": "The name of the run. If not specified, the name will be generated automatically.",
478+
"name_placeholder": "Optional",
479+
"ide": "IDE",
480+
"ide_description": "Select which IDE would you like to use with the dev environment.",
481+
"config": "Configuration file",
482+
"config_description": "Review the configuration file and adjust it if needed. Click Info for examples.",
483+
"success_notification": "The run is submitted!"
484+
}
485+
}
486+
},
468487
"offer": {
469488
"title": "Offers",
470489
"filter_property_placeholder": "Filter by properties",

frontend/src/pages/Offers/List/hooks/useFilters.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { getPropertyFilterOptions } from '../helpers';
1616

1717
type Args = {
1818
gpus: IGpu[];
19+
withSearchParams?: boolean;
1920
};
2021

2122
type RequestParamsKeys = 'project_name' | 'gpu_name' | 'gpu_count' | 'gpu_memory' | 'backend' | 'spot_policy' | 'group_by';
@@ -52,7 +53,7 @@ const defaultGroupByOptions = [{ ...gpuFilterOption }, { label: 'Backend', value
5253

5354
const groupByRequestParamName: RequestParamsKeys = 'group_by';
5455

55-
export const useFilters = ({ gpus }: Args) => {
56+
export const useFilters = ({ gpus, withSearchParams = true }: Args) => {
5657
const [searchParams, setSearchParams] = useSearchParams();
5758
const { projectOptions } = useProjectFilter({ localStorePrefix: 'offers-list-projects' });
5859
const projectNameIsChecked = useRef(false);
@@ -75,7 +76,9 @@ export const useFilters = ({ gpus }: Args) => {
7576
});
7677

7778
const clearFilter = () => {
78-
setSearchParams({});
79+
if (withSearchParams) {
80+
setSearchParams({});
81+
}
7982
setPropertyFilterQuery(EMPTY_QUERY);
8083
setGroupBy([]);
8184
};
@@ -137,6 +140,10 @@ export const useFilters = ({ gpus }: Args) => {
137140
tokens: PropertyFilterProps.Query['tokens'];
138141
groupBy: MultiselectProps.Options;
139142
}) => {
143+
if (!withSearchParams) {
144+
return;
145+
}
146+
140147
const searchParams = tokensToSearchParams<RequestParamsKeys>(tokens);
141148

142149
groupBy.forEach(({ value }) => searchParams.append(groupByRequestParamName, value as string));

0 commit comments

Comments
 (0)