sunguroku 5 лет назад
Родитель
Сommit
03e5693977

+ 34 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

@@ -153,6 +153,40 @@ export default class SettingsSection extends Component<PropsType, StateType> {
       return;
     }
 
+    if (this.state.action.git_repo.length > 0) {
+      return (
+        <>
+          <Heading>Connected Source</Heading>
+          <Holder>
+            <InputRow
+              disabled={true}
+              label="Git Repository"
+              type="text"
+              width="100%"
+              value={this.state.action.git_repo}
+              setValue={(x: string) => console.log(x)}
+            />
+            <InputRow
+              disabled={true}
+              label="Dockerfile Path"
+              type="text"
+              width="100%"
+              value={this.state.action.dockerfile_path}
+              setValue={(x: string) => console.log(x)}
+            />
+            <InputRow
+              disabled={true}
+              label="Docker Image Repository"
+              type="text"
+              width="100%"
+              value={this.state.action.image_repo_uri}
+              setValue={(x: string) => console.log(x)}
+            />
+          </Holder>
+        </>
+      );
+    }
+
     return (
       <>
         <Heading>Connected Source</Heading>

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

@@ -5,6 +5,7 @@ import posthog from "posthog-js";
 import _ from "lodash";
 import { Context } from "shared/Context";
 import api from "shared/api";
+import { RouteComponentProps, withRouter } from "react-router";
 
 import {
   ActionConfigType,
@@ -22,7 +23,8 @@ import ValuesWrapper from "components/values-form/ValuesWrapper";
 import ValuesForm from "components/values-form/ValuesForm";
 import { isAlphanumeric } from "shared/common";
 
-type PropsType = {
+
+type PropsType = RouteComponentProps & {
   currentTemplate: any;
   hideLaunch: () => void;
   values: any;
@@ -57,7 +59,7 @@ const defaultActionConfig: ActionConfigType = {
   dockerfile_path: "",
 };
 
-export default class LaunchTemplate extends Component<PropsType, StateType> {
+class LaunchTemplate extends Component<PropsType, StateType> {
   state = {
     currentView: "repo",
     clusterOptions: [] as { label: string; value: string }[],
@@ -133,10 +135,12 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
         if (this.state.sourceType === "repo") {
           this.createGHAction(name, this.state.selectedNamespace);
         }
-        // this.props.setCurrentView('cluster-dashboard');
+
         this.setState({ saveValuesStatus: "successful" }, () => {
           // redirect to dashboard
+          setTimeout(() => { this.props.history.push("cluster-dashboard")}, 1000);
         });
+
         posthog.capture("Deployed template", {
           name: this.props.currentTemplate.name,
           namespace: this.state.selectedNamespace,
@@ -241,6 +245,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
         // this.props.setCurrentView('cluster-dashboard');
         this.setState({ saveValuesStatus: "successful" }, () => {
           // redirect to dashboard with namespace
+          setTimeout(() => { this.props.history.push("cluster-dashboard")}, 1000);
         });
         try {
           posthog.capture("Deployed template", {
@@ -590,6 +595,8 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
 
 LaunchTemplate.contextType = Context;
 
+export default withRouter(LaunchTemplate);
+
 const Title = styled.div`
   font-size: 24px;
   font-weight: 600;