Просмотр исходного кода

pass in image_repo_uri for non-custom/DH registry

jusrhee 5 лет назад
Родитель
Сommit
34bcc9c830

+ 4 - 4
dashboard/src/components/repo-selector/ActionConfEditor.tsx

@@ -19,8 +19,8 @@ type PropsType = {
   setDockerfilePath: (x: string) => void;
   setDockerfilePath: (x: string) => void;
   folderPath: string;
   folderPath: string;
   setFolderPath: (x: string) => void;
   setFolderPath: (x: string) => void;
-  setSelectedRegistryId: (x: number) => void;
-  selectedRegistryId: number;
+  setSelectedRegistry: (x: any) => void;
+  selectedRegistry: any;
 };
 };
 
 
 type StateType = {
 type StateType = {
@@ -102,8 +102,8 @@ export default class ActionConfEditor extends Component<PropsType, StateType> {
         setActionConfig={setActionConfig}
         setActionConfig={setActionConfig}
         dockerfilePath={this.props.dockerfilePath}
         dockerfilePath={this.props.dockerfilePath}
         folderPath={this.props.folderPath}
         folderPath={this.props.folderPath}
-        setSelectedRegistryId={this.props.setSelectedRegistryId}
-        selectedRegistryId={this.props.selectedRegistryId}
+        setSelectedRegistry={this.props.setSelectedRegistry}
+        selectedRegistry={this.props.selectedRegistry}
       />
       />
     );
     );
   };
   };

+ 6 - 6
dashboard/src/components/repo-selector/ActionDetails.tsx

@@ -15,8 +15,8 @@ type PropsType = {
   branch: string;
   branch: string;
   dockerfilePath: string;
   dockerfilePath: string;
   folderPath: string;
   folderPath: string;
-  setSelectedRegistryId: (x: number) => void;
-  selectedRegistryId: number;
+  setSelectedRegistry: (x: any) => void;
+  selectedRegistry: any;
   setDockerfilePath: (x: string) => void;
   setDockerfilePath: (x: string) => void;
   setFolderPath: (x: string) => void;
   setFolderPath: (x: string) => void;
 };
 };
