Kaynağa Gözat

Merge pull request #384 from porter-dev/master

Merge buildpack CI fixes to staging
abelanger5 5 yıl önce
ebeveyn
işleme
44e0ed6ae4

+ 45 - 0
dashboard/src/components/InfoTooltip.tsx

@@ -0,0 +1,45 @@
+import React, { Component } from "react";
+import styled from "styled-components";
+
+type PropsType = {
+  text: string;
+};
+
+type StateType = {
+  showTooltip: boolean;
+};
+
+export default class InfoTooltip extends Component<PropsType, StateType> {
+  state = {
+    showTooltip: false
+  };
+
+  render() {
+    return (
+      <StyledInfoTooltip>
+        <i className="material-icons">help_outline</i>
+      </StyledInfoTooltip>
+    );
+  }
+}
+
+const StyledInfoTooltip = styled.div`
+  display: inline-block;
+  position: relative;
+  width: 26px;
+  margin-right: 2px;
+
+  > i {
+    display: flex;
+    align-items: center;
+    position: absolute;
+    top: -14px;
+    font-size: 18px;
+    right: -1px;
+    color: #858faaaa;
+    cursor: pointer;
+    :hover {
+      color: #aaaabb;
+    }
+  }
+`;

+ 3 - 1
dashboard/src/components/image-selector/ImageList.tsx

@@ -261,7 +261,9 @@ const BackButton = styled.div`
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   justify-content: space-between;
   justify-content: space-between;
-  margin-top: 10px;
+  margin-top: 28px;
+  margin-bottom: -6px;
+  height: 35px;
   cursor: pointer;
   cursor: pointer;
   font-size: 13px;
   font-size: 13px;
   padding: 5px 13px;
   padding: 5px 13px;

+ 2 - 0
dashboard/src/components/image-selector/TagList.tsx

@@ -72,6 +72,8 @@ export default class TagList extends Component<PropsType, StateType> {
       );
       );
     } else if (error || !tags) {
     } else if (error || !tags) {
       return <LoadingWrapper>Error loading tags</LoadingWrapper>;
       return <LoadingWrapper>Error loading tags</LoadingWrapper>;
+    } else if (tags.length === 0) {
+      return <LoadingWrapper>This image repository is empty.</LoadingWrapper>;
     }
     }
 
 
     return tags.map((tag: string, i: number) => {
     return tags.map((tag: string, i: number) => {

+ 12 - 1
dashboard/src/components/repo-selector/ActionDetails.tsx

@@ -8,6 +8,7 @@ import api from "../../shared/api";
 import Loading from "components/Loading";
 import Loading from "components/Loading";
 import { ActionConfigType } from "../../shared/types";
 import { ActionConfigType } from "../../shared/types";
 import InputRow from "../values-form/InputRow";
 import InputRow from "../values-form/InputRow";
+import InfoTooltip from "components/InfoTooltip";
 
 
 type PropsType = {
 type PropsType = {
   actionConfig: ActionConfigType | null;
   actionConfig: ActionConfigType | null;
@@ -43,6 +44,7 @@ export default class ActionDetails extends Component<PropsType, StateType> {
   };
   };
 
 
   componentDidMount() {
   componentDidMount() {
+    // TODO: Handle custom registry case (unroll repos?)
     api
     api
       .getProjectRegistries(
       .getProjectRegistries(
         "<token>",
         "<token>",
@@ -96,7 +98,10 @@ export default class ActionDetails extends Component<PropsType, StateType> {
     } else {
     } else {
       return (
       return (
         <>
         <>
-          <Subtitle>Container Registry</Subtitle>
+          <Subtitle>
+            Select an Image Destination
+            <Required>*</Required>
+          </Subtitle>
           <ExpandedWrapper>{this.renderIntegrationList()}</ExpandedWrapper>
           <ExpandedWrapper>{this.renderIntegrationList()}</ExpandedWrapper>
         </>
         </>
       );
       );
@@ -163,6 +168,12 @@ export default class ActionDetails extends Component<PropsType, StateType> {
 
 
 ActionDetails.contextType = Context;
 ActionDetails.contextType = Context;
 
 
+const Required = styled.div`
+  margin-left: 8px;
+  color: #fc4976;
+  display: inline-block;
+`;
+
 const Subtitle = styled.div`
 const Subtitle = styled.div`
   margin-top: 21px;
   margin-top: 21px;
 `;
 `;

+ 1 - 1
dashboard/src/main/CurrentError.tsx

@@ -94,7 +94,7 @@ const StyledCurrentError = styled.div`
   position: fixed;
   position: fixed;
   bottom: 22px;
   bottom: 22px;
   width: 300px;
   width: 300px;
