|
@@ -15,7 +15,6 @@ import { inflateRaw, inflateRawSync } from 'zlib';
|
|
|
type PropsType = {
|
|
type PropsType = {
|
|
|
viewData: any,
|
|
viewData: any,
|
|
|
setCurrentView: (x: string) => void,
|
|
setCurrentView: (x: string) => void,
|
|
|
- setRefreshClusters: (x: boolean) => void,
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type StateType = {
|
|
type StateType = {
|
|
@@ -24,6 +23,7 @@ type StateType = {
|
|
|
websockets: any[],
|
|
websockets: any[],
|
|
|
maxStep : Record<string, number>,
|
|
maxStep : Record<string, number>,
|
|
|
currentStep: Record<string, number>,
|
|
currentStep: Record<string, number>,
|
|
|
|
|
+ triggerEnd: boolean,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default class Provisioner extends Component<PropsType, StateType> {
|
|
export default class Provisioner extends Component<PropsType, StateType> {
|
|
@@ -33,6 +33,7 @@ export default class Provisioner extends Component<PropsType, StateType> {
|
|
|
websockets : [] as any[],
|
|
websockets : [] as any[],
|
|
|
maxStep: {} as Record<string, any>,
|
|
maxStep: {} as Record<string, any>,
|
|
|
currentStep: {} as Record<string, number>,
|
|
currentStep: {} as Record<string, number>,
|
|
|
|
|
+ triggerEnd: false,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
scrollToBottom = () => {
|
|
scrollToBottom = () => {
|
|
@@ -187,6 +188,24 @@ export default class Provisioner extends Component<PropsType, StateType> {
|
|
|
</>
|
|
</>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ onEnd = () => {
|
|
|
|
|
+ let myInterval = setInterval(() => {
|
|
|
|
|
+ console.log('interval')
|
|
|
|
|
+ api.getClusters('<token>', {}, { id: this.context.currentProject.id }, (err: any, res: any) => {
|
|
|
|
|
+ if (err) {
|
|
|
|
|
+ console.log(err);
|
|
|
|
|
+ } else if (res.data) {
|
|
|
|
|
+ let clusters = res.data;
|
|
|
|
|
+ console.log('found clusters:', res.data);
|
|
|
|
|
+ if (clusters.length > 0) {
|
|
|
|
|
+ this.props.setCurrentView('dashboard');
|
|
|
|
|
+ clearInterval(myInterval);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }, 1000);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
let maxStep = 0;
|
|
let maxStep = 0;
|
|
@@ -204,9 +223,9 @@ export default class Provisioner extends Component<PropsType, StateType> {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (maxStep !== 0 && currentStep === maxStep) {
|
|
|
|
|
- this.props.setRefreshClusters(true);
|
|
|
|
|
- this.props.setCurrentView('dashboard');
|
|
|
|
|
|
|
+ if (maxStep !== 0 && currentStep === maxStep && !this.state.triggerEnd) {
|
|
|
|
|
+ this.onEnd()
|
|
|
|
|
+ this.setState({ triggerEnd: true });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|