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

MUMUP-2199 : Cleanup some wisc.edu search stuff #378

Merged
merged 2 commits into from
Jan 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion angularjs-portal-home/src/main/webapp/js/app-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ define(['angular'], function(angular) {
'notificationsURL' : '/web/staticFeeds/notifications.json',
'groupURL' : '/portal/api/groups',
'kvURL' : '/storage/',
'googleSearchURL' : '/web/staticFeeds/gcs.json'
'googleSearchURL' : '/web/staticFeeds/gcs.json?firstVariablemock=true'
})
.constant('NAMES', {
'title' : 'MyUW',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ define(['angular', 'portal/search/controllers', 'my-app/marketplace/controllers'

var recalcTotalCount = function(){
//all results are set to arrays by the time this is called.
$scope.totalCount = $scope.googleResults.length + $scope.myuwResults.length;
$scope.totalCount = $scope.googleResultsEstimatedCount.length + $scope.myuwResults.length;
}

var initWiscEduSearch = function(){
Expand All @@ -66,6 +66,7 @@ define(['angular', 'portal/search/controllers', 'my-app/marketplace/controllers'
$scope.sortParameter = ['-rating','-userRated'];
$scope.myuwResults = [];
$scope.googleResults = [];
$scope.googleResultsEstimatedCount = 0;
recalcTotalCount();
$scope.searchResultLimit = 20;
$scope.showAll = false;
Expand All @@ -78,7 +79,9 @@ define(['angular', 'portal/search/controllers', 'my-app/marketplace/controllers'
});
};
init();
initWiscEduSearch();
if(googleCustomSearchService.googleSearchEnabled()){
initWiscEduSearch();
}
}]);

return app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h4><a href="{{::portlet.maxUrl}}" target="{{::portlet.target}}">{{ portlet.name
</div>
</div>
<!--wisc.edu results-->
<div id="wisc-edu-results" class='search-results-container'>
<div id="wisc-edu-results" class='search-results-container' ng-show="googleResults && googleResults.length > 0">
<h4 class='header'>Wisc.edu</h4>
<hr>
<loading-gif data-object='googleResults'></loading-gif>
Expand Down
13 changes: 11 additions & 2 deletions angularjs-portal-home/src/main/webapp/my-app/search/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define(['angular', 'jquery'], function(angular, $) {
app.factory('googleCustomSearchService', ['$http', 'miscService', 'SERVICE_LOC', function($http, miscService, SERVICE_LOC){

function googleSearch(term) {
return $http.get(SERVICE_LOC.googleSearchURL + "?q=" + term).then(
return $http.get(SERVICE_LOC.googleSearchURL + "&q=" + term).then(
function(response){
return response.data;
},
Expand All @@ -17,8 +17,17 @@ define(['angular', 'jquery'], function(angular, $) {
)
}

function googleSearchEnabled() {
if(SERVICE_LOC.googleSearchURL) {
return true;
} else {
return false;
}
}

return {
googleSearch : googleSearch
googleSearch : googleSearch,
googleSearchEnabled : googleSearchEnabled
};


Expand Down