Просмотр исходного кода

purged console logs from expandedjobchart

jusrhee 5 лет назад
Родитель
Сommit
4b75df2698

+ 7 - 11
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedJobChart.tsx

@@ -180,11 +180,9 @@ export default class ExpandedJobChart extends Component<PropsType, StateType> {
 
     if (!config) {
       let values = {};
-
-      console.log("newest image", this.state.newestImage);
       let imageUrl = this.state.newestImage;
       let tag = null;
-  
+
       if (imageUrl.includes(":")) {
         let splits = imageUrl.split(":");
         imageUrl = splits[0];
@@ -198,8 +196,6 @@ export default class ExpandedJobChart extends Component<PropsType, StateType> {
         _.set(values, "image.tag", tag);
       }
 
-      console.log("values before yaml", values)
-
       conf = yaml.dump({
         ...this.state.currentChart.config,
         ...values,
@@ -212,10 +208,9 @@ export default class ExpandedJobChart extends Component<PropsType, StateType> {
         _.set(values, key, config[key]);
       }
 
-      console.log("newest image", this.state.newestImage);
       let imageUrl = this.state.newestImage;
       let tag = null;
-  
+
       if (imageUrl.includes(":")) {
         let splits = imageUrl.split(":");
         imageUrl = splits[0];
@@ -229,14 +224,11 @@ export default class ExpandedJobChart extends Component<PropsType, StateType> {
         _.set(values, "image.tag", tag);
       }
 
-      console.log("values before yaml", values)
-
       // Weave in preexisting values and convert to yaml
       conf = yaml.dump({
         ...(this.state.currentChart.config as Object),
         ...values,
       });
-      console.log("yaml converted", values)
     }
 
     api
@@ -295,7 +287,11 @@ export default class ExpandedJobChart extends Component<PropsType, StateType> {
       return date2.getTime() - date1.getTime();
     });
     let newestImage = jobs[0]?.spec?.template?.spec?.containers[0]?.image;
-    if (newestImage && newestImage !== "porterdev/hello-porter-job" && newestImage !== "porterdev/hello-porter-job:latest") {
+    if (
+      newestImage &&
+      newestImage !== "porterdev/hello-porter-job" &&
+      newestImage !== "porterdev/hello-porter-job:latest"
+    ) {
       this.setState({ jobs, newestImage, imageIsPlaceholder: false });
     } else {
       this.setState({ jobs });

+ 16 - 12
dashboard/src/main/home/cluster-dashboard/expanded-chart/jobs/JobResource.tsx

@@ -30,21 +30,22 @@ export default class JobResource extends Component<PropsType, StateType> {
     if (event) {
       event.stopPropagation();
     }
-    
+
     this.getPods(() => {
       this.setState({ expanded: !this.state.expanded });
     });
   };
-  
+
   stopJob = (event: MouseEvent) => {
     if (event) {
       event.stopPropagation();
     }
-    
+
     let { currentCluster, currentProject, setCurrentError } = this.context;
 
-    api.stopJob(
-      "<token>",
+    api
+      .stopJob(
+        "<token>",
         {},
         {
           id: currentProject.id,
@@ -52,9 +53,10 @@ export default class JobResource extends Component<PropsType, StateType> {
           namespace: this.props.job.metadata?.namespace,
           cluster_id: currentCluster.id,
         }
-    ).then((res) => {})
+      )
+      .then((res) => {})
       .catch((err) => setCurrentError(JSON.stringify(err)));
-  }
+  };
 
   getPods = (callback: () => void) => {
     let { currentCluster, currentProject, setCurrentError } = this.context;
@@ -224,14 +226,16 @@ export default class JobResource extends Component<PropsType, StateType> {
 
   renderStopButton = () => {
     if (!this.props.job.status?.succeeded && !this.props.job.status?.failed) {
-      // look for a sidecar container 
+      // look for a sidecar container
       if (this.props.job?.spec?.template?.spec?.containers.length == 2) {
-        return <i className="material-icons" onClick={this.stopJob}>
-          stop
-        </i>
+        return (
+          <i className="material-icons" onClick={this.stopJob}>
+            stop
+          </i>
+        );
       }
     }
-  }
+  };
 
   render() {
     let icon =

+ 2 - 3
dashboard/src/shared/api.tsx

@@ -791,13 +791,12 @@ const deleteConfigMap = baseApi<
 
 const stopJob = baseApi<
   {},
-  { name: string; namespace: string; id: number, cluster_id: number }
+  { name: string; namespace: string; id: number; cluster_id: number }
 >("POST", (pathParams) => {
-  let { id, name, namespace, cluster_id } = pathParams
+  let { id, name, namespace, cluster_id } = pathParams;
   return `/api/projects/${id}/k8s/jobs/${namespace}/${name}/stop?cluster_id=${cluster_id}`;
 });
 
-
 // Bundle export to allow default api import (api.<method> is more readable)
 export default {
   checkAuth,