Jelajahi Sumber

use correct incident logs endpoint

Mohammed Nafees 4 tahun lalu
induk
melakukan
290681aff4

+ 1 - 3
dashboard/src/main/home/cluster-dashboard/dashboard/incidents/EventDrawer.tsx

@@ -23,7 +23,7 @@ const EventDrawer: React.FC<{ event: IncidentEvent }> = ({ event }) => {
 
   useEffect(() => {
     if (!event) {
-      return () => {};
+      return () => { };
     }
 
     let isSubscribed = true;
@@ -42,8 +42,6 @@ const EventDrawer: React.FC<{ event: IncidentEvent }> = ({ event }) => {
           {
             project_id: currentProject.id,
             cluster_id: currentCluster.id,
-            namespace: event.namespace,
-            release_name: event.release_name,
           }
         )
         .then((res) => ({

+ 6 - 6
dashboard/src/main/home/cluster-dashboard/dashboard/incidents/IncidentPage.tsx

@@ -84,7 +84,7 @@ const IncidentPage = () => {
         <BackButton onClick={handleClose}>
           <BackButtonImg src={backArrow} />
         </BackButton>
-        <TitleSection icon={nodePng}>{incident.incident_id}</TitleSection>
+        <TitleSection icon={nodePng}>Incident for {incident.release_name}</TitleSection>
         <IncidentMessage>{incident.latest_message}</IncidentMessage>
         <IncidentStatus status={incident.latest_state}>
           Status: <i>{incident.latest_state}</i>
@@ -240,11 +240,11 @@ const IncidentStatus = styled.span`
   > i {
     margin-left: 5px;
     color: ${(props: { status: string }) => {
-      if (props.status === "ONGOING") {
-        return "#f5cb42";
-      }
-      return "#00d12a";
-    }};
+    if (props.status === "ONGOING") {
+      return "#f5cb42";
+    }
+    return "#00d12a";
+  }};
   }
 `;
 

+ 15 - 24
dashboard/src/shared/api.tsx

@@ -1,3 +1,4 @@
+import { release } from "process";
 import { baseApi } from "./baseApi";
 
 import { FullActionConfigType, StorageType } from "./types";
@@ -422,11 +423,9 @@ const detectBuildpack = baseApi<
     branch: string;
   }
 >("GET", (pathParams) => {
-  return `/api/projects/${pathParams.project_id}/gitrepos/${
-    pathParams.git_repo_id
-  }/repos/${pathParams.kind}/${pathParams.owner}/${
-    pathParams.name
-  }/${encodeURIComponent(pathParams.branch)}/buildpack/detect`;
+  return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
+    }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
+    }/${encodeURIComponent(pathParams.branch)}/buildpack/detect`;
 });
 
 const getBranchContents = baseApi<
@@ -442,11 +441,9 @@ const getBranchContents = baseApi<
     branch: string;
   }
 >("GET", (pathParams) => {
-  return `/api/projects/${pathParams.project_id}/gitrepos/${
-    pathParams.git_repo_id
-  }/repos/${pathParams.kind}/${pathParams.owner}/${
-    pathParams.name
-  }/${encodeURIComponent(pathParams.branch)}/contents`;
+  return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
+    }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
+    }/${encodeURIComponent(pathParams.branch)}/contents`;
 });
 
 const getProcfileContents = baseApi<
@@ -462,11 +459,9 @@ const getProcfileContents = baseApi<
     branch: string;
   }
 >("GET", (pathParams) => {
-  return `/api/projects/${pathParams.project_id}/gitrepos/${
-    pathParams.git_repo_id
-  }/repos/${pathParams.kind}/${pathParams.owner}/${
-    pathParams.name
-  }/${encodeURIComponent(pathParams.branch)}/procfile`;
+  return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
+    }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
+    }/${encodeURIComponent(pathParams.branch)}/procfile`;
 });
 
 const getBranches = baseApi<
@@ -1198,11 +1193,9 @@ const getEnvGroup = baseApi<
     version?: number;
   }
 >("GET", (pathParams) => {
-  return `/api/projects/${pathParams.id}/clusters/${
-    pathParams.cluster_id
-  }/namespaces/${pathParams.namespace}/envgroup?name=${pathParams.name}${
-    pathParams.version ? "&version=" + pathParams.version : ""
-  }`;
+  return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id
+    }/namespaces/${pathParams.namespace}/envgroup?name=${pathParams.name}${pathParams.version ? "&version=" + pathParams.version : ""
+    }`;
 });
 
 const getConfigMap = baseApi<
@@ -1636,13 +1629,11 @@ const getIncidentLogsByLogId = baseApi<
   {
     project_id: number;
     cluster_id: number;
-    namespace: string;
-    release_name: string;
   }
 >(
   "GET",
-  ({ project_id, cluster_id, namespace, release_name: name }) =>
-    `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/incidents/logs`
+  ({ project_id, cluster_id }) =>
+    `/api/projects/${project_id}/clusters/${cluster_id}/incidents/logs`
 );
 
 const upgradePorterAgent = baseApi<