فهرست منبع

Allow user to change source settings if image is not a porter template

jnfrati 4 سال پیش
والد
کامیت
867a4d249a
1فایلهای تغییر یافته به همراه5 افزوده شده و 12 حذف شده
  1. 5 12
      dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

+ 5 - 12
dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

@@ -18,6 +18,7 @@ import NotificationSettingsSection from "./NotificationSettingsSection";
 import { Link } from "react-router-dom";
 import { Link } from "react-router-dom";
 import { isDeployedFromGithub } from "shared/release/utils";
 import { isDeployedFromGithub } from "shared/release/utils";
 import TagSelector from "./TagSelector";
 import TagSelector from "./TagSelector";
+import { PORTER_IMAGE_TEMPLATES } from "shared/common";
 
 
 type PropsType = {
 type PropsType = {
   currentChart: ChartType;
   currentChart: ChartType;
@@ -45,13 +46,6 @@ const SettingsSection: React.FC<PropsType> = ({
   ] = useState<string>("");
   ] = useState<string>("");
   const [loadingWebhookToken, setLoadingWebhookToken] = useState<boolean>(true);
   const [loadingWebhookToken, setLoadingWebhookToken] = useState<boolean>(true);
 
 
-  const [action, setAction] = useState<ActionConfigType>({
-    git_repo: "",
-    image_repo_uri: "",
-    git_repo_id: 0,
-    git_branch: "",
-  });
-
   const { currentCluster, currentProject, setCurrentError } = useContext(
   const { currentCluster, currentProject, setCurrentError } = useContext(
     Context
     Context
   );
   );
@@ -81,7 +75,6 @@ const SettingsSection: React.FC<PropsType> = ({
           return;
           return;
         }
         }
 
 
-        setAction(res.data.git_action_config);
         setWebhookToken(res.data.webhook_token);
         setWebhookToken(res.data.webhook_token);
       })
       })
       .catch(console.log)
       .catch(console.log)
@@ -162,7 +155,6 @@ const SettingsSection: React.FC<PropsType> = ({
       );
       );
       setCreateWebhookButtonStatus("successful");
       setCreateWebhookButtonStatus("successful");
       setTimeout(() => {
       setTimeout(() => {
-        setAction(res.data.git_action_config);
         setWebhookToken(res.data.webhook_token);
         setWebhookToken(res.data.webhook_token);
       }, 500);
       }, 500);
     } catch (err) {
     } catch (err) {
@@ -214,10 +206,11 @@ const SettingsSection: React.FC<PropsType> = ({
     if (!isAuthorizedToCreateWebhook) {
     if (!isAuthorizedToCreateWebhook) {
       buttonStatus = "Unauthorized to create webhook token";
       buttonStatus = "Unauthorized to create webhook token";
     }
     }
-
+    console.log(PORTER_IMAGE_TEMPLATES.includes(selectedImageUrl));
     return (
     return (
       <>
       <>
-        {!currentChart.is_stack ? (
+        {!currentChart.is_stack &&
+        !PORTER_IMAGE_TEMPLATES.includes(selectedImageUrl) ? (
           <>
           <>
             <Heading>Source Settings</Heading>
             <Heading>Source Settings</Heading>
             <Helper>Specify an image tag to use.</Helper>
             <Helper>Specify an image tag to use.</Helper>
@@ -227,7 +220,7 @@ const SettingsSection: React.FC<PropsType> = ({
               setSelectedImageUrl={(x: string) => setSelectedImageUrl(x)}
               setSelectedImageUrl={(x: string) => setSelectedImageUrl(x)}
               setSelectedTag={(x: string) => setSelectedTag(x)}
               setSelectedTag={(x: string) => setSelectedTag(x)}
               forceExpanded={true}
               forceExpanded={true}
-              disableImageSelect={isDeployedFromGithub(currentChart)}
+              disableImageSelect={false}
             />
             />
             {!loadingWebhookToken && (
             {!loadingWebhookToken && (
               <>
               <>