sunguroku 5 лет назад
Родитель
Сommit
56579c8fbe

+ 4 - 4
dashboard/src/main/home/Home.tsx

@@ -28,7 +28,7 @@ type StateType = {
   forceSidebar: boolean,
   showWelcome: boolean,
   currentView: string,
-  viewData: any,
+  viewData: any[],
 
   // Track last project id for refreshing clusters on project change
   prevProjectId: number | null,
@@ -71,9 +71,9 @@ export default class Home extends Component<PropsType, StateType> {
                 }
               });
 
-              // if (viewData.length > 0) {
-              this.setState({ currentView: 'provisioner', viewData});
-              // }
+              if (viewData.length > 0) {
+                this.setState({ currentView: 'provisioner', viewData});
+              }
 
             }
           });

+ 4 - 3
dashboard/src/main/home/new-project/Provisioner.tsx

@@ -2,7 +2,6 @@ import React, { Component } from 'react';
 import styled from 'styled-components';
 
 import api from '../../../shared/api';
-import { ProvisioningDataType } from '../../../shared/types'
 import { Context } from '../../../shared/Context';
 import ansiparse from '../../../shared/ansiparser'
 import { integrationList } from '../../../shared/common';
@@ -13,7 +12,7 @@ import { eventNames } from 'process';
 import { inflateRaw, inflateRawSync } from 'zlib';
 
 type PropsType = {
-  viewData: any,
+  viewData: any[]
 };
 
 type StateType = {
@@ -49,7 +48,9 @@ export default class Provisioner extends Component<PropsType, StateType> {
     let protocol = process.env.NODE_ENV == 'production' ? 'wss' : 'ws'
     let viewData = this.props.viewData || []
 
-    let websockets = viewData.forEach((infra: any) => {
+    console.log("viewData", viewData)
+
+    let websockets = viewData.map((infra: any) => {
       let ws = new WebSocket(`${protocol}://${process.env.API_SERVER}/api/projects/${currentProject.id}/provision/${infra.kind}/${infra.infra_id}/logs`)
       
       ws.onopen = () => {

+ 0 - 7
dashboard/src/shared/types.tsx

@@ -147,11 +147,4 @@ export interface InfraType {
   project_d: number,
   kind: string,
   status: string,
-}
-
-export interface ProvisioningDataType {
-  log: string,
-  created_resources: number,
-  total_resources: number,
-  kind: string,
 }