New click-to-pull protocol

Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
Jeffrey Morgan 2015-04-11 17:59:03 -04:00
parent 53cf2b696b
commit b06999e36a
2 changed files with 10 additions and 7 deletions

View File

@ -202,6 +202,10 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), {
var data = JSON.parse(json);
console.log(data);
if (data.status === 'pull' || data.status === 'untag' || data.status === 'delete') {
return;
}
// If the event is delete, remove the container
if (data.status === 'destroy') {
var container = _.findWhere(_.values(_containers), {Id: data.id});

View File

@ -34,7 +34,6 @@ ipc.on('application:quitting', opts => {
});
ipc.on('application:open-url', opts => {
console.log('Creating container from protocol');
var parser = document.createElement('a');
parser.href = opts.url;
@ -43,12 +42,12 @@ ipc.on('application:open-url', opts => {
}
var pathname = parser.pathname.replace('//', '');
var slash = pathname.indexOf('/');
var base = pathname.slice(0, slash);
if (base === 'runRepo') {
var repo = pathname.substring(slash + 1);
ContainerStore.setPending(repo, 'latest');
var tokens = pathname.split('/');
var type = tokens[0];
var method = tokens[1];
var repo = tokens.slice(2).join('/');
if (type === 'repository' && method === 'run') {
ContainerStore.setPending(repo, parser.tag || 'latest');
}
});