Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit ff51309

Browse files
committed
rename id to appId across routes
1 parent 7595f10 commit ff51309

35 files changed

+489
-483
lines changed

desktop-app/src/components/navbar.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface NavbarProps {
1111
}
1212

1313
const Navbar = ({ showNav = true }: NavbarProps) => {
14-
const { id } = useParams();
14+
const { appId } = useParams();
1515

1616
return (
1717
<nav className="border-b">
@@ -22,13 +22,13 @@ const Navbar = ({ showNav = true }: NavbarProps) => {
2222
<Logo />
2323
</a>
2424
</div>
25-
{showNav && id && (
25+
{showNav && appId && (
2626
<div className="flex space-x-6">
27-
<NavLink to={`/app/${id}/dashboard`}>Dashboard</NavLink>
28-
<NavLink to={`/app/${id}/components`}>Components</NavLink>
29-
<NavLink to={`/app/${id}/apis`}>APIs</NavLink>
30-
<NavLink to={`/app/${id}/deployments`}>Deployments</NavLink>
31-
<NavLink to={`/app/${id}/plugins`}>Plugins</NavLink>
27+
<NavLink to={`/app/${appId}/dashboard`}>Dashboard</NavLink>
28+
<NavLink to={`/app/${appId}/components`}>Components</NavLink>
29+
<NavLink to={`/app/${appId}/apis`}>APIs</NavLink>
30+
<NavLink to={`/app/${appId}/deployments`}>Deployments</NavLink>
31+
<NavLink to={`/app/${appId}/plugins`}>Plugins</NavLink>
3232
</div>
3333
)}
3434
</div>

desktop-app/src/components/yaml-uploader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { YamlEditor } from "./yaml-editor";
2424
// import { parse } from "path";
2525

2626
export default function YamlUploader() {
27-
const { apiName, version, id } = useParams();
27+
const { apiName, version, appId } = useParams();
2828
const navigate = useNavigate();
2929
const [queryParams] = useSearchParams();
3030
const path = queryParams.get("path");
@@ -44,8 +44,8 @@ export default function YamlUploader() {
4444
try {
4545
setIsLoading(true);
4646
const [apiResponse, componentResponse] = await Promise.all([
47-
API.getApi(id, apiName),
48-
API.getComponentByIdAsKey(id!),
47+
API.getApi(appId, apiName),
48+
API.getComponentByIdAsKey(appId!),
4949
]);
5050
setActiveApiDetails(apiResponse!);
5151
} catch (error) {

desktop-app/src/pages/api/create/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type CreateApiFormValues = z.infer<typeof createApiSchema>;
3939
const CreateAPI = () => {
4040
const navigate = useNavigate();
4141
const [isSubmitting, setIsSubmitting] = useState(false);
42-
const { id } = useParams<{ id: string }>();
42+
const { appId } = useParams<{ appId: string }>();
4343

4444
const form = useForm<CreateApiFormValues>({
4545
resolver: zodResolver(createApiSchema),
@@ -58,7 +58,7 @@ const CreateAPI = () => {
5858
routes: [],
5959
draft: true,
6060
});
61-
navigate(`/app/${id}/apis/${values.apiName}/version/${values.version}`);
61+
navigate(`/app/${appId}/apis/${values.apiName}/version/${values.version}`);
6262
} catch (error) {
6363
console.error("Failed to create API:", error);
6464
form.setError("apiName", {

desktop-app/src/pages/api/details/apis-layout.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,26 @@ import { NavRoutes } from "@/components/nav-route.tsx";
3737
import { Button } from "@/components/ui/button.tsx";
3838
import { HttpApiDefinition } from "@/types/golemManifest.ts";
3939

40-
const MenuItems = (id: string, apiName: string, version: string) => [
40+
const MenuItems = (appId: string, apiName: string, version: string) => [
4141
{
4242
title: "Overview",
43-
url: `/app/${id}/apis/${apiName}/version/${version}`,
43+
url: `/app/${appId}/apis/${apiName}/version/${version}`,
4444
icon: Home,
4545
},
4646
{
4747
title: "Settings",
48-
url: `/app/${id}/apis/${apiName}/version/${version}/settings`,
48+
url: `/app/${appId}/apis/${apiName}/version/${version}/settings`,
4949
icon: Settings,
5050
},
5151
{
5252
title: "New Version",
53-
url: `/app/${id}/apis/${apiName}/version/${version}/newversion`,
53+
url: `/app/${appId}/apis/${apiName}/version/${version}/newversion`,
5454
icon: CircleFadingPlusIcon,
5555
},
5656
];
5757

5858
export const ApiLayout = () => {
59-
const { apiName, version, id } = useParams();
59+
const { apiName, version, appId } = useParams();
6060
const [queryParams] = useSearchParams();
6161
const navigate = useNavigate();
6262
const [apiDetails, setApiDetails] = useState<HttpApiDefinition>();
@@ -81,7 +81,7 @@ export const ApiLayout = () => {
8181
}, [apiDetails]);
8282

8383
useEffect(() => {
84-
API.getApi(id!, apiName!).then(async response => {
84+
API.getApi(appId!, apiName!).then(async response => {
8585
let detail = response.find(r => r.version == version);
8686
setApiDetails(detail);
8787
if (response) {
@@ -98,15 +98,15 @@ export const ApiLayout = () => {
9898
}, [apiName, version, path, method, reload]);
9999

100100
const handleNavigateHome = useCallback(() => {
101-
navigate(`/app/${id}/apis/${apiName}/version/${version}`);
101+
navigate(`/app/${appId}/apis/${apiName}/version/${version}`);
102102
setCurrentMenu("Overview");
103103
}, [navigate, apiName, version]);
104104

105105
return (
106106
<ErrorBoundary>
107107
<SidebarProvider>
108108
<SidebarMenu
109-
menus={MenuItems(id!, apiName!, version!)}
109+
menus={MenuItems(appId!, apiName!, version!)}
110110
activeItem={currentMenu}
111111
setActiveItem={setCurrentMenu}
112112
title={"Worker"}
@@ -117,7 +117,7 @@ export const ApiLayout = () => {
117117
return {
118118
method: route.method,
119119
name: route.path,
120-
url: `/app/${id}/apis/${apiName}/version/${version}/routes/?path=${route.path}&method=${route.method}`,
120+
url: `/app/${appId}/apis/${apiName}/version/${version}/routes/?path=${route.path}&method=${route.method}`,
121121
};
122122
})}
123123
setActiveItem={value => setCurrentMenu(value)}
@@ -156,7 +156,7 @@ export const ApiLayout = () => {
156156
);
157157
if (selectedApi) {
158158
navigate(
159-
`/app/${id}/apis/${apiName}/version/${version}${basePath}`,
159+
`/app/${appId}/apis/${apiName}/version/${version}${basePath}`,
160160
);
161161
}
162162
}}
@@ -200,7 +200,7 @@ export const ApiLayout = () => {
200200
variant="default"
201201
onClick={() => {
202202
navigate(
203-
`/app/${id}/apis/${apiName}/version/${version}/routes/add?`,
203+
`/app/${appId}/apis/${apiName}/version/${version}/routes/add?`,
204204
);
205205
setCurrentMenu("Add New Route");
206206
}}

desktop-app/src/pages/api/details/createRoute.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const interpolations = [
104104
];
105105

106106
const CreateRoute = () => {
107-
const { apiName, version, id } = useParams();
107+
const { apiName, version, appId } = useParams();
108108
const navigate = useNavigate();
109109
const [componentList, setComponentList] = useState<{
110110
[key: string]: ComponentList;
@@ -174,7 +174,7 @@ const CreateRoute = () => {
174174
setIsLoading(true);
175175
const [apiResponse, componentResponse] = await Promise.all([
176176
API.getApi(apiName),
177-
API.getComponentByIdAsKey(id!),
177+
API.getComponentByIdAsKey(appId!),
178178
]);
179179
const selectedApi = apiResponse.find(api => api.version === version);
180180
setActiveApiDetails(selectedApi!);
@@ -267,12 +267,12 @@ const CreateRoute = () => {
267267
);
268268
selectedApi.routes.push(values);
269269
await API.putApi(
270-
activeApiDetails.id,
270+
activeApiDetails.appId,
271271
activeApiDetails.version,
272272
selectedApi,
273273
).then(() => {
274274
navigate(
275-
`/app/${id}/apis/${apiName}/version/${version}/routes?path=${values.path == "/" ? "" : values.path}&method=${values.method}&reload=${!reload}`,
275+
`/app/${appId}/apis/${apiName}/version/${version}/routes?path=${values.path == "/" ? "" : values.path}&method=${values.method}&reload=${!reload}`,
276276
);
277277
});
278278
} catch (error) {

desktop-app/src/pages/api/details/index.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import ErrorBoundary from "@/components/errorBoundary.tsx";
1212
import { HTTP_METHOD_COLOR } from "@/components/nav-route.tsx";
1313

1414
const APIDetails = () => {
15-
const { apiName, version, id } = useParams();
15+
const { apiName, version, appId } = useParams();
1616
const [queryParams] = useSearchParams();
1717
const reload = queryParams.get("reload");
1818
const navigate = useNavigate();
@@ -22,11 +22,11 @@ const APIDetails = () => {
2222

2323
useEffect(() => {
2424
if (apiName) {
25-
API.getApi(id!, apiName).then(response => {
25+
API.getApi(appId!, apiName).then(response => {
2626
const selectedApi = response.find(r => r.version == version);
2727
setActiveApiDetails(selectedApi!);
2828
});
29-
API.getDeploymentApi(id!).then(response => {
29+
API.getDeploymentApi(appId!).then(response => {
3030
const result = [] as Deployment[];
3131
response.forEach((deployment: Deployment) => {
3232
if (deployment.apiDefinitions.length > 0) {
@@ -44,7 +44,7 @@ const APIDetails = () => {
4444

4545
const routeToQuery = (route: RouteRequestData) => {
4646
navigate(
47-
`/app/${id}/apis/${apiName}/version/${version}/routes/?path=${route.path}&method=${route.method}`,
47+
`/app/${appId}/apis/${apiName}/version/${version}/routes/?path=${route.path}&method=${route.method}`,
4848
);
4949
};
5050
return (
@@ -59,7 +59,7 @@ const APIDetails = () => {
5959
variant="outline"
6060
onClick={() =>
6161
navigate(
62-
`/app/${id}/apis/${apiName}/version/${version}/routes/add?`,
62+
`/app/${appId}/apis/${apiName}/version/${version}/routes/add?`,
6363
)
6464
}
6565
className="flex items-center gap-2"
@@ -120,7 +120,7 @@ const APIDetails = () => {
120120
<Button
121121
variant="ghost"
122122
className="text-primary"
123-
onClick={() => navigate(`/app/${id}/deployments`)}
123+
onClick={() => navigate(`/app/${appId}/deployments`)}
124124
>
125125
View All
126126
</Button>
@@ -133,7 +133,7 @@ const APIDetails = () => {
133133
<div
134134
key={deployment.createdAt + deployment.site.host}
135135
className="flex items-center justify-between rounded-lg border p-4 cursor-pointer"
136-
onClick={() => navigate(`/app/${id}/deployments`)}
136+
onClick={() => navigate(`/app/${appId}/deployments`)}
137137
>
138138
<div className="space-y-2">
139139
<div className="flex items-center gap-2">

desktop-app/src/pages/api/details/newVersion.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type NewVersionFormValues = z.infer<typeof newVersionSchema>;
5050

5151
export default function APINewVersion() {
5252
const navigate = useNavigate();
53-
const { apiName, version, id } = useParams();
53+
const { apiName, version, appId } = useParams();
5454
const [isLoading, setIsLoading] = useState(false);
5555
const [isSubmitting, setIsSubmitting] = useState(false);
5656
const [apiDetails, setApiDetails] = useState<HttpApiDefinition[]>([]);
@@ -92,7 +92,7 @@ export default function APINewVersion() {
9292
try {
9393
setIsLoading(true);
9494
setFetchError(null);
95-
const response = await API.getApi(id!, apiName);
95+
const response = await API.getApi(appId!, apiName);
9696
setApiDetails(response);
9797
setActiveApiDetails(response[response.length - 1]);
9898
} catch (error) {
@@ -149,9 +149,12 @@ export default function APINewVersion() {
149149
draft: true,
150150
createdAt: new Date().toISOString(),
151151
};
152-
await API.postApi(payload).then(() => {
153-
navigate(`/app/${id}/apis/${apiName}/version/${values.version}`);
154-
});
152+
console.log(payload);
153+
await API.createApiVersion(appId!, payload);
154+
// .then(() => {
155+
navigate(`/app/${appId}/apis/${apiName}/version/${values.version}`);
156+
// });
157+
// throw new Error("yes o");
155158
} catch (error) {
156159
console.error("Failed to create new version:", error);
157160
form.setError("version", {

desktop-app/src/pages/api/details/settings.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Trash2 } from "lucide-react";
2424
export default function APISettings() {
2525
const { toast } = useToast();
2626
const navigate = useNavigate();
27-
const { apiName, version, id } = useParams();
27+
const { apiName, version, appId } = useParams();
2828
const [queryParams] = useSearchParams();
2929
const reload = queryParams.get("reload");
3030

@@ -39,7 +39,7 @@ export default function APISettings() {
3939

4040
useEffect(() => {
4141
if (apiName) {
42-
API.getApi(id!, apiName).then(response => {
42+
API.getApi(appId!, apiName).then(response => {
4343
setApiDetails(response);
4444
const selectedApi = response.find(api => api.version === version);
4545
setActiveApiDetails(selectedApi!);
@@ -51,7 +51,7 @@ export default function APISettings() {
5151
setIsDeleting(true);
5252
try {
5353
if (type === "version") {
54-
await API.deleteApi(activeApiDetails.id, activeApiDetails.version);
54+
await API.deleteApi(activeApiDetails.appId, activeApiDetails.version);
5555
toast({
5656
title: "Version deleted",
5757
description: `API version ${activeApiDetails.version} has been deleted successfully.`,
@@ -62,23 +62,23 @@ export default function APISettings() {
6262
);
6363
navigate(
6464
newVersion
65-
? `/app/${id}/apis/${apiName}/version/${newVersion.version}`
66-
: `/app/${id}/apis`,
65+
? `/app/${appId}/apis/${apiName}/version/${newVersion.version}`
66+
: `/app/${appId}/apis`,
6767
);
6868
setShowConfirmDialog(false);
6969
} else if (type === "all") {
7070
await Promise.all(
71-
apiDetails.map(api => API.deleteApi(api.id, api.version)),
71+
apiDetails.map(api => API.deleteApi(api.appId, api.version)),
7272
);
7373
toast({
7474
title: "All versions deleted",
7575
description: "All API versions have been deleted successfully.",
7676
duration: 3000,
7777
});
78-
navigate(`/app/${id}/apis`);
78+
navigate(`/app/${appId}/apis`);
7979
setShowConfirmAllDialog(false);
8080
} else {
81-
await API.putApi(activeApiDetails.id, activeApiDetails.version, {
81+
await API.putApi(activeApiDetails.appId, activeApiDetails.version, {
8282
...activeApiDetails,
8383
routes: [],
8484
});
@@ -88,7 +88,7 @@ export default function APISettings() {
8888
duration: 3000,
8989
});
9090
navigate(
91-
`/app/${id}/apis/${apiName}/version/${version}?reload=${!reload}`,
91+
`/app/${appId}/apis/${apiName}/version/${version}?reload=${!reload}`,
9292
);
9393
setShowConfirmAllRoutes(false);
9494
}

desktop-app/src/pages/api/details/viewRoute.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function PathParameters({ url }: { url: string }) {
131131

132132
export const ApiRoute = () => {
133133
const navigate = useNavigate();
134-
const { apiName, version, id } = useParams();
134+
const { apiName, version, appId } = useParams();
135135
const [currentRoute, setCurrentRoute] = useState({} as RouteRequestData);
136136
const [apiResponse, setApiResponse] = useState({} as Api);
137137
const [queryParams] = useSearchParams();
@@ -142,7 +142,7 @@ export const ApiRoute = () => {
142142
useEffect(() => {
143143
const fetchData = async () => {
144144
if (apiName && version && method && path !== null) {
145-
const apiResponse = await API.getApi(id!, apiName);
145+
const apiResponse = await API.getApi(appId!, apiName);
146146
const selectedApi = apiResponse.find(api => api.version === version);
147147
if (selectedApi) {
148148
setApiResponse(selectedApi);
@@ -151,18 +151,18 @@ export const ApiRoute = () => {
151151
);
152152
setCurrentRoute(route || ({} as RouteRequestData));
153153
} else {
154-
navigate(`/app/${id}/apis/${apiName}/version/${version}`);
154+
navigate(`/app/${appId}/apis/${apiName}/version/${version}`);
155155
}
156156
} else {
157-
navigate(`/app/${id}/apis/${apiName}/version/${version}`);
157+
navigate(`/app/${appId}/apis/${apiName}/version/${version}`);
158158
}
159159
};
160160
fetchData();
161161
}, [apiName, version, path, method, reload]);
162162

163163
const routeToQuery = () => {
164164
navigate(
165-
`/app/${id}/apis/${apiName}/version/${version}/routes/edit?path=${path}&method=${method}`,
165+
`/app/${appId}/apis/${apiName}/version/${version}/routes/edit?path=${path}&method=${method}`,
166166
);
167167
};
168168

@@ -175,7 +175,7 @@ export const ApiRoute = () => {
175175
route => !(route.path === path && route.method === method),
176176
);
177177
API.putApi(apiName, version!, currentApi).then(() => {
178-
navigate(`/app/${id}/apis/${apiName}/version/${version}`);
178+
navigate(`/app/${appId}/apis/${apiName}/version/${version}`);
179179
});
180180
}
181181
});

0 commit comments

Comments
 (0)