Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #415 from kitematic/fix-download-v1
Browse files Browse the repository at this point in the history
Fixing small bug where downloading an image would not show Downloading
  • Loading branch information
JeffDM committed Apr 20, 2015
2 parents 048abff + 2521b28 commit b9f5afa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
22 changes: 16 additions & 6 deletions src/ContainerHome.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
5 changes: 3 additions & 2 deletions src/ContainerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b9f5afa

Please sign in to comment.