-  left: 100px;
+  left: 20px;
   padding: 15px;
   padding: 15px;
   padding-right: 0px;
   padding-right: 0px;
   font-family: "Work Sans", sans-serif;
   font-family: "Work Sans", sans-serif;

+ 20 - 0
dashboard/src/main/Login.tsx

@@ -167,6 +167,13 @@ export default class Login extends Component<PropsType, StateType> {
             </Helper>
             </Helper>
           </FormWrapper>
           </FormWrapper>
         </LoginPanel>
         </LoginPanel>
+
+        <Footer>
+          © 2021 Porter Technologies Inc. • 
+          <Link href="https://docs.getporter.dev/docs/terms-of-service" target="_blank">
+            Terms & Privacy
+          </Link>
+        </Footer>
       </StyledLogin>
       </StyledLogin>
     );
     );
   }
   }
@@ -174,6 +181,19 @@ export default class Login extends Component<PropsType, StateType> {
 
 
 Login.contextType = Context;
 Login.contextType = Context;
 
 
+const Footer = styled.div`
+  position: absolute;
+  bottom: 0;
+  left: 0;
+  margin-bottom: 30px;
+  width: 100vw;
+  text-align: center;
+  color: #aaaabb;
+  font-size: 13px;
+  padding-right: 8px;
+  font: Work Sans, sans-serif;
+`;
+
 const DarkMatter = styled.div`
 const DarkMatter = styled.div`
   margin-top: -10px;
   margin-top: -10px;
 `;
 `;

+ 19 - 0
dashboard/src/main/Register.tsx

@@ -182,6 +182,12 @@ export default class Register extends Component<PropsType, StateType> {
             </Helper>
             </Helper>
           </FormWrapper>
           </FormWrapper>
         </LoginPanel>
         </LoginPanel>
+        <Footer>
+          © 2021 Porter Technologies Inc. • 
+          <Link href="https://docs.getporter.dev/docs/terms-of-service" target="_blank">
+            Terms & Privacy
+          </Link>
+        </Footer>
       </StyledRegister>
       </StyledRegister>
     );
     );
   }
   }
