Bläddra i källkod

chore: minor fixes

Soham Parekh 3 år sedan
förälder
incheckning
02157777df

+ 6 - 4
dashboard/src/main/home/cluster-dashboard/preview-environments/components/PorterYAMLErrorsModal.tsx

@@ -32,10 +32,12 @@ const PorterYAMLErrorsModal = ({
           <img src={info} /> <Bold>Repo:</Bold>
           <img src={info} /> <Bold>Repo:</Bold>
           {repo}
           {repo}
         </InfoTab>
         </InfoTab>
-        <InfoTab>
-          <img src={info} /> <Bold>Branch:</Bold>
-          {branch ?? "base"}
-        </InfoTab>
+        {branch ? (
+          <InfoTab>
+            <img src={info} /> <Bold>Branch:</Bold>
+            {branch}
+          </InfoTab>
+        ) : null}
       </InfoRow>
       </InfoRow>
       <Message>
       <Message>
         {errors.map((el) => {
         {errors.map((el) => {

+ 16 - 10
dashboard/src/main/home/cluster-dashboard/preview-environments/deployments/DeploymentList.tsx

@@ -302,16 +302,18 @@ const DeploymentList = () => {
         capitalize={false}
         capitalize={false}
       />
       />
       {porterYAMLErrors.length > 0 ? (
       {porterYAMLErrors.length > 0 ? (
-        <Banner type="error">
-          Your porter.yaml file has errors. Please fix them before deploying.
-          <LinkButton
-            onClick={() => {
-              setExpandedPorterYAMLErrors(porterYAMLErrors);
-            }}
-          >
-            View details
-          </LinkButton>
-        </Banner>
+        <PorterYAMLBannerWrapper>
+          <Banner type="warning">
+            We found some errors in the porter.yaml file in the default branch.
+            <LinkButton
+              onClick={() => {
+                setExpandedPorterYAMLErrors(porterYAMLErrors);
+              }}
+            >
+              Learn more
+            </LinkButton>
+          </Banner>
+        </PorterYAMLBannerWrapper>
       ) : null}
       ) : null}
       <FlexRow>
       <FlexRow>
         <Flex>
         <Flex>
@@ -589,3 +591,7 @@ const CreatePreviewEnvironmentButton = styled(DynamicLink)`
     justify-content: center;
     justify-content: center;
   }
   }
 `;
 `;
+
+const PorterYAMLBannerWrapper = styled.div`
+  margin-block: 15px;
+`;

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

@@ -64,6 +64,7 @@ const CreateEnvironment: React.FC = () => {
       projectID: currentProject.id,
       projectID: currentProject.id,
       clusterID: currentCluster.id,
       clusterID: currentCluster.id,
       environmentID: Number(environment_id),
       environmentID: Number(environment_id),
+      branch: pullRequest.branch_from,
     });
     });
 
 
     setPorterYAMLErrors(res.data.errors ?? []);
     setPorterYAMLErrors(res.data.errors ?? []);
@@ -161,7 +162,8 @@ const CreateEnvironment: React.FC = () => {
       {selectedPR && porterYAMLErrors.length ? (
       {selectedPR && porterYAMLErrors.length ? (
         <ValidationErrorBannerWrapper>
         <ValidationErrorBannerWrapper>
           <Banner type="warning">
           <Banner type="warning">
-            We found some errors in the porter.yaml file on your branch. &nbsp;
+            We found some errors in the porter.yaml file in the&nbsp;
+            {selectedPR.branch_from}&nbsp;branch. &nbsp;
             <LearnMoreButton onClick={() => setShowErrorsModal(true)}>
             <LearnMoreButton onClick={() => setShowErrorsModal(true)}>
               Learn more
               Learn more
             </LearnMoreButton>
             </LearnMoreButton>