mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-12 09:25:23 +00:00
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:
parent
ae9162aa86
commit
12f2bc9ec5
@ -41,13 +41,18 @@ public class Application extends Controller
|
|||||||
private static String PIWIK_SITE_ID = "tracking.piwik.siteid";
|
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
|
* @param path takes a path string, which essentially is ignored
|
||||||
* routing is managed client side
|
* routing is managed client side
|
||||||
* @return {Result}
|
* @return {Result} build output index.html resource
|
||||||
*/
|
*/
|
||||||
public static Result serveAsset(String path) {
|
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()
|
public static Result healthcheck()
|
||||||
|
@ -6,7 +6,8 @@ const {
|
|||||||
Route,
|
Route,
|
||||||
run,
|
run,
|
||||||
get,
|
get,
|
||||||
inject: { service }
|
inject: { service },
|
||||||
|
testing,
|
||||||
} = Ember;
|
} = Ember;
|
||||||
|
|
||||||
export default Route.extend(ApplicationRouteMixin, {
|
export default Route.extend(ApplicationRouteMixin, {
|
||||||
@ -30,6 +31,19 @@ export default Route.extend(ApplicationRouteMixin, {
|
|||||||
this._loadCurrentUser();
|
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
|
* Internal method to invoke the currentUser service's load method
|
||||||
* If an exception occurs during the load for the current user,
|
* If an exception occurs during the load for the current user,
|
||||||
|
@ -69,13 +69,11 @@ const ldapResolver = (userNameQuery, syncResults, asyncResults) => {
|
|||||||
* @param {String} userName the unique userName
|
* @param {String} userName the unique userName
|
||||||
* @return {Promise.<TResult|null>} resolves with the userEntity or null otherwise
|
* @return {Promise.<TResult|null>} resolves with the userEntity or null otherwise
|
||||||
*/
|
*/
|
||||||
const getPartyEntityWithUserName = userName => {
|
const getPartyEntityWithUserName = userName => getLDAPUsers()
|
||||||
return getLDAPUsers()
|
.then(
|
||||||
.then(
|
({ userEntities }) => userEntities.find(({ label }) => label === userName) ||
|
||||||
({ userEntities }) => userEntities.find(({ label }) => label === userName) ||
|
null
|
||||||
null
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Service.extend({
|
export default Service.extend({
|
||||||
getPartyEntityWithUserName,
|
getPartyEntityWithUserName,
|
||||||
|
@ -61,7 +61,7 @@ module.exports = function(environment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'production') {
|
if (environment === 'production') {
|
||||||
|
ENV.rootURL = '/assets';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user