Quellcode durchsuchen

fix app updates when there is a built image (#3191)

Feroze Mohideen vor 2 Jahren
Ursprung
Commit
b78922133b

+ 1 - 1
dashboard/src/main/home/app-dashboard/build-settings/buildpacks/AddCustomBuildpackComponent.tsx

@@ -1,7 +1,7 @@
 import InputRow from "components/form-components/InputRow";
 import React, { useState } from "react";
 import styled, { keyframes } from "styled-components";
-import { Buildpack } from "./BuildpackSettings";
+import { Buildpack } from "../../types/buildpack";
 
 function isValidURL(url: string): boolean {
   const pattern = /^(https?:\/\/)?([\w.-]+)\.([a-z]{2,})(:\d{2,5})?([\/\w.-]*)*\/?$/i;

+ 1 - 1
dashboard/src/main/home/app-dashboard/build-settings/buildpacks/BuildpackCard.tsx

@@ -1,8 +1,8 @@
 import React from "react";
-import { Buildpack } from "./BuildpackSettings";
 import { DeviconsNameList } from "assets/devicons-name-list";
 import styled, { keyframes } from "styled-components";
 import { Draggable } from "react-beautiful-dnd";
+import { Buildpack } from "../../types/buildpack";
 
 interface Props {
   buildpack: Buildpack;

+ 1 - 1
dashboard/src/main/home/app-dashboard/build-settings/buildpacks/BuildpackList.tsx

@@ -1,12 +1,12 @@
 import React from "react";
 import { PorterApp } from "../../types/porterApp";
-import { Buildpack } from "./BuildpackSettings";
 import BuildpackCard from "./BuildpackCard";
 import Spacer from "components/porter/Spacer";
 import Text from "components/porter/Text";
 import Loading from "components/Loading";
 import Error from "components/porter/Error";
 import { Droppable, DragDropContext } from "react-beautiful-dnd";
+import { Buildpack } from "../../types/buildpack";
 
 interface Props {
     porterApp: PorterApp,

+ 8 - 37
dashboard/src/main/home/app-dashboard/build-settings/buildpacks/BuildpackSettings.tsx

@@ -1,4 +1,3 @@
-import { DeviconsNameList } from "assets/devicons-name-list";
 import Helper from "components/form-components/Helper";
 import Select from "components/porter/Select";
 import Loading from "components/Loading";
@@ -16,42 +15,14 @@ import AddCustomBuildpackComponent from "./AddCustomBuildpackComponent";
 import BuildpackList from "./BuildpackList";
 import Icon from "components/porter/Icon";
 import stars from "assets/stars-white.svg";
-
-const DEFAULT_BUILDER_NAME = "heroku";
-const DEFAULT_PAKETO_STACK = "paketobuildpacks/builder:full";
-const DEFAULT_HEROKU_STACK = "heroku/buildpacks:20";
-
-type BuildConfig = {
-  builder: string;
-  buildpacks: string[];
-  config: null | {
-    [key: string]: string;
-  };
-};
-
-export type Buildpack = {
-  name: string;
-  buildpack: string;
-  config: {
-    [key: string]: string;
-  };
-};
-
-type DetectedBuildpack = {
-  name: string;
-  builders: string[];
-  detected: Buildpack[];
-  others: Buildpack[];
-  buildConfig: BuildConfig;
-};
-
-const BUILDPACK_TO_NAME: { [key: string]: string } = {
-  "heroku/nodejs": "NodeJS",
-  "heroku/python": "Python",
-  "heroku/java": "Java",
-  "heroku/ruby": "Ruby",
-  "heroku/go": "Go",
-};
+import {
+  BUILDPACK_TO_NAME,
+  BuildConfig,
+  Buildpack,
+  DEFAULT_BUILDER_NAME,
+  DEFAULT_HEROKU_STACK,
+  DetectedBuildpack
+} from "../../types/buildpack";
 
 const BuildpackSettings: React.FC<{
   porterApp: PorterApp;

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

@@ -301,8 +301,8 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
             repo_name: tempPorterApp.repo_name,
             git_branch: tempPorterApp.git_branch,
             build_context: tempPorterApp.build_context,
-            builder: !_.isEmpty(tempPorterApp.dockerfile) ? "null" : tempPorterApp.builder,
-            buildpacks: !_.isEmpty(tempPorterApp.dockerfile) ? "null" : tempPorterApp.buildpacks.join(","),
+            builder: !_.isEmpty(tempPorterApp.dockerfile) || !_.isEmpty(tempPorterApp.image_repo_uri) ? "null" : tempPorterApp.builder,
+            buildpacks: !_.isEmpty(tempPorterApp.dockerfile) || !_.isEmpty(tempPorterApp.image_repo_uri) ? "null" : tempPorterApp.buildpacks.join(","),
             dockerfile: tempPorterApp.dockerfile,
             ...options,
             override_release: true,
@@ -407,7 +407,7 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
         }
       }
     } catch (error) {
-      console.log(error);
+      // console.log(error);
     }
   };
 

+ 32 - 0
dashboard/src/main/home/app-dashboard/types/buildpack.ts

@@ -0,0 +1,32 @@
+export type BuildConfig = {
+    builder: string;
+    buildpacks: string[];
+    config: null | {
+        [key: string]: string;
+    };
+};
+export type Buildpack = {
+    name: string;
+    buildpack: string;
+    config: {
+        [key: string]: string;
+    };
+};
+export type DetectedBuildpack = {
+    name: string;
+    builders: string[];
+    detected: Buildpack[];
+    others: Buildpack[];
+    buildConfig: BuildConfig;
+};
+export const DEFAULT_BUILDER_NAME = "heroku";
+export const DEFAULT_PAKETO_STACK = "paketobuildpacks/builder:full";
+export const DEFAULT_HEROKU_STACK = "heroku/buildpacks:20";
+
+export const BUILDPACK_TO_NAME: { [key: string]: string } = {
+    "heroku/nodejs": "NodeJS",
+    "heroku/python": "Python",
+    "heroku/java": "Java",
+    "heroku/ruby": "Ruby",
+    "heroku/go": "Go",
+};