From 2521b28c4bf42ba2151bc0471581a20b78bf5680 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Mon, 20 Apr 2015 14:15:52 -0400 Subject: [PATCH] Fixing small bug where downloading an image would not show Downloading --- src/ContainerHome.react.js | 22 ++++++++++++++++------ src/ContainerStore.js | 5 +++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ContainerHome.react.js b/src/ContainerHome.react.js index e2cc93f78..0e458e49d 100644 --- a/src/ContainerHome.react.js +++ b/src/ContainerHome.react.js @@ -83,12 +83,22 @@ var ContainerHome = React.createClass({ ); } else if (this.props.container && this.props.container.State.Downloading) { if (this.state.progress !== undefined) { - body = ( -
-

Downloading Image

- -
- ); + if (this.state.progress > 0) { + body = ( +
+

Downloading Image

+ +
+ ); + } else { + body = ( +
+

Downloading Image

+ +
+ ); + } + } else if (this.state.blocked) { body = (
diff --git a/src/ContainerStore.js b/src/ContainerStore.js index 583ba410b..001474bab 100644 --- a/src/ContainerStore.js +++ b/src/ContainerStore.js @@ -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;