@@ -52,7 +52,7 @@ export default class ActionDetails extends Component<PropsType, StateType> {
       .then((res: any) => {
       .then((res: any) => {
         this.setState({ registries: res.data, loading: false });
         this.setState({ registries: res.data, loading: false });
         if (res.data.length === 1) {
         if (res.data.length === 1) {
-          this.props.setSelectedRegistryId(res.data[0].id);
+          this.props.setSelectedRegistry(res.data[0]);
         }
         }
       })
       })
       .catch((err: any) => console.log(err));
       .catch((err: any) => console.log(err));
@@ -78,9 +78,9 @@ export default class ActionDetails extends Component<PropsType, StateType> {
       return (
       return (
         <RegistryItem
         <RegistryItem
           key={i}
           key={i}
-          isSelected={registry.id === this.props.selectedRegistryId}
+          isSelected={registry.id === this.props.selectedRegistry.id}
           lastItem={i === registries.length - 1}
           lastItem={i === registries.length - 1}
-          onClick={() => this.props.setSelectedRegistryId(registry.id)}
+          onClick={() => this.props.setSelectedRegistry(registry)}
         >
         >
           <img src={icon && icon} />
           <img src={icon && icon} />
           {registry.url}
           {registry.url}
@@ -145,7 +145,7 @@ export default class ActionDetails extends Component<PropsType, StateType> {
             <i className="material-icons">keyboard_backspace</i>
             <i className="material-icons">keyboard_backspace</i>
             Select Folder
             Select Folder
           </BackButton>
           </BackButton>
-          {this.props.selectedRegistryId ? (
+          {this.props.selectedRegistry ? (
             <StatusWrapper successful={true}>
             <StatusWrapper successful={true}>
               <i className="material-icons">done</i> Source selected.
               <i className="material-icons">done</i> Source selected.
             </StatusWrapper>
             </StatusWrapper>

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

@@ -53,7 +53,7 @@ type StateType = {
   repoType: string;
   repoType: string;
   dockerfilePath: string | null;
   dockerfilePath: string | null;
   folderPath: string | null;
   folderPath: string | null;
-  selectedRegistryId: number | null;
+  selectedRegistry: any | null;
 };
 };
 
 
 const defaultActionConfig: ActionConfigType = {
 const defaultActionConfig: ActionConfigType = {
@@ -83,7 +83,7 @@ class LaunchTemplate extends Component<PropsType, StateType> {
     repoType: "",
     repoType: "",
     dockerfilePath: null as string | null,
     dockerfilePath: null as string | null,
     folderPath: null as string | null,
     folderPath: null as string | null,
-    selectedRegistryId: null as number | null,
+    selectedRegistry: null as any | null,
   };
   };
 
 
   createGHAction = (chartName: string, chartNamespace: string) => {
   createGHAction = (chartName: string, chartNamespace: string) => {
@@ -94,9 +94,10 @@ class LaunchTemplate extends Component<PropsType, StateType> {
         "<token>",
         "<token>",
         {
         {
           git_repo: actionConfig.git_repo,
           git_repo: actionConfig.git_repo,
-          registry_id: this.state.selectedRegistryId,
+          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}`,
           git_repo_id: actionConfig.git_repo_id,
           git_repo_id: actionConfig.git_repo_id,
         },
         },
         {
         {
@@ -301,7 +302,7 @@ class LaunchTemplate extends Component<PropsType, StateType> {
 
 
       // Allow if source type is repo and dockerfile or folder path is set
       // Allow if source type is repo and dockerfile or folder path is set
       if (sourceType === "repo" && (dockerfilePath || folderPath)) {
       if (sourceType === "repo" && (dockerfilePath || folderPath)) {
-        return !this.state.selectedRegistryId;
+        return !this.state.selectedRegistry;
       }
       }
 
 
       return true;
       return true;
@@ -312,7 +313,7 @@ class LaunchTemplate extends Component<PropsType, StateType> {
 
 
   getStatus = () => {
   getStatus = () => {
     let {
     let {
-      selectedRegistryId,
+      selectedRegistry,
       sourceType,
       sourceType,
       dockerfilePath,
       dockerfilePath,
       folderPath,
       folderPath,
@@ -322,7 +323,7 @@ class LaunchTemplate extends Component<PropsType, StateType> {
       if (
       if (
         sourceType === "repo" &&
         sourceType === "repo" &&
         (dockerfilePath || folderPath) &&
         (dockerfilePath || folderPath) &&
-        !selectedRegistryId
+        !selectedRegistry
       ) {
       ) {
         return "A connected container registry is required";
         return "A connected container registry is required";
       }
       }
@@ -598,10 +599,10 @@ class LaunchTemplate extends Component<PropsType, StateType> {
                 folderPath: null,
                 folderPath: null,
               });
               });
             }}
             }}
-            setSelectedRegistryId={(x: number) => {
-              this.setState({ selectedRegistryId: x });
+            setSelectedRegistry={(x: any) => {
+              this.setState({ selectedRegistry: x });
             }}
             }}
-            selectedRegistryId={this.state.selectedRegistryId}
+            selectedRegistry={this.state.selectedRegistry}
           />
           />
           <br />
           <br />
         </StyledSourceBox>
         </StyledSourceBox>

+ 1 - 0
dashboard/src/shared/api.tsx

@@ -99,6 +99,7 @@ const createGHAction = baseApi<
   {
   {
     git_repo: string;
     git_repo: string;
     registry_id: number;
     registry_id: number;
+    image_repo_uri: string;
     dockerfile_path: string;
     dockerfile_path: string;
     folder_path: string;
     folder_path: string;
     git_repo_id: number;
     git_repo_id: number;