mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Merge pull request #344 from weaveworks/relative-paths
Relative paths for all API URLs
This commit is contained in:
4309
app/static.go
4309
app/static.go
File diff suppressed because it is too large
Load Diff
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user