Fixing small bug where downloading an image would not show Downloading

This commit is contained in:
Jeffrey Morgan 2015-04-20 14:15:52 -04:00
parent 048abff77e
commit 2521b28c4b
2 changed files with 19 additions and 8 deletions

View File

@ -83,12 +83,22 @@ var ContainerHome = React.createClass({
);
} else if (this.props.container && this.props.container.State.Downloading) {
if (this.state.progress !== undefined) {
body = (
<div className="details-progress">
<h2>Downloading Image</h2>
<Radial progress={Math.min(Math.round(this.state.progress * 100), 99)} thick={true} gray={true}/>
</div>
);
if (this.state.progress > 0) {
body = (
<div className="details-progress">
<h2>Downloading Image</h2>
<Radial progress={Math.min(Math.round(this.state.progress * 100), 99)} thick={true} gray={true}/>
</div>
);
} else {
body = (
<div className="details-progress">
<h2>Downloading Image</h2>
<Radial spin="true" progress="90" thick={true} transparent={true}/>
</div>
);
}
} else if (this.state.blocked) {
body = (
<div className="details-progress">

View File

@ -72,7 +72,8 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
var current = data.progressDetail.current;
var total = data.progressDetail.total;
if (total <= 0) {
layerProgress[data.id] = 0;
progressCallback(0);
return;
} else {
layerProgress[data.id] = current / total;
}
@ -177,6 +178,7 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
stream.on('data', function () {});
stream.on('end', function () {
delete _placeholders[container.Name];
delete _progress[container.Name];
localStorage.setItem('store.placeholders', JSON.stringify(_placeholders));
self._createContainer(container.Name, {Image: container.Config.Image}, err => {
if (err) {
@ -316,7 +318,6 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
this.emit(this.CLIENT_CONTAINER_EVENT, containerName, 'create');
_muted[containerName] = true;
_progress[containerName] = 0;
this._pullImage(repository, tag, err => {
if (err) {
_error = err;