Merge pull request #344 from weaveworks/relative-paths

Relative paths for all API URLs
This commit is contained in:
Tom Wilkie
2015-08-11 10:57:47 +01:00
2 changed files with 2193 additions and 2126 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ const reqwest = require('reqwest');
const AppActions = require('../actions/app-actions');
const WS_URL = window.WS_URL || 'ws://' + location.host;
const WS_URL = window.WS_URL || 'ws://' + location.host + location.pathname.replace(/\/$/, '');
const apiTimerInterval = 10000;
@@ -52,9 +52,11 @@ function createWebsocket(topologyUrl) {
currentUrl = topologyUrl;
}
/* keep URLs relative */
function getTopologies() {
clearTimeout(topologyTimer);
const url = '/api/topology';
const url = 'api/topology';
reqwest({
url: url,
success: function(res) {
@@ -71,7 +73,7 @@ function getTopologies() {
function getNodeDetails(topologyUrl, nodeId) {
if (topologyUrl && nodeId) {
const url = [topologyUrl, encodeURIComponent(nodeId)].join('/');
const url = [topologyUrl, encodeURIComponent(nodeId)].join('/').substr(1);
reqwest({
url: url,
success: function(res) {
@@ -87,7 +89,7 @@ function getNodeDetails(topologyUrl, nodeId) {
function getApiDetails() {
clearTimeout(apiDetailsTimer);
const url = '/api';
const url = 'api';
reqwest({
url: url,
success: function(res) {