From 22122a27b5d549f169149cc5dfd09585e1539f63 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 10 Aug 2016 15:40:35 +1200 Subject: [PATCH 1/2] fix(dashboard): fix an error when no volumes are availables (#116) --- app/components/dashboard/dashboardController.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/dashboard/dashboardController.js b/app/components/dashboard/dashboardController.js index 2b3667304..0368f3ee2 100644 --- a/app/components/dashboard/dashboardController.js +++ b/app/components/dashboard/dashboardController.js @@ -50,7 +50,9 @@ function ($scope, $q, Config, Container, Image, Network, Volume, Info) { function prepareVolumeData(d) { var volumes = d.Volumes; - $scope.volumeData.total = volumes.length; + if (volumes) { + $scope.volumeData.total = volumes.length; + } } function prepareNetworkData(d) { From 7b72da857f8df2882ea1094460aaf003571a5027 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 10 Aug 2016 16:04:19 +1200 Subject: [PATCH 2/2] feat(ui): format all dates to use ISO8601 --- app/components/container/container.html | 5 +++-- app/components/events/events.html | 2 +- app/components/images/images.html | 2 +- app/shared/filters.js | 10 +--------- test/unit/app/shared/filters.spec.js | 6 ------ 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/app/components/container/container.html b/app/components/container/container.html index bc76f31cc..52e203069 100644 --- a/app/components/container/container.html +++ b/app/components/container/container.html @@ -84,7 +84,7 @@ Created - {{ container.Created | date: 'medium' }} + {{ container.Created|getisodate }} Path @@ -186,7 +186,8 @@ {{key}} - {{ val }} + {{val|getisodate}} + {{val}} diff --git a/app/components/events/events.html b/app/components/events/events.html index 17764e1fb..f68971578 100644 --- a/app/components/events/events.html +++ b/app/components/events/events.html @@ -50,7 +50,7 @@ - {{ event.Time|getdatefromtimestamp }} + {{ event.Time|getisodatefromtimestamp }} {{ event.Type }} {{ event.Details }} diff --git a/app/components/images/images.html b/app/components/images/images.html index 4bfe5ec59..63a9022b6 100644 --- a/app/components/images/images.html +++ b/app/components/images/images.html @@ -105,7 +105,7 @@ {{ tag }} {{ image.VirtualSize|humansize }} - {{ image.Created|getdate }} + {{ image.Created|getisodatefromtimestamp }} diff --git a/app/shared/filters.js b/app/shared/filters.js index c668b109f..a0afbcb41 100644 --- a/app/shared/filters.js +++ b/app/shared/filters.js @@ -154,15 +154,7 @@ angular.module('uifordocker.filters', []) return []; }; }) -.filter('getdate', function () { - 'use strict'; - return function (data) { - //Multiply by 1000 for the unix format - var date = new Date(data * 1000); - return date.toDateString(); - }; -}) -.filter('getdatefromtimestamp', function () { +.filter('getisodatefromtimestamp', function () { 'use strict'; return function (timestamp) { return moment.unix(timestamp).format('YYYY-MM-DD HH:mm:ss'); diff --git a/test/unit/app/shared/filters.spec.js b/test/unit/app/shared/filters.spec.js index db832cd8f..b9235f38b 100644 --- a/test/unit/app/shared/filters.spec.js +++ b/test/unit/app/shared/filters.spec.js @@ -134,12 +134,6 @@ describe('filters', function () { })); }); - describe('getdate', function () { - it('should convert the Docker date to a human readable form', inject(function (getdateFilter) { - expect(getdateFilter(1420424998)).toBe('Sun Jan 04 2015'); - })); - }); - describe('errorMsgFilter', function () { it('should convert the $resource object to a string message', inject(function (errorMsgFilter) {