From e3f804ef88ca184cfd420d782d022a8f3f10d509 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 13 Dec 2013 10:05:35 -0800 Subject: [PATCH] Add container naming to container display --- js/app.js | 2 +- js/filters.js | 6 ++++++ js/viewmodel.js | 1 + partials/containers.html | 6 ++---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/js/app.js b/js/app.js index 6dc3ce96b..1cde9456a 100644 --- a/js/app.js +++ b/js/app.js @@ -14,5 +14,5 @@ angular.module('dockerui', ['dockerui.services', 'dockerui.filters']) // You need to set this to the api endpoint without the port i.e. http://192.168.1.9 .constant('DOCKER_ENDPOINT', '/dockerapi') .constant('DOCKER_PORT', '') // Docker port, leave as an empty string if no port is requred. If you have a port, prefix it with a ':' i.e. :4243 - .constant('UI_VERSION', 'v0.3') + .constant('UI_VERSION', 'v0.4') .constant('DOCKER_API_VERSION', 'v1.4'); diff --git a/js/filters.js b/js/filters.js index 35969e815..4be249519 100644 --- a/js/filters.js +++ b/js/filters.js @@ -62,6 +62,12 @@ angular.module('dockerui.filters', []) var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[[i]]; }; + }) + .filter('containername', function() { + return function(container) { + var name = container.Names[0]; + return name.substring(1, name.length); + }; }) .filter('getdate', function() { return function(data) { diff --git a/js/viewmodel.js b/js/viewmodel.js index 20763a255..f8578a879 100644 --- a/js/viewmodel.js +++ b/js/viewmodel.js @@ -15,4 +15,5 @@ function ContainerViewModel(data) { this.SizeRw = data.SizeRw; this.Status = data.Status; this.Checked = false; + this.Names = data.Names; } diff --git a/partials/containers.html b/partials/containers.html index 1d3973274..c76af8905 100644 --- a/partials/containers.html +++ b/partials/containers.html @@ -22,22 +22,20 @@ Action - Id + Name Image Command Created - Size Status - {{ container.Id|truncate:10}} + {{ container|containername}} {{ container.Image }} {{ container.Command|truncate:40 }} {{ container.Created|getdate }} - {{ container.SizeRw|humansize }} {{ container.Status }}