Feroze Mohideen 2 роки тому
батько
коміт
557a5da34e

+ 28 - 28
api/server/router/porter_app.go

@@ -398,34 +398,6 @@ func getPorterAppRoutes(
 		Router:   r,
 	})
 
-	// GET /api/projects/{project_id}/clusters/{cluster_id}/events/id -> porter_app.NewGetPorterAppEventHandler
-	getPorterAppEventEndpoint := factory.NewAPIEndpoint(
-		&types.APIRequestMetadata{
-			Verb:   types.APIVerbCreate,
-			Method: types.HTTPVerbGet,
-			Path: &types.Path{
-				Parent:       basePath,
-				RelativePath: fmt.Sprintf("/events/{%s}", types.URLParamPorterAppEventID),
-			},
-			Scopes: []types.PermissionScope{
-				types.UserScope,
-				types.ProjectScope,
-				types.ClusterScope,
-			},
-		},
-	)
-
-	getPorterAppEventHandler := porter_app.NewGetPorterAppEventHandler(
-		config,
-		factory.GetResultWriter(),
-	)
-
-	routes = append(routes, &router.Route{
-		Endpoint: getPorterAppEventEndpoint,
-		Handler:  getPorterAppEventHandler,
-		Router:   r,
-	})
-
 	// POST /api/projects/{project_id}/clusters/{cluster_id}/applications/analytics -> porter_app.NewPorterAppAnalyticsHandler
 	porterAppAnalyticsEndpoint := factory.NewAPIEndpoint(
 		&types.APIRequestMetadata{
@@ -1763,5 +1735,33 @@ func getPorterAppRoutes(
 		Router:   r,
 	})
 
+	// GET /api/projects/{project_id}/clusters/{cluster_id}/apps/{porter_app_name}/events/id -> porter_app.NewGetPorterAppEventHandler
+	getPorterAppEventEndpoint := factory.NewAPIEndpoint(
+		&types.APIRequestMetadata{
+			Verb:   types.APIVerbCreate,
+			Method: types.HTTPVerbGet,
+			Path: &types.Path{
+				Parent:       basePath,
+				RelativePath: fmt.Sprintf("%s/{%s}/events/{%s}", relPathV2, types.URLParamPorterAppName, types.URLParamPorterAppEventID),
+			},
+			Scopes: []types.PermissionScope{
+				types.UserScope,
+				types.ProjectScope,
+				types.ClusterScope,
+			},
+		},
+	)
+
+	getPorterAppEventHandler := porter_app.NewGetPorterAppEventHandler(
+		config,
+		factory.GetResultWriter(),
+	)
+
+	routes = append(routes, &router.Route{
+		Endpoint: getPorterAppEventEndpoint,
+		Handler:  getPorterAppEventHandler,
+		Router:   r,
+	})
+
 	return routes, newPath
 }

+ 4 - 2
dashboard/src/main/home/app-dashboard/app-view/tabs/activity-feed/events/focus-views/EventFocusView.tsx

@@ -33,12 +33,13 @@ const EventFocusView: React.FC = () => {
   const { search } = useLocation();
   const queryParams = new URLSearchParams(search);
   const eventId = queryParams.get("event_id");
-  const { projectId, clusterId, tabUrlGenerator } = useLatestRevision();
+  const { projectId, clusterId, tabUrlGenerator, appName } =
+    useLatestRevision();
 
   const [event, setEvent] = useState<SupportedEventFocusViewEvent | null>(null);
 
   const { data } = useQuery(
-    ["getPorterAppEvent", projectId, clusterId, eventId, event],
+    ["getPorterAppEvent", projectId, clusterId, eventId, event, appName],
     async () => {
       if (eventId == null || eventId === "") {
         return null;
@@ -50,6 +51,7 @@ const EventFocusView: React.FC = () => {
           project_id: projectId,
           cluster_id: clusterId,
           event_id: eventId,
+          porter_app_name: appName,
         }
       );
       return porterAppEventValidator.parse(eventResp.data.event);

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

@@ -216,10 +216,11 @@ const getPorterAppEvent = baseApi<
     project_id: number;
     cluster_id: number;
     event_id: string;
+    porter_app_name: string;
   }
 >("GET", (pathParams) => {
-  const { project_id, cluster_id, event_id } = pathParams;
-  return `/api/projects/${project_id}/clusters/${cluster_id}/events/${event_id}`;
+  const { project_id, cluster_id, event_id, porter_app_name } = pathParams;
+  return `/api/projects/${project_id}/clusters/${cluster_id}/apps/${porter_app_name}/events/${event_id}`;
 });
 
 const createPorterApp = baseApi<