Skip to content

Commit 4590499

Browse files
committed
Pass projectId in API call
1 parent 5893510 commit 4590499

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

frontend/src/components/config/ProjectConfig.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import type { CommonFormFields } from "@/lib/form.types";
1+
import { UserContext } from "@/components/UserProvider";
2+
import { Label } from "@/components/ui/label";
23
import {
34
Select,
4-
SelectTrigger,
5-
SelectValue,
65
SelectContent,
76
SelectGroup,
87
SelectItem,
8+
SelectTrigger,
9+
SelectValue,
910
} from "@/components/ui/select";
10-
import { Label } from "@/components/ui/label";
11+
import type { CommonFormFields } from "@/lib/form.types";
1112
import { Fence } from "lucide-react";
1213
import { useContext } from "react";
13-
import { UserContext } from "@/components/UserProvider";
1414

1515
export const ProjectConfig = ({
1616
state,
@@ -58,7 +58,7 @@ export const ProjectConfig = ({
5858
<SelectContent>
5959
<SelectGroup>
6060
{user?.projects?.map((project) => (
61-
<SelectItem key={project.id} value={project.id.toString()}>
61+
<SelectItem key={project.id} value={project.id}>
6262
<p>
6363
{project.name}{" "}
6464
<span className="text-sm text-black-2">

frontend/src/lib/form.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const createNewAppWithoutGroup = (
118118
return {
119119
name: getAppName(appState),
120120
namespace: generateNamespace(appState),
121+
projectId: appState.projectId ?? undefined,
121122
config: createDeploymentConfig(appState),
122123
};
123124
};

frontend/src/pages/app/ConfigTab.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { useAppConfig } from "@/components/AppConfigProvider";
21
import HelpTooltip from "@/components/HelpTooltip";
32
import { UserContext } from "@/components/UserProvider";
43
import { AppConfigFormFields } from "@/components/config/AppConfigFormFields";
54
import { GroupConfigFields } from "@/components/config/GroupConfigFields";
6-
import { ProjectConfig } from "@/components/config/ProjectConfig";
75
import { Button } from "@/components/ui/button";
86
import { Input } from "@/components/ui/input";
97
import { Label } from "@/components/ui/label";
@@ -40,7 +38,6 @@ export const ConfigTab = ({
4038
);
4139
}
4240

43-
const appConfig = useAppConfig();
4441
const [state, setState] = useState<CommonFormFields>(
4542
getFormStateFromApp(app),
4643
);
@@ -69,10 +66,7 @@ export const ConfigTab = ({
6966
body: {
7067
displayName: state.displayName,
7168
appGroup: groupState.groupOption,
72-
projectId:
73-
state.projectId && state.projectId !== app.projectId
74-
? state.projectId
75-
: undefined,
69+
projectId: state.projectId ?? undefined,
7670
config: createDeploymentConfig(finalAppState),
7771
},
7872
});
@@ -139,9 +133,6 @@ export const ConfigTab = ({
139133
/>
140134
</div>
141135
<GroupConfigFields state={groupState} setState={setGroupState} />
142-
{appConfig?.isRancherManaged && (
143-
<ProjectConfig state={state} setState={setState} />
144-
)}
145136
<FormContext value="UpdateApp">
146137
<AppConfigFormFields
147138
groupState={groupState}

0 commit comments

Comments
 (0)