فهرست منبع

fix frontend issues

Alexander Belanger 4 سال پیش
والد
کامیت
f7e4600067

+ 0 - 4
dashboard/src/main/home/cluster-dashboard/ClusterDashboard.tsx

@@ -5,11 +5,7 @@ import monoweb from "assets/monoweb.png";
 import { Route, Switch } from "react-router-dom";
 
 import { Context } from "shared/Context";
-<<<<<<< HEAD
-import { ChartType, ClusterType } from "shared/types";
-=======
 import { ChartType, ClusterType, JobStatusType } from "shared/types";
->>>>>>> master
 import {
   getQueryParam,
   PorterUrl,

+ 0 - 56
dashboard/src/main/home/cluster-dashboard/chart/Chart.tsx

@@ -67,62 +67,6 @@ const Chart: React.FunctionComponent<Props> = ({
     getControllerForChart(chart);
   }, [chart]);
 
-<<<<<<< HEAD
-  const setupWebsocket = (kind: string) => {
-    const { currentProject, currentCluster } = context;
-
-    const apiEndpoint = `/api/projects/${currentProject.id}/clusters/${currentCluster.id}/${kind}/status`;
-
-    const wsConfig = {
-      onmessage(evt: MessageEvent) {
-        const event = JSON.parse(evt.data);
-        let object = event.Object;
-        object.metadata.kind = event.Kind;
-        if (event.event_type != "UPDATE") {
-          return;
-        }
-        getJobStatus();
-      },
-      onerror() {
-        closeWebsocket(kind);
-      },
-    };
-
-    newWebsocket(kind, apiEndpoint, wsConfig);
-    openWebsocket(kind);
-  };
-
-  const getJobStatus = () => {
-    let { currentCluster, currentProject, setCurrentError } = context;
-
-    api
-      .getJobStatus(
-        "<token>",
-        {
-        },
-        {
-          id: currentProject.id,
-          release_name: chart.name,
-          cluster_id: currentCluster.id,
-          namespace: chart.namespace,
-        }
-      )
-      .then((res) => {
-        setJobStatus(res.data);
-      })
-      .catch((err) => setCurrentError(err));
-  };
-
-  useEffect(() => {
-    if (isJob) {
-      getJobStatus();
-      setupWebsocket("job");
-    }
-    return () => closeAllWebsockets();
-  }, [isJob]);
-
-=======
->>>>>>> master
   const readableDate = (s: string) => {
     const ts = new Date(s);
     const date = ts.toLocaleDateString();

+ 4 - 8
dashboard/src/main/home/cluster-dashboard/chart/ChartList.tsx

@@ -94,19 +94,15 @@ const ChartList: React.FunctionComponent<Props> = ({
     }
   };
 
-<<<<<<< HEAD
-  const setupHelmReleasesWebsocket = () => {
-    const apiPath = `/api/projects/${context.currentProject.id}/clusters/${context.currentCluster.id}/helm_release`;
-=======
   const setupHelmReleasesWebsocket = (
     websocketID: string,
     namespace: string
   ) => {
-    let apiPath = `/api/projects/${context.currentProject.id}/k8s/helm_releases?cluster_id=${context.currentCluster.id}`;
+    let apiPath = `/api/projects/${context.currentProject.id}/clusters/${context.currentCluster.id}/helm_release`;
+
     if (namespace) {
-      apiPath += `&namespace=${namespace}`;
+      apiPath += `?namespace=${namespace}`;
     }
->>>>>>> master
 
     const wsConfig = {
       onopen: () => {
@@ -193,7 +189,7 @@ const ChartList: React.FunctionComponent<Props> = ({
   const setupJobWebsocket = (websocketID: string) => {
     const kind = "job";
     let { currentCluster, currentProject } = context;
-    const apiPath = `/api/projects/${currentProject.id}/k8s/${kind}/status?cluster_id=${currentCluster.id}`;
+    const apiPath = `/api/projects/${currentProject.id}/clusters/${currentCluster.id}/${kind}/status`;
 
     const wsConfig = {
       onopen: () => {

+ 1 - 35
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChartWrapper.tsx

@@ -41,44 +41,10 @@ class ExpandedChartWrapper extends Component<PropsType, StateType> {
           "<token>",
           {
           },
-<<<<<<< HEAD
-          { id: currentProject.id, namespace: namespace, cluster_id: currentCluster.id ,name: chartName }
-        )
-        .then((res) => {
-          res.data.sort((a: ChartType, b: ChartType) => {
-            return -(a.version - b.version);
-          });
-          let maxVersion = res.data[0].version;
-          api
-            .getChart(
-              "<token>",
-              {
-              },
-              {
-                name: chartName,
-                revision: maxVersion,
-                namespace: namespace,
-                cluster_id: currentCluster.id,
-                id: currentProject.id,
-              }
-            )
-            .then((res) => {
-              this.setState({ currentChart: res.data, loading: false });
-            })
-            .catch((err) => {
-              console.log("err", err.response.data);
-              this.setState({ loading: false });
-            });
-=======
-          {
-            name: chartName,
-            revision: Number(lastCheckedRevision),
-            id: currentProject.id,
-          }
+          { id: currentProject.id, namespace: namespace, cluster_id: currentCluster.id ,name: chartName, revision: Number(lastCheckedRevision), }
         )
         .then((res) => {
           this.setState({ currentChart: res.data, loading: false });
->>>>>>> master
         })
         .catch((err) => {
           console.log("err", err.response.data);

+ 1 - 12
dashboard/src/main/home/provisioner/DOFormSection.tsx

@@ -150,19 +150,8 @@ const DOFormSectionFC: React.FC<PropsType> = (props) => {
       .catch(catchError);
   };
 
-<<<<<<< HEAD
-  doRedirect = (projectId: number) => {
-    let {
-      subscriptionTier,
-      doRegion,
-      selectedInfras,
-      clusterName,
-    } = this.state;
-    let redirectUrl = `/api/projects/${projectId}/oauth/digitalocean?project_id=${projectId}&provision=do`;
-=======
   const doRedirect = (projectId: number) => {
-    let redirectUrl = `/api/oauth/projects/${projectId}/digitalocean?project_id=${projectId}&provision=do`;
->>>>>>> master
+    let redirectUrl = `/api/projects/${projectId}/oauth/digitalocean?project_id=${projectId}&provision=do`;
     redirectUrl += `&tier=${subscriptionTier}&region=${doRegion}&cluster_name=${clusterName}`;
     selectedInfras.forEach((option: { value: string; label: string }) => {
       redirectUrl += `&infras=${option.value}`;

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

@@ -685,9 +685,9 @@ const getReleaseToken = baseApi<
 >("GET", (pathParams) => {
   let { id, cluster_id, namespace, name } = pathParams;
 
-<<<<<<< HEAD
   return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/webhook`;
-=======
+});
+
 const getReleaseSteps = baseApi<
   {
     namespace: string;
@@ -698,19 +698,6 @@ const getReleaseSteps = baseApi<
   return `/api/projects/${pathParams.id}/releases/${pathParams.name}/steps`;
 });
 
-const destroyEKS = baseApi<
-  {
-    eks_name: string;
-  },
-  {
-    project_id: number;
-    infra_id: number;
-  }
->("POST", (pathParams) => {
-  return `/api/projects/${pathParams.project_id}/infra/${pathParams.infra_id}/eks/destroy`;
->>>>>>> master
-});
-
 const destroyInfra = baseApi<
 {
   name: string;
@@ -1096,12 +1083,8 @@ export default {
   detectBuildpack,
   getBranchContents,
   getBranches,
-<<<<<<< HEAD
   getMetadata,
-=======
-  getCapabilities,
   getWelcome,
->>>>>>> master
   getChart,
   getCharts,
   getChartComponents,