Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix-gracefully-no-app-dir-results
Browse files Browse the repository at this point in the history
  • Loading branch information
apetro committed Jun 7, 2018
2 parents 8db6136 + 58473d3 commit 96a468e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,8 @@ and this project adheres to

* Hide app directory search loading indicator when search returns zero results
(#826)
* Gracefully handle case where directory search JSON URL is bad, as is the case
in naive localhost demo against stub data (#825)

## [8.2.0][] - 2018-06-22

Expand Down
11 changes: 10 additions & 1 deletion web/src/main/webapp/my-app/search/controllers.js
Expand Up @@ -119,15 +119,24 @@ define([
results.errors[1] &&
results.errors[1].error_msg) {
if (results.errors[0].code == 4) {
$log.warn(
'Too many directory results for term ' + $scope.searchTerm);
$scope.wiscDirectoryTooManyResults = true;
} else {
$log.warn(
'Directory search error [' + results.errors[1].error_msg +
'] on term ' + $scope.searchTerm);
}

$scope.wiscDirectoryErrorMessage= results.errors[1].error_msg;
}
}
return results;
}).catch(function() {
$log.warn('Directory search error on term ' + $scope.searchTerm);
$scope.wiscDirectoryLoading = false;
$scope.wiscDirectoryError = true;
$scope.wiscDirectoryErrorMessage =
'Error. Unable to search the directory.';
}
);
};
Expand Down
16 changes: 12 additions & 4 deletions web/src/main/webapp/my-app/search/partials/directory-results.html
Expand Up @@ -24,11 +24,22 @@ <h4 class="md-subhead">
</h4>

<div layout="row" layout-align="center center">
<loading-gif data-object="wiscDirectoryResults" data-empty="wiscDirectoryResultsEmpty"></loading-gif>
<loading-gif
ng-show="wiscDirectoryLoading"
data-object="wiscDirectoryResults"
data-empty="wiscDirectoryResultsEmpty"></loading-gif>
</div>
<div ng-show="wiscDirectoryResultsEmpty && !wiscDirectoryTooManyResults" class='no-result'>
No directory results.
</div>

<div ng-if="wiscDirectoryErrorMessage"
layout="row" layout-align="center center">
<p>
{{wiscDirectoryErrorMessage}}
</p>
</div>

<div class="result" ng-repeat="item in wiscDirectoryResults | limitTo:wiscDirectoryResultLimit">
<h4>{{item.fullName}}</h4>
<p ng-if="item.formalName">Also known as {{item.formalName}}</p>
Expand Down Expand Up @@ -62,7 +73,4 @@ <h4>{{item.fullName}}</h4>
<p ng-if="wiscDirectoryResultCount>wiscDirectoryResultLimit">
<a href="" ng-click="showAllDirectoryResults()">See all {{wiscDirectoryResultCount}} directory results</a>
</p>
<p ng-if="wiscDirectoryErrorMessage">
{{wiscDirectoryErrorMessage}}
</p>
</div>

0 comments on commit 96a468e

Please sign in to comment.