@@ -189,6 +195,19 @@ export default class Register extends Component<PropsType, StateType> {
 
 
 Register.contextType = Context;
 Register.contextType = Context;
 
 
+const Footer = styled.div`
+  position: absolute;
+  bottom: 0;
+  left: 0;
+  margin-bottom: 30px;
+  width: 100vw;
+  text-align: center;
+  color: #aaaabb;
+  font-size: 13px;
+  padding-right: 8px;
+  font: Work Sans, sans-serif;
+`;
+
 const DarkMatter = styled.div`
 const DarkMatter = styled.div`
   margin-top: -10px;
   margin-top: -10px;
 `;
 `;

+ 0 - 1
dashboard/src/main/home/launch/Launch.tsx

@@ -331,7 +331,6 @@ const TitleSection = styled.div`
       font-size: 18px;
       font-size: 18px;
       margin-left: 18px;
       margin-left: 18px;
       color: #858faaaa;
       color: #858faaaa;
-      cursor: pointer;
       :hover {
       :hover {
         color: #aaaabb;
         color: #aaaabb;
       }
       }

+ 9 - 2
dashboard/src/main/home/launch/expanded-template/LaunchTemplate.tsx

@@ -90,6 +90,13 @@ class LaunchTemplate extends Component<PropsType, StateType> {
   createGHAction = (chartName: string, chartNamespace: string) => {
   createGHAction = (chartName: string, chartNamespace: string) => {
     let { currentProject, currentCluster } = this.context;
     let { currentProject, currentCluster } = this.context;
     let { actionConfig } = this.state;
     let { actionConfig } = this.state;
+    let imageRepoUri = `${this.state.selectedRegistry.url}/${chartName}-${chartNamespace}`;
+
+    // DockerHub registry integration is per repo
+    if (this.state.selectedRegistry.service === "dockerhub") {
+      imageRepoUri = this.state.selectedRegistry.url;
+    }
+
     api
     api
       .createGHAction(
       .createGHAction(
         "<token>",
         "<token>",
@@ -98,7 +105,7 @@ class LaunchTemplate extends Component<PropsType, StateType> {
           registry_id: this.state.selectedRegistry.id,
           registry_id: this.state.selectedRegistry.id,
           dockerfile_path: this.state.dockerfilePath,
           dockerfile_path: this.state.dockerfilePath,
           folder_path: this.state.folderPath,
           folder_path: this.state.folderPath,
-          image_repo_uri: `${this.state.selectedRegistry.url}/${chartName}-${chartNamespace}`,
+          image_repo_uri: imageRepoUri,
           git_repo_id: actionConfig.git_repo_id,
           git_repo_id: actionConfig.git_repo_id,
           env: this.state.env,
           env: this.state.env,
         },
         },
@@ -853,7 +860,7 @@ const Warning = styled.span<{ highlight: boolean; makeFlush?: boolean }>`
 const Required = styled.div`
 const Required = styled.div`
   margin-left: 8px;
   margin-left: 8px;
   color: #fc4976;
   color: #fc4976;
-  dislay: inline-block;
+  display: inline-block;
 `;
 `;
 
 
 const Link = styled.a`
 const Link = styled.a`

+ 1 - 1
dashboard/src/shared/common.tsx

@@ -17,7 +17,7 @@ export const integrationList: any = {
   kubernetes: {
   kubernetes: {
     icon:
     icon:
       "https://uxwing.com/wp-content/themes/uxwing/download/10-brands-and-social-media/kubernetes.png",
       "https://uxwing.com/wp-content/themes/uxwing/download/10-brands-and-social-media/kubernetes.png",
-    label: "Kubernetes",
+    label: "Kubernetes Cluster",
     buttonText: "Add a Cluster"
     buttonText: "Add a Cluster"
   },
   },
   repo: {
   repo: {

+ 9 - 11
server/api/git_action_handler.go

@@ -92,20 +92,18 @@ func (app *App) createGitActionFromForm(
 			return nil
 			return nil
 		}
 		}
 
 
-		if reg.InfraID != 0 {
-			_reg := registry.Registry(*reg)
-			regAPI := &_reg
+		_reg := registry.Registry(*reg)
+		regAPI := &_reg
 
 
-			// parse the name from the registry
-			nameSpl := strings.Split(form.ImageRepoURI, "/")
-			repoName := nameSpl[len(nameSpl)-1]
+		// parse the name from the registry
+		nameSpl := strings.Split(form.ImageRepoURI, "/")
+		repoName := nameSpl[len(nameSpl)-1]
 
 
-			err := regAPI.CreateRepository(*app.Repo, repoName)
+		err = regAPI.CreateRepository(*app.Repo, repoName)
 
 
-			if err != nil {
-				app.handleErrorInternal(err, w)
-				return nil
-			}
+		if err != nil {
+			app.handleErrorInternal(err, w)
+			return nil
 		}
 		}
 	}
 	}