Browse Source

make cluster id a query param'

Alexander Belanger 4 years ago
parent
commit
f892fef92b

+ 2 - 3
dashboard/src/components/events/EventsContext.tsx

@@ -147,11 +147,10 @@ const EventsContextProvider: React.FC<Props> = ({
     try {
     try {
       await api.installPorterAgent(
       await api.installPorterAgent(
         "<token>",
         "<token>",
-        {
-          cluster_id: currentCluster.id,
-        },
+        {},
         {
         {
           project_id: currentProject.id,
           project_id: currentProject.id,
+          cluster_id: currentCluster.id,
         }
         }
       );
       );
       setIsPorterAgentInstalling(true);
       setIsPorterAgentInstalling(true);

+ 3 - 5
dashboard/src/shared/api.tsx

@@ -1014,12 +1014,10 @@ const getPorterAgentIsInstalled = baseApi<
 });
 });
 
 
 const installPorterAgent = baseApi<
 const installPorterAgent = baseApi<
-  {
-    cluster_id: number;
-  },
-  { project_id: number }
+  {},
+  { project_id: number, cluster_id: number }
 >("POST", (pathParams) => {
 >("POST", (pathParams) => {
-  return `/api/projects/${pathParams.project_id}/agent/deploy`;
+  return `/api/projects/${pathParams.project_id}/agent/deploy?cluster_id=${pathParams.cluster_id}`;
 });
 });
 
 
 const getEvents = baseApi<
 const getEvents = baseApi<

+ 1 - 1
server/router/router.go

@@ -1330,7 +1330,7 @@ func New(a *api.App) *chi.Mux {
 					auth.DoesUserHaveClusterAccess(
 					auth.DoesUserHaveClusterAccess(
 						requestlog.NewHandler(a.HandleDeployAgent, l),
 						requestlog.NewHandler(a.HandleDeployAgent, l),
 						mw.URLParam,
 						mw.URLParam,
-						mw.BodyParam,
+						mw.QueryParam,
 					),
 					),
 					mw.URLParam,
 					mw.URLParam,
 					mw.WriteAccess,
 					mw.WriteAccess,