diff --git a/web/app/controllers/Application.java b/web/app/controllers/Application.java index 5fc0edf989..fe6b943889 100644 --- a/web/app/controllers/Application.java +++ b/web/app/controllers/Application.java @@ -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() diff --git a/wherehows-web/app/routes/application.js b/wherehows-web/app/routes/application.js index c237ad12eb..73b0909944 100644 --- a/wherehows-web/app/routes/application.js +++ b/wherehows-web/app/routes/application.js @@ -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, diff --git a/wherehows-web/app/services/user-lookup.js b/wherehows-web/app/services/user-lookup.js index 8b252a9e03..b1e9a8c5cb 100644 --- a/wherehows-web/app/services/user-lookup.js +++ b/wherehows-web/app/services/user-lookup.js @@ -69,13 +69,11 @@ const ldapResolver = (userNameQuery, syncResults, asyncResults) => { * @param {String} userName the unique userName * @return {Promise.} 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, diff --git a/wherehows-web/config/environment.js b/wherehows-web/config/environment.js index b26f2a3ef2..7392630a4e 100644 --- a/wherehows-web/config/environment.js +++ b/wherehows-web/config/environment.js @@ -61,7 +61,7 @@ module.exports = function(environment) { } if (environment === 'production') { - + ENV.rootURL = '/assets'; } return ENV;