mirror of https://github.com/docker/docs.git
Allow only downloading one container at a time
Due to docker engine bug
This commit is contained in:
parent
7f735990d7
commit
6fd6113502
|
@ -13,9 +13,15 @@ var ContainerList = React.createClass({
|
||||||
<ContainerListItem key={container.Id} container={container} start={self._start}/>
|
<ContainerListItem key={container.Id} container={container} start={self._start}/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
var newItem;
|
||||||
|
if (!this.props.downloading) {
|
||||||
|
newItem = <ContainerListNewItem key={'newcontainer'} containers={this.props.containers} />;
|
||||||
|
} else {
|
||||||
|
newItem = '';
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<ul>
|
<ul>
|
||||||
<ContainerListNewItem key={'newcontainer'} containers={this.props.containers} />
|
{newItem}
|
||||||
{containers}
|
{containers}
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
|
|
|
@ -463,6 +463,9 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
return _error;
|
return _error;
|
||||||
|
},
|
||||||
|
downloading: function () {
|
||||||
|
return !!_.keys(_placeholders).length;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ var metrics = require('./Metrics');
|
||||||
var autoUpdater = remote.require('auto-updater');
|
var autoUpdater = remote.require('auto-updater');
|
||||||
var RetinaImage = require('react-retina-image');
|
var RetinaImage = require('react-retina-image');
|
||||||
var machine = require('./DockerMachine');
|
var machine = require('./DockerMachine');
|
||||||
|
var OverlayTrigger = require('react-bootstrap').OverlayTrigger;
|
||||||
|
var Tooltip = require('react-bootstrap').Tooltip;
|
||||||
var util = require('./Util');
|
var util = require('./Util');
|
||||||
|
|
||||||
var Containers = React.createClass({
|
var Containers = React.createClass({
|
||||||
|
@ -21,7 +23,8 @@ var Containers = React.createClass({
|
||||||
sorted: ContainerStore.sorted(),
|
sorted: ContainerStore.sorted(),
|
||||||
updateAvailable: false,
|
updateAvailable: false,
|
||||||
currentButtonLabel: '',
|
currentButtonLabel: '',
|
||||||
error: ContainerStore.error()
|
error: ContainerStore.error(),
|
||||||
|
downloading: ContainerStore.downloading()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentDidMount: function () {
|
componentDidMount: function () {
|
||||||
|
@ -62,7 +65,8 @@ var Containers = React.createClass({
|
||||||
update: function (name, status) {
|
update: function (name, status) {
|
||||||
this.setState({
|
this.setState({
|
||||||
containers: ContainerStore.containers(),
|
containers: ContainerStore.containers(),
|
||||||
sorted: ContainerStore.sorted()
|
sorted: ContainerStore.sorted(),
|
||||||
|
downloading: ContainerStore.downloading()
|
||||||
});
|
});
|
||||||
if (status === 'destroy') {
|
if (status === 'destroy') {
|
||||||
this.onDestroy();
|
this.onDestroy();
|
||||||
|
@ -71,7 +75,8 @@ var Containers = React.createClass({
|
||||||
updateFromClient: function (name, status) {
|
updateFromClient: function (name, status) {
|
||||||
this.setState({
|
this.setState({
|
||||||
containers: ContainerStore.containers(),
|
containers: ContainerStore.containers(),
|
||||||
sorted: ContainerStore.sorted()
|
sorted: ContainerStore.sorted(),
|
||||||
|
downloading: ContainerStore.downloading()
|
||||||
});
|
});
|
||||||
if (status === 'create') {
|
if (status === 'create') {
|
||||||
this.transitionTo('containerHome', {name: name});
|
this.transitionTo('containerHome', {name: name});
|
||||||
|
@ -158,6 +163,19 @@ var Containers = React.createClass({
|
||||||
<a className="btn btn-action small" onClick={this.handleAutoUpdateClick}>New Update</a>
|
<a className="btn btn-action small" onClick={this.handleAutoUpdateClick}>New Update</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var button;
|
||||||
|
console.log(this.state.downloading);
|
||||||
|
if (this.state.downloading) {
|
||||||
|
button = (
|
||||||
|
<OverlayTrigger placement="bottom" overlay={<Tooltip>Only one container can be downloaded at a time.</Tooltip>}>
|
||||||
|
<a disabled={true} className="btn-new icon icon-add-3"></a>
|
||||||
|
</OverlayTrigger>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
button = <a className="btn-new icon icon-add-3" onClick={this.handleNewContainer}></a>;
|
||||||
|
}
|
||||||
|
|
||||||
var container = this.getParams().name ? this.state.containers[this.getParams().name] : {};
|
var container = this.getParams().name ? this.state.containers[this.getParams().name] : {};
|
||||||
return (
|
return (
|
||||||
<div className="containers">
|
<div className="containers">
|
||||||
|
@ -167,11 +185,11 @@ var Containers = React.createClass({
|
||||||
<section className={sidebarHeaderClass}>
|
<section className={sidebarHeaderClass}>
|
||||||
<h4>Containers</h4>
|
<h4>Containers</h4>
|
||||||
<div className="create">
|
<div className="create">
|
||||||
<span className="btn-new icon icon-add-3" onClick={this.handleNewContainer}></span>
|
{button}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section className="sidebar-containers" onScroll={this.handleScroll}>
|
<section className="sidebar-containers" onScroll={this.handleScroll}>
|
||||||
<ContainerList containers={this.state.sorted} newContainer={this.state.newContainer} />
|
<ContainerList downloading={this.state.downloading} containers={this.state.sorted} newContainer={this.state.newContainer} />
|
||||||
<div className="sidebar-buttons">
|
<div className="sidebar-buttons">
|
||||||
<div className="btn-label">{this.state.currentButtonLabel}</div>
|
<div className="btn-label">{this.state.currentButtonLabel}</div>
|
||||||
<span className="btn-sidebar" onClick={this.handleClickDockerTerminal} onMouseEnter={this.handleMouseEnterDockerTerminal} onMouseLeave={this.handleMouseLeaveDockerTerminal}><RetinaImage src="docker-terminal.png"/></span>
|
<span className="btn-sidebar" onClick={this.handleClickDockerTerminal} onMouseEnter={this.handleMouseEnterDockerTerminal} onMouseLeave={this.handleMouseLeaveDockerTerminal}><RetinaImage src="docker-terminal.png"/></span>
|
||||||
|
|
Loading…
Reference in New Issue