From 3985e608c20d7f93c910cee929d13bb3d627e517 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 14 Jun 2013 15:37:00 -0900 Subject: [PATCH] Add err message when image or container not found --- css/app.css | 5 +++++ js/controllers.js | 15 +++++++++++++-- partials/container.html | 7 ++++--- partials/image.html | 8 ++++---- partials/images.html | 4 ++++ 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/css/app.css b/css/app.css index a70a0982e..d7833aac6 100644 --- a/css/app.css +++ b/css/app.css @@ -96,3 +96,8 @@ .footer { max-height:6px; } + + #response { + width: 80%; + margin: 0 auto; + } diff --git a/js/controllers.js b/js/controllers.js index 580b7ebb5..46a2628f2 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -151,7 +151,10 @@ function ContainerController($scope, $routeParams, $location, Container) { $scope.container = d; }, function(e) { console.log(e); - $location.path('/containers/'); + setFailedResponse($scope, e.data, '#response'); + if (e.status === 404) { + $('.detail').hide(); + } }); $scope.getChanges(); @@ -185,9 +188,14 @@ function ContainersController($scope, Container, Settings) { // Controller for the list of images function ImagesController($scope, Image) { $scope.predicate = '-Created'; + $('#response').hide(); + $scope.alertClass = 'block'; Image.query({}, function(d) { $scope.images = d; + }, function (e) { + console.log(e); + setFailedResponse($scope, e.data, '#response'); }); } @@ -232,7 +240,10 @@ function ImageController($scope, $routeParams, $location, Image) { $scope.image = d; }, function(e) { console.log(e); - $location.path('/images/'); + setFailedResponse($scope, e.data, '#response'); + if (e.status === 404) { + $('.detail').hide(); + } }); $scope.getHistory(); diff --git a/partials/container.html b/partials/container.html index df0d0e84d..ddbed3b87 100644 --- a/partials/container.html +++ b/partials/container.html @@ -1,8 +1,9 @@ -
-
+
{{ response }} -
+
+
+

Container: {{ container.Id }}

diff --git a/partials/image.html b/partials/image.html index 05f7b021a..595efde42 100644 --- a/partials/image.html +++ b/partials/image.html @@ -1,9 +1,9 @@ -
- -
+
{{ response }} -
+
+
+

Image: {{ image.id }}

diff --git a/partials/images.html b/partials/images.html index 0840f3938..e6549e9a1 100644 --- a/partials/images.html +++ b/partials/images.html @@ -1,6 +1,10 @@

Images:

+
+ {{ response }} +
+