make ODE API endpoint configurable and set a smart default.
Project: http://git-wip-us.apache.org/repos/asf/ode-console/repo Commit: http://git-wip-us.apache.org/repos/asf/ode-console/commit/b39327bd Tree: http://git-wip-us.apache.org/repos/asf/ode-console/tree/b39327bd Diff: http://git-wip-us.apache.org/repos/asf/ode-console/diff/b39327bd Branch: refs/heads/master Commit: b39327bdca78172e413d9ecca5f07875aacb0b9b Parents: cd3903b Author: Tammo van Lessen <[email protected]> Authored: Wed Oct 19 14:30:25 2016 +0200 Committer: Tammo van Lessen <[email protected]> Committed: Wed Oct 19 14:38:47 2016 +0200 ---------------------------------------------------------------------- src/app/index.js | 23 +++++++++++++---------- src/index.html | 6 ++++++ 2 files changed, 19 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode-console/blob/b39327bd/src/app/index.js ---------------------------------------------------------------------- diff --git a/src/app/index.js b/src/app/index.js index 5a5a46c..173a124 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -19,15 +19,18 @@ /*jslint browser: true*/ /*global vkbeautify:false */ +/*global ApacheOdeConsole:true */ 'use strict'; +// prepopulate endpoint if not overridden +ApacheOdeConsole.endpoint = ApacheOdeConsole.endpoint || window.location.protocol + '//' + window.location.host + window.location.pathname; +ApacheOdeConsole.endpoint = ApacheOdeConsole.endpoint.replace(/\/$/, ''); + var underscore = angular.module('underscore', []); underscore.factory('_', function() { return window._; -}); - -var rootURI = window.location.toString().split('ode')[0]; +}); angular.module('odeConsole', ['ngAnimate', 'ngSanitize', 'ngRoute', 'ui.bootstrap', 'ngToast', 'smart-table', 'xml', 'angularMoment', 'underscore', 'angular-loading-bar', 'ui.ace', 'naif.base64']) .config(function ($httpProvider) { @@ -62,10 +65,10 @@ angular.module('odeConsole', ['ngAnimate', 'ngSanitize', 'ngRoute', 'ui.bootstra redirectTo: '/' }); }) - .constant('IMAPI_ENDPOINT', rootURI+'ode/processes/InstanceManagement') - .constant('PMAPI_ENDPOINT', rootURI+'ode/processes/ProcessManagement') - .constant('DSAPI_ENDPOINT', rootURI+'ode/processes/DeploymentService') - .constant('POLLING_INTERVAL', '0') + .constant('IMAPI_ENDPOINT', ApacheOdeConsole.endpoint + '/processes/InstanceManagement') + .constant('PMAPI_ENDPOINT', ApacheOdeConsole.endpoint + '/processes/ProcessManagement') + .constant('DSAPI_ENDPOINT', ApacheOdeConsole.endpoint + '/processes/DeploymentService') + .constant('POLLING_INTERVAL', '10000') .filter('escape', function() { return window.encodeURIComponent; }) http://git-wip-us.apache.org/repos/asf/ode-console/blob/b39327bd/src/index.html ---------------------------------------------------------------------- diff --git a/src/index.html b/src/index.html index 9332de9..bca3aaa 100644 --- a/src/index.html +++ b/src/index.html @@ -33,6 +33,12 @@ <div ng-view></div> + <script> + /** configure ODE console here: */ + var ApacheOdeConsole = { + endpoint: '' // put ODE's root URL here, e.g. "http://myhost:myport/ode" -- defaults to host/path opened in the browser. + } + </script> <!-- build:js scripts/vendor.js --> <!-- bower:js -->
