Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 4c9bd03

Browse files
disabled all of the buttons after a click to prevent spam clicks
1 parent 1c15f34 commit 4c9bd03

File tree

3 files changed

+55
-50
lines changed

3 files changed

+55
-50
lines changed

‎src/app/App.js‎

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,57 @@ class App extends Component {
88
super();
99

1010
this.state = {frameworks:
11-
[{
12-
name:'TensorFlow',
13-
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
14-
img: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Tensorflow_logo.svg/115px-Tensorflow_logo.svg.png",
15-
image: "acmuiuc/tensorflow"
16-
},
17-
{
18-
name:'Caffe2',
19-
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
20-
img: "https://caffe2.ai/static/logo.svg",
21-
image: "registry.gitlab.com/acm-uiuc/gpu-cluster-images:caffe2"
22-
},
23-
{
24-
name:'PyTorch',
25-
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
26-
img: "http://pytorch.org/static/img/pytorch-logo-dark.svg",
27-
image: "acmuiuc/pytorch"
28-
},
29-
{
30-
name:'Keras',
31-
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
32-
img: "https://upload.wikimedia.org/wikipedia/commons/c/c9/Keras_Logo.jpg",
33-
image: "acmuiuc/keras"
34-
},
35-
{
36-
name:'NVIDIA Digits',
37-
details: "Ubuntu 16.04 - In Browser GUI",
38-
img: "https://www.scan.co.uk/images/3xs/infopages/nvidia-digits.png",
39-
image: "nvidia/digits"
40-
},
41-
{
42-
name:'Caffe',
43-
details: "Ubuntu 16.04 - C++ - SSH",
44-
img: "http://antmicro.com/images/logos/products-tk-caffe.svg",
45-
image: "nvidia/caffe"
46-
},
47-
{
48-
name:'Dockerfile',
49-
details: null,
50-
img: "https://cdn.worldvectorlogo.com/logos/docker.svg",
51-
image: null
52-
}]
53-
};
11+
[{
12+
name:'TensorFlow',
13+
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
14+
img: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Tensorflow_logo.svg/115px-Tensorflow_logo.svg.png",
15+
image: "acmuiuc/tensorflow"
16+
},
17+
{
18+
name:'Caffe2',
19+
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
20+
img: "https://caffe2.ai/static/logo.svg",
21+
image: "registry.gitlab.com/acm-uiuc/gpu-cluster-images:caffe2"
22+
},
23+
{
24+
name:'PyTorch',
25+
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
26+
img: "http://pytorch.org/static/img/pytorch-logo-dark.svg",
27+
image: "acmuiuc/pytorch"
28+
},
29+
{
30+
name:'Keras',
31+
details: "Ubuntu 16.04 - Python 3.5 - Jupyter Notebook",
32+
img: "https://upload.wikimedia.org/wikipedia/commons/c/c9/Keras_Logo.jpg",
33+
image: "acmuiuc/keras"
34+
},
35+
{
36+
name:'NVIDIA Digits',
37+
details: "Ubuntu 16.04 - In Browser GUI",
38+
img: "https://www.scan.co.uk/images/3xs/infopages/nvidia-digits.png",
39+
image: "nvidia/digits"
40+
},
41+
{
42+
name:'Caffe',
43+
details: "Ubuntu 16.04 - C++ - SSH",
44+
img: "http://antmicro.com/images/logos/products-tk-caffe.svg",
45+
image: "nvidia/caffe"
46+
},
47+
{
48+
name:'Dockerfile',
49+
details: null,
50+
img: "https://cdn.worldvectorlogo.com/logos/docker.svg",
51+
image: null
52+
}],
53+
disableButton: false
54+
};
55+
5456
this.click = this.click.bind(this);
5557
}
5658

5759

5860
click(f) {
61+
this.setState({framework:this.state.framework, disableButton:true})
5962
fetch('http://vault.acm.illinois.edu:5656/create_container', {
6063
method: 'POST',
6164
headers: {
@@ -70,10 +73,11 @@ class App extends Component {
7073
}
7174

7275
render() {
73-
return (
76+
console.log(this.state.disableButton);
77+
return (
7478
<div className="GPU-CLUSTER-FRONTEND">
7579
<Nav/>
76-
<Frameworks frameworks={this.state.frameworks} handler={this.click}/>
80+
<Frameworks disabled={this.state.disableButton}frameworks={this.state.frameworks} handler={this.click}/>
7781
</div>
7882
);
7983
}

‎src/app/frameworks/Frameworks.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Framework from './framework/Framework.js'
44

55
class Grid extends Component {
66
renderFramework(f, t, cl) {
7-
return <Framework framework={f} onClickHandler={this.props.handler}/>
7+
return <Framework disabled={this.props.disabled}framework={f} onClickHandler={this.props.handler}/>
88
}
99

1010
render() {
@@ -22,4 +22,4 @@ class Grid extends Component {
2222
}
2323
}
2424

25-
export default Grid;
25+
export default Grid;

‎src/app/frameworks/framework/Framework.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import './Framework.css'
33

44
class Framework extends Component {
55
render() {
6-
return (
7-
<button className="Framework" onClick={() => this.props.onClickHandler(this.props.framework)}>
6+
console.log(this.props.disabled);
7+
return (
8+
<button className="Framework" onClick={() => this.props.onClickHandler(this.props.framework)} disabled={this.props.disabled}>
89
<img className="logo" src={this.props.framework.img} alt=""/>
910
<div className="label">
1011
<span className="name">{this.props.framework.name}</span>
@@ -15,4 +16,4 @@ class Framework extends Component {
1516
}
1617
}
1718

18-
export default Framework;
19+
export default Framework;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /