Repository: aurora Updated Branches: refs/heads/master 705f25611 -> 3e239b48b
Add support for controlling API url in UI without modifying code. Reviewed at https://reviews.apache.org/r/63040/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/3e239b48 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/3e239b48 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/3e239b48 Branch: refs/heads/master Commit: 3e239b48becb9359850c7f016ba7ab67aa6a68bf Parents: 705f256 Author: David McLaughlin <[email protected]> Authored: Mon Oct 16 16:31:34 2017 -0700 Committer: David McLaughlin <[email protected]> Committed: Mon Oct 16 16:31:34 2017 -0700 ---------------------------------------------------------------------- ui/src/main/js/client/scheduler-client.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/3e239b48/ui/src/main/js/client/scheduler-client.js ---------------------------------------------------------------------- diff --git a/ui/src/main/js/client/scheduler-client.js b/ui/src/main/js/client/scheduler-client.js index 1c38108..1a82f20 100644 --- a/ui/src/main/js/client/scheduler-client.js +++ b/ui/src/main/js/client/scheduler-client.js @@ -1,5 +1,21 @@ +import { isNully } from 'utils/Common'; + +function getBaseUrl() { + // Power feature: load a different Scheduler URL from local storage to test against live APIs. + // + // In your browser console: + // window.localStorage.apiUrl = 'http://myauroracluster.com'; + // + // To remove the item: + // window.localStorage.removeItem('apiUrl') + if (window && window.localStorage) { + return isNully(window.localStorage.apiUrl) ? '' : window.localStorage.apiUrl; + } + return ''; +} + function makeClient() { - const transport = new Thrift.Transport('/api'); + const transport = new Thrift.Transport(`${getBaseUrl()}/api`); const protocol = new Thrift.Protocol(transport); return new ReadOnlySchedulerClient(protocol); }
