From e3f804ef88ca184cfd420d782d022a8f3f10d509 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 13 Dec 2013 10:05:35 -0800 Subject: [PATCH 1/4] 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 }} From a392c8ec87382196e72dbba6e89aa64f2efa32c5 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 13 Dec 2013 10:16:40 -0800 Subject: [PATCH 2/4] Add name to container display --- .gitignore | 1 + partials/container.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 35f9ef908..6966ea248 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ dockerui +*.esproj* diff --git a/partials/container.html b/partials/container.html index cefefb8d9..a06a17e9f 100644 --- a/partials/container.html +++ b/partials/container.html @@ -1,6 +1,6 @@
-

Container: {{ container.Id }}

+

Container: {{ container.Name }}

From 27a9e97062808b0ad9f4f3b8fcf5bc3954c9b59b Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 13 Dec 2013 10:26:58 -0800 Subject: [PATCH 3/4] Fix images repo name --- js/filters.js | 10 ++++++++++ js/viewmodel.js | 1 + partials/images.html | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/js/filters.js b/js/filters.js index 4be249519..c9c39c6f3 100644 --- a/js/filters.js +++ b/js/filters.js @@ -68,6 +68,16 @@ angular.module('dockerui.filters', []) var name = container.Names[0]; return name.substring(1, name.length); }; + }) + .filter('repotag', function() { + return function(image) { + if (image.RepoTags && image.RepoTags.length > 0) { + var tag = image.RepoTags[0]; + if (tag == ':') { tag = ''; } + return tag; + } + return ''; + }; }) .filter('getdate', function() { return function(data) { diff --git a/js/viewmodel.js b/js/viewmodel.js index f8578a879..7a17b21e9 100644 --- a/js/viewmodel.js +++ b/js/viewmodel.js @@ -5,6 +5,7 @@ function ImageViewModel(data) { this.Repository = data.Repository; this.Created = data.Created; this.Checked = false; + this.RepoTags = data.RepoTags; } function ContainerViewModel(data) { diff --git a/partials/images.html b/partials/images.html index 7751b5d07..e93a6fa3a 100644 --- a/partials/images.html +++ b/partials/images.html @@ -23,8 +23,8 @@ - {{ image.Id|truncate:20}} - {{ image.Repository }}:{{ image.Tag }} + {{ image.Id|truncate:20}} + {{ image|repotag }} {{ image.Created|getdate }} From a9dd55a720e816a6e3187fa6a8ba3ee04545eb31 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 16 Dec 2013 13:40:10 -0800 Subject: [PATCH 4/4] Update to api version 1.8 --- js/app.js | 2 +- partials/dashboard.html | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/js/app.js b/js/app.js index 1cde9456a..983427fc7 100644 --- a/js/app.js +++ b/js/app.js @@ -15,4 +15,4 @@ angular.module('dockerui', ['dockerui.services', 'dockerui.filters']) .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.4') - .constant('DOCKER_API_VERSION', 'v1.4'); + .constant('DOCKER_API_VERSION', 'v1.8'); diff --git a/partials/dashboard.html b/partials/dashboard.html index 63602e608..f2f21ee0b 100644 --- a/partials/dashboard.html +++ b/partials/dashboard.html @@ -24,25 +24,21 @@

Status

- Get a better broswer... Your holding everyone back. + Get a better browser... Your holding everyone back.
-
-
+

Containers created

- Get a better broswer... Your holding everyone back. + Get a better browser... Your holding everyone back. -

{{ totalContainers }}

-

Images created

- Get a better broswer... Your holding everyone back. + Get a better browser... Your holding everyone back. -

{{ totalImages }}