diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-03-29 13:41:47 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-03-31 13:09:07 +0200 |
commit | 3142e872bcfa1eba2940efa4e4b45612bfc1dd64 (patch) | |
tree | b4c75819c85e0729d55fccd76660bcee0f8a068b /server/sonar-web/src | |
parent | 491644917a5ebb44429ef45ee1885ed9728daf56 (diff) | |
download | sonarqube-3142e872bcfa1eba2940efa4e4b45612bfc1dd64.tar.gz sonarqube-3142e872bcfa1eba2940efa4e4b45612bfc1dd64.zip |
SONAR-7494 Web: Reintroduce the web app context
Diffstat (limited to 'server/sonar-web/src')
213 files changed, 451 insertions, 450 deletions
diff --git a/server/sonar-web/src/main/js/api/ce.js b/server/sonar-web/src/main/js/api/ce.js index 3209ac3d0d7..e46eb236026 100644 --- a/server/sonar-web/src/main/js/api/ce.js +++ b/server/sonar-web/src/main/js/api/ce.js @@ -21,22 +21,22 @@ import $ from 'jquery'; import { getJSON, post } from '../helpers/request.js'; export function getQueue (data) { - const url = '/api/ce/queue'; + const url = window.baseUrl + '/api/ce/queue'; return $.get(url, data); } export function getActivity (data) { - const url = '/api/ce/activity'; + const url = window.baseUrl + '/api/ce/activity'; return $.get(url, data); } export function getTask (id) { - const url = '/api/ce/task'; + const url = window.baseUrl + '/api/ce/task'; return getJSON(url, { id }).then(r => r.task); } export function cancelTask (id) { - const url = '/api/ce/cancel'; + const url = window.baseUrl + '/api/ce/cancel'; return post(url, { id }).then( getTask.bind(null, id), getTask.bind(null, id) @@ -44,17 +44,17 @@ export function cancelTask (id) { } export function cancelAllTasks () { - const url = '/api/ce/cancel_all'; + const url = window.baseUrl + '/api/ce/cancel_all'; return post(url); } export function getTasksForComponent (componentId) { - const url = '/api/ce/component'; + const url = window.baseUrl + '/api/ce/component'; const data = { componentId }; return new Promise(resolve => $.get(url, data).done(resolve)); } export function getTypes () { - const url = '/api/ce/task_types'; + const url = window.baseUrl + '/api/ce/task_types'; return getJSON(url).then(r => r.taskTypes); } diff --git a/server/sonar-web/src/main/js/api/components.js b/server/sonar-web/src/main/js/api/components.js index b77f6a684ce..a4ce0bcaf55 100644 --- a/server/sonar-web/src/main/js/api/components.js +++ b/server/sonar-web/src/main/js/api/components.js @@ -21,32 +21,32 @@ import { getJSON, postJSON, post } from '../helpers/request.js'; export function getComponents (data) { - const url = '/api/components/search'; + const url = window.baseUrl + '/api/components/search'; return getJSON(url, data); } export function getProvisioned (data) { - const url = '/api/projects/provisioned'; + const url = window.baseUrl + '/api/projects/provisioned'; return getJSON(url, data); } export function getGhosts (data) { - const url = '/api/projects/ghosts'; + const url = window.baseUrl + '/api/projects/ghosts'; return getJSON(url, data); } export function deleteComponents (data) { - const url = '/api/projects/bulk_delete'; + const url = window.baseUrl + '/api/projects/bulk_delete'; return post(url, data); } export function createProject (data) { - const url = '/api/projects/create'; + const url = window.baseUrl + '/api/projects/create'; return postJSON(url, data); } export function getComponentTree (strategy, componentKey, metrics = [], additional = {}) { - const url = '/api/measures/component_tree'; + const url = window.baseUrl + '/api/measures/component_tree'; const data = Object.assign({}, additional, { baseComponentKey: componentKey, metricKeys: metrics.join(','), @@ -64,25 +64,25 @@ export function getComponentLeaves (componentKey, metrics, additional) { } export function getComponent (componentKey, metrics = []) { - const url = '/api/measures/component'; + const url = window.baseUrl + '/api/measures/component'; const data = { componentKey, metricKeys: metrics.join(',') }; return getJSON(url, data).then(r => r.component); } export function getTree (baseComponentKey, options = {}) { - const url = '/api/components/tree'; + const url = window.baseUrl + '/api/components/tree'; const data = Object.assign({}, options, { baseComponentKey }); return getJSON(url, data); } export function getParents ({ id, key }) { - const url = '/api/components/show'; + const url = window.baseUrl + '/api/components/show'; const data = id ? { id } : { key }; return getJSON(url, data).then(r => r.ancestors); } export function getBreadcrumbs ({ id, key }) { - const url = '/api/components/show'; + const url = window.baseUrl + '/api/components/show'; const data = id ? { id } : { key }; return getJSON(url, data).then(r => { const reversedAncestors = [...r.ancestors].reverse(); @@ -91,7 +91,7 @@ export function getBreadcrumbs ({ id, key }) { } export function getProjectsWithInternalId (query) { - const url = '/api/resources/search'; + const url = window.baseUrl + '/api/resources/search'; const data = { f: 's2', q: 'TRK', diff --git a/server/sonar-web/src/main/js/api/events.js b/server/sonar-web/src/main/js/api/events.js index 8922faa2021..1a4b0bdb473 100644 --- a/server/sonar-web/src/main/js/api/events.js +++ b/server/sonar-web/src/main/js/api/events.js @@ -27,7 +27,7 @@ import { getJSON } from '../helpers/request.js'; * @returns {Promise} */ export function getEvents (componentKey, categories) { - const url = '/api/events'; + const url = window.baseUrl + '/api/events'; const data = { resource: componentKey }; if (categories) { data.categories = categories; diff --git a/server/sonar-web/src/main/js/api/issue-filters.js b/server/sonar-web/src/main/js/api/issue-filters.js index f2bd4226eab..1e8c872dc7d 100644 --- a/server/sonar-web/src/main/js/api/issue-filters.js +++ b/server/sonar-web/src/main/js/api/issue-filters.js @@ -20,7 +20,7 @@ import { post } from '../helpers/request.js'; export function toggleIssueFilter (id) { - const url = '/issues/toggle_fav'; + const url = window.baseUrl + '/issues/toggle_fav'; const data = { id }; return post(url, data); } diff --git a/server/sonar-web/src/main/js/api/issues.js b/server/sonar-web/src/main/js/api/issues.js index 89486fcd1b4..7e2a70ad440 100644 --- a/server/sonar-web/src/main/js/api/issues.js +++ b/server/sonar-web/src/main/js/api/issues.js @@ -23,7 +23,7 @@ import { getJSON } from '../helpers/request.js'; export function getFacets (query, facets) { - const url = '/api/issues/search'; + const url = window.baseUrl + '/api/issues/search'; const data = _.extend({}, query, { facets: facets.join(), ps: 1, additionalFields: '_all' }); return getJSON(url, data).then(r => { return { facets: r.facets, response: r }; @@ -62,7 +62,7 @@ export function getAssignees (query) { export function getIssuesCount (query) { - const url = '/api/issues/search'; + const url = window.baseUrl + '/api/issues/search'; const data = _.extend({}, query, { ps: 1, facetMode: 'debt' }); return getJSON(url, data).then(r => { return { issues: r.total, debt: r.debtTotal }; @@ -70,6 +70,6 @@ export function getIssuesCount (query) { } export function getIssueFilters () { - const url = '/api/issue_filters/search'; + const url = window.baseUrl + '/api/issue_filters/search'; return getJSON(url).then(r => r.issueFilters); } diff --git a/server/sonar-web/src/main/js/api/languages.js b/server/sonar-web/src/main/js/api/languages.js index 4b3a00b764d..e1176b8527b 100644 --- a/server/sonar-web/src/main/js/api/languages.js +++ b/server/sonar-web/src/main/js/api/languages.js @@ -20,6 +20,6 @@ import { getJSON } from '../helpers/request.js'; export function getLanguages () { - const url = '/api/languages/list'; + const url = window.baseUrl + '/api/languages/list'; return getJSON(url).then(r => r.languages); } diff --git a/server/sonar-web/src/main/js/api/measure-filters.js b/server/sonar-web/src/main/js/api/measure-filters.js index ed64ba09db7..67699863d9a 100644 --- a/server/sonar-web/src/main/js/api/measure-filters.js +++ b/server/sonar-web/src/main/js/api/measure-filters.js @@ -20,7 +20,7 @@ import { post } from '../helpers/request.js'; export function toggleMeasureFilter (id) { - const url = '/measures/toggle_fav'; + const url = window.baseUrl + '/measures/toggle_fav'; const data = { id }; return post(url, data); } diff --git a/server/sonar-web/src/main/js/api/measures.js b/server/sonar-web/src/main/js/api/measures.js index 4676b338b53..1ebc1e3e225 100644 --- a/server/sonar-web/src/main/js/api/measures.js +++ b/server/sonar-web/src/main/js/api/measures.js @@ -21,13 +21,13 @@ import { getJSON } from '../helpers/request.js'; export function getMeasures (componentKey, metrics) { - const url = '/api/measures/component'; + const url = window.baseUrl + '/api/measures/component'; const data = { componentKey, metricKeys: metrics.join(',') }; return getJSON(url, data).then(r => r.component.measures); } export function getMeasuresAndMeta (componentKey, metrics, additional = {}) { - const url = '/api/measures/component'; + const url = window.baseUrl + '/api/measures/component'; const data = Object.assign({}, additional, { componentKey, metricKeys: metrics.join(',') diff --git a/server/sonar-web/src/main/js/api/metrics.js b/server/sonar-web/src/main/js/api/metrics.js index 45f2500288c..51118918c00 100644 --- a/server/sonar-web/src/main/js/api/metrics.js +++ b/server/sonar-web/src/main/js/api/metrics.js @@ -20,7 +20,7 @@ import { getJSON } from '../helpers/request.js'; export function getMetrics () { - const url = '/api/metrics/search'; + const url = window.baseUrl + '/api/metrics/search'; const data = { ps: 9999 }; return getJSON(url, data).then(r => r.metrics); } diff --git a/server/sonar-web/src/main/js/api/nav.js b/server/sonar-web/src/main/js/api/nav.js index 424c0a68536..1aeafc17a6f 100644 --- a/server/sonar-web/src/main/js/api/nav.js +++ b/server/sonar-web/src/main/js/api/nav.js @@ -20,17 +20,17 @@ import { getJSON } from '../helpers/request.js'; export function getGlobalNavigation () { - const url = '/api/navigation/global'; + const url = window.baseUrl + '/api/navigation/global'; return getJSON(url); } export function getComponentNavigation (componentKey) { - const url = '/api/navigation/component'; + const url = window.baseUrl + '/api/navigation/component'; const data = { componentKey }; return getJSON(url, data); } export function getSettingsNavigation () { - const url = '/api/navigation/settings'; + const url = window.baseUrl + '/api/navigation/settings'; return getJSON(url); } diff --git a/server/sonar-web/src/main/js/api/permissions.js b/server/sonar-web/src/main/js/api/permissions.js index 4eed0a0deea..533120e4df8 100644 --- a/server/sonar-web/src/main/js/api/permissions.js +++ b/server/sonar-web/src/main/js/api/permissions.js @@ -30,7 +30,7 @@ function typeError (method, message) { export function getUsers (data) { - const url = '/api/permissions/users'; + const url = window.baseUrl + '/api/permissions/users'; return request({ type: 'GET', url, data }); } @@ -43,7 +43,7 @@ export function grantToUser (permission, user, project) { return typeError('grantToUser', 'please provide user login'); } - const url = '/api/permissions/add_user'; + const url = window.baseUrl + '/api/permissions/add_user'; const data = { permission, login: user }; if (project) { data.projectId = project; @@ -60,7 +60,7 @@ export function revokeFromUser (permission, user, project) { return typeError('revokeFromUser', 'please provide user login'); } - const url = '/api/permissions/remove_user'; + const url = window.baseUrl + '/api/permissions/remove_user'; const data = { permission, login: user }; if (project) { data.projectId = project; @@ -70,7 +70,7 @@ export function revokeFromUser (permission, user, project) { export function getGroups (data) { - const url = '/api/permissions/groups'; + const url = window.baseUrl + '/api/permissions/groups'; return request({ type: 'GET', url, data }); } @@ -83,7 +83,7 @@ export function grantToGroup (permission, group, project) { return typeError('grantToGroup', 'please provide group name'); } - const url = '/api/permissions/add_group'; + const url = window.baseUrl + '/api/permissions/add_group'; const data = { permission, groupName: group }; if (project) { data.projectId = project; @@ -100,7 +100,7 @@ export function revokeFromGroup (permission, group, project) { return typeError('revokeFromGroup', 'please provide group name'); } - const url = '/api/permissions/remove_group'; + const url = window.baseUrl + '/api/permissions/remove_group'; const data = { permission, groupName: group }; if (project) { data.projectId = project; @@ -110,7 +110,7 @@ export function revokeFromGroup (permission, group, project) { export function getPermissionTemplates (query) { - const url = '/api/permissions/search_templates'; + const url = window.baseUrl + '/api/permissions/search_templates'; const data = { }; if (query) { data.q = query; @@ -120,18 +120,18 @@ export function getPermissionTemplates (query) { export function createPermissionTemplate (options) { - const url = '/api/permissions/create_template'; + const url = window.baseUrl + '/api/permissions/create_template'; return request(_.extend({ type: 'POST', url }, options)); } export function updatePermissionTemplate (options) { - const url = '/api/permissions/update_template'; + const url = window.baseUrl + '/api/permissions/update_template'; return request(_.extend({ type: 'POST', url }, options)); } export function deletePermissionTemplate (options) { - const url = '/api/permissions/delete_template'; + const url = window.baseUrl + '/api/permissions/delete_template'; return request(_.extend({ type: 'POST', url }, options)); } @@ -141,13 +141,13 @@ export function setDefaultPermissionTemplate (template, qualifier) { return typeError('setDefaultPermissionTemplate', 'please provide permission template ID'); } - const url = '/api/permissions/set_default_template'; + const url = window.baseUrl + '/api/permissions/set_default_template'; const data = { templateId: template, qualifier }; return request({ type: 'POST', url, data }); } export function applyTemplateToProject(options) { - const url = '/api/permissions/apply_template'; + const url = window.baseUrl + '/api/permissions/apply_template'; return request(_.extend({ type: 'POST', url }, options)); } diff --git a/server/sonar-web/src/main/js/api/quality-gates.js b/server/sonar-web/src/main/js/api/quality-gates.js index a32b0295d1d..e6567a918c1 100644 --- a/server/sonar-web/src/main/js/api/quality-gates.js +++ b/server/sonar-web/src/main/js/api/quality-gates.js @@ -20,13 +20,13 @@ import { getJSON, post, postJSON } from '../helpers/request'; export function fetchQualityGatesAppDetails () { - const url = '/api/qualitygates/app'; + const url = window.baseUrl + '/api/qualitygates/app'; return getJSON(url); } export function fetchQualityGates () { - const url = '/api/qualitygates/list'; + const url = window.baseUrl + '/api/qualitygates/list'; return getJSON(url).then(r => r.qualitygates.map(qualityGate => { return { @@ -37,51 +37,51 @@ export function fetchQualityGates () { } export function fetchQualityGate (id) { - const url = '/api/qualitygates/show'; + const url = window.baseUrl + '/api/qualitygates/show'; return getJSON(url, { id }); } export function createQualityGate (name) { - const url = '/api/qualitygates/create'; + const url = window.baseUrl + '/api/qualitygates/create'; return postJSON(url, { name }); } export function deleteQualityGate (id) { - const url = '/api/qualitygates/destroy'; + const url = window.baseUrl + '/api/qualitygates/destroy'; return post(url, { id }); } export function renameQualityGate (id, name) { - const url = '/api/qualitygates/rename'; + const url = window.baseUrl + '/api/qualitygates/rename'; return post(url, { id, name }); } export function copyQualityGate (id, name) { - const url = '/api/qualitygates/copy'; + const url = window.baseUrl + '/api/qualitygates/copy'; return postJSON(url, { id, name }); } export function setQualityGateAsDefault (id) { - const url = '/api/qualitygates/set_as_default'; + const url = window.baseUrl + '/api/qualitygates/set_as_default'; return post(url, { id }); } export function unsetQualityGateAsDefault (id) { - const url = '/api/qualitygates/unset_default'; + const url = window.baseUrl + '/api/qualitygates/unset_default'; return post(url, { id }); } export function createCondition (gateId, condition) { - const url = '/api/qualitygates/create_condition'; + const url = window.baseUrl + '/api/qualitygates/create_condition'; return postJSON(url, { ...condition, gateId }); } export function updateCondition (condition) { - const url = '/api/qualitygates/update_condition'; + const url = window.baseUrl + '/api/qualitygates/update_condition'; return postJSON(url, { ...condition }); } export function deleteCondition (id) { - const url = '/api/qualitygates/delete_condition'; + const url = window.baseUrl + '/api/qualitygates/delete_condition'; return post(url, { id }); } diff --git a/server/sonar-web/src/main/js/api/quality-profiles.js b/server/sonar-web/src/main/js/api/quality-profiles.js index 3daf1e6f8f4..69ceca5bb50 100644 --- a/server/sonar-web/src/main/js/api/quality-profiles.js +++ b/server/sonar-web/src/main/js/api/quality-profiles.js @@ -20,7 +20,7 @@ import { checkStatus, parseJSON } from '../helpers/request'; export function createQualityProfile (data) { - const url = '/api/qualityprofiles/create'; + const url = window.baseUrl + '/api/qualityprofiles/create'; const options = { method: 'post', credentials: 'same-origin', diff --git a/server/sonar-web/src/main/js/api/system.js b/server/sonar-web/src/main/js/api/system.js index 13efcd502cc..25b52880f9b 100644 --- a/server/sonar-web/src/main/js/api/system.js +++ b/server/sonar-web/src/main/js/api/system.js @@ -20,23 +20,23 @@ import { getJSON, post } from '../helpers/request'; export function setLogLevel (level) { - const url = '/api/system/change_log_level'; + const url = window.baseUrl + '/api/system/change_log_level'; const data = { level }; return post(url, data); } export function getSystemInfo () { - const url = '/api/system/info'; + const url = window.baseUrl + '/api/system/info'; return getJSON(url); } export function getStatus () { - const url = '/api/system/status'; + const url = window.baseUrl + '/api/system/status'; return getJSON(url); } export function restart () { - const url = '/api/system/restart'; + const url = window.baseUrl + '/api/system/restart'; return post(url); } diff --git a/server/sonar-web/src/main/js/api/time-machine.js b/server/sonar-web/src/main/js/api/time-machine.js index adf44fdbcac..76af59dfb84 100644 --- a/server/sonar-web/src/main/js/api/time-machine.js +++ b/server/sonar-web/src/main/js/api/time-machine.js @@ -20,7 +20,7 @@ import { getJSON } from '../helpers/request.js'; export function getTimeMachineData (componentKey, metrics) { - const url = '/api/timemachine/index'; + const url = window.baseUrl + '/api/timemachine/index'; const data = { resource: componentKey, metrics }; return getJSON(url, data); } diff --git a/server/sonar-web/src/main/js/api/user-tokens.js b/server/sonar-web/src/main/js/api/user-tokens.js index e0d46231eae..218da22f2fe 100644 --- a/server/sonar-web/src/main/js/api/user-tokens.js +++ b/server/sonar-web/src/main/js/api/user-tokens.js @@ -26,7 +26,7 @@ import { getJSON, postJSON, post } from '../helpers/request.js'; * @returns {Promise} */ export function getTokens (login) { - const url = '/api/user_tokens/search'; + const url = window.baseUrl + '/api/user_tokens/search'; const data = { login }; return getJSON(url, data).then(r => r.userTokens); } @@ -39,7 +39,7 @@ export function getTokens (login) { * @returns {Promise} */ export function generateToken(userLogin, tokenName) { - const url = '/api/user_tokens/generate'; + const url = window.baseUrl + '/api/user_tokens/generate'; const data = { login: userLogin, name: tokenName }; return postJSON(url, data); } @@ -52,7 +52,7 @@ export function generateToken(userLogin, tokenName) { * @returns {Promise} */ export function revokeToken(userLogin, tokenName) { - const url = '/api/user_tokens/revoke'; + const url = window.baseUrl + '/api/user_tokens/revoke'; const data = { login: userLogin, name: tokenName }; return post(url, data); } diff --git a/server/sonar-web/src/main/js/api/users.js b/server/sonar-web/src/main/js/api/users.js index 6c00ea84945..0be56fada04 100644 --- a/server/sonar-web/src/main/js/api/users.js +++ b/server/sonar-web/src/main/js/api/users.js @@ -20,12 +20,12 @@ import { getJSON, post } from '../helpers/request.js'; export function getCurrentUser () { - const url = '/api/users/current'; + const url = window.baseUrl + '/api/users/current'; return getJSON(url); } export function changePassword (login, password, previousPassword) { - const url = '/api/users/change_password'; + const url = window.baseUrl + '/api/users/change_password'; const data = { login, password }; if (previousPassword != null) { diff --git a/server/sonar-web/src/main/js/api/web-api.js b/server/sonar-web/src/main/js/api/web-api.js index d7c2c734df3..a790121e2d8 100644 --- a/server/sonar-web/src/main/js/api/web-api.js +++ b/server/sonar-web/src/main/js/api/web-api.js @@ -20,7 +20,7 @@ import { getJSON } from '../helpers/request'; export function fetchWebApi (showInternal = true) { - const url = '/api/webservices/list'; + const url = window.baseUrl + '/api/webservices/list'; const data = { 'include_internals': showInternal }; return getJSON(url, data).then(r => r.webServices.map(domain => { @@ -31,7 +31,7 @@ export function fetchWebApi (showInternal = true) { } export function fetchResponseExample (domain, action) { - const url = '/api/webservices/response_example'; + const url = window.baseUrl + '/api/webservices/response_example'; const data = { controller: domain, action }; return getJSON(url, data); diff --git a/server/sonar-web/src/main/js/apps/account/app.js b/server/sonar-web/src/main/js/apps/account/app.js index 4494c4d3d65..e4643b9349c 100644 --- a/server/sonar-web/src/main/js/apps/account/app.js +++ b/server/sonar-web/src/main/js/apps/account/app.js @@ -36,7 +36,7 @@ window.sonarqube.appStarted.then(options => { const el = document.querySelector(options.el); const history = useRouterHistory(createHistory)({ - basename: '/account' + basename: window.baseUrl + '/account' }); const store = configureStore(); diff --git a/server/sonar-web/src/main/js/apps/account/components/FavoriteIssueFilters.js b/server/sonar-web/src/main/js/apps/account/components/FavoriteIssueFilters.js index af3baa5d0dd..3eb59fcc076 100644 --- a/server/sonar-web/src/main/js/apps/account/components/FavoriteIssueFilters.js +++ b/server/sonar-web/src/main/js/apps/account/components/FavoriteIssueFilters.js @@ -42,7 +42,7 @@ const FavoriteIssueFilters = ({ issueFilters }) => ( <FavoriteIssueFilter filter={f} favorite={true}/> </td> <td> - <a href={`/issues/search#id=${f.id}`}> + <a href={`${window.baseUrl}/issues/search#id=${f.id}`}> {f.name} </a> </td> @@ -52,7 +52,7 @@ const FavoriteIssueFilters = ({ issueFilters }) => ( </table> <div className="spacer-top small"> - <a href="/issues/manage">{translate('see_all')}</a> + <a href={`${window.baseUrl}/issues/manage`}>{translate('see_all')}</a> </div> </section> diff --git a/server/sonar-web/src/main/js/apps/account/components/FavoriteMeasureFilters.js b/server/sonar-web/src/main/js/apps/account/components/FavoriteMeasureFilters.js index 4bf9b26e79a..c9998d0eaca 100644 --- a/server/sonar-web/src/main/js/apps/account/components/FavoriteMeasureFilters.js +++ b/server/sonar-web/src/main/js/apps/account/components/FavoriteMeasureFilters.js @@ -42,7 +42,7 @@ const FavoriteMeasureFilters = ({ measureFilters }) => ( <FavoriteMeasureFilter filter={f} favorite={true}/> </td> <td> - <a href={`/measures/filter/${f.id}`}> + <a href={`${window.baseUrl}/measures/filter/${f.id}`}> {f.name} </a> </td> @@ -52,7 +52,7 @@ const FavoriteMeasureFilters = ({ measureFilters }) => ( </table> <div className="spacer-top small"> - <a href="/measures/manage">{translate('see_all')}</a> + <a href={`${window.baseUrl}/measures/manage`}>{translate('see_all')}</a> </div> </section> diff --git a/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js b/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js index a59d59a5585..673089bab6a 100644 --- a/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js +++ b/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js @@ -32,27 +32,27 @@ const BASE_QUERY = { resolved: false, assignees: '__me__' }; function getTotalUrl () { - return '/account/issues#resolved=false'; + return window.baseUrl + '/account/issues#resolved=false'; } function getToFixUrl () { - return '/account/issues#resolved=false|statuses=CONFIRMED'; + return window.baseUrl + '/account/issues#resolved=false|statuses=CONFIRMED'; } function getToReviewUrl () { - return '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED'); + return window.baseUrl + '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED'); } function getSeverityUrl (severity) { - return '/account/issues#resolved=false|severities=' + severity; + return window.baseUrl + '/account/issues#resolved=false|severities=' + severity; } function getProjectUrl (project) { - return '/account/issues#resolved=false|projectUuids=' + project; + return window.baseUrl + '/account/issues#resolved=false|projectUuids=' + project; } function getPeriodUrl (createdAfter, createdBefore) { - return `/account/issues#resolved=false|createdAfter=${createdAfter}|createdBefore=${createdBefore}`; + return window.baseUrl + `/account/issues#resolved=false|createdAfter=${createdAfter}|createdBefore=${createdBefore}`; } diff --git a/server/sonar-web/src/main/js/apps/account/components/Nav.js b/server/sonar-web/src/main/js/apps/account/components/Nav.js index de266f2b5da..a1fe74bfc0d 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Nav.js +++ b/server/sonar-web/src/main/js/apps/account/components/Nav.js @@ -36,8 +36,8 @@ const Nav = ({ user }) => ( </li> <li> <a - className={window.location.pathname === '/account/issues' && 'active'} - href="/account/issues"> + className={window.location.pathname === `${window.baseUrl}/account/issues` && 'active'} + href={`${window.baseUrl}/account/issues`}> {translate('issues.page')} </a> </li> diff --git a/server/sonar-web/src/main/js/apps/account/components/Notifications.js b/server/sonar-web/src/main/js/apps/account/components/Notifications.js index 5c1e5d020f6..8eb4e437afb 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Notifications.js +++ b/server/sonar-web/src/main/js/apps/account/components/Notifications.js @@ -31,7 +31,7 @@ export default function Notifications ({ globalNotifications, projectNotificatio <p className="big-spacer-bottom"> {translate('notification.dispatcher.information')} </p> - <form id="notif_form" method="post" action="/account/update_notifications"> + <form id="notif_form" method="post" action={`${window.baseUrl}/account/update_notifications`}> <div className="columns columns-overflow-visible"> <div className="column-half"> <GlobalNotifications diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskLogsLink.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskLogsLink.js index 1954e26d52f..2f5893e8bed 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskLogsLink.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskLogsLink.js @@ -21,7 +21,7 @@ import React from 'react'; import { translate } from '../../../helpers/l10n'; export default function TaskLogsLink ({ task }) { - const url = `/api/ce/logs?taskId=${task.id}`; + const url = `${window.baseUrl}/api/ce/logs?taskId=${task.id}`; return ( <a diff --git a/server/sonar-web/src/main/js/apps/coding-rules/app.js b/server/sonar-web/src/main/js/apps/coding-rules/app.js index 813d04b1af6..ea4adc1cf3f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/app.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/app.js @@ -77,7 +77,7 @@ const init = function () { Backbone.history.start(); }; -const appXHR = $.get('/api/rules/app').done(function (r) { +const appXHR = $.get(window.baseUrl + '/api/rules/app').done(function (r) { App.canWrite = r.canWrite; App.qualityProfiles = _.sortBy(r.qualityprofiles, ['name', 'lang']); App.languages = _.extend(r.languages, { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js index f998e58012f..196b11e8d10 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js @@ -59,7 +59,7 @@ export default ModalFormView.extend({ onFormSubmit () { ModalFormView.prototype.onFormSubmit.apply(this, arguments); - const url = `/api/qualityprofiles/${this.options.action}_rules`; + const url = `${window.baseUrl}/api/qualityprofiles/${this.options.action}_rules`; const options = _.extend({}, this.options.app.state.get('query'), { wsAction: this.options.action }); const profiles = this.$('#coding-rules-bulk-change-profile').val() || [this.options.param]; this.ui.messagesContainer.empty(); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/controller.js b/server/sonar-web/src/main/js/apps/coding-rules/controller.js index 3cfad3f2f3c..c872a21227d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/controller.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/controller.js @@ -60,7 +60,7 @@ export default Controller.extend({ this.hideDetails(firstPage); const that = this; - const url = '/api/rules/search'; + const url = window.baseUrl + '/api/rules/search'; const options = _.extend(this._searchParameters(), this.app.state.get('query')); return $.get(url, options).done(function (r) { const rules = that.app.list.parseRules(r); @@ -92,7 +92,7 @@ export default Controller.extend({ }, requestFacet (id) { - const url = '/api/rules/search'; + const url = window.baseUrl + '/api/rules/search'; const facet = this.app.facets.get(id); const options = _.extend({ facets: id, ps: 1 }, this.app.state.get('query')); return $.get(url, options).done(function (r) { @@ -112,7 +112,7 @@ export default Controller.extend({ getRuleDetails (rule) { const that = this; - const url = '/api/rules/show'; + const url = window.baseUrl + '/api/rules/show'; const options = { key: rule.id, actives: true diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js index 5902c89ee78..881625aa5b0 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js @@ -32,7 +32,7 @@ export default BaseFacet.extend({ }, getUrl () { - return ''; + return window.baseUrl; }, onRender () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js index 05c268aeb09..9af9562fff7 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js @@ -23,7 +23,7 @@ import CustomValuesFacet from './custom-values-facet'; export default CustomValuesFacet.extend({ getUrl () { - return '/api/languages/list'; + return window.baseUrl + '/api/languages/list'; }, prepareAjaxSearch () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js index 3c5fea1b300..76067f5b24c 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js @@ -23,7 +23,7 @@ import CustomValuesFacet from './custom-values-facet'; export default CustomValuesFacet.extend({ getUrl () { - return '/api/rules/repositories'; + return window.baseUrl + '/api/rules/repositories'; }, prepareAjaxSearch () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js index 210a73a9434..b672b3af9ba 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js @@ -22,7 +22,7 @@ import CustomValuesFacet from './custom-values-facet'; export default CustomValuesFacet.extend({ getUrl () { - return '/api/rules/tags'; + return window.baseUrl + '/api/rules/tags'; }, prepareAjaxSearch () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js index dc4665ee3a5..5566f70945d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js @@ -95,7 +95,7 @@ export default Marionette.LayoutView.extend({ fetchCustomRules () { const that = this; - const url = '/api/rules/search'; + const url = window.baseUrl + '/api/rules/search'; const options = { template_key: this.model.get('key'), f: 'name,severity,params' diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js index 853082f3234..b9ebae4d1a2 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js @@ -154,7 +154,7 @@ export default ModalFormView.extend({ sendRequest (action, options) { this.$('.alert').addClass('hidden'); const that = this; - const url = '/api/rules/' + action; + const url = window.baseUrl + '/api/rules/' + action; return $.ajax({ url, type: 'POST', diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js index 24a4854e98f..6e2907598f6 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js @@ -49,7 +49,7 @@ export default Marionette.ItemView.extend({ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { canWrite: this.options.app.canWrite, templateRule: this.options.templateRule, - permalink: '/coding_rules/#rule_key=' + encodeURIComponent(this.model.id) + permalink: window.baseUrl + '/coding_rules/#rule_key=' + encodeURIComponent(this.model.id) }); } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/delete-rule-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/delete-rule-view.js index bfeff19b91f..b0d344118f0 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/delete-rule-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/delete-rule-view.js @@ -28,7 +28,7 @@ export default ModalFormView.extend({ onFormSubmit() { ModalFormView.prototype.onFormSubmit.apply(this, arguments); - const url = '/api/rules/delete'; + const url = window.baseUrl + '/api/rules/delete'; const options = { key: this.model.id }; $.post(url, options).done(() => { this.destroy(); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js index 311fa010f5f..dce27670e4d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js @@ -99,7 +99,7 @@ export default ModalForm.extend({ return $.ajax({ type: 'POST', - url: '/api/qualityprofiles/activate_rule', + url: window.baseUrl + '/api/qualityprofiles/activate_rule', data: { severity, profile_key: profileKey, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js index 9c5c5df3bf8..49486712db8 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js @@ -64,7 +64,7 @@ export default Marionette.ItemView.extend({ this.ui.extendDescriptionForm.addClass('hidden'); return $.ajax({ type: 'POST', - url: '/api/rules/update', + url: window.baseUrl + '/api/rules/update', dataType: 'json', data: { key: this.model.get('key'), diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js index afd73aa6957..db19ac674c0 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js @@ -36,7 +36,7 @@ export default Marionette.ItemView.extend({ requestIssues () { const that = this; - const url = '/api/issues/search'; + const url = window.baseUrl + '/api/issues/search'; const options = { rules: this.model.id, resolved: false, @@ -61,7 +61,7 @@ export default Marionette.ItemView.extend({ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { total: this.total, projects: this.projects, - baseSearchUrl: '/issues/search#resolved=false|rules=' + encodeURIComponent(this.model.id) + baseSearchUrl: window.baseUrl + '/issues/search#resolved=false|rules=' + encodeURIComponent(this.model.id) }); } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js index a11699b561e..1a5e0507fe0 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js @@ -57,7 +57,7 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ }, requestTags () { - const url = '/api/rules/tags'; + const url = window.baseUrl + '/api/rules/tags'; return $.get(url); }, @@ -90,7 +90,7 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ const tags = this.ui.tagInput.val(); return $.ajax({ type: 'POST', - url: '/api/rules/update', + url: window.baseUrl + '/api/rules/update', data: { key: this.model.get('key'), tags @@ -107,7 +107,7 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { canWrite: this.options.app.canWrite, allTags: _.union(this.model.get('sysTags'), this.model.get('tags')), - permalink: '/coding_rules#rule_key=' + encodeURIComponent(this.model.id) + permalink: window.baseUrl + '/coding_rules#rule_key=' + encodeURIComponent(this.model.id) }); } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js index e30ed43fd77..a2dcd979655 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js @@ -75,7 +75,7 @@ export default Marionette.ItemView.extend({ yesHandler () { return $.ajax({ type: 'POST', - url: '/api/qualityprofiles/activate_rule', + url: window.baseUrl + '/api/qualityprofiles/activate_rule', data: { profile_key: that.model.get('qProfile'), rule_key: ruleKey, @@ -97,7 +97,7 @@ export default Marionette.ItemView.extend({ yesHandler () { return $.ajax({ type: 'POST', - url: '/api/qualityprofiles/deactivate_rule', + url: window.baseUrl + '/api/qualityprofiles/deactivate_rule', data: { profile_key: that.model.get('qProfile'), rule_key: ruleKey diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js index 37bda32771b..a965be731e3 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js @@ -99,7 +99,7 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ yesHandler () { return $.ajax({ type: 'POST', - url: '/api/qualityprofiles/deactivate_rule', + url: window.baseUrl + '/api/qualityprofiles/deactivate_rule', data: { profile_key: activation.qProfile, rule_key: ruleKey diff --git a/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js b/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js index 64524614f64..239b93c1ac8 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js +++ b/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js @@ -24,7 +24,7 @@ export default Backbone.Model.extend({ idAttribute: 'id', urlRoot () { - return '/api/custom_measures'; + return window.baseUrl + '/api/custom_measures'; }, sync (method, model, options) { diff --git a/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js b/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js index 7367c7fe437..fe06cc39c22 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js +++ b/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js @@ -29,7 +29,7 @@ export default Backbone.Collection.extend({ }, url () { - return '/api/custom_measures/search'; + return window.baseUrl + '/api/custom_measures/search'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js b/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js index eebc1249772..f74b578f772 100644 --- a/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js +++ b/server/sonar-web/src/main/js/apps/global-permissions/groups-view.js @@ -22,7 +22,7 @@ import Template from './templates/global-permissions-groups.hbs'; import '../../components/SelectList'; function getSearchUrl (permission, project) { - let url = '/api/permissions/groups?ps=100&permission=' + permission; + let url = window.baseUrl + '/api/permissions/groups?ps=100&permission=' + permission; if (project) { url = url + '&projectId=' + project; } @@ -52,8 +52,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: getSearchUrl(this.options.permission, this.options.project), - selectUrl: '/api/permissions/add_group', - deselectUrl: '/api/permissions/remove_group', + selectUrl: window.baseUrl + '/api/permissions/add_group', + deselectUrl: window.baseUrl + '/api/permissions/remove_group', extra: getExtra(this.options.permission, this.options.project), selectParameter: 'groupName', selectParameterValue: 'name', diff --git a/server/sonar-web/src/main/js/apps/global-permissions/main.js b/server/sonar-web/src/main/js/apps/global-permissions/main.js index 3a468aef67d..85571020b10 100644 --- a/server/sonar-web/src/main/js/apps/global-permissions/main.js +++ b/server/sonar-web/src/main/js/apps/global-permissions/main.js @@ -32,7 +32,7 @@ export default React.createClass({ }, requestPermissions() { - const url = '/api/permissions/search_global_permissions'; + const url = window.baseUrl + '/api/permissions/search_global_permissions'; $.get(url).done(r => { this.setState({ ready: true, permissions: r.permissions }); }); diff --git a/server/sonar-web/src/main/js/apps/global-permissions/permission.js b/server/sonar-web/src/main/js/apps/global-permissions/permission.js index 7b6be54f353..456aa69befb 100644 --- a/server/sonar-web/src/main/js/apps/global-permissions/permission.js +++ b/server/sonar-web/src/main/js/apps/global-permissions/permission.js @@ -40,7 +40,7 @@ export default React.createClass({ }, requestUsers() { - const url = '/api/permissions/users'; + const url = window.baseUrl + '/api/permissions/users'; let data = { permission: this.props.permission.key, ps: MAX_ITEMS }; if (this.props.project) { data.projectId = this.props.project; @@ -49,7 +49,7 @@ export default React.createClass({ }, requestGroups() { - const url = '/api/permissions/groups'; + const url = window.baseUrl + '/api/permissions/groups'; let data = { permission: this.props.permission.key, ps: MAX_ITEMS }; if (this.props.project) { data.projectId = this.props.project; diff --git a/server/sonar-web/src/main/js/apps/global-permissions/users-view.js b/server/sonar-web/src/main/js/apps/global-permissions/users-view.js index 10d152599c2..ba4789f1bcd 100644 --- a/server/sonar-web/src/main/js/apps/global-permissions/users-view.js +++ b/server/sonar-web/src/main/js/apps/global-permissions/users-view.js @@ -22,7 +22,7 @@ import Template from './templates/global-permissions-users.hbs'; import '../../components/SelectList'; function getSearchUrl (permission, project) { - let url = '/api/permissions/users?ps=100&permission=' + permission; + let url = window.baseUrl + '/api/permissions/users?ps=100&permission=' + permission; if (project) { url = url + '&projectId=' + project; } @@ -52,8 +52,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: getSearchUrl(this.options.permission, this.options.project), - selectUrl: '/api/permissions/add_user', - deselectUrl: '/api/permissions/remove_user', + selectUrl: window.baseUrl + '/api/permissions/add_user', + deselectUrl: window.baseUrl + '/api/permissions/remove_user', extra: getExtra(this.options.permission, this.options.project), selectParameter: 'login', selectParameterValue: 'login', diff --git a/server/sonar-web/src/main/js/apps/groups/group.js b/server/sonar-web/src/main/js/apps/groups/group.js index 9c80986eaa1..f1e9ff54f88 100644 --- a/server/sonar-web/src/main/js/apps/groups/group.js +++ b/server/sonar-web/src/main/js/apps/groups/group.js @@ -22,7 +22,7 @@ import Backbone from 'backbone'; export default Backbone.Model.extend({ urlRoot () { - return '/api/user_groups'; + return window.baseUrl + '/api/user_groups'; }, sync (method, model, options) { diff --git a/server/sonar-web/src/main/js/apps/groups/groups.js b/server/sonar-web/src/main/js/apps/groups/groups.js index e3e18d3bf48..73c1886f081 100644 --- a/server/sonar-web/src/main/js/apps/groups/groups.js +++ b/server/sonar-web/src/main/js/apps/groups/groups.js @@ -24,7 +24,7 @@ export default Backbone.Collection.extend({ model: Group, url () { - return '/api/user_groups/search'; + return window.baseUrl + '/api/user_groups/search'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/apps/groups/users-view.js b/server/sonar-web/src/main/js/apps/groups/users-view.js index 894b7f9a206..63615a330b3 100644 --- a/server/sonar-web/src/main/js/apps/groups/users-view.js +++ b/server/sonar-web/src/main/js/apps/groups/users-view.js @@ -35,9 +35,9 @@ export default Modal.extend({ return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', - searchUrl: '/api/user_groups/users?ps=100&id=' + this.model.id, - selectUrl: '/api/user_groups/add_user', - deselectUrl: '/api/user_groups/remove_user', + searchUrl: window.baseUrl + '/api/user_groups/users?ps=100&id=' + this.model.id, + selectUrl: window.baseUrl + '/api/user_groups/add_user', + deselectUrl: window.baseUrl + '/api/user_groups/remove_user', extra: { id: this.model.id }, diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js index bbca2009db9..d7326d71009 100644 --- a/server/sonar-web/src/main/js/apps/issues/controller.js +++ b/server/sonar-web/src/main/js/apps/issues/controller.js @@ -70,7 +70,7 @@ export default Controller.extend({ if (this.options.app.state.get('isContext')) { _.extend(data, this.options.app.state.get('contextQuery')); } - return $.get('/api/issues/search', data).done(function (r) { + return $.get(window.baseUrl + '/api/issues/search', data).done(function (r) { const issues = that.options.app.list.parseIssues(r); if (firstPage) { that.options.app.list.reset(issues); @@ -108,7 +108,7 @@ export default Controller.extend({ const that = this; return $.when( that.options.app.filters.fetch({ reset: true }), - $.get('/api/issue_filters/app', function (r) { + $.get(window.baseUrl + '/api/issue_filters/app', function (r) { that.options.app.state.set({ canBulkChange: r.canBulkChange, canManageFilters: r.canManageFilters @@ -132,7 +132,7 @@ export default Controller.extend({ if (this.options.app.state.get('isContext')) { _.extend(data, this.options.app.state.get('contextQuery')); } - return $.get('/api/issues/search', data, function (r) { + return $.get(window.baseUrl + '/api/issues/search', data, function (r) { FACET_DATA_FIELDS.forEach(function (field) { that.options.app.facets[field] = that._mergeCollections(that.options.app.facets[field], r[field]); }); @@ -151,7 +151,7 @@ export default Controller.extend({ if (this.options.app.state.get('isContext')) { _.extend(data, this.options.app.state.get('contextQuery')); } - return $.get('/api/issues/search', data, function (r) { + return $.get(window.baseUrl + '/api/issues/search', data, function (r) { FACET_DATA_FIELDS.forEach(function (field) { that.options.app.facets[field] = that._mergeCollections(that.options.app.facets[field], r[field]); }); diff --git a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js index 0cfe969d2f4..d1d2a27b5e3 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js @@ -26,7 +26,7 @@ export default CustomValuesFacet.extend({ template: Template, getUrl () { - return '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, prepareAjaxSearch () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js index aec9e84f270..448922fa23d 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js @@ -22,7 +22,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ getUrl () { - return '/api/issues/authors'; + return window.baseUrl + '/api/issues/authors'; }, prepareSearch () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js index 2c1d2e0ba8f..38164faed8f 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js @@ -23,7 +23,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ getUrl () { - return '/api/languages/list'; + return window.baseUrl + '/api/languages/list'; }, prepareSearch () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js index 50cc3e3531a..5b1eaf2bfd0 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js @@ -26,9 +26,9 @@ export default CustomValuesFacet.extend({ getUrl () { const q = this.options.app.state.get('contextComponentQualifier'); if (q === 'VW' || q === 'SVW') { - return '/api/components/search_view_components'; + return window.baseUrl + '/api/components/search_view_components'; } else { - return '/api/resources/search?f=s2&q=TRK&display_uuid=true'; + return window.baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true'; } }, diff --git a/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js index d043039b66c..d2f36ace123 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js @@ -22,7 +22,7 @@ import CustomValuesFacet from './custom-values-facet'; export default CustomValuesFacet.extend({ getUrl () { - return '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, prepareAjaxSearch () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js index b0dd063d6ae..9cd5a702385 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js @@ -23,7 +23,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ prepareSearch () { - let url = '/api/rules/search?f=name,langName'; + let url = window.baseUrl + '/api/rules/search?f=name,langName'; const languages = this.options.app.state.get('query').languages; if (languages != null) { url += '&languages=' + languages; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js index e537955cebc..1e41af86e4e 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js @@ -23,7 +23,7 @@ import { translate } from '../../../helpers/l10n'; export default CustomValuesFacet.extend({ prepareSearch () { - let url = '/api/issues/tags?ps=10'; + let url = window.baseUrl + '/api/issues/tags?ps=10'; const tags = this.options.app.state.get('query').tags; if (tags != null) { url += '&tags=' + tags; diff --git a/server/sonar-web/src/main/js/apps/issues/filters-view.js b/server/sonar-web/src/main/js/apps/issues/filters-view.js index 303c567fe5a..810a060944d 100644 --- a/server/sonar-web/src/main/js/apps/issues/filters-view.js +++ b/server/sonar-web/src/main/js/apps/issues/filters-view.js @@ -75,26 +75,26 @@ export default Marionette.ItemView.extend({ saveAs () { const query = this.options.app.controller.getQuery('&'); - const url = '/issues/save_as_form?' + query; + const url = window.baseUrl + '/issues/save_as_form?' + query; window.openModalWindow(url, {}); }, save () { const that = this; const query = this.options.app.controller.getQuery('&'); - const url = '/issues/save/' + (this.options.app.state.get('filter').id) + '?' + query; + const url = window.baseUrl + '/issues/save/' + (this.options.app.state.get('filter').id) + '?' + query; return $.post(url).done(function () { return that.options.app.state.set({ changed: false }); }); }, copy () { - const url = '/issues/copy_form/' + (this.options.app.state.get('filter').id); + const url = window.baseUrl + '/issues/copy_form/' + (this.options.app.state.get('filter').id); window.openModalWindow(url, {}); }, edit () { - const url = '/issues/edit_form/' + (this.options.app.state.get('filter').id); + const url = window.baseUrl + '/issues/edit_form/' + (this.options.app.state.get('filter').id); window.openModalWindow(url, {}); }, diff --git a/server/sonar-web/src/main/js/apps/issues/models/filter.js b/server/sonar-web/src/main/js/apps/issues/models/filter.js index 2110e307d45..23e1060a37a 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/filter.js +++ b/server/sonar-web/src/main/js/apps/issues/models/filter.js @@ -21,7 +21,7 @@ import Backbone from 'backbone'; export default Backbone.Model.extend({ url () { - return '/api/issue_filters/show/' + this.id; + return window.baseUrl + '/api/issue_filters/show/' + this.id; }, parse (r) { diff --git a/server/sonar-web/src/main/js/apps/issues/models/filters.js b/server/sonar-web/src/main/js/apps/issues/models/filters.js index 479817bddfb..0aeff2969a5 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/filters.js +++ b/server/sonar-web/src/main/js/apps/issues/models/filters.js @@ -24,7 +24,7 @@ export default Backbone.Collection.extend({ model: Filter, url () { - return '/api/issue_filters/search'; + return window.baseUrl + '/api/issue_filters/search'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/apps/issues/models/issues.js b/server/sonar-web/src/main/js/apps/issues/models/issues.js index cf88e28729d..c8b94fca35d 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/issues.js +++ b/server/sonar-web/src/main/js/apps/issues/models/issues.js @@ -25,7 +25,7 @@ export default Backbone.Collection.extend({ model: Issue, url () { - return '/api/issues/search'; + return window.baseUrl + '/api/issues/search'; }, _injectRelational (issue, source, baseField, lookupField) { diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js index d6ba4728cb2..89ed4d1975f 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js @@ -105,7 +105,7 @@ export default WorkspaceHeaderView.extend({ bulkChange () { const query = this.options.app.controller.getQuery('&', true); - const url = '/issues/bulk_change_form?' + query; + const url = window.baseUrl + '/issues/bulk_change_form?' + query; window.openModalWindow(url, {}); }, @@ -113,7 +113,7 @@ export default WorkspaceHeaderView.extend({ const selected = this.options.app.list.where({ selected: true }); const selectedKeys = _.first(_.pluck(selected, 'id'), 200); const query = 'issues=' + selectedKeys.join(); - const url = '/issues/bulk_change_form?' + query; + const url = window.baseUrl + '/issues/bulk_change_form?' + query; window.openModalWindow(url, {}); }, diff --git a/server/sonar-web/src/main/js/apps/maintenance/main-view.js b/server/sonar-web/src/main/js/apps/maintenance/main-view.js index d083fdb7be4..dd79b1fd73a 100644 --- a/server/sonar-web/src/main/js/apps/maintenance/main-view.js +++ b/server/sonar-web/src/main/js/apps/maintenance/main-view.js @@ -34,7 +34,7 @@ export default Marionette.ItemView.extend({ const that = this; this.requestOptions = { type: 'GET', - url: '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status') + url: window.baseUrl + '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status') }; this.pollingInternal = setInterval(function () { that.refresh(); @@ -62,7 +62,7 @@ export default Marionette.ItemView.extend({ startMigration () { const that = this; Backbone.ajax({ - url: '/api/system/migrate_db', + url: window.baseUrl + '/api/system/migrate_db', type: 'POST' }).done(function (r) { that.model.set(r); @@ -76,7 +76,7 @@ export default Marionette.ItemView.extend({ goHome () { setInterval(function () { - window.location = '/'; + window.location = window.baseUrl + '/'; }, 2500); }, diff --git a/server/sonar-web/src/main/js/apps/metrics/app.js b/server/sonar-web/src/main/js/apps/metrics/app.js index 6a569e9fd53..02222b06fe7 100644 --- a/server/sonar-web/src/main/js/apps/metrics/app.js +++ b/server/sonar-web/src/main/js/apps/metrics/app.js @@ -63,12 +63,12 @@ const init = function () { App.requestDomains = function () { - return $.get('/api/metrics/domains').done(function (r) { + return $.get(window.baseUrl + '/api/metrics/domains').done(function (r) { App.domains = r.domains; }); }; App.requestTypes = function () { - return $.get('/api/metrics/types').done(function (r) { + return $.get(window.baseUrl + '/api/metrics/types').done(function (r) { App.types = r.types; }); }; diff --git a/server/sonar-web/src/main/js/apps/metrics/metric.js b/server/sonar-web/src/main/js/apps/metrics/metric.js index ee8bc9b473e..300f1596800 100644 --- a/server/sonar-web/src/main/js/apps/metrics/metric.js +++ b/server/sonar-web/src/main/js/apps/metrics/metric.js @@ -24,7 +24,7 @@ export default Backbone.Model.extend({ idAttribute: 'id', urlRoot () { - return '/api/metrics'; + return window.baseUrl + '/api/metrics'; }, sync (method, model, options) { diff --git a/server/sonar-web/src/main/js/apps/metrics/metrics.js b/server/sonar-web/src/main/js/apps/metrics/metrics.js index 51e041ad120..59bff3f0b01 100644 --- a/server/sonar-web/src/main/js/apps/metrics/metrics.js +++ b/server/sonar-web/src/main/js/apps/metrics/metrics.js @@ -25,7 +25,7 @@ export default Backbone.Collection.extend({ model: Metric, url () { - return '/api/metrics/search'; + return window.baseUrl + '/api/metrics/search'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/apps/overview/gate/gate-empty.js b/server/sonar-web/src/main/js/apps/overview/gate/gate-empty.js index fa339aca23c..75aee6e6144 100644 --- a/server/sonar-web/src/main/js/apps/overview/gate/gate-empty.js +++ b/server/sonar-web/src/main/js/apps/overview/gate/gate-empty.js @@ -22,7 +22,7 @@ import { translate } from '../../../helpers/l10n'; export default React.createClass({ render() { - const qualityGatesUrl = '/quality_gates'; + const qualityGatesUrl = window.baseUrl + '/quality_gates'; return ( <div className="overview-gate"> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js b/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js index 3f05ffdc8eb..9c8f359aedc 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js @@ -23,7 +23,8 @@ import '../../components/SelectList'; import Template from './templates/permission-templates-groups.hbs'; function getSearchUrl (permission, permissionTemplate) { - return `/api/permissions/template_groups?ps=100&permission=${permission.key}&templateId=${permissionTemplate.id}`; + return window.baseUrl + + `/api/permissions/template_groups?ps=100&permission=${permission.key}&templateId=${permissionTemplate.id}`; } export default Modal.extend({ @@ -41,8 +42,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: getSearchUrl(this.options.permission, this.options.permissionTemplate), - selectUrl: '/api/permissions/add_group_to_template', - deselectUrl: '/api/permissions/remove_group_from_template', + selectUrl: window.baseUrl + '/api/permissions/add_group_to_template', + deselectUrl: window.baseUrl + '/api/permissions/remove_group_from_template', extra: { permission: this.options.permission.key, templateId: this.options.permissionTemplate.id diff --git a/server/sonar-web/src/main/js/apps/permission-templates/users-view.js b/server/sonar-web/src/main/js/apps/permission-templates/users-view.js index 3e91656400a..b14fbdef464 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/users-view.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/users-view.js @@ -27,8 +27,8 @@ export default Modal.extend({ onRender () { Modal.prototype.onRender.apply(this, arguments); - const searchUrl = '/api/permissions/template_users?ps=100&permission=' + this.options.permission.key + - '&templateId=' + this.options.permissionTemplate.id; + const searchUrl = window.baseUrl + '/api/permissions/template_users?ps=100&permission=' + + this.options.permission.key + '&templateId=' + this.options.permissionTemplate.id; new window.SelectList({ searchUrl, el: this.$('#permission-templates-users'), @@ -39,8 +39,8 @@ export default Modal.extend({ return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', - selectUrl: '/api/permissions/add_user_to_template', - deselectUrl: '/api/permissions/remove_user_from_template', + selectUrl: window.baseUrl + '/api/permissions/add_user_to_template', + deselectUrl: window.baseUrl + '/api/permissions/remove_user_from_template', extra: { permission: this.options.permission.key, templateId: this.options.permissionTemplate.id diff --git a/server/sonar-web/src/main/js/apps/project-permissions/app.js b/server/sonar-web/src/main/js/apps/project-permissions/app.js index c4630bdd744..c90cd10cec1 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/app.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/app.js @@ -23,7 +23,7 @@ import ReactDOM from 'react-dom'; import Main from './main'; function requestPermissionTemplates () { - return $.get('/api/permissions/search_templates'); + return $.get(window.baseUrl + '/api/permissions/search_templates'); } window.sonarqube.appStarted.then(options => { diff --git a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js index a75fa8a8db2..20fcec63f97 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js @@ -23,7 +23,7 @@ import '../../components/SelectList'; import Template from './templates/project-permissions-groups.hbs'; function getSearchUrl (permission, project) { - return `/api/permissions/groups?ps=100&permission=${permission}&projectId=${project}`; + return `${window.baseUrl}/api/permissions/groups?ps=100&permission=${permission}&projectId=${project}`; } export default Modal.extend({ @@ -41,8 +41,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: getSearchUrl(this.options.permission, this.options.project), - selectUrl: '/api/permissions/add_group', - deselectUrl: '/api/permissions/remove_group', + selectUrl: window.baseUrl + '/api/permissions/add_group', + deselectUrl: window.baseUrl + '/api/permissions/remove_group', extra: { permission: this.options.permission, projectId: this.options.project diff --git a/server/sonar-web/src/main/js/apps/project-permissions/main.js b/server/sonar-web/src/main/js/apps/project-permissions/main.js index b3545d43eb8..3b70c09939e 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/main.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/main.js @@ -60,7 +60,7 @@ export default React.createClass({ }, requestPermissions(page = 1, query = '', filter = this.state.filter) { - let url = '/api/permissions/search_project_permissions'; + let url = window.baseUrl + '/api/permissions/search_project_permissions'; let data = { p: page, q: query }; if (filter !== '__ALL__') { data.qualifier = filter; diff --git a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js index 217988359b5..ff641cbc272 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js @@ -27,7 +27,7 @@ export default Modal.extend({ onRender () { Modal.prototype.onRender.apply(this, arguments); - const searchUrl = '/api/permissions/users?ps=100&permission=' + this.options.permission + + const searchUrl = window.baseUrl + '/api/permissions/users?ps=100&permission=' + this.options.permission + '&projectId=' + this.options.project; new window.SelectList({ searchUrl, @@ -39,8 +39,8 @@ export default Modal.extend({ return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', - selectUrl: '/api/permissions/add_user', - deselectUrl: '/api/permissions/remove_user', + selectUrl: window.baseUrl + '/api/permissions/add_user', + deselectUrl: window.baseUrl + '/api/permissions/remove_user', extra: { permission: this.options.permission, projectId: this.options.project diff --git a/server/sonar-web/src/main/js/apps/quality-gates/app.js b/server/sonar-web/src/main/js/apps/quality-gates/app.js index b34f8d97fd5..ded4a821315 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/app.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/app.js @@ -35,7 +35,7 @@ window.sonarqube.appStarted.then(options => { const el = document.querySelector(options.el); const history = useRouterHistory(createHistory)({ - basename: '/quality_gates' + basename: window.baseUrl + '/quality_gates' }); const finalReducer = combineReducers({ diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/gate-projects-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/gate-projects-view.js index 41d12eee7f7..8c4cd9406a3 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/views/gate-projects-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/views/gate-projects-view.js @@ -38,9 +38,9 @@ export default Marionette.ItemView.extend({ format (item) { return item.name; }, - searchUrl: '/api/qualitygates/search?gateId=' + qualityGate.id, - selectUrl: '/api/qualitygates/select', - deselectUrl: '/api/qualitygates/deselect', + searchUrl: window.baseUrl + '/api/qualitygates/search?gateId=' + qualityGate.id, + selectUrl: window.baseUrl + '/api/qualitygates/select', + deselectUrl: window.baseUrl + '/api/qualitygates/deselect', extra: { gateId: qualityGate.id }, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js index 11d014ae1c1..7cec542e58a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/actions-view.js @@ -83,7 +83,7 @@ export default Marionette.ItemView.extend({ requestLanguages () { const that = this; - const url = '/api/languages/list'; + const url = window.baseUrl + '/api/languages/list'; return $.get(url).done(function (r) { that.languages = r.languages; }); @@ -91,7 +91,7 @@ export default Marionette.ItemView.extend({ requestImporters () { const that = this; - const url = '/api/qualityprofiles/importers'; + const url = window.baseUrl + '/api/qualityprofiles/importers'; return $.get(url).done(function (r) { that.importers = r.importers; }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/app.js b/server/sonar-web/src/main/js/apps/quality-profiles/app.js index db98ec75561..24881c7b7ef 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/app.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/app.js @@ -28,10 +28,10 @@ import ActionsView from './actions-view'; import ProfilesView from './profiles-view'; const App = new Marionette.Application(); -const requestUser = $.get('/api/users/current').done(function (r) { +const requestUser = $.get(window.baseUrl + '/api/users/current').done(function (r) { App.canWrite = r.permissions.global.indexOf('profileadmin') !== -1; }); -const requestExporters = $.get('/api/qualityprofiles/exporters').done(function (r) { +const requestExporters = $.get(window.baseUrl + '/api/qualityprofiles/exporters').done(function (r) { App.exporters = r.exporters; }); const init = function () { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js index 7dab90e61ae..246a9315334 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/change-profile-parent-view.js @@ -42,7 +42,7 @@ export default ModalFormView.extend({ sendRequest () { const that = this; - const url = '/api/qualityprofiles/change_parent'; + const url = window.baseUrl + '/api/qualityprofiles/change_parent'; const parent = this.$('#change-profile-parent').val(); const options = { profileKey: this.model.get('key'), diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/controller.js b/server/sonar-web/src/main/js/apps/quality-profiles/controller.js index 5bd378dee83..e2076ea8fbc 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/controller.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/controller.js @@ -99,7 +99,7 @@ export default Marionette.Controller.extend({ onProfileSetAsDefault (profile) { const that = this; - const url = '/api/qualityprofiles/set_default'; + const url = window.baseUrl + '/api/qualityprofiles/set_default'; const key = profile.get('key'); const options = { profileKey: key }; return $.post(url, options).done(function () { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js index 1ecb6c92aea..f9d2852d095 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/copy-profile-view.js @@ -33,7 +33,7 @@ export default ModalFormView.extend({ sendRequest () { const that = this; - const url = '/api/qualityprofiles/copy'; + const url = window.baseUrl + '/api/qualityprofiles/copy'; const name = this.$('#copy-profile-name').val(); const options = { fromKey: this.model.get('key'), diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js index bc255295038..551348ee26a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/delete-profile-view.js @@ -36,7 +36,7 @@ export default ModalFormView.extend({ sendRequest () { const that = this; - const url = '/api/qualityprofiles/delete'; + const url = window.baseUrl + '/api/qualityprofiles/delete'; const options = { profileKey: this.model.get('key') }; return $.ajax({ url, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js index da366eac71f..26748b8e3be 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js @@ -84,9 +84,9 @@ export default Marionette.LayoutView.extend({ format (item) { return item.name; }, - searchUrl: '/api/qualityprofiles/projects?key=' + encodeURIComponent(key), - selectUrl: '/api/qualityprofiles/add_project', - deselectUrl: '/api/qualityprofiles/remove_project', + searchUrl: window.baseUrl + '/api/qualityprofiles/projects?key=' + encodeURIComponent(key), + selectUrl: window.baseUrl + '/api/qualityprofiles/add_project', + deselectUrl: window.baseUrl + '/api/qualityprofiles/remove_project', extra: { profileKey: key }, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile.js index ab0770edea6..00935378225 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/profile.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile.js @@ -42,7 +42,7 @@ export default Backbone.Model.extend({ fetchProfileRules () { const that = this; - const url = '/api/rules/search'; + const url = window.baseUrl + '/api/rules/search'; const key = this.id; const options = { ps: 1, @@ -66,7 +66,7 @@ export default Backbone.Model.extend({ fetchInheritance () { const that = this; - const url = '/api/qualityprofiles/inheritance'; + const url = window.baseUrl + '/api/qualityprofiles/inheritance'; const options = { profileKey: this.id }; return $.get(url, options).done(function (r) { _.extend(that.fetchChanged, r.profile, { @@ -78,7 +78,7 @@ export default Backbone.Model.extend({ fetchChangelog (options) { const that = this; - const url = '/api/qualityprofiles/changelog'; + const url = window.baseUrl + '/api/qualityprofiles/changelog'; const opts = _.extend({}, options, { profileKey: this.id }); return $.get(url, opts).done(function (r) { that.set({ @@ -92,7 +92,7 @@ export default Backbone.Model.extend({ fetchMoreChangelog () { const that = this; - const url = '/api/qualityprofiles/changelog'; + const url = window.baseUrl + '/api/qualityprofiles/changelog'; const page = this.get('eventsPage') || 0; const parameters = this.get('eventsParameters') || {}; const opts = _.extend({}, parameters, { profileKey: this.id, p: page + 1 }); @@ -114,7 +114,7 @@ export default Backbone.Model.extend({ compareWith (withKey) { const that = this; - const url = '/api/qualityprofiles/compare'; + const url = window.baseUrl + '/api/qualityprofiles/compare'; const options = { leftKey: this.id, rightKey: withKey }; return $.get(url, options).done(function (r) { const comparison = _.extend(r, { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js b/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js index a170c4f334e..c3b9335c952 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/profiles.js @@ -22,7 +22,7 @@ import Profile from './profile'; export default Backbone.Collection.extend({ model: Profile, - url: '/api/qualityprofiles/search', + url: window.baseUrl + '/api/qualityprofiles/search', comparator: 'key', parse (r) { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js index 4e15d54fc6b..77ab397642c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/rename-profile-view.js @@ -31,7 +31,7 @@ export default ModalFormView.extend({ sendRequest () { const that = this; - const url = '/api/qualityprofiles/rename'; + const url = window.baseUrl + '/api/qualityprofiles/rename'; const name = this.$('#rename-profile-name').val(); const options = { key: this.model.get('key'), diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js index 97cd9797c6d..3f3de05c29e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js @@ -47,7 +47,7 @@ export default ModalFormView.extend({ sendRequest () { const that = this; - const url = '/api/qualityprofiles/restore_built_in'; + const url = window.baseUrl + '/api/qualityprofiles/restore_built_in'; const lang = this.$('#restore-built-in-profiles-language').val(); const options = { language: lang }; this.selectedLanguage = _.findWhere(this.options.languages, { key: lang }).name; diff --git a/server/sonar-web/src/main/js/apps/system/main.js b/server/sonar-web/src/main/js/apps/system/main.js index 65cafba2d93..f600dd3438b 100644 --- a/server/sonar-web/src/main/js/apps/system/main.js +++ b/server/sonar-web/src/main/js/apps/system/main.js @@ -70,8 +70,8 @@ export default React.createClass({ <header className="page-header"> <h1 className="page-title">{translate('system_info.page')}</h1> <div className="page-actions"> - <a className="spacer-right" href={'/api/system/logs'} id="logs-link">Logs</a> - <a href={'/api/system/info'} id="download-link">Download</a> + <a className="spacer-right" href={window.baseUrl + '/api/system/logs'} id="logs-link">Logs</a> + <a href={window.baseUrl + '/api/system/info'} id="download-link">Download</a> <button id="restart-server-button" className="big-spacer-left" diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin.js b/server/sonar-web/src/main/js/apps/update-center/plugin.js index 959ee5eb378..3997e5c9a8f 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugin.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugin.js @@ -61,7 +61,7 @@ export default Backbone.Model.extend({ install () { return this._action({ - url: '/api/plugins/install', + url: window.baseUrl + '/api/plugins/install', success (model) { model.set({ _status: 'installing' }); } @@ -70,7 +70,7 @@ export default Backbone.Model.extend({ update () { return this._action({ - url: '/api/plugins/update', + url: window.baseUrl + '/api/plugins/update', success (model) { model.set({ _status: 'installing' }); } @@ -79,7 +79,7 @@ export default Backbone.Model.extend({ uninstall () { return this._action({ - url: '/api/plugins/uninstall', + url: window.baseUrl + '/api/plugins/uninstall', success (model) { model.set({ _status: 'uninstalling' }); } diff --git a/server/sonar-web/src/main/js/apps/update-center/plugins.js b/server/sonar-web/src/main/js/apps/update-center/plugins.js index fee5a59fb0b..94317555e5d 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugins.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugins.js @@ -70,7 +70,7 @@ const Plugins = Backbone.Collection.extend({ const that = this; const opts = { type: 'GET', - url: '/api/plugins/installed', + url: window.baseUrl + '/api/plugins/installed', success (r) { that._installed = that.parse(r); } @@ -85,7 +85,7 @@ const Plugins = Backbone.Collection.extend({ const that = this; const opts = { type: 'GET', - url: '/api/plugins/updates', + url: window.baseUrl + '/api/plugins/updates', success (r) { that._updates = that.parse(r); } @@ -100,7 +100,7 @@ const Plugins = Backbone.Collection.extend({ const that = this; const opts = { type: 'GET', - url: '/api/plugins/available', + url: window.baseUrl + '/api/plugins/available', success (r) { that._available = that.parse(r); } @@ -112,7 +112,7 @@ const Plugins = Backbone.Collection.extend({ const that = this; const opts = { type: 'GET', - url: '/api/plugins/pending', + url: window.baseUrl + '/api/plugins/pending', success (r) { const installing = r.installing.map(function (plugin) { return { key: plugin.key, _status: 'installing' }; @@ -135,7 +135,7 @@ const Plugins = Backbone.Collection.extend({ const that = this; const opts = { type: 'GET', - url: '/api/system/upgrades', + url: window.baseUrl + '/api/system/upgrades', success (r) { that._systemUpdates = r.upgrades.map(function (update) { return _.extend(update, { _system: true }); @@ -195,7 +195,7 @@ const Plugins = Backbone.Collection.extend({ const that = this; const opts = { type: 'POST', - url: '/api/plugins/cancel_all', + url: window.baseUrl + '/api/plugins/cancel_all', success () { that._installedCount = 0; that._uninstalledCount = 0; diff --git a/server/sonar-web/src/main/js/apps/users/groups-view.js b/server/sonar-web/src/main/js/apps/users/groups-view.js index b66ec089153..f8a01ebc49a 100644 --- a/server/sonar-web/src/main/js/apps/users/groups-view.js +++ b/server/sonar-web/src/main/js/apps/users/groups-view.js @@ -35,9 +35,9 @@ export default Modal.extend({ return `${item.name}<br><span class="note">${item.description}</span>`; }, queryParam: 'q', - searchUrl: '/api/users/groups?ps=100&login=' + this.model.id, - selectUrl: '/api/user_groups/add_user', - deselectUrl: '/api/user_groups/remove_user', + searchUrl: window.baseUrl + '/api/users/groups?ps=100&login=' + this.model.id, + selectUrl: window.baseUrl + '/api/user_groups/add_user', + deselectUrl: window.baseUrl + '/api/user_groups/remove_user', extra: { login: this.model.id }, diff --git a/server/sonar-web/src/main/js/apps/users/user.js b/server/sonar-web/src/main/js/apps/users/user.js index 84e7728dc2a..d041faad611 100644 --- a/server/sonar-web/src/main/js/apps/users/user.js +++ b/server/sonar-web/src/main/js/apps/users/user.js @@ -24,7 +24,7 @@ export default Backbone.Model.extend({ idAttribute: 'login', urlRoot () { - return '/api/users'; + return window.baseUrl + '/api/users'; }, defaults () { diff --git a/server/sonar-web/src/main/js/apps/users/users.js b/server/sonar-web/src/main/js/apps/users/users.js index 8759d700c5a..1d495078ac4 100644 --- a/server/sonar-web/src/main/js/apps/users/users.js +++ b/server/sonar-web/src/main/js/apps/users/users.js @@ -24,7 +24,7 @@ export default Backbone.Collection.extend({ model: User, url () { - return '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/components/common/templates/_markdown-tips.hbs b/server/sonar-web/src/main/js/components/common/templates/_markdown-tips.hbs index b2d3a4b672c..d6e538797c3 100644 --- a/server/sonar-web/src/main/js/components/common/templates/_markdown-tips.hbs +++ b/server/sonar-web/src/main/js/components/common/templates/_markdown-tips.hbs @@ -1,4 +1,4 @@ <div class="markdown-tips"> - <a href="#" onclick="window.open('/markdown/help','markdown','height=300,width=600,scrollbars=1,resizable=1');return false;">{{t 'markdown.helplink'}}</a> : + <a href="#" onclick="window.open(window.baseUrl + '/markdown/help','markdown','height=300,width=600,scrollbars=1,resizable=1');return false;">{{t 'markdown.helplink'}}</a> : *{{t 'bold'}}* ``{{t 'code'}}`` * {{t 'bulleted_point'}} </div> diff --git a/server/sonar-web/src/main/js/components/issue/collections/issues.js b/server/sonar-web/src/main/js/components/issue/collections/issues.js index bb17e325a8e..ee155975159 100644 --- a/server/sonar-web/src/main/js/components/issue/collections/issues.js +++ b/server/sonar-web/src/main/js/components/issue/collections/issues.js @@ -25,7 +25,7 @@ export default Backbone.Collection.extend({ model: Issue, url () { - return '/api/issues/search'; + return window.baseUrl + '/api/issues/search'; }, _injectRelational (issue, source, baseField, lookupField) { diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js index 82594682e0f..51c7162c716 100644 --- a/server/sonar-web/src/main/js/components/issue/issue-view.js +++ b/server/sonar-web/src/main/js/components/issue/issue-view.js @@ -151,7 +151,7 @@ export default Marionette.ItemView.extend({ this.disableControls(); return $.ajax({ type: 'POST', - url: '/api/issues/delete_comment?key=' + commentKey + url: window.baseUrl + '/api/issues/delete_comment?key=' + commentKey }).done(function () { that.updateAfterAction(true); }); @@ -253,7 +253,7 @@ export default Marionette.ItemView.extend({ serializeData () { const issueKey = encodeURIComponent(this.model.get('key')); return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - permalink: '/issues/search#issues=' + issueKey, + permalink: window.baseUrl + '/issues/search#issues=' + issueKey, hasSecondaryLocations: this.model.get('flows').length }); } diff --git a/server/sonar-web/src/main/js/components/issue/models/changelog.js b/server/sonar-web/src/main/js/components/issue/models/changelog.js index dc27c3ff8b9..d4859628929 100644 --- a/server/sonar-web/src/main/js/components/issue/models/changelog.js +++ b/server/sonar-web/src/main/js/components/issue/models/changelog.js @@ -21,7 +21,7 @@ import Backbone from 'backbone'; export default Backbone.Collection.extend({ url () { - return '/api/issues/changelog'; + return window.baseUrl + '/api/issues/changelog'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js index d860a9c57d1..8a282647b41 100644 --- a/server/sonar-web/src/main/js/components/issue/models/issue.js +++ b/server/sonar-web/src/main/js/components/issue/models/issue.js @@ -30,11 +30,11 @@ export default Backbone.Model.extend({ }, url () { - return '/api/issues'; + return window.baseUrl + '/api/issues'; }, urlRoot () { - return '/api/issues'; + return window.baseUrl + '/api/issues'; }, parse (r) { diff --git a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js index 5fba121bf5c..3750074803a 100644 --- a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js @@ -119,7 +119,7 @@ export default ActionOptionsView.extend({ search (query) { const that = this; if (query.length > 1) { - $.get('/api/users/search', { q: query }).done(function (data) { + $.get(window.baseUrl + '/api/users/search', { q: query }).done(function (data) { that.resetAssignees(data.users); }); } else { diff --git a/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js b/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js index 4e4ac129b09..8b4c0c629c5 100644 --- a/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js @@ -82,7 +82,7 @@ export default PopupView.extend({ const text = this.ui.textarea.val(); const update = this.model && this.model.has('key'); const method = update ? 'edit_comment' : 'add_comment'; - const url = '/api/issues/' + method; + const url = window.baseUrl + '/api/issues/' + method; const data = { text }; if (update) { data.key = this.model.get('key'); diff --git a/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js b/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js index 8465005d70a..ca096aa4d2a 100644 --- a/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js @@ -50,7 +50,7 @@ export default ActionOptionsView.extend({ requestTags (query) { const that = this; - return $.get('/api/issues/tags', { ps: 10, q: query }).done(function (data) { + return $.get(window.baseUrl + '/api/issues/tags', { ps: 10, q: query }).done(function (data) { that.tags = data.tags; that.renderTags(); }); @@ -134,7 +134,7 @@ export default ActionOptionsView.extend({ this.model.set({ tags }); return $.ajax({ type: 'POST', - url: '/api/issues/set_tags', + url: window.baseUrl + '/api/issues/set_tags', data: { key: this.model.id, tags: tags.join() diff --git a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js index 4e5bcb8fb00..461d4113348 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js @@ -69,7 +69,7 @@ const Suggestions = Backbone.Collection.extend({ const UserSuggestions = Suggestions.extend({ url () { - return '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, parse (response) { @@ -84,7 +84,7 @@ const UserSuggestions = Suggestions.extend({ const ProjectSuggestions = Suggestions.extend({ url () { - return '/api/resources/search?f=s2&q=TRK&display_key=true'; + return window.baseUrl + '/api/resources/search?f=s2&q=TRK&display_key=true'; } }); @@ -93,7 +93,7 @@ const ProjectSuggestions = Suggestions.extend({ const ComponentSuggestions = Suggestions.extend({ url () { - return '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true'; + return window.baseUrl + '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true'; }, parse (r) { @@ -377,7 +377,7 @@ const ComponentFilterView = AjaxSelectFilterView.extend({ const that = this; return $ .ajax({ - url: '/api/resources', + url: window.baseUrl + '/api/resources', type: 'GET', data: { resource: v } }) @@ -407,7 +407,7 @@ const ProjectFilterView = AjaxSelectFilterView.extend({ const that = this; return $ .ajax({ - url: '/api/resources', + url: window.baseUrl + '/api/resources', type: 'GET', data: { resource: v } }) @@ -437,7 +437,7 @@ const AssigneeFilterView = AjaxSelectFilterView.extend({ const that = this; return $ .ajax({ - url: '/api/users/search', + url: window.baseUrl + '/api/users/search', type: 'GET', data: { q: v } }) diff --git a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js index 11b769a903a..1c14e30f127 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js @@ -36,12 +36,12 @@ const DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({ applyFavorite (e) { const id = $(e.target).data('id'); - window.location = this.model.get('favoriteUrl') + '/' + id; + window.location = window.baseUrl + this.model.get('favoriteUrl') + '/' + id; }, manage () { - window.location = this.model.get('manageUrl'); + window.location = window.baseUrl + this.model.get('manageUrl'); }, diff --git a/server/sonar-web/src/main/js/components/shared/favorite.js b/server/sonar-web/src/main/js/components/shared/favorite.js index b742e31b0eb..00dd7d8359f 100644 --- a/server/sonar-web/src/main/js/components/shared/favorite.js +++ b/server/sonar-web/src/main/js/components/shared/favorite.js @@ -40,13 +40,13 @@ export default React.createClass({ }, addFavorite() { - const url = '/api/favourites'; + const url = window.baseUrl + '/api/favourites'; const data = { key: this.props.component }; $.ajax({ type: 'POST', url, data }).done(() => this.setState({ favorite: true })); }, removeFavorite() { - const url = `/api/favourites/${encodeURIComponent(this.props.component)}`; + const url = `${window.baseUrl}/api/favourites/${encodeURIComponent(this.props.component)}`; $.ajax({ type: 'DELETE', url }).done(() => this.setState({ favorite: false })); }, diff --git a/server/sonar-web/src/main/js/components/shared/quality-gate-link.js b/server/sonar-web/src/main/js/components/shared/quality-gate-link.js index 852e347ccb2..c0f506ce69a 100644 --- a/server/sonar-web/src/main/js/components/shared/quality-gate-link.js +++ b/server/sonar-web/src/main/js/components/shared/quality-gate-link.js @@ -22,7 +22,7 @@ import React from 'react'; export const QualityGateLink = React.createClass({ render() { - let url = `/quality_gates/show/${this.props.gate}`; + let url = `${window.baseUrl}/quality_gates/show/${this.props.gate}`; return <a href={url}>{this.props.children}</a>; } }); diff --git a/server/sonar-web/src/main/js/components/shared/quality-profile-link.js b/server/sonar-web/src/main/js/components/shared/quality-profile-link.js index 1b9b4ea7ddc..681c1494258 100644 --- a/server/sonar-web/src/main/js/components/shared/quality-profile-link.js +++ b/server/sonar-web/src/main/js/components/shared/quality-profile-link.js @@ -22,7 +22,7 @@ import React from 'react'; export const QualityProfileLink = React.createClass({ render() { - let url = `/profiles/show?key=${encodeURIComponent(this.props.profile)}`; + let url = `${window.baseUrl}/profiles/show?key=${encodeURIComponent(this.props.profile)}`; return <a href={url}>{this.props.children}</a>; } }); diff --git a/server/sonar-web/src/main/js/components/source-viewer/header.js b/server/sonar-web/src/main/js/components/source-viewer/header.js index 14b995d2127..07a191a6061 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/header.js +++ b/server/sonar-web/src/main/js/components/source-viewer/header.js @@ -24,7 +24,7 @@ import MoreActionsView from './more-actions'; import MeasuresOverlay from './measures-overlay'; import Template from './templates/source-viewer-header.hbs'; -const API_FAVORITE = '/api/favourites'; +const API_FAVORITE = window.baseUrl + '/api/favourites'; export default Marionette.ItemView.extend({ template: Template, @@ -75,11 +75,11 @@ export default Marionette.ItemView.extend({ if (this.options.viewer.highlightedLine) { query = query + '&line=' + this.options.viewer.highlightedLine; } - window.open('/component/index?' + query, this.model.get('name'), windowParams); + window.open(window.baseUrl + '/component/index?' + query, this.model.get('name'), windowParams); }, showRawSources () { - const url = '/api/sources/raw?key=' + encodeURIComponent(this.model.get('key')); + const url = window.baseUrl + '/api/sources/raw?key=' + encodeURIComponent(this.model.get('key')); const windowParams = 'resizable=1,scrollbars=1,status=1'; window.open(url, this.model.get('name'), windowParams); }, diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js index 4669fb5b079..0eb02489056 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/main.js +++ b/server/sonar-web/src/main/js/components/source-viewer/main.js @@ -150,7 +150,7 @@ export default Marionette.LayoutView.extend({ requestComponent () { const that = this; - const url = '/api/components/app'; + const url = window.baseUrl + '/api/components/app'; const data = { uuid: this.model.id }; return $.ajax({ url, @@ -206,7 +206,7 @@ export default Marionette.LayoutView.extend({ requestSource () { const that = this; - const url = '/api/sources/lines'; + const url = window.baseUrl + '/api/sources/lines'; const options = _.extend({ uuid: this.model.id }, this.linesLimit()); return $.get(url, options).done(function (data) { let source = (data.sources || []).slice(0); @@ -243,7 +243,7 @@ export default Marionette.LayoutView.extend({ requestDuplications () { const that = this; - const url = '/api/duplications/show'; + const url = window.baseUrl + '/api/duplications/show'; const options = { uuid: this.model.id }; return $.get(url, options, function (data) { const hasDuplications = (data != null) && (data.duplications != null); @@ -418,7 +418,7 @@ export default Marionette.LayoutView.extend({ this.clearTooltips(); const line = $(e.currentTarget).data('line-number'); const row = _.findWhere(this.model.get('source'), { line }); - const url = '/api/tests/list'; + const url = window.baseUrl + '/api/tests/list'; const options = { sourceFileId: this.model.id, sourceFileLineNumber: line, @@ -619,7 +619,7 @@ export default Marionette.LayoutView.extend({ const that = this; let source = this.model.get('source'); const firstLine = _.first(source).line; - const url = '/api/sources/lines'; + const url = window.baseUrl + '/api/sources/lines'; const options = { uuid: this.model.id, from: firstLine - this.LINES_AROUND, @@ -665,7 +665,7 @@ export default Marionette.LayoutView.extend({ const that = this; let source = this.model.get('source'); const lastLine = _.last(source).line; - const url = '/api/sources/lines'; + const url = window.baseUrl + '/api/sources/lines'; const options = { uuid: this.model.id, from: lastLine + 1, diff --git a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js index 953a3e90f80..44d9837f70c 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js +++ b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js @@ -106,7 +106,7 @@ export default ModalView.extend({ getMetrics () { let metrics = ''; - const url = '/api/metrics/search'; + const url = window.baseUrl + '/api/metrics/search'; $.ajax({ url, async: false, @@ -156,7 +156,7 @@ export default ModalView.extend({ requestMeasures () { const that = this; - const url = '/api/resources'; + const url = window.baseUrl + '/api/resources'; const metrics = this.getMetrics(); const options = { resource: this.model.key(), @@ -181,7 +181,7 @@ export default ModalView.extend({ requestIssues () { const that = this; - const url = '/api/issues/search'; + const url = window.baseUrl + '/api/issues/search'; const options = { componentUuids: this.model.id, resolved: false, @@ -211,7 +211,7 @@ export default ModalView.extend({ requestTests () { const that = this; - const url = '/api/tests/list'; + const url = window.baseUrl + '/api/tests/list'; const options = { testFileId: this.model.id }; return $.get(url, options).done(function (data) { that.model.set({ tests: data.tests }); @@ -267,7 +267,7 @@ export default ModalView.extend({ showTest (e) { const that = this; const testId = $(e.currentTarget).data('id'); - const url = '/api/tests/covered_files'; + const url = window.baseUrl + '/api/tests/covered_files'; const options = { testId }; this.testsScroll = $(e.currentTarget).scrollParent().scrollTop(); return $.get(url, options).done(function (data) { diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js index acb9b46be42..0dc4d4ab012 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js +++ b/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js @@ -29,7 +29,7 @@ export default Popup.extend({ getPermalink (e) { e.preventDefault(); - const url = `/component/index?id=${encodeURIComponent(this.model.key())}&line=${this.options.line}`; + const url = `${window.baseUrl}/component/index?id=${encodeURIComponent(this.model.key())}&line=${this.options.line}`; const windowParams = 'resizable=1,scrollbars=1,status=1'; window.open(url, this.model.get('name'), windowParams); } diff --git a/server/sonar-web/src/main/js/components/workspace/main.js b/server/sonar-web/src/main/js/components/workspace/main.js index b3f94c3e6d1..b41e3e1440f 100644 --- a/server/sonar-web/src/main/js/components/workspace/main.js +++ b/server/sonar-web/src/main/js/components/workspace/main.js @@ -127,7 +127,7 @@ Workspace.prototype = { }, fetchRule (model) { - const url = '/api/rules/show'; + const url = window.baseUrl + '/api/rules/show'; const options = { key: model.get('key') }; return $.get(url, options).done(function (r) { model.set(r.rule); diff --git a/server/sonar-web/src/main/js/helpers/handlebars/componentBrowsePermalink.js b/server/sonar-web/src/main/js/helpers/handlebars/componentBrowsePermalink.js index 3ab861f7ed5..7ff20912433 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/componentBrowsePermalink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/componentBrowsePermalink.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (componentKey) { - return '/components/index?id=' + encodeURIComponent(componentKey); + return window.baseUrl + '/components/index?id=' + encodeURIComponent(componentKey); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/componentDashboardPermalink.js b/server/sonar-web/src/main/js/helpers/handlebars/componentDashboardPermalink.js index 6dbd1e36d05..4409bdfa442 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/componentDashboardPermalink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/componentDashboardPermalink.js @@ -35,5 +35,5 @@ module.exports = function (componentKey, dashboardKey) { const query = params.map(function (p) { return p.key + '=' + encodeURIComponent(p.value); }).join('&'); - return '/dashboard/index?' + query; + return window.baseUrl + '/dashboard/index?' + query; }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/componentIssuesPermalink.js b/server/sonar-web/src/main/js/helpers/handlebars/componentIssuesPermalink.js index 6a05b8fbb77..5dcf2d00bcc 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/componentIssuesPermalink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/componentIssuesPermalink.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (componentKey) { - return '/component_issues/index?id=' + encodeURIComponent(componentKey); + return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(componentKey); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/componentPermalink.js b/server/sonar-web/src/main/js/helpers/handlebars/componentPermalink.js index a259f0f1c19..9a58d761cb2 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/componentPermalink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/componentPermalink.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (componentKey) { - return '/dashboard/index?id=' + encodeURIComponent(componentKey); + return window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/dashboardUrl.js b/server/sonar-web/src/main/js/helpers/handlebars/dashboardUrl.js index 618f65b651c..f4ffe0d04e6 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/dashboardUrl.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/dashboardUrl.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (componentKey, componentQualifier) { - let url = '/dashboard/index?id=' + encodeURIComponent(componentKey); + let url = window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey); if (componentQualifier === 'FIL' || componentQualifier === 'CLA') { url += '&metric=sqale_index'; } diff --git a/server/sonar-web/src/main/js/helpers/handlebars/exporterUrl.js b/server/sonar-web/src/main/js/helpers/handlebars/exporterUrl.js index dca3e991b69..7ae30121d77 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/exporterUrl.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/exporterUrl.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (profile, exporterKey) { - let url = '/api/qualityprofiles/export'; + let url = window.baseUrl + '/api/qualityprofiles/export'; url += '?language=' + encodeURIComponent(profile.language); url += '&name=' + encodeURIComponent(profile.name); if (exporterKey != null) { diff --git a/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js b/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js index d52892d3512..34e9433c814 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js @@ -22,6 +22,6 @@ module.exports = function (...args) { const list = args.slice(0, -1); const prefix = list.join(''); const path = window.location.pathname; - const match = path.indexOf(prefix) === 0; + const match = path.indexOf(window.baseUrl + prefix) === 0; return match ? options.fn(this) : options.inverse(this); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterHomeLink.js b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterHomeLink.js index 916163307c1..45223dab35a 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterHomeLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterHomeLink.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (id) { - return '/issues/search#id=' + id; + return window.baseUrl + '/issues/search#id=' + id; }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js index 5039f525a95..92c18bcc5ca 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js @@ -36,9 +36,9 @@ module.exports = function (query, property, value, mode) { r.facetMode = 'debt'; } if (r.componentKey != null) { - return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return '/issues/search#' + getQuery(r); + return window.baseUrl + '/issues/search#' + getQuery(r); } }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js index 5b02cca139f..c5212c6fcfb 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js @@ -34,9 +34,9 @@ module.exports = function (query, mode) { r.facetMode = 'debt'; } if (r.componentKey != null) { - return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return '/issues/search#' + getQuery(r); + return window.baseUrl + '/issues/search#' + getQuery(r); } }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/link.js b/server/sonar-web/src/main/js/helpers/handlebars/link.js index c0db825918d..5ef30cdbddf 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/link.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/link.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (...args) { - return args.slice(0, -1).join(''); + return window.baseUrl + args.slice(0, -1).join(''); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/profileUrl.js b/server/sonar-web/src/main/js/helpers/handlebars/profileUrl.js index 29635828f10..e865772206c 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/profileUrl.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/profileUrl.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (key) { - return '/profiles/show?key=' + encodeURIComponent(key); + return window.baseUrl + '/profiles/show?key=' + encodeURIComponent(key); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/rulePermalink.js b/server/sonar-web/src/main/js/helpers/handlebars/rulePermalink.js index 2e119690f34..13b121aa173 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/rulePermalink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/rulePermalink.js @@ -18,5 +18,5 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ module.exports = function (ruleKey) { - return '/coding_rules#rule_key=' + encodeURIComponent(ruleKey); + return window.baseUrl + '/coding_rules#rule_key=' + encodeURIComponent(ruleKey); }; diff --git a/server/sonar-web/src/main/js/helpers/l10n.js b/server/sonar-web/src/main/js/helpers/l10n.js index 3045a66c855..0744ede3acf 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.js +++ b/server/sonar-web/src/main/js/helpers/l10n.js @@ -44,7 +44,7 @@ function getCurrentLocale () { } function makeRequest (params) { - const url = `/api/l10n/index?${stringify(params)}`; + const url = `${window.baseUrl}/api/l10n/index?${stringify(params)}`; return fetch(url, { credentials: 'same-origin' }).then(response => { if (response.status === 304) { diff --git a/server/sonar-web/src/main/js/helpers/urls.js b/server/sonar-web/src/main/js/helpers/urls.js index 5279154290a..ef621da701a 100644 --- a/server/sonar-web/src/main/js/helpers/urls.js +++ b/server/sonar-web/src/main/js/helpers/urls.js @@ -23,7 +23,7 @@ * @returns {string} */ export function getComponentUrl (componentKey) { - return '/dashboard?id=' + encodeURIComponent(componentKey); + return window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey); } @@ -37,7 +37,7 @@ export function getComponentIssuesUrl (componentKey, query) { const serializedQuery = Object.keys(query).map(criterion => ( `${encodeURIComponent(criterion)}=${encodeURIComponent(query[criterion])}` )).join('|'); - return '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery; + return window.baseUrl + '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery; } @@ -48,7 +48,7 @@ export function getComponentIssuesUrl (componentKey, query) { * @returns {string} */ export function getComponentDrilldownUrl (componentKey, metric) { - return `/component_measures/metric/${metric}?id=${encodeURIComponent(componentKey)}`; + return `${window.baseUrl}/component_measures/metric/${metric}?id=${encodeURIComponent(componentKey)}`; } @@ -60,7 +60,7 @@ export function getComponentDrilldownUrl (componentKey, metric) { * @returns {string} */ export function getComponentDashboardUrl (componentKey, dashboardKey, period) { - let url = '/dashboard?id=' + encodeURIComponent(componentKey) + + let url = window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey) + '&did=' + encodeURIComponent(dashboardKey); if (period) { url += '&period=' + period; @@ -76,7 +76,7 @@ export function getComponentDashboardUrl (componentKey, dashboardKey, period) { * @returns {string} */ export function getComponentFixedDashboardUrl (componentKey, dashboardKey) { - return '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey); + return window.baseUrl + '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey); } @@ -86,5 +86,5 @@ export function getComponentFixedDashboardUrl (componentKey, dashboardKey) { * @returns {string} */ export function getComponentDashboardManagementUrl (componentKey) { - return '/dashboards?resource=' + encodeURIComponent(componentKey); + return window.baseUrl + '/dashboards?resource=' + encodeURIComponent(componentKey); } diff --git a/server/sonar-web/src/main/js/libs/application.js b/server/sonar-web/src/main/js/libs/application.js index 20564e127d5..43a1492ca2d 100644 --- a/server/sonar-web/src/main/js/libs/application.js +++ b/server/sonar-web/src/main/js/libs/application.js @@ -99,7 +99,7 @@ function toggleFav (resourceId, elt) { jQuery.ajax({ - type: 'POST', dataType: 'json', url: '/favourites/toggle/' + resourceId, + type: 'POST', dataType: 'json', url: window.baseUrl + '/favourites/toggle/' + resourceId, success: function (data) { var star = jQuery(elt); star.removeClass('icon-favorite icon-not-favorite'); diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-breadcrumbs.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-breadcrumbs.js index 9f606b9f24d..0b71555ad81 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-breadcrumbs.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-breadcrumbs.js @@ -26,7 +26,7 @@ export default React.createClass({ return null; } const items = this.props.breadcrumbs.map((item, index) => { - const url = `/dashboard/index?id=${encodeURIComponent(item.key)}`; + const url = `${window.baseUrl}/dashboard/index?id=${encodeURIComponent(item.key)}`; return ( <li key={index}> <a href={url}> diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js index a8041db7fe5..22fb055a93a 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js @@ -69,13 +69,13 @@ export default React.createClass({ isFixedDashboardActive() { const path = window.location.pathname; - return path.indexOf('/overview') === 0; + return path.indexOf(window.baseUrl + '/overview') === 0; }, isCustomDashboardActive(customDashboard) { const path = window.location.pathname; const params = qs.parse(window.location.search.substr(1)); - return path.indexOf('/dashboard') === 0 && params['did'] === `${customDashboard.key}`; + return path.indexOf(window.baseUrl + '/dashboard') === 0 && params['did'] === `${customDashboard.key}`; }, isCustomDashboardsActive () { @@ -87,12 +87,12 @@ export default React.createClass({ isDefaultDeveloperDashboardActive() { const path = window.location.pathname; - return this.isDeveloper() && path.indexOf('/dashboard') === 0; + return this.isDeveloper() && path.indexOf(window.baseUrl + '/dashboard') === 0; }, isDashboardManagementActive () { const path = window.location.pathname; - return path.indexOf('/dashboards') === 0; + return path.indexOf(window.baseUrl + '/dashboards') === 0; }, renderOverviewLink() { diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-meta.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-meta.js index d3ad623999c..27e52fc7508 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-meta.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-meta.js @@ -26,7 +26,7 @@ export default React.createClass({ render() { let metaList = []; let canSeeBackgroundTasks = this.props.conf.showBackgroundTasks; - let backgroundTasksUrl = `/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`; + let backgroundTasksUrl = `${window.baseUrl}/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`; if (this.props.isInProgress) { let tooltip = canSeeBackgroundTasks ? diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js index b572ad97ce6..150e8f524be 100644 --- a/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js +++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js @@ -22,7 +22,7 @@ import { translate } from '../../../helpers/l10n'; export default React.createClass({ renderLogo() { - let url = this.props.logoUrl || '/images/logo.svg'; + let url = this.props.logoUrl || `${window.baseUrl}/images/logo.svg`; let width = this.props.logoWidth || 100; let height = 30; let title = translate('layout.sonar.slogan'); @@ -34,7 +34,7 @@ export default React.createClass({ }, render() { - const homeUrl = '/'; + const homeUrl = window.baseUrl + '/'; const homeLinkClassName = 'navbar-brand' + (this.props.logoUrl ? ' navbar-brand-custom' : ''); return ( <div className="navbar-header"> diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js index e3d0bc158c9..cf945ffb4b8 100644 --- a/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js @@ -30,7 +30,7 @@ export default React.createClass({ }, renderDashboardLink (dashboard) { - const url = `/dashboard/index?did=${encodeURIComponent(dashboard.key)}`; + const url = `${window.baseUrl}/dashboard/index?did=${encodeURIComponent(dashboard.key)}`; const name = this.getLocalizedDashboardName(dashboard.name); return ( <li key={dashboard.name}> @@ -40,7 +40,7 @@ export default React.createClass({ }, renderDashboardsManagementLink () { - const url = '/dashboards'; + const url = window.baseUrl + '/dashboards'; return ( <li> <a href={url}>{translate('dashboard.manage_dashboards')}</a> @@ -67,7 +67,7 @@ export default React.createClass({ }, renderIssuesLink () { - const url = '/issues/search'; + const url = window.baseUrl + '/issues/search'; return ( <li className={this.activeLink('/issues')}> <a href={url}>{translate('issues.page')}</a> @@ -76,7 +76,7 @@ export default React.createClass({ }, renderMeasuresLink () { - const url = '/measures/search?qualifiers[]=TRK'; + const url = window.baseUrl + '/measures/search?qualifiers[]=TRK'; return ( <li className={this.activeLink('/measures')}> <a href={url}>{translate('layout.measures')}</a> @@ -85,7 +85,7 @@ export default React.createClass({ }, renderRulesLink () { - const url = '/coding_rules'; + const url = window.baseUrl + '/coding_rules'; return ( <li className={this.activeLink('/coding_rules')}> <a href={url}>{translate('coding_rules.page')}</a> @@ -94,7 +94,7 @@ export default React.createClass({ }, renderProfilesLink() { - const url = '/profiles'; + const url = window.baseUrl + '/profiles'; return ( <li className={this.activeLink('/profiles')}> <a href={url}>{translate('quality_profiles.page')}</a> @@ -103,7 +103,7 @@ export default React.createClass({ }, renderQualityGatesLink () { - const url = '/quality_gates'; + const url = window.baseUrl + '/quality_gates'; return ( <li className={this.activeLink('/quality_gates')}> <a href={url}>{translate('quality_gates.page')}</a> @@ -115,7 +115,7 @@ export default React.createClass({ if (!window.SS.isUserAdmin) { return null; } - const url = '/settings'; + const url = window.baseUrl + '/settings'; return ( <li className={this.activeLink('/settings')}> <a className="navbar-admin-link" href={url}>{translate('layout.settings')}</a> @@ -124,7 +124,7 @@ export default React.createClass({ }, renderComparisonLink () { - const url = '/comparison'; + const url = window.baseUrl + '/comparison'; return ( <li className={this.activeLink('/comparison')}> <a href={url}>{translate('comparison_global.page')}</a> @@ -133,7 +133,7 @@ export default React.createClass({ }, renderGlobalPageLink (globalPage, index) { - const url = globalPage.url; + const url = window.baseUrl + globalPage.url; return ( <li key={index}> <a href={url}>{globalPage.name}</a> diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js index e9acafd4700..1feb41770e1 100644 --- a/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js +++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js @@ -32,7 +32,7 @@ export default React.createClass({ </a> <ul className="dropdown-menu dropdown-menu-right"> <li> - <a href="/account/">{translate('my_account.page')}</a> + <a href={`${window.baseUrl}/account/`}>{translate('my_account.page')}</a> </li> <li> <a onClick={this.handleLogout} href="#">{translate('layout.logout')}</a> @@ -53,13 +53,13 @@ export default React.createClass({ handleLogin(e) { e.preventDefault(); const returnTo = window.location.pathname + window.location.search; - window.location = `/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`; + window.location = `${window.baseUrl}/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`; }, handleLogout(e) { e.preventDefault(); RecentHistory.clear(); - window.location = '/sessions/logout'; + window.location = `${window.baseUrl}/sessions/logout`; }, render() { diff --git a/server/sonar-web/src/main/js/main/nav/global/search-view.js b/server/sonar-web/src/main/js/main/nav/global/search-view.js index 14751ee3ad7..80c05243334 100644 --- a/server/sonar-web/src/main/js/main/nav/global/search-view.js +++ b/server/sonar-web/src/main/js/main/nav/global/search-view.js @@ -154,11 +154,11 @@ export default Marionette.LayoutView.extend({ fetchFavorite () { const that = this; - return $.get('/api/favourites').done(function (r) { + return $.get(window.baseUrl + '/api/favourites').done(function (r) { that.favorite = r.map(function (f) { const isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1; return { - url: '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true), + url: window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true), name: isFile ? collapsedDirFromPath(f.lname) + fileFromPath(f.lname) : f.name, icon: 'favorite' }; @@ -170,7 +170,7 @@ export default Marionette.LayoutView.extend({ resetResultsToDefault () { const recentHistory = RecentHistory.get(); const history = recentHistory.map(function (historyItem, index) { - const url = '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + + const url = window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + window.dashboardParameters(true); return { url, @@ -184,7 +184,7 @@ export default Marionette.LayoutView.extend({ }); const qualifiers = this.model.get('qualifiers').map(function (q, index) { return { - url: '/all_projects?qualifier=' + encodeURIComponent(q), + url: window.baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q), name: translate('qualifiers.all', q), extra: index === 0 ? '' : null }; @@ -198,7 +198,7 @@ export default Marionette.LayoutView.extend({ return; } const that = this; - const url = '/api/components/suggestions'; + const url = window.baseUrl + '/api/components/suggestions'; const options = { s: q }; return $.get(url, options).done(function (r) { const collection = []; @@ -207,7 +207,7 @@ export default Marionette.LayoutView.extend({ collection.push(_.extend(item, { q: domain.q, extra: index === 0 ? domain.name : null, - url: '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true) + url: window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true) })); }); }); @@ -222,16 +222,16 @@ export default Marionette.LayoutView.extend({ getNavigationFindings (q) { const DEFAULT_ITEMS = [ - { name: translate('issues.page'), url: '/issues/search' }, - { name: translate('layout.measures'), url: '/measures/search?qualifiers[]=TRK' }, - { name: translate('coding_rules.page'), url: '/coding_rules' }, - { name: translate('quality_profiles.page'), url: '/profiles' }, - { name: translate('quality_gates.page'), url: '/quality_gates' }, - { name: translate('comparison_global.page'), url: '/comparison' } + { name: translate('issues.page'), url: window.baseUrl + '/issues/search' }, + { name: translate('layout.measures'), url: window.baseUrl + '/measures/search?qualifiers[]=TRK' }, + { name: translate('coding_rules.page'), url: window.baseUrl + '/coding_rules' }, + { name: translate('quality_profiles.page'), url: window.baseUrl + '/profiles' }, + { name: translate('quality_gates.page'), url: window.baseUrl + '/quality_gates' }, + { name: translate('comparison_global.page'), url: window.baseUrl + '/comparison' } ]; const customItems = []; if (window.SS.isUserAdmin) { - customItems.push({ name: translate('layout.settings'), url: '/settings' }); + customItems.push({ name: translate('layout.settings'), url: window.baseUrl + '/settings' }); } const findings = [].concat(DEFAULT_ITEMS, customItems).filter(function (f) { return f.name.match(new RegExp(q, 'i')); @@ -245,7 +245,7 @@ export default Marionette.LayoutView.extend({ getGlobalDashboardFindings (q) { const dashboards = this.model.get('globalDashboards') || []; const items = dashboards.map(function (d) { - return { name: d.name, url: '/dashboard/index?did=' + encodeURIComponent(d.key) }; + return { name: d.name, url: window.baseUrl + '/dashboard/index?did=' + encodeURIComponent(d.key) }; }); const findings = items.filter(function (f) { return f.name.match(new RegExp(q, 'i')); diff --git a/server/sonar-web/src/main/js/main/nav/links-mixin.js b/server/sonar-web/src/main/js/main/nav/links-mixin.js index 4990a86365d..5db7233ba3c 100644 --- a/server/sonar-web/src/main/js/main/nav/links-mixin.js +++ b/server/sonar-web/src/main/js/main/nav/links-mixin.js @@ -23,11 +23,11 @@ import React from 'react'; export default { activeLink(url) { - return window.location.pathname.indexOf(url) === 0 ? 'active' : null; + return window.location.pathname.indexOf(window.baseUrl + url) === 0 ? 'active' : null; }, renderLink(url, title, highlightUrl = url) { - let fullUrl = url; + let fullUrl = window.baseUrl + url; let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink; return ( <li key={url} className={check(highlightUrl)}> @@ -37,7 +37,7 @@ export default { }, renderNewLink(url, title, highlightUrl = url) { - let fullUrl = url; + let fullUrl = window.baseUrl + url; let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink; return ( <li key={highlightUrl} className={check(highlightUrl)}> diff --git a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js index 343e0be6482..4e768bdd01a 100644 --- a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js +++ b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js @@ -56,10 +56,10 @@ const defaultLink = function (item, property, query, index, items, mode) { r.facetMode = 'debt'; } if (r.componentKey != null) { - return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return '/issues/search#' + getQuery(r); + return window.baseUrl + '/issues/search#' + getQuery(r); } }; @@ -181,10 +181,10 @@ const byDistributionConf = { r.facetMode = 'debt'; } if (r.componentKey != null) { - return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return '/issues/search#' + getQuery(r); + return window.baseUrl + '/issues/search#' + getQuery(r); } } } @@ -285,7 +285,7 @@ export default Marionette.ItemView.extend({ requestIssues () { const that = this; const facetMode = this.options.displayMode; - const url = '/api/issues/search'; + const url = window.baseUrl + '/api/issues/search'; const options = _.extend({}, this.query, { facetMode, ps: 1, diff --git a/server/sonar-web/src/main/js/widgets/old/treemap.js b/server/sonar-web/src/main/js/widgets/old/treemap.js index 8ee32b8397d..090deb10886 100644 --- a/server/sonar-web/src/main/js/widgets/old/treemap.js +++ b/server/sonar-web/src/main/js/widgets/old/treemap.js @@ -331,7 +331,7 @@ import { translate } from '../../helpers/l10n'; Treemap.prototype.requestChildren = function (d) { const that = this; const metrics = this.metricsPriority().join(','); - const RESOURCES_URL = '/api/resources/index'; + const RESOURCES_URL = window.baseUrl + '/api/resources/index'; return $.get(RESOURCES_URL, { resource: d.key, depth: 1, diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb index 99d3093545d..508c5ac7ae1 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb @@ -80,7 +80,7 @@ class AccountController < ApplicationController end end - redirect_to "/account/notifications" + redirect_to "#{ApplicationController.root_context}/account/notifications" end private diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb index 55959e331d1..d1c1682b30e 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb @@ -43,7 +43,7 @@ class ApplicationController < ActionController::Base rescue_from Errors::AccessDenied, :with => :render_access_denied # See lib/authenticated_system.rb#access_denied() def self.root_context - '' + ActionController::Base.relative_url_root || '' end def java_facade diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 262665471b9..982956acd76 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -167,9 +167,9 @@ module ApplicationHelper # url_for_static(:plugin => 'myplugin', :path => 'image.png') def url_for_static(options={}) if options[:plugin] - "/static/#{options[:plugin]}/#{options[:path]}" + "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}" else - "/#{options[:path]}" + "#{ApplicationController.root_context}/#{options[:path]}" end end @@ -329,10 +329,10 @@ module ApplicationHelper period_index=nil if period_index && period_index<=0 if resource.display_dashboard? if options[:dashboard] - root = "/dashboard/index?" + root = "#{ApplicationController.root_context}/dashboard/index?" else # stay on the same page (for example components) - root = "/#{u params[:controller]}/#{u params[:action]}?" + root = "#{ApplicationController.root_context}/#{u params[:controller]}/#{u params[:action]}?" end path = '' query = request.query_parameters @@ -345,7 +345,7 @@ module ApplicationHelper end "<a class='#{options[:class]}' title='#{options[:title]}' href='#{root + path}'>#{name || resource.name}</a>" else - url = "/dashboard/index?id=#{u resource.key}" + url = "#{ApplicationController.root_context}/dashboard/index?id=#{u resource.key}" url += "&period=#{u period_index}" if period_index url += "&metric=#{u options[:metric]}" if options[:metric] "<a class='#{options[:class]}' title='#{options[:title]}' " + @@ -413,7 +413,7 @@ module ApplicationHelper end def chart(parameters, options={}) - image_tag("/chart?#{parameters}", options) + image_tag("#{ApplicationController.root_context}/chart?#{parameters}", options) end def link_to_favourite(resource, deprecated_options=nil) @@ -645,7 +645,7 @@ module ApplicationHelper # see limitation in /api/resources/search options[:min_length]=2 - ws_url="/api/resources/search?f=s2&" + ws_url="#{ApplicationController::root_context}/api/resources/search?f=s2&" if options[:qualifiers] ws_url+="q=#{options[:qualifiers].join(',')}" elsif options[:resource_type_property] @@ -679,7 +679,7 @@ module ApplicationHelper # see limitation in /api/resources/search options[:min_length]=2 - ws_url="/api/resources/search?f=s2&" + ws_url="#{ApplicationController::root_context}/api/resources/search?f=s2&" if options[:qualifiers] ws_url+="q=#{options[:qualifiers].join(',')}" elsif options[:resource_type_property] @@ -711,7 +711,7 @@ module ApplicationHelper # * <tt>:select2_options</tt> - hash of select2 options # def user_select_tag(name, options={}) - ws_url="/api/users/search" + ws_url="#{ApplicationController::root_context}/api/users/search" options[:min_length]=2 options[:select2_ajax_options]={ 'data' => 'function (term, page) { return { q: term, p: page } }', @@ -851,7 +851,7 @@ module ApplicationHelper message_params = options[:confirm_msg_params] width = options[:confirm_width]||500 - url = "/confirm?url=#{u post_url}" + url = "#{ApplicationController.root_context}/confirm?url=#{u post_url}" url += "&tk=#{u title_key}" if title_key if message_key url += "&mk=#{u message_key}&" @@ -877,7 +877,7 @@ module ApplicationHelper html += " colspan='#{options[:colspan]}'" if options[:colspan] html += '>' if options[:include_loading_icon] && options[:id] - html += "<img src='/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>" + html += "<img src='#{ApplicationController.root_context}/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>" end html += '<div' html += " id='#{options[:id]}_pages'" if options[:id] @@ -944,7 +944,7 @@ module ApplicationHelper html += " colspan='#{options[:colspan]}'" if options[:colspan] html += '>' if options[:include_loading_icon] && options[:id] - html += "<img src='/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>" + html += "<img src='#{ApplicationController.root_context}/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>" end html += '<div' html += " id='#{options[:id]}_pages'" if options[:id] @@ -992,7 +992,7 @@ module ApplicationHelper end def url_for_issues(params) - url = '/issues/search#' + url = ApplicationController.root_context + '/issues/search#' params.each_with_index do |(key, value), index| if key == 'filter' key = 'id' @@ -1009,7 +1009,7 @@ module ApplicationHelper if component.blank? url_for_issues(params) else - url = '/component_issues/index?id=' + url_encode(component.key) + '#' + url = ApplicationController.root_context + '/component_issues/index?id=' + url_encode(component.key) + '#' params.each_with_index do |(key, value), index| if key != 'componentUuids' url += key.to_s + '=' + value.to_s diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb index 63b2f0b9cfd..c62a514c98e 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_change_password_form.html.erb @@ -1,4 +1,4 @@ -<form id="pass_form_tag" name="pass_form_tag" method="post" action="/account/change_password"> +<form id="pass_form_tag" name="pass_form_tag" method="post" action="<%= ApplicationController.root_context -%>/account/change_password"> <div class="modal-head"> <h2><%= message('my_profile.password.title') -%></h2> </div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb index 434c160613a..e0f6c2f658f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/_favorites.html.erb @@ -7,7 +7,7 @@ <td class="thin"><%= link_to_favourite f -%></td> <td> <% - url = '/dashboard?id=' + url_encode(f.key) + url = ApplicationController.root_context + '/dashboard?id=' + url_encode(f.key) %> <a href="<%= url -%>" class="link-with-icon"> <%= qualifier_icon f %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb index c81109e64f9..bcad3768198 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/index.html.erb @@ -92,5 +92,5 @@ ] }; </script> - <script src="/js/bundles/account.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/account.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/notifications.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/notifications.html.erb index 728550b5a3e..29ac2b1ce1d 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/notifications.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/account/notifications.html.erb @@ -48,7 +48,7 @@ </section> <% end %> - <form id="notif_form" method="post" action="/account/update_notifications"> + <form id="notif_form" method="post" action="<%= ApplicationController.root_context -%>/account/update_notifications"> <% unless @global_dispatchers.empty? -%> <section class="big-spacer-bottom"> <%= render "account/global_notifications" -%> @@ -71,5 +71,5 @@ </div> <% content_for :extra_script do %> - <script src="/js/bundles/account.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/account.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb index 5b1b5346f45..3e12a98f45d 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/api_documentation/index.html.erb @@ -2,5 +2,5 @@ <script> window.sonarqube.urlRoot = window.baseUrl + '/web_api'; </script> - <script src="/js/bundles/api-documentation.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/api-documentation.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/background_tasks/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/background_tasks/index.html.erb index 8b7563b9081..18cce998a6f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/background_tasks/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/background_tasks/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/code/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/code/index.html.erb index a805ff002fd..f5600f6ca03 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/code/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/code/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/code.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/code.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb index 21b70621c4e..7d421c9d66d 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/coding-rules.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/coding-rules.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb index 540fd047a6e..67618e7b4cb 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb @@ -69,7 +69,7 @@ <header class="page-header"> <h1 class="page-title"><%= h message('comparison.page') -%></h1> </header> - <form method="GET" id="compare-form" action="/comparison/index"> + <form method="GET" id="compare-form" action="<%= ApplicationController.root_context -%>/comparison/index"> <input type="hidden" name="sids" id="sids" value="<%= @snapshots.map { |s| s.id.to_s }.join(',') -%>"> <input type="hidden" name="metrics" id="metrics" value="<%= @metrics.map { |m| m.key }.join(',') -%>"> @@ -112,7 +112,7 @@ $j('#version_loading').show(); $j.ajax({ type:'GET', - url:'/comparison/versions?resource=' + url:'<%= ApplicationController.root_context -%>/comparison/versions?resource=' + id + '&sids=' + $j('#sids').val(), success:function (data) { @@ -169,7 +169,7 @@ <% if index > 0 %> <a class="icon-move-left" href="#" onclick="moveLeft(<%= index -%>)" id="left-<%= index -%>"></a> <% else %> - <img src="/images/transparent_16.gif"/> + <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/> <% end %> </td> <td style="text-align: center; min-width: 100px"> @@ -181,7 +181,7 @@ <% if index < last_index %> <a class="icon-move-right" href="#" onclick="moveRight(<%= index -%>)" id="right-<%= index -%>"></a> <% else %> - <img src="/images/transparent_16.gif"/> + <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/> <% end %> </td> </tr> @@ -199,7 +199,7 @@ %> <th style="text-align: center; vertical-align: top; line-height: 1.5;"> <span class="no-transform"> - <a href="/dashboard/index/<%= s.resource.key -%>"><%= h s.resource.name(true) -%></a> + <a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= s.resource.key -%>"><%= h s.resource.name(true) -%></a> <br/> <span class="note"><b><%= event ? h(event.name) : message('comparison.version.latest') -%></b></span> <br/> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb index 39ca697ed6e..27fe285b3d7 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component/index.html.erb @@ -9,7 +9,7 @@ }; })(); </script> - <script src="/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb index 53629f56020..b2b853e610b 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_issues/index.html.erb @@ -9,5 +9,5 @@ }; })(); </script> - <script src="/js/bundles/component-issues.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/component-issues.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_measures/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_measures/index.html.erb index 48f2b4c0e95..96d117fa27e 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_measures/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/component_measures/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/component-measures.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/component-measures.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb index bfecce9911e..64f47c4f522 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb @@ -11,7 +11,7 @@ </div> <div class="modal-body"> <div class="info"> - <img src="/images/information.png" style="vertical-align: text-bottom"/> + <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/> <%= h message(message_key, :params => message_params) -%> </div> </div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb index cff02fb111d..8a7e139e257 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/custom_measures/index.html.erb @@ -2,5 +2,5 @@ <script> window.sonarqube.projectId = '<%= @resource.uuid -%>'; </script> - <script src="/js/bundles/custom-measures.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/custom-measures.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb index 319694faee3..48343d6ab40 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb @@ -1,4 +1,4 @@ -<form id="configure-widget-<%= widget.id -%>" method="post" action="/dashboard/save_widget?wid=<%= widget.id -%>"> +<form id="configure-widget-<%= widget.id -%>" method="post" action="<%= ApplicationController.root_context -%>/dashboard/save_widget?wid=<%= widget.id -%>"> <div id="error<%= widget.id -%>" class="error" style="display: none"></div> <table class="table width100"> <tbody> @@ -65,7 +65,7 @@ $('#error<%= widget.id -%>').show(); } else { $.ajax({ - url: baseUrl + '/dashboard/save_widget?wid=<%= widget.id -%>&id=<%= params[:id] -%>', + url: window.baseUrl + '/dashboard/save_widget?wid=<%= widget.id -%>&id=<%= params[:id] -%>', type: 'POST', data: form.serialize(), error: function (request) { diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb index 296fe1e3e00..48b2288e5fa 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb @@ -1,6 +1,6 @@ <% content_for :script do %> - <script src="/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> - <script src="/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> <% end %> <div class="page" id="dashboard"> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb index 6603843b870..132fe9ded98 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb @@ -1,6 +1,6 @@ <% content_for :script do %> - <script src="/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> - <script src="/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb index 05f0f5bfb27..72416ed82eb 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb @@ -14,7 +14,7 @@ }; })(); </script> - <script src="/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb index 298a8073f34..6ea50822919 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb @@ -1,4 +1,4 @@ -<form id="create-dashboard-form" method="post" action="/dashboards/create"> +<form id="create-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/create"> <% if @global %> <input type="hidden" name="global" value="true" /> <% else %> @@ -39,7 +39,7 @@ <script> $j("#create-dashboard-form").modalForm({success: function (data) { var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : ''; - window.location = baseUrl + '/dashboards' + contextParams; + window.location = window.baseUrl + '/dashboards' + contextParams; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb index 9b44f6643a1..2bbdcfa5270 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb @@ -1,4 +1,4 @@ -<form id="delete-dashboard-form" method="post" action="/dashboards/delete"> +<form id="delete-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/delete"> <input type="hidden" name="id" value="<%= @dashboard.id -%>"> <% if @dashboard.global %> <input type="hidden" name="global" value="true" /> @@ -27,6 +27,6 @@ <script> $j("#delete-dashboard-form").modalForm({success: function (data) { var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : ''; - window.location = baseUrl + '/dashboards' + contextParams; + window.location = window.baseUrl + '/dashboards' + contextParams; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb index 9309a22c5ff..afd283ef4ac 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb @@ -1,4 +1,4 @@ -<form id="edit-dashboard-form" method="post" action="/dashboards/update"> +<form id="edit-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/update"> <input type="hidden" name="id" value="<%= @dashboard.id -%>"> <% if @dashboard.global %> <input type="hidden" name="global" value="true" /> @@ -46,6 +46,6 @@ <script> $j("#edit-dashboard-form").modalForm({success: function (data) { var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : ''; - window.location = baseUrl + '/dashboards' + contextParams; + window.location = window.baseUrl + '/dashboards' + contextParams; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/issues.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/issues.html.erb index b071bc9ea40..375fb397e3c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/issues.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/issues.html.erb @@ -7,7 +7,7 @@ severity: <% if @severity %>'<%= @severity -%>'<% else %>null<% end %>, periodDate: <% if @period %>'<%= @snapshot.period_datetime(@period) -%>'<% else %>null<% end %> }, - url = baseUrl + '/component_issues/index?id=<%= @resource.key -%>#resolved=false'; + url = window.baseUrl + '/component_issues/index?id=<%= @resource.key -%>#resolved=false'; if (config.rule) { url = url + '|rules=' + config.rule; } diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb index 0de15fd9ff5..76265ab1097 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb @@ -1,4 +1,4 @@ -<form method="post" action="/email_configuration/save" class="marginbottom10"> +<form method="post" action="<%= ApplicationController.root_context -%>/email_configuration/save" class="marginbottom10"> <table class="marginbottom10"> <tbody> <tr class="property"> @@ -62,7 +62,7 @@ </table> </form> -<form method="post" action="/email_configuration/send_test_email"> +<form method="post" action="<%= ApplicationController.root_context -%>/email_configuration/send_test_email"> <table class="data marginbottom10"> <thead> <tr> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb index 572d1ea6ea5..e2624527d17 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb @@ -17,7 +17,7 @@ type="button" value="Generate secret key" onclick="$j.ajax({ - url:'/encryption_configuration/generate_secret', + url:'<%=ApplicationController.root_context-%>/encryption_configuration/generate_secret', type:'post', success:function(response){$j('#secret_content').html(response);}, error:function(response){$j('#secret_error').html(response.responseText); $j('#secret_error').show();} diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb index 112eb854801..c2a1493ccd5 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb @@ -13,7 +13,7 @@ <form class="spacer-bottom" onsubmit= "$j.ajax({ - url:'/encryption_configuration/encrypt', + url:'<%=ApplicationController.root_context-%>/encryption_configuration/encrypt', type:'post', success:function(response) { @@ -31,7 +31,7 @@ }); return false;" method="post" - action="/encryption_configuration/encrypt" > + action="<%=ApplicationController.root_context-%>/encryption_configuration/encrypt" > <!-- for our lovely Chrome --> <input style="display:none"> <input type="password" name="fake" style="display:none"> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb index 747f7383293..e3bee63260c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/groups/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/groups.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/groups.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb index 81e331a02a3..1d209e79cf9 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb @@ -23,7 +23,7 @@ all_issues_are_assigned_to_current_user &&= issue.assignee() == current_user.login end %> -<form id="bulk-change-form" method="post" action="/issues/bulk_change"> +<form id="bulk-change-form" method="post" action="<%= ApplicationController.root_context -%>/issues/bulk_change"> <input type="hidden" name="issues" value="<%= @issues.map { |issue| issue.key() }.join(',') -%>"> <input type="hidden" name="actions[]" id="bulk-change-transition-action"> <fieldset> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_copy_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_copy_form.html.erb index 51551254393..ad34992b288 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_copy_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_copy_form.html.erb @@ -1,4 +1,4 @@ -<form id="copy-filter-form" method="post" action="/issues/copy"> +<form id="copy-filter-form" method="post" action="<%= ApplicationController.root_context -%>/issues/copy"> <input type="hidden" name="id" value="<%= @filter.id -%>"> <fieldset> <div class="modal-head"> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_edit_form.html.erb index c30a633e202..650e7e19993 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_edit_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_edit_form.html.erb @@ -1,4 +1,4 @@ -<form id="edit-filter-form" method="post" action="/issues/edit"> +<form id="edit-filter-form" method="post" action="<%= ApplicationController.root_context -%>/issues/edit"> <input type="hidden" name="id" value="<%= @filter.id -%>"> <fieldset> <div class="modal-head"> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_save_as_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_save_as_form.html.erb index 339e6cde5b7..a771f24bd01 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_save_as_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_filter_save_as_form.html.erb @@ -1,4 +1,4 @@ -<form id="save-as-filter-form" method="post" action="/issues/save_as"> +<form id="save-as-filter-form" method="post" action="<%= ApplicationController.root_context -%>/issues/save_as"> <input type="hidden" name="data" value="<%= u(@filter_query_serialized) -%>"> <fieldset> <div class="modal-head"> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/manage.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/manage.html.erb index d3019835eb5..6f069b68533 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/manage.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/manage.html.erb @@ -6,7 +6,7 @@ var star = $j(this); $j.ajax({ type: 'POST', - url: baseUrl + "/issues/toggle_fav", + url: window.baseUrl + "/issues/toggle_fav", data: {id: filterId}, success: function (data) { if (data == 'true') { @@ -23,15 +23,15 @@ }); function onSaveAs(data) { - window.location = baseUrl + '/issues/search#id=' + data; + window.location = window.baseUrl + '/issues/search#id=' + data; } function onCopy(data) { - window.location = baseUrl + '/issues/search#id=' + data; + window.location = window.baseUrl + '/issues/search#id=' + data; } function onEdit(data) { - window.location = baseUrl + '/issues/search#id=' + data; + window.location = window.baseUrl + '/issues/search#id=' + data; } </script> <% end %> @@ -59,7 +59,7 @@ <%= issue_filter_star(filter, @favourite_filter_ids.include?(filter.id)) -%> </td> <td> - <a href="/issues/search#id=<%= h filter.id -%>"><%= h filter.name -%></a> + <a href="<%= ApplicationController.root_context -%>/issues/search#id=<%= h filter.id -%>"><%= h filter.name -%></a> <% if filter.description %> <div class="note"><%= h filter.description -%></div> <% end %> @@ -72,13 +72,13 @@ <% end %> </td> <td class="thin nowrap text-right"> - <a id="copy-<%= filter.name.parameterize -%>" href="/issues/copy_form/<%= filter.id -%>" + <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> - <a id="edit_<%= filter.name.parameterize -%>" href="/issues/edit_form/<%= filter.id -%>" + <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - <%= link_to_action message('delete'), "/issues/delete/#{filter.id}", + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/issues/delete/#{filter.id}", :class => 'link-action link-red', :id => "delete_#{filter.name.parameterize}", :confirm_button => message('delete'), @@ -116,7 +116,7 @@ <%= issue_filter_star(filter, @favourite_filter_ids.include?(filter.id)) -%> </td> <td> - <a href="/issues/search#id=<%= h filter.id -%>|<%= h filter.data -%>"><%= h filter.name -%></a> + <a href="<%= ApplicationController.root_context -%>/issues/search#id=<%= h filter.id -%>|<%= h filter.data -%>"><%= h filter.name -%></a> <% if filter.description %> <div class="note"><%= h filter.description -%></div> <% end %> @@ -125,12 +125,12 @@ <%= filter.userLogin ? h(Api.users.findByLogin(filter.userLogin).name) : '[SonarQube]' -%> </td> <td class="thin nowrap text-right"> - <a id="copy-<%= filter.name.parameterize -%>" href="/issues/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> + <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> <% if has_role?(:admin) %> - <a id="edit_shared_<%= filter.name.parameterize -%>" href="/issues/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> + <a id="edit_shared_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - <%= link_to_action message('delete'), "/issues/delete/#{filter.id}", + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/issues/delete/#{filter.id}", :class => 'link-action link-red', :id => "delete_system_#{filter.name.parameterize}", :confirm_button => message('delete'), diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb index 48b7b4b268d..b1baf27f96c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/search.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/issues.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/issues.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb index 409489b0094..c5dbab53411 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb @@ -16,7 +16,7 @@ </script> <% end %> -<script src="/js/bundles/main.js?v=<%= sonar_version -%>"></script> +<script src="<%= ApplicationController.root_context -%>/js/bundles/main.js?v=<%= sonar_version -%>"></script> <%= yield :extra_script -%> </body> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb index ec1b9db64c7..66c5645c688 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb @@ -18,7 +18,7 @@ %> <title><%= title -%></title> - <link href="/css/sonar.css?v=<%= sonar_version -%>" rel="stylesheet" media="all"> + <link href="<%= ApplicationController.root_context -%>/css/sonar.css?v=<%= sonar_version -%>" rel="stylesheet" media="all"> <%= yield :style -%> <script> @@ -36,10 +36,10 @@ updateCenterActive: <%= configuration('sonar.updatecenter.activate', true) %> }; </script> - <script src="/js/bundles/vendor.js?v=<%= sonar_version -%>"></script> - <script src="/js/bundles/sonar.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/vendor.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/sonar.js?v=<%= sonar_version -%>"></script> <script> - window.baseUrl = ''; + window.baseUrl = '<%= ApplicationController.root_context -%>'; </script> <%= yield :script -%> </head> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index 55cfc7eb409..956616e9c7b 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -56,7 +56,7 @@ <a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> - <a href="http://www.sonarqube.org/support" target="support">Get Support</a> - <a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> - - <a href="/web_api">Web API</a> + <a href="<%= ApplicationController.root_context -%>/web_api">Web Service API</a> </div> <!--[if lte IE 8 ]><p class="spacer-top alert alert-danger">IE 8 is not supported. Some widgets may not be properly displayed. Please switch to a <a target="_blank" href="http://redirect.sonarsource.com/doc/requirements.html">supported version or another supported browser</a>.</p><!--<![endif]--> </div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/nonav.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/nonav.html.erb index 34a06883d13..be802926bd3 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/nonav.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/nonav.html.erb @@ -2,8 +2,8 @@ <nav class="navbar navbar-global page-container" id="global-navigation"> <div class="navbar-header"> - <a class="navbar-brand" href="/"> - <img src="/images/logo.svg" height="30" + <a class="navbar-brand" href="<%= ApplicationController.root_context -%>/"> + <img src="<%= ApplicationController.root_context -%>/images/logo.svg" height="30" alt="<%= h message('layout.sonar.slogan') -%>" title="<%= h message('layout.sonar.slogan') -%>"> </a> @@ -24,7 +24,7 @@ <a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> - <a href="http://www.sonarqube.org/support" target="support">Get Support</a> - <a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> - - <a href="/web_api">Web API</a> + <a href="<%= ApplicationController.root_context -%>/web_api">Web API</a> </div> <%= render 'branding/footer' -%> </div> @@ -36,7 +36,7 @@ })(window.jQuery); </script> -<script src="/js/bundles/main.js?v=<%= sonar_version -%>"></script> +<script src="<%= ApplicationController.root_context -%>/js/bundles/main.js?v=<%= sonar_version -%>"></script> <%= yield :extra_script -%> </body></html> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb index 106956d89d9..346aa13f860 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb @@ -2,6 +2,6 @@ <script> window.sonarqube.setup = false; </script> - <script src="/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb index 84057db8521..6f667bc45cd 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb @@ -4,5 +4,5 @@ <script> window.sonarqube.el = '#markdown-full-help'; </script> - <script src="/js/bundles/markdown.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/markdown.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb index 7fa6351ed3d..8112f5105a4 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb @@ -1,4 +1,4 @@ -<form id="copy-filter-form" method="post" action="/measures/copy"> +<form id="copy-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/copy"> <input type="hidden" name="id" value="<%= @filter.id -%>"> <fieldset> <div class="modal-head"> @@ -15,6 +15,6 @@ </form> <script> $j("#copy-filter-form").modalForm({success: function (data) { - window.location = baseUrl + '/measures/filter/' + data; + window.location = window.baseUrl + '/measures/filter/' + data; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb index 7c6ebfcb704..2e27d04a14c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb @@ -9,7 +9,7 @@ filterCriteria<%= widget_id -%>['sort']=sort; filterCriteria<%= widget_id -%>['asc']=asc; filterCriteria<%= widget_id -%>['page']=page; - var url=baseUrl + '/measures/search/<%= filter.id -%>?widget_id=<%= widget_id -%>&' + $j.param(filterCriteria<%= widget_id -%>); + var url = window.baseUrl + '/measures/search/<%= filter.id -%>?widget_id=<%= widget_id -%>&' + $j.param(filterCriteria<%= widget_id -%>); <% if widget_id %> $j('#measure_filter_list<%= widget_id -%>').load(url); @@ -109,13 +109,13 @@ } cols.push(columnKey); filterCriteria['edit']='true'; - window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>); + window.location = window.baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>); }); $j("#add-metric").attr("disabled", "disabled"); $j("#exit-edit").on("click", function (e) { delete filterCriteria['edit']; - window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>); + window.location = window.baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>); }); }); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb index dff381e9e19..361edddcd9a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb @@ -1,4 +1,4 @@ -<form id="edit-filter-form" method="post" action="/measures/edit"> +<form id="edit-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/edit"> <input type="hidden" name="id" value="<%= @filter.id -%>"> <fieldset> <div class="modal-head"> @@ -15,6 +15,6 @@ </form> <script> $j("#edit-filter-form").modalForm({success: function (data) { - window.location = baseUrl + '/measures/filter/' + data; + window.location = window.baseUrl + '/measures/filter/' + data; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb index d12704e559d..89618059614 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb @@ -3,10 +3,10 @@ <li class="sidebar-title"><%= message('measure_filter.favourite_filters') -%></li> <% current_user.favourited_measure_filters.each do |filter| %> <li <%= "class='active'" if @filter && filter.id==@filter.id -%>> - <a href="/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a> + <a href="<%= ApplicationController.root_context -%>/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a> </li> <% end %> - <li><a href="/measures/manage" class="link-action"><%= message('manage') %></a></li> + <li><a href="<%= ApplicationController.root_context -%>/measures/manage" class="link-action"><%= message('manage') %></a></li> <li class="spacer"></li> <% end %> </div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb index b43563c5e80..2bfc2eb1516 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb @@ -1,4 +1,4 @@ -<form id="save-as-filter-form" method="post" action="/measures/save_as"> +<form id="save-as-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/save_as"> <input type="hidden" name="id" value="<%= @filter.id -%>"> <input type="hidden" name="data" value="<%= u(@filter.data) -%>"> <fieldset> @@ -16,6 +16,6 @@ </form> <script> $j("#save-as-filter-form").modalForm({success:function (data) { - window.location = baseUrl + '/measures/filter/' + data; + window.location = window.baseUrl + '/measures/filter/' + data; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb index 6c4c3581a50..fa098e97750 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb @@ -24,7 +24,7 @@ <div class="page-actions"> <div class="button-group"> - <button onclick="window.location='/measures/search?qualifiers[]=TRK';"><%= message 'measure_filter.new_search' -%></button> + <button onclick="window.location='<%= ApplicationController.root_context -%>/measures/search?qualifiers[]=TRK';"><%= message 'measure_filter.new_search' -%></button> <% unless edit_mode %> <% if logged_in? %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb index 802605fe3e1..3017c74dcff 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb @@ -6,7 +6,7 @@ var star = $j(this); $j.ajax({ type: 'POST', - url: baseUrl + "/measures/toggle_fav", + url: window.baseUrl + "/measures/toggle_fav", data: {id: filterId}, success: function (data) { if (data == 'true') { @@ -60,11 +60,11 @@ <% end %> </td> <td class="text-thin nowrap text-right"> - <a id="copy-<%= filter.name.parameterize -%>" href="/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> + <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> - <a id="edit_<%= filter.name.parameterize -%>" href="/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> + <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - <%= link_to_action message('delete'), "/measures/delete/#{filter.id}", + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", :class => 'link-action link-red', :id => "delete_#{filter.name.parameterize}", :confirm_button => message('delete'), @@ -111,12 +111,12 @@ <%= filter.user ? h(filter.user.name) : '[SonarQube]' -%> </td> <td class="thin nowrap text-right"> - <a id="copy-<%= filter.name.parameterize -%>" href="/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> + <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> <% if has_role?(:admin) %> - <a id="edit_system_<%= filter.name.parameterize -%>" href="/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> + <a id="edit_system_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - <%= link_to_action message('delete'), "/measures/delete/#{filter.id}", + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", :class => 'link-action link-red', :id => "delete_system_#{filter.name.parameterize}", :confirm_button => message('delete'), diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb index 5d0bd1c595b..fff811989ea 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb @@ -16,7 +16,7 @@ <script id="filter-bar-template" type="text/x-handlebars-template"> - <form method="get" action="/measures/search"> + <form method="get" action="<%= ApplicationController.root_context -%>/measures/search"> <% if @filter.id %> <input type="hidden" name="id" value="<%= h @filter.id -%>"> <% end %> @@ -93,5 +93,5 @@ ]; </script> - <script src="/js/bundles/measures.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/measures.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb index e8879ceb432..5a8e0641d97 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/metrics.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/metrics.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb index 3990afdce08..e5fc799417b 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb @@ -130,5 +130,5 @@ }; })(); </script> - <script src="/js/bundles/overview.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/overview.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb index 7597579ae76..fb97f387c59 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/permission-templates.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/permission-templates.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 898ed10342f..b41bb0bbcd5 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -1,6 +1,6 @@ <% content_for :extra_script do %> <script> - window.sonarqube.urlRoot = baseUrl + '/profiles'; + window.sonarqube.urlRoot = window.baseUrl + '/profiles'; </script> - <script src="/js/bundles/quality-profiles.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/quality-profiles.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/_delete_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/_delete_form.html.erb index f4fddfc4391..79c73cd6f82 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/_delete_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/_delete_form.html.erb @@ -1,5 +1,5 @@ <% resource_qualifier = message('qualifier.' + @project.qualifier) %> -<form id="delete-project-form" method="post" action="/project/delete"> +<form id="delete-project-form" method="post" action="<%= ApplicationController.root_context -%>/project/delete"> <fieldset> <div class="modal-head"> <h2><%= message('project_deletion.page', :params => resource_qualifier) -%></h2> @@ -18,7 +18,7 @@ $j("#delete-project-form").modalForm({ success: function () { $j.ajax({ - url: "/project/delete/<%= h(@project.id) -%>", + url: "<%= ApplicationController.root_context-%>/project/delete/<%= h(@project.id) -%>", success: function (request) { window.location = '<%= url_for(:action => 'pending_deletion',:id => @project.id)-%>'; }, diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/background_tasks.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/background_tasks.html.erb index 096a2eb2f8b..ba6d27a4da6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/background_tasks.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/background_tasks.html.erb @@ -2,5 +2,5 @@ <script> window.sonarqube.componentId = '<%= @project.uuid -%>'; </script> - <script src="/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb index 8f9f509b939..73bdb62f6be 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb @@ -12,7 +12,7 @@ <div class="yui-g widget" id="widget_delete_project"> <div class="alert alert-warning spacer-bottom"><%= message('project_deletion.operation_cannot_be_undone') -%></div> <a id="delete_resource" class="open-modal button button-red" - href="/project/delete_form/<%= h(@project.id) -%>"><%= delete_resource_message -%></a> + href="<%= ApplicationController.root_context -%>/project/delete_form/<%= h(@project.id) -%>"><%= delete_resource_message -%></a> </div> <% end %> </div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/profile.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/profile.html.erb index 399e50a65c2..d24f845572e 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/profile.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/profile.html.erb @@ -19,7 +19,7 @@ <tr class="<%= cycle 'even', 'odd' -%>"> <td class="thin" nowrap><%= h language.getName() -%></td> <td> - <form id="form-<%= language.getKey().parameterize -%>" method="POST" action="/project/set_profile"> + <form id="form-<%= language.getKey().parameterize -%>" method="POST" action="<%= ApplicationController.root_context -%>/project/set_profile"> <input type="hidden" name="id" value="<%= @project_id -%>"/> <input type="hidden" name="language" value="<%= language.getKey() -%>"/> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/qualitygate.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/qualitygate.html.erb index d14507675a0..cd6e5a57567 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/qualitygate.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/qualitygate.html.erb @@ -4,7 +4,7 @@ <p class="page-description"><%= message('project_quality_gate.page.description') -%></p> </header> - <form id="select-quality-gate" method="POST" action="/project/set_qualitygate"> + <form id="select-quality-gate" method="POST" action="<%= ApplicationController.root_context -%>/project/set_qualitygate"> <input type="hidden" name="id" value="<%= @project_id -%>"/> <input type="hidden" name="previous_qgate_id" value="<%= @selected_qgate -%>"/> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb index 70938e7cad1..02610e495e4 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb @@ -56,7 +56,7 @@ <%= h truncate(issue.message, :length => 100) -%></a> <% if last_comment && last_comment.userLogin() %> <div class="comment-excerpt"> - <img src="/images/reviews/comment.png"/> + <img src="<%= ApplicationController.root_context -%>/images/reviews/comment.png"/> <% commentAuthor = users_by_login[last_comment.userLogin()] %> <b><%= h( commentAuthor.nil? ? last_comment.userLogin() : commentAuthor.name() ) -%> :</b> <%= Internal.text.markdownToHtml(last_comment.markdownText) -%> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb index 57b2c1ab069..2ffe436320a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb @@ -2,5 +2,5 @@ <script> window.sonarqube.componentId = '<%= @project.uuid -%>'; </script> - <script src="/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/projects/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/projects/index.html.erb index 290a9ac5f9f..e9c8ffd9ad8 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/projects/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/projects/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/projects.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/projects.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb index ed03db047c0..5cc9585f4dd 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb @@ -1,6 +1,6 @@ <% content_for :extra_script do %> <script> - window.sonarqube.urlRoot = baseUrl + '/quality_gates'; + window.sonarqube.urlRoot = window.baseUrl + '/quality_gates'; </script> - <script src="/js/bundles/quality-gates.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/quality-gates.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb index 1b84a1069de..3c79bb2feca 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/global.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/global-permissions.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/global-permissions.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb index b37e4b37e92..df0126ffd09 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb index feede78b06e..6e7bb79fa36 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/server_id_configuration/index.html.erb @@ -1,4 +1,4 @@ -<form method="post" action="/server_id_configuration/generate"> +<form method="post" action="<%= ApplicationController.root_context -%>/server_id_configuration/generate"> <table class="marginbottom10"> <thead> <tr> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb index 7d87eabaa49..9ef0f8ba55d 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb @@ -85,7 +85,7 @@ <div class="marginbottom10" style="padding-left: 5px;"> <%= hidden_field_tag('page_version', (params[:page_version] || 0).to_i + 1) -%> <%= submit_tag(message('settings.save_category', :params => [subcategory_name(@category, @subcategory)]), :id => 'submit_settings') -%> - <img src="/images/loading.gif" id="loading_settings" style="display:none;"> + <img src="<%= ApplicationController.root_context -%>/images/loading.gif" id="loading_settings" style="display:none;"> </div> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb index 2d20d38d06f..a06263ce445 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/setup/index.html.erb @@ -2,6 +2,6 @@ <script> window.sonarqube.setup = true; </script> - <script src="/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/index.html.erb index cd47108111d..1cb19867388 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/index.html.erb @@ -1,4 +1,4 @@ <% content_for :extra_script do %> -<script src="/js/bundles/system.js?v=<%= sonar_version -%>"></script> +<script src="<%= ApplicationController.root_context -%>/js/bundles/system.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb index d98e537dcfb..403d4baf226 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb @@ -1,7 +1,7 @@ <% content_for :extra_script do %> <script> - window.sonarqube.urlRoot = baseUrl + '/updatecenter'; + window.sonarqube.urlRoot = window.baseUrl + '/updatecenter'; </script> - <script src="/js/bundles/update-center.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/update-center.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb index 8e36411a411..17fc622e600 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb @@ -1,4 +1,4 @@ -<form id="user_edit_form" method="post" action="/users/update"> +<form id="user_edit_form" method="post" action="<%= ApplicationController.root_context -%>/users/update"> <fieldset> <div class="modal-head"> <h2>Edit user: <%= h @user.login() -%></h2> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb index b7ba2fbd7e5..73d98802573 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb @@ -21,9 +21,9 @@ } return label; }, - searchUrl: baseUrl + '/user_groups/search?user=<%= @user.login -%>', - selectUrl: baseUrl + '/groups/add_member', - deselectUrl: baseUrl + '/groups/remove_member', + searchUrl: window.baseUrl + '/user_groups/search?user=<%= @user.login -%>', + selectUrl: window.baseUrl + '/groups/add_member', + deselectUrl: window.baseUrl + '/groups/remove_member', extra: { user: '<%= @user.login -%>' }, diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb index 12257ae3f4d..56d012090af 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/users.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/users.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/view_projects/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/view_projects/index.html.erb index a805ff002fd..f5600f6ca03 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/view_projects/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/view_projects/index.html.erb @@ -1,3 +1,3 @@ <% content_for :extra_script do %> - <script src="/js/bundles/code.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/code.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/web_api/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/web_api/index.html.erb index 5e276447f7d..8edb6222ec3 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/web_api/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/web_api/index.html.erb @@ -1,6 +1,6 @@ <% content_for :extra_script do %> <script> - window.sonarqube.urlRoot = '/web_api'; + window.sonarqube.urlRoot = window.baseUrl + '/web_api'; </script> - <script src="/js/bundles/web-api.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/web-api.js?v=<%= sonar_version -%>"></script> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb index d2ca0b0b9c3..ea9e4e3e9d5 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb @@ -1,6 +1,6 @@ <% content_for :script do %> - <script src="/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> - <script src="/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> + <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> <% end %> <div id="block_1" class="block" style="width: <%= @widget_width -%>"> |