Преглед изворни кода

Updated name to correspond to the object deployment

jnfrati пре 4 година
родитељ
комит
afcada6b7e

+ 5 - 5
dashboard/src/main/home/cluster-dashboard/preview-environments/EnvironmentCard.tsx → dashboard/src/main/home/cluster-dashboard/preview-environments/DeploymentCard.tsx

@@ -10,7 +10,7 @@ import api from "shared/api";
 import { useContext } from "react";
 import { useContext } from "react";
 import { Context } from "shared/Context";
 import { Context } from "shared/Context";
 
 
-const EnvironmentCard: React.FC<{
+const DeploymentCard: React.FC<{
   deployment: PRDeployment;
   deployment: PRDeployment;
   environment: Environment;
   environment: Environment;
   onDelete: () => void;
   onDelete: () => void;
@@ -47,7 +47,7 @@ const EnvironmentCard: React.FC<{
   };
   };
 
 
   return (
   return (
-    <EnvironmentCardWrapper key={deployment.id}>
+    <DeploymentCardWrapper key={deployment.id}>
       <DataContainer>
       <DataContainer>
         <PRName>
         <PRName>
           <PRIcon src={pr_icon} alt="pull request icon" />
           <PRIcon src={pr_icon} alt="pull request icon" />
@@ -128,11 +128,11 @@ const EnvironmentCard: React.FC<{
           </DeleteMessage>
           </DeleteMessage>
         )}
         )}
       </Flex>
       </Flex>
-    </EnvironmentCardWrapper>
+    </DeploymentCardWrapper>
   );
   );
 };
 };
 
 
-export default EnvironmentCard;
+export default DeploymentCard;
 
 
 const DeleteMessage = styled.div`
 const DeleteMessage = styled.div`
   display: flex;
   display: flex;
@@ -188,7 +188,7 @@ const PRName = styled.div`
   margin-bottom: 10px;
   margin-bottom: 10px;
 `;
 `;
 
 
-const EnvironmentCardWrapper = styled.div`
+const DeploymentCardWrapper = styled.div`
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   justify-content: space-between;
   justify-content: space-between;

+ 3 - 13
dashboard/src/main/home/cluster-dashboard/preview-environments/EnvironmentDetail.tsx → dashboard/src/main/home/cluster-dashboard/preview-environments/DeploymentDetail.tsx

@@ -14,17 +14,13 @@ import github from "assets/github-white.png";
 import { integrationList } from "shared/common";
 import { integrationList } from "shared/common";
 import { capitalize } from "shared/string_utils";
 import { capitalize } from "shared/string_utils";
 
 
-const EnvironmentDetail = () => {
+const DeploymentDetail = () => {
   const { params } = useRouteMatch<{ namespace: string }>();
   const { params } = useRouteMatch<{ namespace: string }>();
   const context = useContext(Context);
   const context = useContext(Context);
   const [prDeployment, setPRDeployment] = useState<PRDeployment>(null);
   const [prDeployment, setPRDeployment] = useState<PRDeployment>(null);
-  const [hasError, setHasError] = useState(false);
-  const [isLoading, setIsLoading] = useState(false);
   const [showRepoTooltip, setShowRepoTooltip] = useState(false);
   const [showRepoTooltip, setShowRepoTooltip] = useState(false);
 
 
-  const { currentProject, currentCluster, setCurrentError } = useContext(
-    Context
-  );
+  const { currentProject, currentCluster } = useContext(Context);
 
 
   const { search } = useLocation();
   const { search } = useLocation();
   let searchParams = new URLSearchParams(search);
   let searchParams = new URLSearchParams(search);
@@ -55,14 +51,8 @@ const EnvironmentDetail = () => {
       .catch((err) => {
       .catch((err) => {
         console.error(err);
         console.error(err);
         if (isSubscribed) {
         if (isSubscribed) {
-          setHasError(true);
           setPRDeployment(null);
           setPRDeployment(null);
         }
         }
-      })
-      .finally(() => {
-        if (isSubscribed) {
-          setIsLoading(false);
-        }
       });
       });
   }, [params]);
   }, [params]);
 
 
@@ -137,7 +127,7 @@ const EnvironmentDetail = () => {
   );
   );
 };
 };
 
 
-export default EnvironmentDetail;
+export default DeploymentDetail;
 
 
 const Flex = styled.div`
 const Flex = styled.div`
   display: flex;
   display: flex;

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/preview-environments/DeploymentList.tsx

@@ -12,7 +12,7 @@ import ConnectNewRepo from "./components/ConnectNewRepo";
 import Loading from "components/Loading";
 import Loading from "components/Loading";
 
 
 import _, { flatMapDepth } from "lodash";
 import _, { flatMapDepth } from "lodash";
-import EnvironmentCard from "./EnvironmentCard";
+import EnvironmentCard from "./DeploymentCard";
 
 
 export type PRDeployment = {
 export type PRDeployment = {
   id: number;
   id: number;

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/preview-environments/routes.tsx

@@ -2,7 +2,7 @@ import React, { useContext } from "react";
 import { Redirect, Route, Switch, useRouteMatch } from "react-router";
 import { Redirect, Route, Switch, useRouteMatch } from "react-router";
 import { Context } from "shared/Context";
 import { Context } from "shared/Context";
 import ConnectNewRepo from "./components/ConnectNewRepo";
 import ConnectNewRepo from "./components/ConnectNewRepo";
-import EnvironmentDetail from "./EnvironmentDetail";
+import EnvironmentDetail from "./DeploymentDetail";
 import PreviewEnvironmentsHome from "./PreviewEnvironmentsHome";
 import PreviewEnvironmentsHome from "./PreviewEnvironmentsHome";
 
 
 export const Routes = () => {
 export const Routes = () => {