jusrhee 5 лет назад
Родитель
Сommit
180965af64

+ 0 - 1
dashboard/src/components/values-form/SelectRow.tsx

@@ -18,7 +18,6 @@ type StateType = {
 
 export default class SelectRow extends Component<PropsType, StateType> {
   render() {
-    console.log(this.props.width)
     return (
       <StyledSelectRow>
         <Label>{this.props.label}</Label>

+ 9 - 6
dashboard/src/main/home/Home.tsx

@@ -86,11 +86,9 @@ export default class Home extends Component<PropsType, StateType> {
           this.setState({ currentView: 'new-project', sidebarReady: true, });
         } else if (res.data.length > 0 && !currentProject) {
           setProjects(res.data);
-          if (!id) {
-            this.context.setCurrentProject(res.data[0]);
-            this.initializeView();
-          } else {
-            let foundProject = null;
+
+          let foundProject = null;
+          if (id) {
             res.data.forEach((project: ProjectType, i: number) => {
               if (project.id === id) {
                 foundProject = project;
@@ -99,6 +97,11 @@ export default class Home extends Component<PropsType, StateType> {
             this.context.setCurrentProject(foundProject);
             this.setState({ currentView: 'provisioner' });
           }
+
+          if (!foundProject) {
+            this.context.setCurrentProject(res.data[0]);
+            this.initializeView();
+          }
         }
       }
     });
@@ -186,7 +189,7 @@ export default class Home extends Component<PropsType, StateType> {
     let provision = urlParams.get('provision');
     let defaultProjectId = null;
     if (provision === 'do') {
-      defaultProjectId = parseInt(urlParams.get('projectId'));
+      defaultProjectId = parseInt(urlParams.get('project_id'));
       this.setState({ handleDO: true });
       this.checkDO();
     }

+ 0 - 82
dashboard/src/main/home/provisioner/ProvisionerContainer.tsx

@@ -1,82 +0,0 @@
-import React, { Component } from 'react';
-import styled from 'styled-components';
-
-import api from '../../../shared/api';
-import { Context } from '../../../shared/Context';
-import { ProjectType } from '../../../shared/types';
-
-import ProvisionerStatus from './ProvisionerStatus';
-
-type PropsType = {
-  setCurrentView: (x: string) => void,
-  handleDO: boolean,
-  setHandleDO: (x: boolean) => void,
-  currentProject: ProjectType,
-}
-
-type StateType = {
-};
-
-export default class ProvisionerContainer extends Component<PropsType, StateType> {
-  state = {
-  }
-
-  provisionDOCR = (integrationId: number, tier: string) => {
-    api.createDOCR('<token>', {
-      do_integration_id: integrationId,
-      docr_name: this.props.currentProject.name,
-      docr_subscription_tier: tier,
-    }, { 
-      project_id: this.props.currentProject.id
-    }, (err: any, res: any) => {
-      if (err) {
-        console.log(err);
-        return;
-      }
-      console.log(res.data);
-    });
-  }
-
-  checkDO = () => {
-    let { currentProject } = this.props;
-    if (this.props.handleDO && currentProject?.id) {
-      api.getOAuthIds('<token>', {}, { 
-        project_id: currentProject.id
-      }, (err: any, res: any) => {
-        if (err) {
-          console.log(err);
-          return;
-        }
-        let tgtIntegration = res.data.find((integration: any) => {
-          return integration.client === 'do'
-        });
-        let queryString = window.location.search;
-        let urlParams = new URLSearchParams(queryString);
-        let tier = urlParams.get('tier');
-        let region = urlParams.get('region');
-        let infras = urlParams.getAll('infras');
-        console.log(infras, 'oof');
-        // this.provisionDOCR(tgtIntegration.id, tier);
-      });
-      this.props.setHandleDO(false);
-    }
-  }
-
-  componentDidMount() {
-    this.checkDO();
-  }
-
-  componentDidUpdate(prevProps: PropsType) {
-    if (prevProps.currentProject?.id !== this.props.currentProject?.id) {
-      this.checkDO();
-    }
-  }
-
-  render() {
-    return (
-      <ProvisionerStatus setCurrentView={this.props.setCurrentView} />
-    );
-  }
-}
-
-ProvisionerStatus.contextType = Context;

+ 0 - 1
dashboard/src/main/home/sidebar/ClusterSection.tsx

@@ -51,7 +51,6 @@ export default class ClusterSection extends Component<PropsType, StateType> {
         this.props.setWelcome(false);
         // TODO: handle uninitialized kubeconfig
         if (res.data) {
-          console.log(res.data);
           let clusters = res.data;
           clusters.sort((a: any, b: any) => a.id - b.id);
           if (clusters.length > 0) {