diff --git a/CHANGELOG.md b/CHANGELOG.md index cbae73f4fa..6f1ded5952 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,6 @@ -## v1.3.4.0 [unreleased] - +## v1.3.3.1 [2017-06-20] ### Bug Fixes -### Features -### UI Improvements +1. [#1642](https://github.com/influxdata/chronograf/pull/1642): Do not prefix basepath to external link for news feed ## v1.3.3.0 [2017-06-19] diff --git a/ui/src/status/apis/index.js b/ui/src/status/apis/index.js index 984f9b08da..595e658c03 100644 --- a/ui/src/status/apis/index.js +++ b/ui/src/status/apis/index.js @@ -1,10 +1,13 @@ import AJAX from 'utils/ajax' export const fetchJSONFeed = url => - AJAX({ - method: 'GET', - url, - // For explanation of why this header makes this work: - // https://stackoverflow.com/questions/22968406/how-to-skip-the-options-preflight-request-in-angularjs - headers: {'Content-Type': 'text/plain; charset=UTF-8'}, - }) + AJAX( + { + method: 'GET', + url, + // For explanation of why this header makes this work: + // https://stackoverflow.com/questions/22968406/how-to-skip-the-options-preflight-request-in-angularjs + headers: {'Content-Type': 'text/plain; charset=UTF-8'}, + }, + true // don't prefix route of external link with basepath + ) diff --git a/ui/src/utils/ajax.js b/ui/src/utils/ajax.js index 409e6dc280..99c44ab761 100644 --- a/ui/src/utils/ajax.js +++ b/ui/src/utils/ajax.js @@ -2,6 +2,13 @@ import axios from 'axios' let links +// do not prefix route with basepath, ex. for external links +const addBasepath = (url, excludeBasepath) => { + const basepath = window.basepath || '' + + return excludeBasepath ? url : `${basepath}${url}` +} + const generateResponseWithLinks = (response, {auth, logout, external}) => ({ ...response, auth: {links: auth}, @@ -9,24 +16,18 @@ const generateResponseWithLinks = (response, {auth, logout, external}) => ({ external, }) -const AJAX = async ({ - url, - resource, - id, - method = 'GET', - data = {}, - params = {}, - headers = {}, -}) => { +const AJAX = async ( + {url, resource, id, method = 'GET', data = {}, params = {}, headers = {}}, + excludeBasepath +) => { try { - const basepath = window.basepath || '' let response - url = `${basepath}${url}` + url = addBasepath(url, excludeBasepath) if (!links) { const linksRes = (response = await axios({ - url: `${basepath}/chronograf/v1`, + url: addBasepath('/chronograf/v1', excludeBasepath), method: 'GET', })) links = linksRes.data @@ -34,8 +35,8 @@ const AJAX = async ({ if (resource) { url = id - ? `${basepath}${links[resource]}/${id}` - : `${basepath}${links[resource]}` + ? addBasepath(`${links[resource]}/${id}`, excludeBasepath) + : addBasepath(`${links[resource]}`, excludeBasepath) } response = await axios({