diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-02-02 09:59:36 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-02-19 11:01:56 +0100 |
commit | 2ee64e504b6921fd2d2f2d183e425904bc492c9d (patch) | |
tree | 37b02f07c7a819f4cd9f41d2a1b83ac37445c376 /server | |
parent | 0c2b2d0afe3f28f7075fcadb78a81c59a21b34d3 (diff) | |
download | sonarqube-2ee64e504b6921fd2d2f2d183e425904bc492c9d.tar.gz sonarqube-2ee64e504b6921fd2d2f2d183e425904bc492c9d.zip |
SONAR-7122 drop web context from js code
Diffstat (limited to 'server')
151 files changed, 312 insertions, 335 deletions
diff --git a/server/sonar-web/src/main/js/api/ce.js b/server/sonar-web/src/main/js/api/ce.js index dc36ed444a3..b272cb9c0fb 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 = baseUrl + '/api/ce/queue'; + const url = '/api/ce/queue'; return $.get(url, data); } export function getActivity (data) { - const url = baseUrl + '/api/ce/activity'; + const url = '/api/ce/activity'; return $.get(url, data); } export function getTask (id) { - const url = window.baseUrl + '/api/ce/task'; + const url = '/api/ce/task'; return getJSON(url, { id }).then(r => r.task); } export function cancelTask (id) { - const url = window.baseUrl + '/api/ce/cancel'; + const url = '/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 = window.baseUrl + '/api/ce/cancel_all'; + const url = '/api/ce/cancel_all'; return post(url); } export function getTasksForComponent (componentId) { - const url = baseUrl + '/api/ce/component'; + const url = '/api/ce/component'; const data = { componentId }; return new Promise((resolve) => $.get(url, data).done(resolve)); } export function getTypes () { - const url = window.baseUrl + '/api/ce/task_types'; + const url = '/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 32ed9f744cd..6b61a89fe42 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 = baseUrl + '/api/components/search'; + const url = '/api/components/search'; return getJSON(url, data); } export function getProvisioned (data) { - const url = baseUrl + '/api/projects/provisioned'; + const url = '/api/projects/provisioned'; return getJSON(url, data); } export function getGhosts (data) { - const url = baseUrl + '/api/projects/ghosts'; + const url = '/api/projects/ghosts'; return getJSON(url, data); } export function deleteComponents (data) { - const url = baseUrl + '/api/projects/bulk_delete'; + const url = '/api/projects/bulk_delete'; return post(url, data); } export function createProject (data) { - const url = baseUrl + '/api/projects/create'; + const url = '/api/projects/create'; return postJSON(url, data); } export function getChildren (componentKey, metrics = []) { - const url = baseUrl + '/api/measures/component_tree'; + const url = '/api/measures/component_tree'; const data = { baseComponentKey: componentKey, metricKeys: metrics.join(','), @@ -56,7 +56,7 @@ export function getChildren (componentKey, metrics = []) { } export function getFiles (componentKey, metrics = [], additional = {}) { - const url = baseUrl + '/api/measures/component_tree'; + const url = '/api/measures/component_tree'; const data = Object.assign({}, additional, { baseComponentKey: componentKey, metricKeys: metrics.join(','), @@ -66,25 +66,25 @@ export function getFiles (componentKey, metrics = [], additional = {}) { } export function getComponent (componentKey, metrics = []) { - const url = baseUrl + '/api/measures/component'; + const url = '/api/measures/component'; const data = { componentKey, metricKeys: metrics.join(',') }; return getJSON(url, data).then(r => r.component); } export function getTree (baseComponentKey, options = {}) { - const url = baseUrl + '/api/components/tree'; + const url = '/api/components/tree'; const data = Object.assign({}, options, { baseComponentKey }); return getJSON(url, data); } export function getParents ({ id, key }) { - const url = baseUrl + '/api/components/show'; + const url = '/api/components/show'; const data = id ? { id } : { key }; return getJSON(url, data).then(r => r.ancestors); } export function getBreadcrumbs ({ id, key }) { - const url = baseUrl + '/api/components/show'; + const url = '/api/components/show'; const data = id ? { id } : { key }; return getJSON(url, data).then(r => { const reversedAncestors = [...r.ancestors].reverse(); @@ -93,7 +93,7 @@ export function getBreadcrumbs ({ id, key }) { } export function getProjectsWithInternalId (query) { - const url = window.baseUrl + '/api/resources/search'; + const url = '/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 a04405dbcf1..8922faa2021 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 = baseUrl + '/api/events'; + const url = '/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 1e8c872dc7d..f2bd4226eab 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 = window.baseUrl + '/issues/toggle_fav'; + const url = '/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 3569d1854bd..89486fcd1b4 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 = baseUrl + '/api/issues/search'; + const url = '/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 = baseUrl + '/api/issues/search'; + const url = '/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 = window.baseUrl + '/api/issue_filters/search'; + const url = '/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 f44b8f8ca60..4b3a00b764d 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 = baseUrl + '/api/languages/list'; + const url = '/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 67699863d9a..ed64ba09db7 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 = window.baseUrl + '/measures/toggle_fav'; + const url = '/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 96dd50b7753..a22b042104d 100644 --- a/server/sonar-web/src/main/js/api/measures.js +++ b/server/sonar-web/src/main/js/api/measures.js @@ -21,7 +21,7 @@ import { getJSON } from '../helpers/request.js'; export function getMeasures (componentKey, metrics) { - const url = baseUrl + '/api/measures/component'; + const url = '/api/measures/component'; const data = { componentKey, metricKeys: metrics.join(',') }; return getJSON(url, data).then(r => r.component.measures); } diff --git a/server/sonar-web/src/main/js/api/metrics.js b/server/sonar-web/src/main/js/api/metrics.js index 6bc54e7437b..45f2500288c 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 = baseUrl + '/api/metrics/search'; + const url = '/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 c43973f1e52..424c0a68536 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 = baseUrl + '/api/navigation/global'; + const url = '/api/navigation/global'; return getJSON(url); } export function getComponentNavigation (componentKey) { - const url = baseUrl + '/api/navigation/component'; + const url = '/api/navigation/component'; const data = { componentKey }; return getJSON(url, data); } export function getSettingsNavigation () { - const url = baseUrl + '/api/navigation/settings'; + const url = '/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 8b699d77e06..64b89276a34 100644 --- a/server/sonar-web/src/main/js/api/permissions.js +++ b/server/sonar-web/src/main/js/api/permissions.js @@ -24,17 +24,13 @@ function request (options) { return $.ajax(options); } -function buildUrl (path) { - return window.baseUrl + path; -} - function typeError (method, message) { throw new TypeError(`permissions#${method}: ${message}`); } export function getUsers (data) { - const url = buildUrl('/api/permissions/users'); + const url = '/api/permissions/users'; return request({ type: 'GET', url: url, data: data }); } @@ -47,7 +43,7 @@ export function grantToUser (permission, user, project) { return typeError('grantToUser', 'please provide user login'); } - const url = buildUrl('/api/permissions/add_user'); + const url = '/api/permissions/add_user'; const data = { permission: permission, login: user }; if (project) { data.projectId = project; @@ -64,7 +60,7 @@ export function revokeFromUser (permission, user, project) { return typeError('revokeFromUser', 'please provide user login'); } - const url = buildUrl('/api/permissions/remove_user'); + const url = '/api/permissions/remove_user'; const data = { permission: permission, login: user }; if (project) { data.projectId = project; @@ -74,7 +70,7 @@ export function revokeFromUser (permission, user, project) { export function getGroups (data) { - const url = buildUrl('/api/permissions/groups'); + const url = '/api/permissions/groups'; return request({ type: 'GET', url: url, data: data }); } @@ -87,7 +83,7 @@ export function grantToGroup (permission, group, project) { return typeError('grantToGroup', 'please provide group name'); } - const url = buildUrl('/api/permissions/add_group'); + const url = '/api/permissions/add_group'; const data = { permission: permission, groupName: group }; if (project) { data.projectId = project; @@ -104,7 +100,7 @@ export function revokeFromGroup (permission, group, project) { return typeError('revokeFromGroup', 'please provide group name'); } - const url = buildUrl('/api/permissions/remove_group'); + const url = '/api/permissions/remove_group'; const data = { permission: permission, groupName: group }; if (project) { data.projectId = project; @@ -114,7 +110,7 @@ export function revokeFromGroup (permission, group, project) { export function getPermissionTemplates (query) { - const url = buildUrl('/api/permissions/search_templates'); + const url = '/api/permissions/search_templates'; const data = { }; if (query) { data.q = query; @@ -124,18 +120,18 @@ export function getPermissionTemplates (query) { export function createPermissionTemplate (options) { - const url = buildUrl('/api/permissions/create_template'); + const url = '/api/permissions/create_template'; return request(_.extend({ type: 'POST', url: url }, options)); } export function updatePermissionTemplate (options) { - const url = buildUrl('/api/permissions/update_template'); + const url = '/api/permissions/update_template'; return request(_.extend({ type: 'POST', url: url }, options)); } export function deletePermissionTemplate (options) { - const url = buildUrl('/api/permissions/delete_template'); + const url = '/api/permissions/delete_template'; return request(_.extend({ type: 'POST', url: url }, options)); } @@ -145,13 +141,13 @@ export function setDefaultPermissionTemplate (template, qualifier) { return typeError('setDefaultPermissionTemplate', 'please provide permission template ID'); } - const url = buildUrl('/api/permissions/set_default_template'); + const url = '/api/permissions/set_default_template'; const data = { templateId: template, qualifier }; return request({ type: 'POST', url, data }); } export function applyTemplateToProject(options) { - const url = buildUrl('/api/permissions/apply_template'); + const url = '/api/permissions/apply_template'; return request(_.extend({ type: 'POST', url: url }, options)); } 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 69ceca5bb50..3daf1e6f8f4 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 = window.baseUrl + '/api/qualityprofiles/create'; + const url = '/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 25b52880f9b..13efcd502cc 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 = window.baseUrl + '/api/system/change_log_level'; + const url = '/api/system/change_log_level'; const data = { level }; return post(url, data); } export function getSystemInfo () { - const url = window.baseUrl + '/api/system/info'; + const url = '/api/system/info'; return getJSON(url); } export function getStatus () { - const url = window.baseUrl + '/api/system/status'; + const url = '/api/system/status'; return getJSON(url); } export function restart () { - const url = window.baseUrl + '/api/system/restart'; + const url = '/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 caabe67e2bf..adf44fdbcac 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 = baseUrl + '/api/timemachine/index'; + const url = '/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 dbfbf362edf..e0d46231eae 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 = baseUrl + '/api/user_tokens/search'; + const url = '/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 = baseUrl + '/api/user_tokens/generate'; + const url = '/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 = baseUrl + '/api/user_tokens/revoke'; + const url = '/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 bd07b1b4d73..ec4b778c623 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 = baseUrl + '/api/users/current'; + const url = '/api/users/current'; return getJSON(url); } export function changePassword (login, password, previousPassword) { - const url = window.baseUrl + '/api/users/change_password'; + const url = '/api/users/change_password'; const data = { login, password }; if (previousPassword != null) { 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 e4643b9349c..4494c4d3d65 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: window.baseUrl + '/account' + basename: '/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 3eb59fcc076..af3baa5d0dd 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={`${window.baseUrl}/issues/search#id=${f.id}`}> + <a href={`/issues/search#id=${f.id}`}> {f.name} </a> </td> @@ -52,7 +52,7 @@ const FavoriteIssueFilters = ({ issueFilters }) => ( </table> <div className="spacer-top small"> - <a href={`${window.baseUrl}/issues/manage`}>{translate('see_all')}</a> + <a href="/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 c9998d0eaca..4bf9b26e79a 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={`${window.baseUrl}/measures/filter/${f.id}`}> + <a href={`/measures/filter/${f.id}`}> {f.name} </a> </td> @@ -52,7 +52,7 @@ const FavoriteMeasureFilters = ({ measureFilters }) => ( </table> <div className="spacer-top small"> - <a href={`${window.baseUrl}/measures/manage`}>{translate('see_all')}</a> + <a href="/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 673089bab6a..a59d59a5585 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 window.baseUrl + '/account/issues#resolved=false'; + return '/account/issues#resolved=false'; } function getToFixUrl () { - return window.baseUrl + '/account/issues#resolved=false|statuses=CONFIRMED'; + return '/account/issues#resolved=false|statuses=CONFIRMED'; } function getToReviewUrl () { - return window.baseUrl + '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED'); + return '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED'); } function getSeverityUrl (severity) { - return window.baseUrl + '/account/issues#resolved=false|severities=' + severity; + return '/account/issues#resolved=false|severities=' + severity; } function getProjectUrl (project) { - return window.baseUrl + '/account/issues#resolved=false|projectUuids=' + project; + return '/account/issues#resolved=false|projectUuids=' + project; } function getPeriodUrl (createdAfter, createdBefore) { - return window.baseUrl + `/account/issues#resolved=false|createdAfter=${createdAfter}|createdBefore=${createdBefore}`; + return `/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 a1fe74bfc0d..a7c1df4a6db 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 === `${window.baseUrl}/account/issues` && 'active'} - href={`${window.baseUrl}/account/issues`}> + className={window.location.pathname === `/account/issues` && 'active'} + href={`/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 8eb4e437afb..9c24284a7d2 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={`${window.baseUrl}/account/update_notifications`}> + <form id="notif_form" method="post" action={`/account/update_notifications`}> <div className="columns columns-overflow-visible"> <div className="column-half"> <GlobalNotifications diff --git a/server/sonar-web/src/main/js/apps/api-documentation/action-view.js b/server/sonar-web/src/main/js/apps/api-documentation/action-view.js index 9374cca1eb2..99896b6d850 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/action-view.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/action-view.js @@ -57,7 +57,7 @@ export default Marionette.ItemView.extend({ fetchResponse: function () { var that = this, - url = baseUrl + '/api/webservices/response_example', + url = '/api/webservices/response_example', options = { controller: this.model.get('path'), action: this.model.get('key') }; return $.get(url, options).done(function (r) { that.model.set({ responseExample: r.example }); diff --git a/server/sonar-web/src/main/js/apps/api-documentation/list.js b/server/sonar-web/src/main/js/apps/api-documentation/list.js index 0a4edfcbb97..fd9950c438d 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/list.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/list.js @@ -21,7 +21,7 @@ import _ from 'underscore'; import Backbone from 'backbone'; export default Backbone.Collection.extend({ - url: baseUrl + '/api/webservices/list', + url: '/api/webservices/list', comparator: 'path', parse: function (r) { 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 2f5893e8bed..1954e26d52f 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 = `${window.baseUrl}/api/ce/logs?taskId=${task.id}`; + const url = `/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 88477fd3727..c23aa61b3d6 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 @@ -96,7 +96,7 @@ App.getSubCharacteristicName = function (key) { } }; -var appXHR = $.get(baseUrl + '/api/rules/app').done(function (r) { +var appXHR = $.get('/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 754cdc208ec..cf805e393d3 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: function () { ModalFormView.prototype.onFormSubmit.apply(this, arguments); - var url = baseUrl + '/api/qualityprofiles/' + this.options.action + '_rules', + var url = '/api/qualityprofiles/' + this.options.action + '_rules', options = _.extend({}, this.options.app.state.get('query'), { wsAction: this.options.action }), 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 205e2ec483f..7b627f9e818 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 @@ -61,7 +61,7 @@ export default Controller.extend({ this.hideDetails(firstPage); var that = this, - url = baseUrl + '/api/rules/search', + url = '/api/rules/search', options = _.extend(this._searchParameters(), this.app.state.get('query')); return $.get(url, options).done(function (r) { var rules = that.app.list.parseRules(r); @@ -93,7 +93,7 @@ export default Controller.extend({ }, requestFacet: function (id) { - var url = baseUrl + '/api/rules/search', + var url = '/api/rules/search', facet = this.app.facets.get(id), options = _.extend({ facets: id, ps: 1 }, this.app.state.get('query')); return $.get(url, options).done(function (r) { @@ -113,7 +113,7 @@ export default Controller.extend({ getRuleDetails: function (rule) { var that = this, - url = baseUrl + '/api/rules/show', + url = '/api/rules/show', 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 663038ce870..ef9417f855d 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: function () { - return baseUrl; + return ''; }, onRender: function () { 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 35fcb190b7f..56703f8a0a6 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: function () { - return baseUrl + '/api/languages/list'; + return '/api/languages/list'; }, prepareAjaxSearch: function () { 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 d052c168d92..73d4b6ebcb2 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: function () { - return baseUrl + '/api/rules/repositories'; + return '/api/rules/repositories'; }, prepareAjaxSearch: function () { 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 0ead16ee6bd..91d3cb52624 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: function () { - return baseUrl + '/api/rules/tags'; + return '/api/rules/tags'; }, prepareAjaxSearch: function () { 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 6e3f33566c1..c13e5538ee4 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 @@ -98,7 +98,7 @@ export default Marionette.LayoutView.extend({ fetchCustomRules: function () { var that = this, - url = baseUrl + '/api/rules/search', + url = '/api/rules/search', options = { template_key: this.model.get('key'), f: 'name,severity,params' @@ -153,7 +153,7 @@ export default Marionette.LayoutView.extend({ title: translate('delete'), html: translateWithParameters('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')), yesHandler: function () { - var url = baseUrl + '/api/rules/delete', + var url = '/api/rules/delete', options = { key: that.model.id }; $.post(url, options).done(function () { that.options.app.controller.fetchList(); 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 a19de959ef6..dc0ad6fb708 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: function (action, options) { this.$('.alert').addClass('hidden'); var that = this, - url = baseUrl + '/api/rules/' + action; + url = '/api/rules/' + action; return $.ajax({ url: 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 6f813a64cc0..992d662ef31 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 @@ -42,7 +42,7 @@ export default Marionette.ItemView.extend({ title: translate('delete'), html: translate('are_you_sure'), yesHandler: function () { - var url = baseUrl + '/api/rules/delete', + var url = '/api/rules/delete', options = { key: that.model.id }; $.post(url, options).done(function () { that.model.collection.remove(that.model); @@ -56,7 +56,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: baseUrl + '/coding_rules/#rule_key=' + encodeURIComponent(this.model.id) + permalink: '/coding_rules/#rule_key=' + encodeURIComponent(this.model.id) }); } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js index 160405496bd..9e807573888 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js @@ -101,7 +101,7 @@ export default ModalFormView.extend({ sendRequest: function (action, options) { var that = this, - url = baseUrl + '/api/rules/' + action; + url = '/api/rules/' + action; return $.ajax({ url: url, type: 'POST', 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 c9d788914f7..84b4784c44d 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: baseUrl + '/api/qualityprofiles/activate_rule', + url: '/api/qualityprofiles/activate_rule', data: { profile_key: profileKey, rule_key: ruleKey, 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 d21c05e9b34..b6d7b78f0b3 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: baseUrl + '/api/rules/update', + url: '/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 5738ce708d6..bcb5bd09191 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: function () { var that = this, - url = baseUrl + '/api/issues/search', + url = '/api/issues/search', 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: baseUrl + '/issues/search#resolved=false|rules=' + encodeURIComponent(this.model.id) + baseSearchUrl: '/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 3990be2658e..129eb7744fb 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: function () { - var url = baseUrl + '/api/rules/tags'; + var url = '/api/rules/tags'; return $.get(url); }, @@ -90,7 +90,7 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ tags = this.ui.tagInput.val(); return $.ajax({ type: 'POST', - url: baseUrl + '/api/rules/update', + url: '/api/rules/update', data: { key: this.model.get('key'), tags: tags @@ -108,7 +108,7 @@ export default Marionette.ItemView.extend(RuleFilterMixin).extend({ canWrite: this.options.app.canWrite, subCharacteristic: this.options.app.getSubCharacteristicName(this.model.get('debtSubChar')), allTags: _.union(this.model.get('sysTags'), this.model.get('tags')), - permalink: baseUrl + '/coding_rules#rule_key=' + encodeURIComponent(this.model.id) + permalink: '/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 30c888854b8..22ed2b47ad5 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: function () { return $.ajax({ type: 'POST', - url: baseUrl + '/api/qualityprofiles/activate_rule', + url: '/api/qualityprofiles/activate_rule', data: { profile_key: that.model.get('qProfile'), rule_key: ruleKey, @@ -97,7 +97,7 @@ export default Marionette.ItemView.extend({ yesHandler: function () { return $.ajax({ type: 'POST', - url: baseUrl + '/api/qualityprofiles/deactivate_rule', + url: '/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 42e6a441e1f..8a87b4e951c 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 @@ -87,7 +87,7 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ yesHandler: function () { return $.ajax({ type: 'POST', - url: baseUrl + '/api/qualityprofiles/deactivate_rule', + url: '/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 d07513ca9d5..6576b554c8d 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: function () { - return baseUrl + '/api/custom_measures'; + return '/api/custom_measures'; }, sync: function (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 103a289bf25..3afb64f5c63 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: function () { - return baseUrl + '/api/custom_measures/search'; + return '/api/custom_measures/search'; }, parse: function (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 45a774c3a9d..c29c1eeba85 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) { - var url = baseUrl + '/api/permissions/groups?ps=100&permission=' + permission; + var url = '/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: baseUrl + '/api/permissions/add_group', - deselectUrl: baseUrl + '/api/permissions/remove_group', + selectUrl: '/api/permissions/add_group', + deselectUrl: '/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 eb420321990..963713722ed 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 = `${window.baseUrl}/api/permissions/search_global_permissions`; + const url = `/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 bb1270ac4b8..32b5bb71ac0 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 = `${window.baseUrl}/api/permissions/users`; + const url = `/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 = `${window.baseUrl}/api/permissions/groups`; + const url = `/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 61c454f3964..980da17df61 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) { - var url = baseUrl + '/api/permissions/users?ps=100&permission=' + permission; + var url = '/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: baseUrl + '/api/permissions/add_user', - deselectUrl: baseUrl + '/api/permissions/remove_user', + selectUrl: '/api/permissions/add_user', + deselectUrl: '/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 99a484b7637..ff0c7e5a5f0 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: function () { - return baseUrl + '/api/user_groups'; + return '/api/user_groups'; }, sync: function (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 00143e7d095..73f21163135 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: function () { - return baseUrl + '/api/user_groups/search'; + return '/api/user_groups/search'; }, parse: function (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 ca21c132758..8f5baa9f16d 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: baseUrl + '/api/user_groups/users?ps=100&id=' + this.model.id, - selectUrl: baseUrl + '/api/user_groups/add_user', - deselectUrl: baseUrl + '/api/user_groups/remove_user', + searchUrl: '/api/user_groups/users?ps=100&id=' + this.model.id, + selectUrl: '/api/user_groups/add_user', + deselectUrl: '/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 31a13f246da..5cf9f16c893 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(baseUrl + '/api/issues/search', data).done(function (r) { + return $.get('/api/issues/search', data).done(function (r) { var issues = that.options.app.list.parseIssues(r); if (firstPage) { that.options.app.list.reset(issues); @@ -108,7 +108,7 @@ export default Controller.extend({ var that = this; return $.when( that.options.app.filters.fetch({ reset: true }), - $.get(baseUrl + '/api/issue_filters/app', function (r) { + $.get('/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(baseUrl + '/api/issues/search', data, function (r) { + return $.get('/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(baseUrl + '/api/issues/search', data, function (r) { + return $.get('/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 8673311560b..3fc1f32663f 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: function () { - return baseUrl + '/api/users/search'; + return '/api/users/search'; }, prepareAjaxSearch: function () { 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 1c0de423ba5..d252a6e75a3 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: function () { - return baseUrl + '/api/issues/authors'; + return '/api/issues/authors'; }, prepareSearch: function () { 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 5e1359a4d68..af92bd84037 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: function () { - return baseUrl + '/api/languages/list'; + return '/api/languages/list'; }, prepareSearch: function () { 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 c3e3a1ac0e8..363c83c0e40 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: function () { var q = this.options.app.state.get('contextComponentQualifier'); if (q === 'VW' || q === 'SVW') { - return baseUrl + '/api/components/search_view_components'; + return '/api/components/search_view_components'; } else { - return baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true'; + return '/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 368e59b4f43..ac03ba3341c 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: function () { - return baseUrl + '/api/users/search'; + return '/api/users/search'; }, prepareAjaxSearch: function () { 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 0ae574ab032..a9cf5cd0187 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: function () { - var url = baseUrl + '/api/rules/search?f=name,langName', + var url = '/api/rules/search?f=name,langName', 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 43b4de50c28..13be00166fd 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: function () { - var url = baseUrl + '/api/issues/tags?ps=10', + var url = '/api/issues/tags?ps=10', 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 72f775448fb..2deb3b6710c 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: function () { var query = this.options.app.controller.getQuery('&'), - url = baseUrl + '/issues/save_as_form?' + query; + url = '/issues/save_as_form?' + query; window.openModalWindow(url, {}); }, save: function () { var that = this; var query = this.options.app.controller.getQuery('&'), - url = baseUrl + '/issues/save/' + (this.options.app.state.get('filter').id) + '?' + query; + url = '/issues/save/' + (this.options.app.state.get('filter').id) + '?' + query; return $.post(url).done(function () { return that.options.app.state.set({ changed: false }); }); }, copy: function () { - var url = baseUrl + '/issues/copy_form/' + (this.options.app.state.get('filter').id); + var url = '/issues/copy_form/' + (this.options.app.state.get('filter').id); window.openModalWindow(url, {}); }, edit: function () { - var url = baseUrl + '/issues/edit_form/' + (this.options.app.state.get('filter').id); + var url = '/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 63024e99950..c43bd88fa73 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: function () { - return baseUrl + '/api/issue_filters/show/' + this.id; + return '/api/issue_filters/show/' + this.id; }, parse: function (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 8053a5e3634..ba3e50c684f 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: function () { - return window.baseUrl + '/api/issue_filters/search'; + return '/api/issue_filters/search'; }, parse: function (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 1d1187059a2..7911332865d 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: function () { - return baseUrl + '/api/issues/search'; + return '/api/issues/search'; }, _injectRelational: function (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 4a3a3b84b2b..7d533fe555e 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: function () { var query = this.options.app.controller.getQuery('&', true), - url = baseUrl + '/issues/bulk_change_form?' + query; + url = '/issues/bulk_change_form?' + query; window.openModalWindow(url, {}); }, @@ -113,7 +113,7 @@ export default WorkspaceHeaderView.extend({ var selected = this.options.app.list.where({ selected: true }), selectedKeys = _.first(_.pluck(selected, 'id'), 200), query = 'issues=' + selectedKeys.join(), - url = baseUrl + '/issues/bulk_change_form?' + query; + url = '/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 97bc58d4636..a7bfdac0cc6 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({ var that = this; this.requestOptions = { type: 'GET', - url: baseUrl + '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status') + url: '/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: function () { var that = this; Backbone.ajax({ - url: baseUrl + '/api/system/migrate_db', + url: '/api/system/migrate_db', type: 'POST' }).done(function (r) { that.model.set(r); @@ -76,7 +76,7 @@ export default Marionette.ItemView.extend({ goHome: function () { setInterval(function () { - window.location = baseUrl + '/'; + window.location = '/'; }, 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 2b3194f2bf7..d6318adaef2 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 @@ var App = new Marionette.Application(), App.requestDomains = function () { - return $.get(baseUrl + '/api/metrics/domains').done(function (r) { + return $.get('/api/metrics/domains').done(function (r) { App.domains = r.domains; }); }; App.requestTypes = function () { - return $.get(baseUrl + '/api/metrics/types').done(function (r) { + return $.get('/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 c19526599d4..395778d8b94 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: function () { - return baseUrl + '/api/metrics'; + return '/api/metrics'; }, sync: function (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 1e25f177d80..31613599f30 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: function () { - return baseUrl + '/api/metrics/search'; + return '/api/metrics/search'; }, parse: function (r) { diff --git a/server/sonar-web/src/main/js/apps/overview/app.js b/server/sonar-web/src/main/js/apps/overview/app.js index 0625efd5dc9..53ea76de36a 100644 --- a/server/sonar-web/src/main/js/apps/overview/app.js +++ b/server/sonar-web/src/main/js/apps/overview/app.js @@ -32,7 +32,7 @@ class App { start (options) { let opts = _.extend({}, options, window.sonarqube.overview); _.extend(opts.component, options.component); - opts.urlRoot = window.baseUrl + '/overview'; + opts.urlRoot = '/overview'; $('html').toggleClass('dashboard-page', opts.component.hasSnapshot); let el = document.querySelector(opts.el); 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 deffa8ae473..4ad5565b59b 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() { - let qualityGatesUrl = window.baseUrl + '/quality_gates'; + let qualityGatesUrl = '/quality_gates'; return ( <div className="overview-gate"> diff --git a/server/sonar-web/src/main/js/apps/overview/main/components.js b/server/sonar-web/src/main/js/apps/overview/main/components.js index 12d060f541c..80ab66122d7 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/components.js +++ b/server/sonar-web/src/main/js/apps/overview/main/components.js @@ -34,8 +34,7 @@ export const Domain = React.createClass({ export const DomainTitle = React.createClass({ render () { if (this.props.linkTo) { - let url = window.baseUrl + '/overview' + this.props.linkTo + - '?id=' + encodeURIComponent(this.props.component.key); + let url = '/overview' + this.props.linkTo + '?id=' + encodeURIComponent(this.props.component.key); return <div> <div className="overview-title"> {this.props.children} 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 5fb20a259b8..e140e5bafe4 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,7 @@ import '../../components/SelectList'; import Template from './templates/permission-templates-groups.hbs'; function getSearchUrl (permission, permissionTemplate) { - return baseUrl + '/api/permissions/template_groups?ps=100&permission=' + permission.key + + return '/api/permissions/template_groups?ps=100&permission=' + permission.key + '&templateId=' + permissionTemplate.id; } @@ -42,8 +42,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: getSearchUrl(this.options.permission, this.options.permissionTemplate), - selectUrl: baseUrl + '/api/permissions/add_group_to_template', - deselectUrl: baseUrl + '/api/permissions/remove_group_from_template', + selectUrl: '/api/permissions/add_group_to_template', + deselectUrl: '/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 3b73dd2060f..6348a1ad9c4 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,7 +27,7 @@ export default Modal.extend({ onRender: function () { Modal.prototype.onRender.apply(this, arguments); - var searchUrl = baseUrl + '/api/permissions/template_users?ps=100&permission=' + this.options.permission.key + + var searchUrl = '/api/permissions/template_users?ps=100&permission=' + this.options.permission.key + '&templateId=' + this.options.permissionTemplate.id; new window.SelectList({ el: this.$('#permission-templates-users'), @@ -39,8 +39,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: searchUrl, - selectUrl: baseUrl + '/api/permissions/add_user_to_template', - deselectUrl: baseUrl + '/api/permissions/remove_user_from_template', + selectUrl: '/api/permissions/add_user_to_template', + deselectUrl: '/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 071dd763aaf..6e00dcce72f 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(baseUrl + '/api/permissions/search_templates'); + return $.get('/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 4603c21efc7..1a4658b68ff 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 baseUrl + '/api/permissions/groups?ps=100&permission=' + permission + '&projectId=' + project; + return '/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: baseUrl + '/api/permissions/add_group', - deselectUrl: baseUrl + '/api/permissions/remove_group', + selectUrl: '/api/permissions/add_group', + deselectUrl: '/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 556fec0a65d..61d838a8bec 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 = `${window.baseUrl}/api/permissions/search_project_permissions`; + let url = `/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 42947b9ede7..1c19f08bf30 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: function () { Modal.prototype.onRender.apply(this, arguments); - var searchUrl = baseUrl + '/api/permissions/users?ps=100&permission=' + this.options.permission + + var searchUrl = '/api/permissions/users?ps=100&permission=' + this.options.permission + '&projectId=' + this.options.project; new window.SelectList({ el: this.$('#project-permissions-users'), @@ -39,8 +39,8 @@ export default Modal.extend({ }, queryParam: 'q', searchUrl: searchUrl, - selectUrl: baseUrl + '/api/permissions/add_user', - deselectUrl: baseUrl + '/api/permissions/remove_user', + selectUrl: '/api/permissions/add_user', + deselectUrl: '/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 358dee10336..9212527eae6 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 @@ -64,7 +64,7 @@ var init = function () { }); }; -var appXHR = $.get(baseUrl + '/api/qualitygates/app') +var appXHR = $.get('/api/qualitygates/app') .done(function (r) { App.canEdit = r.edit; App.periods = r.periods; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/condition.js b/server/sonar-web/src/main/js/apps/quality-gates/condition.js index 795ffeae47a..8e8f42e0076 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/condition.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/condition.js @@ -26,7 +26,7 @@ export default Backbone.Model.extend({ }, url: function () { - return baseUrl + '/api/qualitygates'; + return '/api/qualitygates'; }, createUrl: function () { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js b/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js index b53b990609b..9973df8a975 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js @@ -24,7 +24,7 @@ export default FormView.extend({ prepareRequest: function () { var that = this; - var url = baseUrl + '/api/qualitygates/copy', + var url = '/api/qualitygates/copy', name = this.$('#quality-gate-form-name').val(), options = { url: url, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/create-view.js b/server/sonar-web/src/main/js/apps/quality-gates/create-view.js index 1bf62ecf15c..9fd9b2e5d11 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/create-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/create-view.js @@ -24,7 +24,7 @@ export default FormView.extend({ prepareRequest: function () { var that = this; - var url = baseUrl + '/api/qualitygates/create', + var url = '/api/qualitygates/create', name = this.$('#quality-gate-form-name').val(), options = { url: url, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js index ac2449ad86d..939face75f0 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js @@ -36,9 +36,9 @@ export default Marionette.ItemView.extend({ format: function (item) { return item.name; }, - searchUrl: baseUrl + '/api/qualitygates/search?gateId=' + this.model.id, - selectUrl: baseUrl + '/api/qualitygates/select', - deselectUrl: baseUrl + '/api/qualitygates/deselect', + searchUrl: '/api/qualitygates/search?gateId=' + this.model.id, + selectUrl: '/api/qualitygates/select', + deselectUrl: '/api/qualitygates/deselect', extra: { gateId: this.model.id }, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate.js b/server/sonar-web/src/main/js/apps/quality-gates/gate.js index 522de6751b9..31c046b62bd 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate.js @@ -26,7 +26,7 @@ export default Backbone.Model.extend({ }, url: function () { - return baseUrl + '/api/qualitygates'; + return '/api/qualitygates'; }, showUrl: function () { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gates.js b/server/sonar-web/src/main/js/apps/quality-gates/gates.js index c411c446a00..2b4a300bb4c 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gates.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gates.js @@ -25,7 +25,7 @@ export default Backbone.Collection.extend({ model: Gate, url: function () { - return baseUrl + '/api/qualitygates/list'; + return '/api/qualitygates/list'; }, parse: function (r) { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js b/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js index 20e79a6a51b..c84ff73422a 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js @@ -24,7 +24,7 @@ export default FormView.extend({ prepareRequest: function () { var that = this; - var url = baseUrl + '/api/qualitygates/rename', + var url = '/api/qualitygates/rename', name = this.$('#quality-gate-form-name').val(), options = { url: url, 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 c9e026d0267..ee8b267313d 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: function () { var that = this, - url = baseUrl + '/api/languages/list'; + url = '/api/languages/list'; return $.get(url).done(function (r) { that.languages = r.languages; }); @@ -91,7 +91,7 @@ export default Marionette.ItemView.extend({ requestImporters: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/importers'; + url = '/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 edded138237..1d77201f20b 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'; var App = new Marionette.Application(), - requestUser = $.get(baseUrl + '/api/users/current').done(function (r) { + requestUser = $.get('/api/users/current').done(function (r) { App.canWrite = r.permissions.global.indexOf('profileadmin') !== -1; }), - requestExporters = $.get(baseUrl + '/api/qualityprofiles/exporters').done(function (r) { + requestExporters = $.get('/api/qualityprofiles/exporters').done(function (r) { App.exporters = r.exporters; }), 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 8fbfccaac71..681098f20cb 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: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/change_parent', + url = '/api/qualityprofiles/change_parent', parent = this.$('#change-profile-parent').val(), 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 d28c0934d75..68046423c39 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: function (profile) { var that = this, - url = baseUrl + '/api/qualityprofiles/set_default', + url = '/api/qualityprofiles/set_default', key = profile.get('key'), 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 09511190211..d17be22b774 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: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/copy', + url = '/api/qualityprofiles/copy', name = this.$('#copy-profile-name').val(), 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 d0b21a3dae0..7b9e6889f4c 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: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/delete', + url = '/api/qualityprofiles/delete', options = { profileKey: this.model.get('key') }; return $.ajax({ type: 'POST', 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 5fa02436f01..6fbdea721f2 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: function (item) { return item.name; }, - searchUrl: baseUrl + '/api/qualityprofiles/projects?key=' + encodeURIComponent(key), - selectUrl: baseUrl + '/api/qualityprofiles/add_project', - deselectUrl: baseUrl + '/api/qualityprofiles/remove_project', + searchUrl: '/api/qualityprofiles/projects?key=' + encodeURIComponent(key), + selectUrl: '/api/qualityprofiles/add_project', + deselectUrl: '/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 c7fa5b21bcf..04018894b05 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: function () { var that = this, - url = baseUrl + '/api/rules/search', + url = '/api/rules/search', key = this.id, options = { ps: 1, @@ -65,7 +65,7 @@ export default Backbone.Model.extend({ fetchInheritance: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/inheritance', + url = '/api/qualityprofiles/inheritance', options = { profileKey: this.id }; return $.get(url, options).done(function (r) { _.extend(that.fetchChanged, r.profile, { @@ -77,7 +77,7 @@ export default Backbone.Model.extend({ fetchChangelog: function (options) { var that = this, - url = baseUrl + '/api/qualityprofiles/changelog', + url = '/api/qualityprofiles/changelog', opts = _.extend({}, options, { profileKey: this.id }); return $.get(url, opts).done(function (r) { that.set({ @@ -91,7 +91,7 @@ export default Backbone.Model.extend({ fetchMoreChangelog: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/changelog', + url = '/api/qualityprofiles/changelog', page = this.get('eventsPage') || 0, parameters = this.get('eventsParameters') || {}, opts = _.extend({}, parameters, { profileKey: this.id, p: page + 1 }); @@ -113,7 +113,7 @@ export default Backbone.Model.extend({ compareWith: function (withKey) { var that = this, - url = baseUrl + '/api/qualityprofiles/compare', + url = '/api/qualityprofiles/compare', options = { leftKey: this.id, rightKey: withKey }; return $.get(url, options).done(function (r) { var 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 52adaa5e40d..01f9440868f 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: baseUrl + '/api/qualityprofiles/search', + url: '/api/qualityprofiles/search', comparator: 'key', parse: function (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 4cb03e66c23..4093cf3ff60 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: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/rename', + url = '/api/qualityprofiles/rename', name = this.$('#rename-profile-name').val(), 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 c595871cb43..3386cfe6a75 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: function () { var that = this, - url = baseUrl + '/api/qualityprofiles/restore_built_in', + url = '/api/qualityprofiles/restore_built_in', lang = this.$('#restore-built-in-profiles-language').val(), 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 e12d12f29a8..0fbabea94bd 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={window.baseUrl + '/api/system/logs'} id="logs-link">Logs</a> - <a href={window.baseUrl + '/api/system/info'} id="download-link">Download</a> + <a className="spacer-right" href={'/api/system/logs'} id="logs-link">Logs</a> + <a href={'/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 e712c8acecb..6e6807e2a06 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: function () { return this._action({ - url: baseUrl + '/api/plugins/install', + url: '/api/plugins/install', success: function (model) { model.set({ _status: 'installing' }); } @@ -70,7 +70,7 @@ export default Backbone.Model.extend({ update: function () { return this._action({ - url: baseUrl + '/api/plugins/update', + url: '/api/plugins/update', success: function (model) { model.set({ _status: 'installing' }); } @@ -79,7 +79,7 @@ export default Backbone.Model.extend({ uninstall: function () { return this._action({ - url: baseUrl + '/api/plugins/uninstall', + url: '/api/plugins/uninstall', success: function (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 2655bf22c5c..537a1d38c33 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 @@ var Plugins = Backbone.Collection.extend({ var that = this; var opts = { type: 'GET', - url: baseUrl + '/api/plugins/installed', + url: '/api/plugins/installed', success: function (r) { that._installed = that.parse(r); } @@ -85,7 +85,7 @@ var Plugins = Backbone.Collection.extend({ var that = this; var opts = { type: 'GET', - url: baseUrl + '/api/plugins/updates', + url: '/api/plugins/updates', success: function (r) { that._updates = that.parse(r); } @@ -100,7 +100,7 @@ var Plugins = Backbone.Collection.extend({ var that = this; var opts = { type: 'GET', - url: baseUrl + '/api/plugins/available', + url: '/api/plugins/available', success: function (r) { that._available = that.parse(r); } @@ -112,7 +112,7 @@ var Plugins = Backbone.Collection.extend({ var that = this; var opts = { type: 'GET', - url: baseUrl + '/api/plugins/pending', + url: '/api/plugins/pending', success: function (r) { var installing = r.installing.map(function (plugin) { return { key: plugin.key, _status: 'installing' }; @@ -135,7 +135,7 @@ var Plugins = Backbone.Collection.extend({ var that = this; var opts = { type: 'GET', - url: baseUrl + '/api/system/upgrades', + url: '/api/system/upgrades', success: function (r) { that._systemUpdates = r.upgrades.map(function (update) { return _.extend(update, { _system: true }); @@ -195,7 +195,7 @@ var Plugins = Backbone.Collection.extend({ var that = this; var opts = { type: 'POST', - url: baseUrl + '/api/plugins/cancel_all', + url: '/api/plugins/cancel_all', success: function () { 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 d619afacb50..30fdb22fc44 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: baseUrl + '/api/users/groups?ps=100&login=' + this.model.id, - selectUrl: baseUrl + '/api/user_groups/add_user', - deselectUrl: baseUrl + '/api/user_groups/remove_user', + searchUrl: '/api/users/groups?ps=100&login=' + this.model.id, + selectUrl: '/api/user_groups/add_user', + deselectUrl: '/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 ef4406966d1..86fc8870f5a 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: function () { - return baseUrl + '/api/users'; + return '/api/users'; }, defaults: function () { 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 81cee0372bd..e9140fc39bb 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: function () { - return baseUrl + '/api/users/search'; + return '/api/users/search'; }, parse: function (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 51ebaa00ae5..b2d3a4b672c 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(baseUrl + '/markdown/help','markdown','height=300,width=600,scrollbars=1,resizable=1');return false;">{{t 'markdown.helplink'}}</a> : + <a href="#" onclick="window.open('/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/action-plans.js b/server/sonar-web/src/main/js/components/issue/collections/action-plans.js index c78664eb9bd..e8fa3358fb4 100644 --- a/server/sonar-web/src/main/js/components/issue/collections/action-plans.js +++ b/server/sonar-web/src/main/js/components/issue/collections/action-plans.js @@ -21,7 +21,7 @@ import Backbone from 'backbone'; export default Backbone.Collection.extend({ url: function () { - return baseUrl + '/api/action_plans/search'; + return '/api/action_plans/search'; }, parse: function (r) { 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 e4a1fdd4ec0..d6bb99f394e 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: function () { - return baseUrl + '/api/issues/search'; + return '/api/issues/search'; }, _injectRelational: function (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 3b787963520..88cc57e1e00 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 @@ -153,7 +153,7 @@ export default Marionette.ItemView.extend({ this.disableControls(); return $.ajax({ type: 'POST', - url: baseUrl + '/api/issues/delete_comment?key=' + commentKey + url: '/api/issues/delete_comment?key=' + commentKey }).done(function () { that.updateAfterAction(true); }); @@ -276,7 +276,7 @@ export default Marionette.ItemView.extend({ serializeData: function () { var issueKey = encodeURIComponent(this.model.get('key')); return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - permalink: baseUrl + '/issues/search#issues=' + issueKey, + permalink: '/issues/search#issues=' + issueKey, hasSecondaryLocations: this.model.get('flows').length }); } diff --git a/server/sonar-web/src/main/js/components/issue/manual-issue-view.js b/server/sonar-web/src/main/js/components/issue/manual-issue-view.js index 99a6a3eec38..12444226e14 100644 --- a/server/sonar-web/src/main/js/components/issue/manual-issue-view.js +++ b/server/sonar-web/src/main/js/components/issue/manual-issue-view.js @@ -34,7 +34,7 @@ export default Marionette.ItemView.extend({ initialize: function () { var that = this; this.rules = []; - $.get(baseUrl + '/api/rules/search?repositories=manual&f=name&ps=9999999').done(function (r) { + $.get('/api/rules/search?repositories=manual&f=name&ps=9999999').done(function (r) { that.rules = r.rules; that.render(); }); 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 96486db0eba..c6d99b86069 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: function () { - return baseUrl + '/api/issues/changelog'; + return '/api/issues/changelog'; }, parse: function (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 7ad1ed95485..25bc16ff662 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: function () { - return window.baseUrl + '/api/issues'; + return '/api/issues'; }, urlRoot: function () { - return window.baseUrl + '/api/issues'; + return '/api/issues'; }, parse: function (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 6910a1f083e..25d1f9eeec5 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: function (query) { var that = this; if (query.length > 1) { - $.get(baseUrl + '/api/users/search', { q: query }).done(function (data) { + $.get('/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 437254de756..6f72ac4964a 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({ var text = this.ui.textarea.val(), update = this.model && this.model.has('key'), method = update ? 'edit_comment' : 'add_comment', - url = baseUrl + '/api/issues/' + method, + url = '/api/issues/' + method, data = { text: 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 b13c6f81023..32f60128284 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: function (query) { var that = this; - return $.get(baseUrl + '/api/issues/tags', { ps: 10, q: query }).done(function (data) { + return $.get('/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: tags }); return $.ajax({ type: 'POST', - url: baseUrl + '/api/issues/set_tags', + url: '/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 5aee4c3fe15..8e3750d78ef 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 @@ var Suggestions = Backbone.Collection.extend({ var UserSuggestions = Suggestions.extend({ url: function () { - return baseUrl + '/api/users/search'; + return '/api/users/search'; }, parse: function (response) { @@ -84,7 +84,7 @@ var UserSuggestions = Suggestions.extend({ var ProjectSuggestions = Suggestions.extend({ url: function () { - return baseUrl + '/api/resources/search?f=s2&q=TRK&display_key=true'; + return '/api/resources/search?f=s2&q=TRK&display_key=true'; } }); @@ -93,7 +93,7 @@ var ProjectSuggestions = Suggestions.extend({ var ComponentSuggestions = Suggestions.extend({ url: function () { - return baseUrl + '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true'; + return '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true'; }, parse: function (r) { @@ -377,7 +377,7 @@ var ComponentFilterView = AjaxSelectFilterView.extend({ var that = this; return $ .ajax({ - url: baseUrl + '/api/resources', + url: '/api/resources', type: 'GET', data: { resource: v } }) @@ -407,7 +407,7 @@ var ProjectFilterView = AjaxSelectFilterView.extend({ var that = this; return $ .ajax({ - url: baseUrl + '/api/resources', + url: '/api/resources', type: 'GET', data: { resource: v } }) @@ -437,7 +437,7 @@ var AssigneeFilterView = AjaxSelectFilterView.extend({ var that = this; return $ .ajax({ - url: baseUrl + '/api/users/search', + url: '/api/users/search', type: 'GET', data: { q: v } }) @@ -469,7 +469,7 @@ var ReporterFilterView = AjaxSelectFilterView.extend({ var that = this; return $ .ajax({ - url: baseUrl + '/api/users/search', + url: '/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 fd85a49410e..6b9734e3263 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 @@ var DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({ applyFavorite: function (e) { var id = $(e.target).data('id'); - window.location = baseUrl + this.model.get('favoriteUrl') + '/' + id; + window.location = this.model.get('favoriteUrl') + '/' + id; }, manage: function () { - window.location = baseUrl + this.model.get('manageUrl'); + window.location = 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 b44d83d6338..c8c13d95973 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 = `${window.baseUrl}/api/favourites`; + const url = `/api/favourites`; const data = { key: this.props.component }; $.ajax({ type: 'POST', url, data }).done(() => this.setState({ favorite: true })); }, removeFavorite() { - const url = `${window.baseUrl}/api/favourites/${encodeURIComponent(this.props.component)}`; + const url = `/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 eecbdeb18f8..852e347ccb2 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 = `${baseUrl}/quality_gates/show/${this.props.gate}`; + let url = `/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 f47020b23aa..1b9b4ea7ddc 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 = `${baseUrl}/profiles/show?key=${encodeURIComponent(this.props.profile)}`; + let url = `/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 fa1b2b6575a..353da24b89d 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'; -var API_FAVORITE = baseUrl + '/api/favourites'; +var API_FAVORITE = '/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(baseUrl + '/component/index?' + query, this.model.get('name'), windowParams); + window.open('/component/index?' + query, this.model.get('name'), windowParams); }, showRawSources: function () { - var url = baseUrl + '/api/sources/raw?key=' + encodeURIComponent(this.model.get('key')), + var url = '/api/sources/raw?key=' + encodeURIComponent(this.model.get('key')), 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 6de5a439197..7447fbc6d9d 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 @@ -149,7 +149,7 @@ export default Marionette.LayoutView.extend({ requestComponent: function () { var that = this, - url = baseUrl + '/api/components/app', + url = '/api/components/app', data = { uuid: this.model.id }; return $.ajax({ type: 'GET', @@ -205,7 +205,7 @@ export default Marionette.LayoutView.extend({ requestSource: function () { var that = this, - url = baseUrl + '/api/sources/lines', + url = '/api/sources/lines', options = _.extend({ uuid: this.model.id }, this.linesLimit()); return $.get(url, options).done(function (data) { var source = (data.sources || []).slice(0); @@ -242,7 +242,7 @@ export default Marionette.LayoutView.extend({ requestDuplications: function () { var that = this, - url = baseUrl + '/api/duplications/show', + url = '/api/duplications/show', options = { uuid: this.model.id }; return $.get(url, options, function (data) { var hasDuplications = (data != null) && (data.duplications != null), @@ -417,7 +417,7 @@ export default Marionette.LayoutView.extend({ this.clearTooltips(); var line = $(e.currentTarget).data('line-number'), row = _.findWhere(this.model.get('source'), { line: line }), - url = baseUrl + '/api/tests/list', + url = '/api/tests/list', options = { sourceFileId: this.model.id, sourceFileLineNumber: line, @@ -605,7 +605,7 @@ export default Marionette.LayoutView.extend({ var that = this, source = this.model.get('source'), firstLine = _.first(source).line, - url = baseUrl + '/api/sources/lines', + url = '/api/sources/lines', options = { uuid: this.model.id, from: firstLine - this.LINES_AROUND, @@ -651,7 +651,7 @@ export default Marionette.LayoutView.extend({ var that = this, source = this.model.get('source'), lastLine = _.last(source).line, - url = baseUrl + '/api/sources/lines', + url = '/api/sources/lines', 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 3b353f43632..254b4d36b81 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: function () { var metrics = '', - url = baseUrl + '/api/metrics/search'; + url = '/api/metrics/search'; $.ajax({ url: url, async: false, @@ -156,7 +156,7 @@ export default ModalView.extend({ requestMeasures: function () { var that = this, - url = baseUrl + '/api/resources', + url = '/api/resources', metrics = this.getMetrics(), options = { resource: this.model.key(), @@ -181,7 +181,7 @@ export default ModalView.extend({ requestIssues: function () { var that = this, - url = baseUrl + '/api/issues/search', + url = '/api/issues/search', options = { componentUuids: this.model.id, resolved: false, @@ -214,7 +214,7 @@ export default ModalView.extend({ requestTests: function () { var that = this, - url = baseUrl + '/api/tests/list', + url = '/api/tests/list', options = { testFileId: this.model.id }; return $.get(url, options).done(function (data) { that.model.set({ tests: data.tests }); @@ -270,7 +270,7 @@ export default ModalView.extend({ showTest: function (e) { var that = this, testId = $(e.currentTarget).data('id'), - url = baseUrl + '/api/tests/covered_files', + url = '/api/tests/covered_files', options = { testId: 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 3c57d639950..6e7d84f75a8 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 @@ -31,7 +31,7 @@ export default Popup.extend({ getPermalink: function (e) { e.preventDefault(); - var url = baseUrl + '/component/index?id=' + + var url = '/component/index?id=' + (encodeURIComponent(this.model.key())) + '&line=' + this.options.line, 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 d5dd988d9c9..462a11bdee6 100644 --- a/server/sonar-web/src/main/js/components/workspace/main.js +++ b/server/sonar-web/src/main/js/components/workspace/main.js @@ -129,7 +129,7 @@ Workspace.prototype = { }, fetchRule: function (model) { - var url = baseUrl + '/api/rules/show', + var url = '/api/rules/show', 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 977175593c6..3ab861f7ed5 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 baseUrl + '/components/index?id=' + encodeURIComponent(componentKey); + return '/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 0f2bb56276d..5068d9a391c 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) { var query = params.map(function (p) { return p.key + '=' + encodeURIComponent(p.value); }).join('&'); - return baseUrl + '/dashboard/index?' + query; + return '/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 b0107366343..6a05b8fbb77 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 baseUrl + '/component_issues/index?id=' + encodeURIComponent(componentKey); + return '/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 9a58d761cb2..a259f0f1c19 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 window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey); + return '/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 0a068584017..2cc7ffe22f4 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) { - var url = baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey); + var url = '/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 a5d74d595e9..0e48bd612fe 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) { - var url = baseUrl + '/api/qualityprofiles/export'; + var url = '/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 b667cc526c6..1f820a9ab5a 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 () { options = arguments[arguments.length - 1], prefix = args.join(''), path = window.location.pathname, - match = path.indexOf(baseUrl + prefix) === 0; + match = path.indexOf(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 e1816d9110d..916163307c1 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 baseUrl + '/issues/search#id=' + id; + return '/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 01c1c77f349..acbd15cf30b 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 baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return baseUrl + '/issues/search#' + getQuery(r); + return '/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 7669d76bd77..3cc8b101f64 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 baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return baseUrl + '/issues/search#' + getQuery(r); + return '/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 9c4fba8b830..8f6eb587e97 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/link.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/link.js @@ -19,5 +19,5 @@ */ module.exports = function () { var url = Array.prototype.slice.call(arguments, 0, -1).join(''); - return window.baseUrl + url; + return url; }; 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 74c0f83690d..29635828f10 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 baseUrl + '/profiles/show?key=' + encodeURIComponent(key); + return '/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 cf988a5ac9f..2e119690f34 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 baseUrl + '/coding_rules#rule_key=' + encodeURIComponent(ruleKey); + return '/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 25c9ded9327..7428c4b1c5b 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.js +++ b/server/sonar-web/src/main/js/helpers/l10n.js @@ -47,7 +47,7 @@ function getCurrentLocale () { } function makeRequest (params) { - const url = `${window.baseUrl}/api/l10n/index?${stringify(params)}`; + const url = `/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 9ddc33aecd1..dc693e74952 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 window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey); + return '/dashboard?id=' + encodeURIComponent(componentKey); } @@ -37,7 +37,7 @@ export function getComponentIssuesUrl (componentKey, query) { let serializedQuery = Object.keys(query).map(criterion => { return `${encodeURIComponent(criterion)}=${encodeURIComponent(query[criterion])}`; }).join('|'); - return window.baseUrl + '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery; + return '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery; } @@ -50,7 +50,7 @@ export function getComponentIssuesUrl (componentKey, query) { * @returns {string} */ export function getComponentDrilldownUrl (componentKey, metric, period, highlightedMetric) { - let url = window.baseUrl + '/drilldown/measures?id=' + encodeURIComponent(componentKey) + + let url = '/drilldown/measures?id=' + encodeURIComponent(componentKey) + '&metric=' + encodeURIComponent(metric); if (period) { url += '&period=' + period; @@ -70,7 +70,7 @@ export function getComponentDrilldownUrl (componentKey, metric, period, highligh * @returns {string} */ export function getComponentDashboardUrl (componentKey, dashboardKey, period) { - let url = window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey) + + let url = '/dashboard?id=' + encodeURIComponent(componentKey) + '&did=' + encodeURIComponent(dashboardKey); if (period) { url += '&period=' + period; @@ -86,7 +86,7 @@ export function getComponentDashboardUrl (componentKey, dashboardKey, period) { * @returns {string} */ export function getComponentFixedDashboardUrl (componentKey, dashboardKey) { - return window.baseUrl + '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey); + return '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey); } @@ -96,5 +96,5 @@ export function getComponentFixedDashboardUrl (componentKey, dashboardKey) { * @returns {string} */ export function getComponentDashboardManagementUrl (componentKey) { - return window.baseUrl + '/dashboards?resource=' + encodeURIComponent(componentKey); + return '/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 5014472cc24..20564e127d5 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: baseUrl + '/favourites/toggle/' + resourceId, + type: 'POST', dataType: 'json', url: '/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 0b71555ad81..9f606b9f24d 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 = `${window.baseUrl}/dashboard/index?id=${encodeURIComponent(item.key)}`; + const url = `/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 bd4dd371985..44987766da3 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 @@ -79,13 +79,13 @@ export default React.createClass({ isFixedDashboardActive(fixedDashboard) { let path = window.location.pathname; - return path === `${window.baseUrl}/overview${fixedDashboard.link}`; + return path === `/overview${fixedDashboard.link}`; }, isCustomDashboardActive(customDashboard) { let path = window.location.pathname; let params = qs.parse(window.location.search.substr(1)); - return path.indexOf(`${window.baseUrl}/dashboard`) === 0 && params['did'] === `${customDashboard.key}`; + return path.indexOf(`/dashboard`) === 0 && params['did'] === `${customDashboard.key}`; }, isCustomDashboardsActive () { @@ -97,12 +97,12 @@ export default React.createClass({ isDefaultDeveloperDashboardActive() { let path = window.location.pathname; - return this.isDeveloper() && path.indexOf(`${window.baseUrl}/dashboard`) === 0; + return this.isDeveloper() && path.indexOf(`/dashboard`) === 0; }, isDashboardManagementActive () { let path = window.location.pathname; - return path.indexOf(`${window.baseUrl}/dashboards`) === 0; + return path.indexOf(`/dashboards`) === 0; }, renderFixedDashboards() { 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 5e1d2e3aa31..d3ad623999c 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 = `${baseUrl}/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`; + let backgroundTasksUrl = `/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 150e8f524be..298a83bd8ee 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 || `${window.baseUrl}/images/logo.svg`; + let url = this.props.logoUrl || `/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 = window.baseUrl + '/'; + const homeUrl = '/'; 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 fe45bbf01d8..3bce14a4b5c 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 = `${window.baseUrl}/dashboard/index?did=${encodeURIComponent(dashboard.key)}`; + const url = `/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 = `${window.baseUrl}/dashboards`; + const url = `/dashboards`; return ( <li> <a href={url}>{translate('dashboard.manage_dashboards')}</a> @@ -66,7 +66,7 @@ export default React.createClass({ }, renderIssuesLink() { - const url = `${window.baseUrl}/issues/search`; + const url = `/issues/search`; return ( <li className={this.activeLink('/issues')}> <a href={url}>{translate('issues.page')}</a> @@ -75,7 +75,7 @@ export default React.createClass({ }, renderMeasuresLink() { - const url = `${window.baseUrl}/measures/search?qualifiers[]=TRK`; + const url = `/measures/search?qualifiers[]=TRK`; return ( <li className={this.activeLink('/measures')}> <a href={url}>{translate('layout.measures')}</a> @@ -84,7 +84,7 @@ export default React.createClass({ }, renderRulesLink() { - const url = `${window.baseUrl}/coding_rules`; + const url = `/coding_rules`; return ( <li className={this.activeLink('/coding_rules')}> <a href={url}>{translate('coding_rules.page')}</a> @@ -93,7 +93,7 @@ export default React.createClass({ }, renderProfilesLink() { - const url = `${window.baseUrl}/profiles`; + const url = `/profiles`; return ( <li className={this.activeLink('/profiles')}> <a href={url}>{translate('quality_profiles.page')}</a> @@ -102,7 +102,7 @@ export default React.createClass({ }, renderQualityGatesLink() { - const url = `${window.baseUrl}/quality_gates`; + const url = `/quality_gates`; return ( <li className={this.activeLink('/quality_gates')}> <a href={url}>{translate('quality_gates.page')}</a> @@ -114,7 +114,7 @@ export default React.createClass({ if (!window.SS.isUserAdmin) { return null; } - const url = `${window.baseUrl}/settings`; + const url = `/settings`; return ( <li className={this.activeLink('/settings')}> <a className="navbar-admin-link" href={url}>{translate('layout.settings')}</a> @@ -123,7 +123,7 @@ export default React.createClass({ }, renderComparisonLink() { - const url = `${window.baseUrl}/comparison`; + const url = `/comparison`; return ( <li className={this.activeLink('/comparison')}> <a href={url}>{translate('comparison_global.page')}</a> @@ -132,7 +132,7 @@ export default React.createClass({ }, renderGlobalPageLink(globalPage, index) { - const url = window.baseUrl + globalPage.url; + const url = 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 54f78a2dad0..b7bb0f78eca 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={`${window.baseUrl}/account/`}>{translate('my_account.page')}</a> + <a href={`/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 = `${window.baseUrl}/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`; + window.location = `/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`; }, handleLogout(e) { e.preventDefault(); RecentHistory.clear(); - window.location = `${window.baseUrl}/sessions/logout`; + window.location = `/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 b434a9ee466..b46a11b2985 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: function () { var that = this; - return $.get(baseUrl + '/api/favourites').done(function (r) { + return $.get('/api/favourites').done(function (r) { that.favorite = r.map(function (f) { var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1; return { - url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true), + url: '/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: function () { var recentHistory = RecentHistory.get(), history = recentHistory.map(function (historyItem, index) { - var url = baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + + var url = '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + window.dashboardParameters(true); return { url: url, @@ -184,7 +184,7 @@ export default Marionette.LayoutView.extend({ }), qualifiers = this.model.get('qualifiers').map(function (q, index) { return { - url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q), + url: '/all_projects?qualifier=' + encodeURIComponent(q), name: translate('qualifiers.all', q), extra: index === 0 ? '' : null }; @@ -198,7 +198,7 @@ export default Marionette.LayoutView.extend({ return; } var that = this, - url = baseUrl + '/api/components/suggestions', + url = '/api/components/suggestions', options = { s: q }; return $.get(url, options).done(function (r) { var collection = []; @@ -207,7 +207,7 @@ export default Marionette.LayoutView.extend({ collection.push(_.extend(item, { q: domain.q, extra: index === 0 ? domain.name : null, - url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true) + url: '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true) })); }); }); @@ -222,16 +222,16 @@ export default Marionette.LayoutView.extend({ getNavigationFindings: function (q) { var DEFAULT_ITEMS = [ - { name: translate('issues.page'), url: baseUrl + '/issues/search' }, - { name: translate('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' }, - { name: translate('coding_rules.page'), url: baseUrl + '/coding_rules' }, - { name: translate('quality_profiles.page'), url: baseUrl + '/profiles' }, - { name: translate('quality_gates.page'), url: baseUrl + '/quality_gates' }, - { name: translate('comparison_global.page'), url: baseUrl + '/comparison' } + { 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' } ], customItems = []; if (window.SS.isUserAdmin) { - customItems.push({ name: translate('layout.settings'), url: baseUrl + '/settings' }); + customItems.push({ name: translate('layout.settings'), url: '/settings' }); } var 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: function (q) { var dashboards = this.model.get('globalDashboards') || [], items = dashboards.map(function (d) { - return { name: d.name, url: baseUrl + '/dashboard/index?did=' + encodeURIComponent(d.key) }; + return { name: d.name, url: '/dashboard/index?did=' + encodeURIComponent(d.key) }; }); var 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 5db7233ba3c..4990a86365d 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(window.baseUrl + url) === 0 ? 'active' : null; + return window.location.pathname.indexOf(url) === 0 ? 'active' : null; }, renderLink(url, title, highlightUrl = url) { - let fullUrl = window.baseUrl + url; + let fullUrl = 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 = window.baseUrl + url; + let fullUrl = 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 9eb36906d19..ade9eab0151 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 @@ -51,10 +51,10 @@ var FACET_LIMIT = 15, r.facetMode = 'debt'; } if (r.componentKey != null) { - return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return baseUrl + '/issues/search#' + getQuery(r); + return '/issues/search#' + getQuery(r); } }, byDistributionConf = { @@ -194,10 +194,10 @@ var FACET_LIMIT = 15, r.facetMode = 'debt'; } if (r.componentKey != null) { - return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + + return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) + '#' + getQuery(_.omit(r, 'componentKey')); } else { - return baseUrl + '/issues/search#' + getQuery(r); + return '/issues/search#' + getQuery(r); } } } @@ -298,7 +298,7 @@ export default Marionette.ItemView.extend({ requestIssues: function () { var that = this, facetMode = this.options.displayMode, - url = baseUrl + '/api/issues/search', + url = '/api/issues/search', options = _.extend({}, this.query, { ps: 1, facets: this.options.distributionAxis, diff --git a/server/sonar-web/src/main/js/widgets/old/pie-chart.js b/server/sonar-web/src/main/js/widgets/old/pie-chart.js index a818cdd72d1..43bcabfff95 100644 --- a/server/sonar-web/src/main/js/widgets/old/pie-chart.js +++ b/server/sonar-web/src/main/js/widgets/old/pie-chart.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/*global d3:false, baseUrl:false */ +/*global d3:false */ /*jshint eqnull:true */ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; 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 5fc8129a0c2..e9cde9c8368 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) { var that = this; var metrics = this.metricsPriority().join(','), - RESOURCES_URL = baseUrl + '/api/resources/index'; + RESOURCES_URL = '/api/resources/index'; return $.get(RESOURCES_URL, { resource: d.key, depth: 1, diff --git a/server/sonar-web/tests/helpers/urls-test.js b/server/sonar-web/tests/helpers/urls-test.js index da02b326155..e506ea427e4 100644 --- a/server/sonar-web/tests/helpers/urls-test.js +++ b/server/sonar-web/tests/helpers/urls-test.js @@ -29,11 +29,6 @@ describe('URLs', function () { it('should encode component key', function () { expect(getComponentUrl(COMPLEX_COMPONENT_KEY)).to.equal('/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED); }); - - it('should take baseUrl into account', function () { - window.baseUrl = '/context'; - expect(getComponentUrl(COMPLEX_COMPONENT_KEY)).to.equal('/context/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED); - }); }); describe('#getComponentIssuesUrl', function () { @@ -56,12 +51,6 @@ describe('URLs', function () { expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, { componentUuids: COMPLEX_COMPONENT_KEY })).to.equal( '/component_issues?id=' + SIMPLE_COMPONENT_KEY + '#componentUuids=' + COMPLEX_COMPONENT_KEY_ENCODED); }); - - it('should take baseUrl into account', function () { - window.baseUrl = '/context'; - expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, {})).to.equal( - '/context/component_issues?id=' + SIMPLE_COMPONENT_KEY + '#'); - }); }); describe('#getComponentDrilldownUrl', function () { @@ -79,11 +68,5 @@ describe('URLs', function () { expect(getComponentDrilldownUrl(SIMPLE_COMPONENT_KEY, METRIC, PERIOD)).to.equal( '/drilldown/measures?id=' + SIMPLE_COMPONENT_KEY + '&metric=' + METRIC + '&period=' + PERIOD); }); - - it('should take baseUrl into account', function () { - window.baseUrl = '/context'; - expect(getComponentDrilldownUrl(SIMPLE_COMPONENT_KEY, METRIC)).to.equal( - '/context/drilldown/measures?id=' + SIMPLE_COMPONENT_KEY + '&metric=' + METRIC); - }); }); }); diff --git a/server/sonar-web/tests/jsdom-setup.js b/server/sonar-web/tests/jsdom-setup.js index f1d92d7d818..6fb408ff7ef 100644 --- a/server/sonar-web/tests/jsdom-setup.js +++ b/server/sonar-web/tests/jsdom-setup.js @@ -9,7 +9,6 @@ global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); global.window = document.defaultView; global.navigator = document.defaultView.navigator; -global.window.baseUrl = ''; global.window.t = global.window.tp = function () { var args = Array.prototype.slice.call(arguments, 0); return args.join('.'); |