Commit eb811153 by dileep bhimineni

changes for search results issue when results are not defined or error response from server

parent d1a7872f
...@@ -47,7 +47,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -47,7 +47,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.totalItems = $scope.resultCount; $scope.totalItems = $scope.resultCount;
$scope.transformedResults = {}; $scope.transformedResults = {};
$scope.dataTransitioned = false; $scope.dataTransitioned = false;
if (response.results.dataType.typeName.indexOf('__') === 0) { if (response.results.dataType && response.results.dataType.typeName.indexOf('__') === 0) {
$scope.dataTransitioned = true; $scope.dataTransitioned = true;
var attrDef = response.results.dataType.attributeDefinitions; var attrDef = response.results.dataType.attributeDefinitions;
angular.forEach(attrDef, function(value) { angular.forEach(attrDef, function(value) {
...@@ -67,7 +67,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -67,7 +67,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.$watch('currentPage + itemsPerPage', function() { $scope.$watch('currentPage + itemsPerPage', function() {
var begin = (($scope.currentPage - 1) * $scope.itemsPerPage), var begin = (($scope.currentPage - 1) * $scope.itemsPerPage),
end = begin + $scope.itemsPerPage; end = begin + $scope.itemsPerPage;
$scope.filteredResults = $scope.transformedResults.slice(begin, end); if ($scope.transformedResults)$scope.filteredResults = $scope.transformedResults.slice(begin, end);
$scope.pageCount = function() { $scope.pageCount = function() {
return Math.ceil($scope.resultCount / $scope.itemsPerPage); return Math.ceil($scope.resultCount / $scope.itemsPerPage);
}; };
...@@ -76,6 +76,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -76,6 +76,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
} }
}); });
}, function searchError(err) { }, function searchError(err) {
$scope.searchMessage = '0 results matching your search query ' + $scope.query + ' were found';
NotificationService.error('Error occurred during executing search query, error status code = ' + err.status + ', status text = ' + err.statusText, false); NotificationService.error('Error occurred during executing search query, error status code = ' + err.status + ', status text = ' + err.statusText, false);
}); });
$state.go('search', { $state.go('search', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment