Fetch more container data on first load

This commit is contained in:
Jeffrey Morgan 2015-06-25 19:59:49 -07:00
parent 49f64abbbd
commit fe4e0ae474
1 changed files with 17 additions and 20 deletions

View File

@ -135,26 +135,23 @@ export default {
if (err) { if (err) {
return; return;
} }
async.map(containers, (container, callback) => {
let modifiedContainers = _.map(containers, container => { this.client.getContainer(container.Id).inspect((error, container) => {
container.Name = container.Names[0].replace('/', ''); if (error) {
delete container.Names; callback(null, null);
return;
// HACK: fill in some data based on simple list data
container.State = {};
container.Config = {
Image: container.Image
};
if (container.Status.indexOf('Exited') !== -1) {
container.State.Stopped = true;
} else if (container.Status.indexOf('Paused') !== -1) {
container.State.Stopped = true;
} else if (container.Status.indexOf('Up') !== -1) {
container.State.Running = true;
} }
return container; container.Name = container.Name.replace('/', '');
callback(null, container);
});
}, (err, containers) => {
containers = containers.filter(c => c !== null);
if (err) {
// TODO: add a global error handler for this
return;
}
containerServerActions.allUpdated({containers: _.indexBy(containers.concat(_.values(this.placeholders)), 'Name')});
}); });
containerServerActions.allUpdated({containers: _.indexBy(modifiedContainers.concat(_.values(this.placeholders)), 'Name')});
}); });
}, },