updates play to read output from build dir and serve content inline for serveAsset action. sets the rootURL for Ember to assets on prod. overrides ESA to redirect to / rather than default rootURL for an environment.

This commit is contained in:
Seyi Adebajo 2017-04-07 09:11:40 -07:00 committed by Mars Lan
parent ae9162aa86
commit 12f2bc9ec5
4 changed files with 29 additions and 12 deletions

View File

@ -41,13 +41,18 @@ public class Application extends Controller
private static String PIWIK_SITE_ID = "tracking.piwik.siteid";
/**
* Serves the index view for any given path
* Serves the build output index.html for any given path
* @param path takes a path string, which essentially is ignored
* routing is managed client side
* @return {Result}
* @return {Result} build output index.html resource
*/
public static Result serveAsset(String path) {
return ok(index.render());
// Get the build output Html file
java.io.File indexHtml = new java.io.File("build/assets/index.html");
// Sets the Content-Disposition to inline to indicate that the browser should
// not treat this as an attachment to be downloaded
response().setHeader("Content-Disposition", "inline");
return ok(indexHtml);
}
public static Result healthcheck()

View File

@ -6,7 +6,8 @@ const {
Route,
run,
get,
inject: { service }
inject: { service },
testing,
} = Ember;
export default Route.extend(ApplicationRouteMixin, {
@ -30,6 +31,19 @@ export default Route.extend(ApplicationRouteMixin, {
this._loadCurrentUser();
},
/**
* __It reloads the Ember.js application__ by redirecting the browser
* to the application's root URL so that all in-memory data (such as Ember
* Data stores etc.) gets cleared.
* @override ApplicationRouteMixin.sessionInvalidated
* @link https://github.com/simplabs/ember-simple-auth/issues/1048
*/
sessionInvalidated() {
if (!testing) {
window.location.replace('/');
}
},
/**
* Internal method to invoke the currentUser service's load method
* If an exception occurs during the load for the current user,

View File

@ -69,13 +69,11 @@ const ldapResolver = (userNameQuery, syncResults, asyncResults) => {
* @param {String} userName the unique userName
* @return {Promise.<TResult|null>} resolves with the userEntity or null otherwise
*/
const getPartyEntityWithUserName = userName => {
return getLDAPUsers()
.then(
({ userEntities }) => userEntities.find(({ label }) => label === userName) ||
null
);
};
const getPartyEntityWithUserName = userName => getLDAPUsers()
.then(
({ userEntities }) => userEntities.find(({ label }) => label === userName) ||
null
);
export default Service.extend({
getPartyEntityWithUserName,

View File

@ -61,7 +61,7 @@ module.exports = function(environment) {
}
if (environment === 'production') {
ENV.rootURL = '/assets';
}
return ENV;