From 5b79bbf779095b7fb7f6d5f3e7de7ecc557e0477 Mon Sep 17 00:00:00 2001 From: Naren Dasan Date: Tue, 27 Feb 2018 10:45:49 -0600 Subject: [PATCH 01/10] ready to test --- src/app/App.js | 52 +++++++++++----------- src/app/frameworks/Frameworks.js | 6 +-- src/app/frameworks/framework/Framework.css | 21 ++++++++- src/app/frameworks/framework/Framework.js | 25 +++++++---- 4 files changed, 66 insertions(+), 38 deletions(-) diff --git a/src/app/App.js b/src/app/App.js index 6fe528b..7db51ce 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -6,43 +6,45 @@ import './App.css'; class App extends Component { constructor(props) { - super(props); - this.state = {frameworks: this.props.frameworkImages, - disableAllButton: false}; - this.loadingGif = "https://loading.io/spinners/double-ring/lg.double-ring-spinner.gif"; - this.click = this.click.bind(this); - this.api = window.location.protocol+"//"+window.location.href.split('/')[2] + super(props); + this.state = {frameworks: this.props.frameworkImages, + disableAllButtons: false, + selects: Array.apply(null, Array(this.props.frameworkImages.length)).map(Number.prototype.valueOf,0), + ui_url: null}; + this.loadingGif = "https://loading.io/spinners/double-ring/lg.double-ring-spinner.gif"; + this.click = this.click.bind(this); + this.api = window.location.protocol+"//"+window.location.href.split('/')[2]; } - click(f) { - var updatedFramework = this.state.frameworks - var type = typeof updatedFramework; - console.log(type); + select(f) { + var updatedFramework = this.state.frameworks; var index = updatedFramework.indexOf(f); updatedFramework[index].loading = true; - this.setState({framework:updatedFramework, disableAllButton:true}) + this.setState({framework:updatedFramework, disableAllButtons:true}); fetch(this.api + '/create_container', { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify(f) - }).then((resp) => resp.json()).then(function(res){ - window.location = res['ui_url']; - }); - console.log(f) + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify(f) + }).then((resp) => resp.json()).then(function(res){ + this.setState({ui_url: res['ui_url']}); + }); + } + + confirm() { + window.location = this.state.ui_url; } render() { - console.log(this.state.disableAllButton); return (
+ +