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

Commit

Permalink
Merge pull request #923 from uPortal-Project/cache-http-get-consistently
Browse files Browse the repository at this point in the history
Configure $http.get usages to cache
  • Loading branch information
apetro committed Feb 17, 2021
2 parents 603db11 + 5db3c17 commit 9b908a8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to
Versions in this document should match those
[published to Sonatype Maven Central Repository][].

## Next

+ Configure usages of `$http.get` to cache.
Previously some usages did not turn on caching.

## 12.0.0 - 2021-02-05

**Breaking change: "silent" login is no longer a thing.**
Expand Down
11 changes: 7 additions & 4 deletions web/src/main/webapp/my-app/layout/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ define(['angular', 'jquery'], function(angular, $) {
};

// no caching... request from the server
return $http.get(SERVICE_LOC.context + SERVICE_LOC.layout)
return $http.get(SERVICE_LOC.context + SERVICE_LOC.layout,
{cache: true} )
.then(successFn, errorFn);
};

Expand Down Expand Up @@ -207,13 +208,15 @@ define(['angular', 'jquery'], function(angular, $) {
};

// no caching... request from the server
return $http.get(SERVICE_LOC.context + SERVICE_LOC.layout)
return $http.get(
SERVICE_LOC.context + SERVICE_LOC.layout, {cache: true} )
.then(successFn, errorFn);
});
};

var getApp = function(fname) {
return $http.get(SERVICE_LOC.base + 'portlet/' +fname + '.json')
return $http.get(SERVICE_LOC.base + 'portlet/' +fname + '.json',
{cache: true})
.then(
function(result) {
return result;
Expand Down Expand Up @@ -335,7 +338,7 @@ define(['angular', 'jquery'], function(angular, $) {
// run that through an RSS to JSON converter.
// Whereas this hack repurposes existing configuration for (3)
// to do (1).
return $http.get(feedURL);
return $http.get(feedURL, {cache: true});
};

return {
Expand Down
4 changes: 2 additions & 2 deletions web/src/main/webapp/my-app/marketplace/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ define(['angular', 'jquery'], function(angular, $) {

var getUserRating = function(fname) {
return $http.get(SERVICE_LOC.base + SERVICE_LOC.marketplace.base +
fname + '/getRating')
fname + '/getRating', {cache: true})
.then(function(result) {
return result.data.rating;
});
Expand Down Expand Up @@ -305,7 +305,7 @@ define(['angular', 'jquery'], function(angular, $) {
return $http.get(
SERVICE_LOC.base +
SERVICE_LOC.marketplace.base + fname +
'/ratings')
'/ratings', {cache: true})
.then(function(result) {
return result.data.ratings;
});
Expand Down
6 changes: 4 additions & 2 deletions web/src/main/webapp/my-app/search/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ define(['angular', 'jquery'], function(angular, $) {
return getGoogleSearchURL().then(function(googleSearchURL) {
return $q(function(resolve, reject) {
if (googleSearchURL) {
return $http.get(googleSearchURL + '&q=' + term).then(
return $http.get(googleSearchURL + '&q=' + term,
{cache: true}).then(
function(response) {
var data = {
results: null,
Expand Down Expand Up @@ -327,7 +328,8 @@ define(['angular', 'jquery'], function(angular, $) {
return getDirectorySearchURL().then(function(searchDirectoryURL) {
return $q(function(resolve, reject) {
if (searchDirectoryURL) {
return $http.get(searchDirectoryURL + '/?name=' + term).then(
return $http.get(searchDirectoryURL + '/?name=' + term,
{cache: true}).then(
function(response) {
return resolve(response.data);
},
Expand Down

0 comments on commit 9b908a8

Please sign in to comment.