Explorar el Código

update stack query

Justin Rhee hace 3 años
padre
commit
56714c41a2

+ 27 - 0
api/server/handlers/stacks/update_porter_app.go

@@ -36,6 +36,8 @@ func (c *UpdatePorterAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
 
 	name, _ := requestutils.GetURLParamString(r, types.URLParamReleaseName)
 
+	fmt.Println("name is", name)
+
 	porterApp, err := c.Repo().PorterApp().ReadPorterAppByName(cluster.ID, name)
 	if err != nil {
 		c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
@@ -48,6 +50,31 @@ func (c *UpdatePorterAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
 		return
 	}
 
+	if request.Name != "" {
+		porterApp.Name = request.Name
+	}
+	if request.RepoName != "" {
+		porterApp.RepoName = request.RepoName
+	}
+	if request.GitBranch != "" {
+		porterApp.GitBranch = request.GitBranch
+	}
+	if request.BuildContext != "" {
+		porterApp.BuildContext = request.BuildContext
+	}
+	if request.Builder != "" {
+		porterApp.Builder = request.Builder
+	}
+	if request.Buildpacks != "" {
+		porterApp.Buildpacks = request.Buildpacks
+	}
+	if request.Dockerfile != "" {
+		porterApp.Dockerfile = request.Dockerfile
+	}
+	if request.ImageRepoURI != "" {
+		porterApp.ImageRepoURI = request.ImageRepoURI
+	}
+
 	updatedPorterApp, err := c.Repo().PorterApp().UpdatePorterApp(porterApp)
 	if err != nil {
 		return

+ 1 - 0
dashboard/src/main/home/app-dashboard/expanded-app/ExpandedApp.tsx

@@ -25,6 +25,7 @@ import { integrationList } from "shared/common";
 import { ChartType, ResourceType } from "shared/types";
 import RevisionSection from "main/home/cluster-dashboard/expanded-chart/RevisionSection";
 import BuildSettingsTabStack from "./BuildSettingsTabStack";
+import Button from "components/porter/Button";
 
 type Props = RouteComponentProps & {};
 

+ 8 - 8
dashboard/src/shared/api.tsx

@@ -209,14 +209,14 @@ const createPorterApp = baseApi<
 
 const updatePorterApp = baseApi<
   {
-    name: string;
-    repo_name: string;
-    git_branch: string;
-    build_context: string;
-    builder: string;
-    buildpacks: string;
-    dockerfile: string;
-    image_repo_uri: string;
+    name?: string;
+    repo_name?: string;
+    git_branch?: string;
+    build_context?: string;
+    builder?: string;
+    buildpacks?: string;
+    dockerfile?: string;
+    image_repo_uri?: string;
   },
   {
     project_id: number;