Преглед на файлове

Merge branch 'master' of github.com:porter-dev/porter into nico/por-391-tag-grouping-for-applications-and-jobs

jnfrati преди 4 години
родител
ревизия
b0b8c7b56d
променени са 2 файла, в които са добавени 47 реда и са изтрити 37 реда
  1. 40 37
      dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx
  2. 7 0
      dashboard/src/shared/release/utils.ts

+ 40 - 37
dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

@@ -19,6 +19,7 @@ import { Link } from "react-router-dom";
 import Autocomplete from "components/Autocomplete";
 // import { Autocomplete, AutocompleteGetTagProps } from "@material-ui/lab";
 // import TextField from "@material-ui/core/TextField";
+import { isDeployedFromGithub } from "shared/release/utils";
 
 type PropsType = {
   currentChart: ChartType;
@@ -229,43 +230,45 @@ const SettingsSection: React.FC<PropsType> = ({
 
     return (
       <>
-        <>
-          <Heading>Application tags</Heading>
-          <Autocomplete
-            defaultValue={
-              currentChart.tags?.map((tagName: string) => ({
-                name: tagName,
-              })) || []
-            }
-            onChange={(value) => setSelectedTags(value)}
-            options={fullTagList}
-          />
-          <Heading>Source Settings</Heading>
-          <Helper>Specify an image tag to use.</Helper>
-          <ImageSelector
-            selectedTag={selectedTag}
-            selectedImageUrl={selectedImageUrl}
-            setSelectedImageUrl={(x: string) => setSelectedImageUrl(x)}
-            setSelectedTag={(x: string) => setSelectedTag(x)}
-            forceExpanded={true}
-            disableImageSelect={true}
-          />
-          {!loadingWebhookToken && (
-            <>
-              <Br />
-              <Br />
-              <Br />
-              <SaveButton
-                clearPosition={true}
-                statusPosition="right"
-                text="Save Source Settings"
-                status={saveValuesStatus}
-                onClick={handleSubmit}
-              />
-            </>
-          )}
-          <Br />
-        </>
+        <Heading>Application tags</Heading>
+        <Autocomplete
+          defaultValue={
+            currentChart.tags?.map((tagName: string) => ({
+              name: tagName,
+            })) || []
+          }
+          onChange={(value) => setSelectedTags(value)}
+          options={fullTagList}
+        />
+        {!isDeployedFromGithub(currentChart) ? (
+          <>
+            <Heading>Source Settings</Heading>
+            <Helper>Specify an image tag to use.</Helper>
+            <ImageSelector
+              selectedTag={selectedTag}
+              selectedImageUrl={selectedImageUrl}
+              setSelectedImageUrl={(x: string) => setSelectedImageUrl(x)}
+              setSelectedTag={(x: string) => setSelectedTag(x)}
+              forceExpanded={true}
+              disableImageSelect={true}
+            />
+            {!loadingWebhookToken && (
+              <>
+                <Br />
+                <Br />
+                <Br />
+                <SaveButton
+                  clearPosition={true}
+                  statusPosition="right"
+                  text="Save Source Settings"
+                  status={saveValuesStatus}
+                  onClick={handleSubmit}
+                />
+              </>
+            )}
+            <Br />
+          </>
+        ) : null}
 
         <>
           <Heading>Redeploy Webhook</Heading>

+ 7 - 0
dashboard/src/shared/release/utils.ts

@@ -0,0 +1,7 @@
+import { ChartTypeWithExtendedConfig } from "shared/types";
+
+export const isDeployedFromGithub = (release: ChartTypeWithExtendedConfig) => {
+  const githubRepository = release?.git_action_config?.git_repo;
+
+  return !!githubRepository?.length;
+};