import { getJSON, post } from '../helpers/request.js';
export function getQueue (data) {
- const url = '/api/ce/queue';
+ const url = window.baseUrl + '/api/ce/queue';
return $.get(url, data);
}
export function getActivity (data) {
- const url = '/api/ce/activity';
+ const url = window.baseUrl + '/api/ce/activity';
return $.get(url, data);
}
export function getTask (id) {
- const url = '/api/ce/task';
+ const url = window.baseUrl + '/api/ce/task';
return getJSON(url, { id }).then(r => r.task);
}
export function cancelTask (id) {
- const url = '/api/ce/cancel';
+ const url = window.baseUrl + '/api/ce/cancel';
return post(url, { id }).then(
getTask.bind(null, id),
getTask.bind(null, id)
}
export function cancelAllTasks () {
- const url = '/api/ce/cancel_all';
+ const url = window.baseUrl + '/api/ce/cancel_all';
return post(url);
}
export function getTasksForComponent (componentId) {
- const url = '/api/ce/component';
+ const url = window.baseUrl + '/api/ce/component';
const data = { componentId };
return new Promise(resolve => $.get(url, data).done(resolve));
}
export function getTypes () {
- const url = '/api/ce/task_types';
+ const url = window.baseUrl + '/api/ce/task_types';
return getJSON(url).then(r => r.taskTypes);
}
export function getComponents (data) {
- const url = '/api/components/search';
+ const url = window.baseUrl + '/api/components/search';
return getJSON(url, data);
}
export function getProvisioned (data) {
- const url = '/api/projects/provisioned';
+ const url = window.baseUrl + '/api/projects/provisioned';
return getJSON(url, data);
}
export function getGhosts (data) {
- const url = '/api/projects/ghosts';
+ const url = window.baseUrl + '/api/projects/ghosts';
return getJSON(url, data);
}
export function deleteComponents (data) {
- const url = '/api/projects/bulk_delete';
+ const url = window.baseUrl + '/api/projects/bulk_delete';
return post(url, data);
}
export function createProject (data) {
- const url = '/api/projects/create';
+ const url = window.baseUrl + '/api/projects/create';
return postJSON(url, data);
}
export function getComponentTree (strategy, componentKey, metrics = [], additional = {}) {
- const url = '/api/measures/component_tree';
+ const url = window.baseUrl + '/api/measures/component_tree';
const data = Object.assign({}, additional, {
baseComponentKey: componentKey,
metricKeys: metrics.join(','),
}
export function getComponent (componentKey, metrics = []) {
- const url = '/api/measures/component';
+ const url = window.baseUrl + '/api/measures/component';
const data = { componentKey, metricKeys: metrics.join(',') };
return getJSON(url, data).then(r => r.component);
}
export function getTree (baseComponentKey, options = {}) {
- const url = '/api/components/tree';
+ const url = window.baseUrl + '/api/components/tree';
const data = Object.assign({}, options, { baseComponentKey });
return getJSON(url, data);
}
export function getParents ({ id, key }) {
- const url = '/api/components/show';
+ const url = window.baseUrl + '/api/components/show';
const data = id ? { id } : { key };
return getJSON(url, data).then(r => r.ancestors);
}
export function getBreadcrumbs ({ id, key }) {
- const url = '/api/components/show';
+ const url = window.baseUrl + '/api/components/show';
const data = id ? { id } : { key };
return getJSON(url, data).then(r => {
const reversedAncestors = [...r.ancestors].reverse();
}
export function getProjectsWithInternalId (query) {
- const url = '/api/resources/search';
+ const url = window.baseUrl + '/api/resources/search';
const data = {
f: 's2',
q: 'TRK',
* @returns {Promise}
*/
export function getEvents (componentKey, categories) {
- const url = '/api/events';
+ const url = window.baseUrl + '/api/events';
const data = { resource: componentKey };
if (categories) {
data.categories = categories;
import { post } from '../helpers/request.js';
export function toggleIssueFilter (id) {
- const url = '/issues/toggle_fav';
+ const url = window.baseUrl + '/issues/toggle_fav';
const data = { id };
return post(url, data);
}
export function getFacets (query, facets) {
- const url = '/api/issues/search';
+ const url = window.baseUrl + '/api/issues/search';
const data = _.extend({}, query, { facets: facets.join(), ps: 1, additionalFields: '_all' });
return getJSON(url, data).then(r => {
return { facets: r.facets, response: r };
export function getIssuesCount (query) {
- const url = '/api/issues/search';
+ const url = window.baseUrl + '/api/issues/search';
const data = _.extend({}, query, { ps: 1, facetMode: 'debt' });
return getJSON(url, data).then(r => {
return { issues: r.total, debt: r.debtTotal };
}
export function getIssueFilters () {
- const url = '/api/issue_filters/search';
+ const url = window.baseUrl + '/api/issue_filters/search';
return getJSON(url).then(r => r.issueFilters);
}
import { getJSON } from '../helpers/request.js';
export function getLanguages () {
- const url = '/api/languages/list';
+ const url = window.baseUrl + '/api/languages/list';
return getJSON(url).then(r => r.languages);
}
import { post } from '../helpers/request.js';
export function toggleMeasureFilter (id) {
- const url = '/measures/toggle_fav';
+ const url = window.baseUrl + '/measures/toggle_fav';
const data = { id };
return post(url, data);
}
export function getMeasures (componentKey, metrics) {
- const url = '/api/measures/component';
+ const url = window.baseUrl + '/api/measures/component';
const data = { componentKey, metricKeys: metrics.join(',') };
return getJSON(url, data).then(r => r.component.measures);
}
export function getMeasuresAndMeta (componentKey, metrics, additional = {}) {
- const url = '/api/measures/component';
+ const url = window.baseUrl + '/api/measures/component';
const data = Object.assign({}, additional, {
componentKey,
metricKeys: metrics.join(',')
import { getJSON } from '../helpers/request.js';
export function getMetrics () {
- const url = '/api/metrics/search';
+ const url = window.baseUrl + '/api/metrics/search';
const data = { ps: 9999 };
return getJSON(url, data).then(r => r.metrics);
}
import { getJSON } from '../helpers/request.js';
export function getGlobalNavigation () {
- const url = '/api/navigation/global';
+ const url = window.baseUrl + '/api/navigation/global';
return getJSON(url);
}
export function getComponentNavigation (componentKey) {
- const url = '/api/navigation/component';
+ const url = window.baseUrl + '/api/navigation/component';
const data = { componentKey };
return getJSON(url, data);
}
export function getSettingsNavigation () {
- const url = '/api/navigation/settings';
+ const url = window.baseUrl + '/api/navigation/settings';
return getJSON(url);
}
export function getUsers (data) {
- const url = '/api/permissions/users';
+ const url = window.baseUrl + '/api/permissions/users';
return request({ type: 'GET', url, data });
}
return typeError('grantToUser', 'please provide user login');
}
- const url = '/api/permissions/add_user';
+ const url = window.baseUrl + '/api/permissions/add_user';
const data = { permission, login: user };
if (project) {
data.projectId = project;
return typeError('revokeFromUser', 'please provide user login');
}
- const url = '/api/permissions/remove_user';
+ const url = window.baseUrl + '/api/permissions/remove_user';
const data = { permission, login: user };
if (project) {
data.projectId = project;
export function getGroups (data) {
- const url = '/api/permissions/groups';
+ const url = window.baseUrl + '/api/permissions/groups';
return request({ type: 'GET', url, data });
}
return typeError('grantToGroup', 'please provide group name');
}
- const url = '/api/permissions/add_group';
+ const url = window.baseUrl + '/api/permissions/add_group';
const data = { permission, groupName: group };
if (project) {
data.projectId = project;
return typeError('revokeFromGroup', 'please provide group name');
}
- const url = '/api/permissions/remove_group';
+ const url = window.baseUrl + '/api/permissions/remove_group';
const data = { permission, groupName: group };
if (project) {
data.projectId = project;
export function getPermissionTemplates (query) {
- const url = '/api/permissions/search_templates';
+ const url = window.baseUrl + '/api/permissions/search_templates';
const data = { };
if (query) {
data.q = query;
export function createPermissionTemplate (options) {
- const url = '/api/permissions/create_template';
+ const url = window.baseUrl + '/api/permissions/create_template';
return request(_.extend({ type: 'POST', url }, options));
}
export function updatePermissionTemplate (options) {
- const url = '/api/permissions/update_template';
+ const url = window.baseUrl + '/api/permissions/update_template';
return request(_.extend({ type: 'POST', url }, options));
}
export function deletePermissionTemplate (options) {
- const url = '/api/permissions/delete_template';
+ const url = window.baseUrl + '/api/permissions/delete_template';
return request(_.extend({ type: 'POST', url }, options));
}
return typeError('setDefaultPermissionTemplate', 'please provide permission template ID');
}
- const url = '/api/permissions/set_default_template';
+ const url = window.baseUrl + '/api/permissions/set_default_template';
const data = { templateId: template, qualifier };
return request({ type: 'POST', url, data });
}
export function applyTemplateToProject(options) {
- const url = '/api/permissions/apply_template';
+ const url = window.baseUrl + '/api/permissions/apply_template';
return request(_.extend({ type: 'POST', url }, options));
}
import { getJSON, post, postJSON } from '../helpers/request';
export function fetchQualityGatesAppDetails () {
- const url = '/api/qualitygates/app';
+ const url = window.baseUrl + '/api/qualitygates/app';
return getJSON(url);
}
export function fetchQualityGates () {
- const url = '/api/qualitygates/list';
+ const url = window.baseUrl + '/api/qualitygates/list';
return getJSON(url).then(r => r.qualitygates.map(qualityGate => {
return {
}
export function fetchQualityGate (id) {
- const url = '/api/qualitygates/show';
+ const url = window.baseUrl + '/api/qualitygates/show';
return getJSON(url, { id });
}
export function createQualityGate (name) {
- const url = '/api/qualitygates/create';
+ const url = window.baseUrl + '/api/qualitygates/create';
return postJSON(url, { name });
}
export function deleteQualityGate (id) {
- const url = '/api/qualitygates/destroy';
+ const url = window.baseUrl + '/api/qualitygates/destroy';
return post(url, { id });
}
export function renameQualityGate (id, name) {
- const url = '/api/qualitygates/rename';
+ const url = window.baseUrl + '/api/qualitygates/rename';
return post(url, { id, name });
}
export function copyQualityGate (id, name) {
- const url = '/api/qualitygates/copy';
+ const url = window.baseUrl + '/api/qualitygates/copy';
return postJSON(url, { id, name });
}
export function setQualityGateAsDefault (id) {
- const url = '/api/qualitygates/set_as_default';
+ const url = window.baseUrl + '/api/qualitygates/set_as_default';
return post(url, { id });
}
export function unsetQualityGateAsDefault (id) {
- const url = '/api/qualitygates/unset_default';
+ const url = window.baseUrl + '/api/qualitygates/unset_default';
return post(url, { id });
}
export function createCondition (gateId, condition) {
- const url = '/api/qualitygates/create_condition';
+ const url = window.baseUrl + '/api/qualitygates/create_condition';
return postJSON(url, { ...condition, gateId });
}
export function updateCondition (condition) {
- const url = '/api/qualitygates/update_condition';
+ const url = window.baseUrl + '/api/qualitygates/update_condition';
return postJSON(url, { ...condition });
}
export function deleteCondition (id) {
- const url = '/api/qualitygates/delete_condition';
+ const url = window.baseUrl + '/api/qualitygates/delete_condition';
return post(url, { id });
}
import { checkStatus, parseJSON } from '../helpers/request';
export function createQualityProfile (data) {
- const url = '/api/qualityprofiles/create';
+ const url = window.baseUrl + '/api/qualityprofiles/create';
const options = {
method: 'post',
credentials: 'same-origin',
import { getJSON, post } from '../helpers/request';
export function setLogLevel (level) {
- const url = '/api/system/change_log_level';
+ const url = window.baseUrl + '/api/system/change_log_level';
const data = { level };
return post(url, data);
}
export function getSystemInfo () {
- const url = '/api/system/info';
+ const url = window.baseUrl + '/api/system/info';
return getJSON(url);
}
export function getStatus () {
- const url = '/api/system/status';
+ const url = window.baseUrl + '/api/system/status';
return getJSON(url);
}
export function restart () {
- const url = '/api/system/restart';
+ const url = window.baseUrl + '/api/system/restart';
return post(url);
}
import { getJSON } from '../helpers/request.js';
export function getTimeMachineData (componentKey, metrics) {
- const url = '/api/timemachine/index';
+ const url = window.baseUrl + '/api/timemachine/index';
const data = { resource: componentKey, metrics };
return getJSON(url, data);
}
* @returns {Promise}
*/
export function getTokens (login) {
- const url = '/api/user_tokens/search';
+ const url = window.baseUrl + '/api/user_tokens/search';
const data = { login };
return getJSON(url, data).then(r => r.userTokens);
}
* @returns {Promise}
*/
export function generateToken(userLogin, tokenName) {
- const url = '/api/user_tokens/generate';
+ const url = window.baseUrl + '/api/user_tokens/generate';
const data = { login: userLogin, name: tokenName };
return postJSON(url, data);
}
* @returns {Promise}
*/
export function revokeToken(userLogin, tokenName) {
- const url = '/api/user_tokens/revoke';
+ const url = window.baseUrl + '/api/user_tokens/revoke';
const data = { login: userLogin, name: tokenName };
return post(url, data);
}
import { getJSON, post } from '../helpers/request.js';
export function getCurrentUser () {
- const url = '/api/users/current';
+ const url = window.baseUrl + '/api/users/current';
return getJSON(url);
}
export function changePassword (login, password, previousPassword) {
- const url = '/api/users/change_password';
+ const url = window.baseUrl + '/api/users/change_password';
const data = { login, password };
if (previousPassword != null) {
import { getJSON } from '../helpers/request';
export function fetchWebApi (showInternal = true) {
- const url = '/api/webservices/list';
+ const url = window.baseUrl + '/api/webservices/list';
const data = { 'include_internals': showInternal };
return getJSON(url, data).then(r => r.webServices.map(domain => {
}
export function fetchResponseExample (domain, action) {
- const url = '/api/webservices/response_example';
+ const url = window.baseUrl + '/api/webservices/response_example';
const data = { controller: domain, action };
return getJSON(url, data);
const el = document.querySelector(options.el);
const history = useRouterHistory(createHistory)({
- basename: '/account'
+ basename: window.baseUrl + '/account'
});
const store = configureStore();
<FavoriteIssueFilter filter={f} favorite={true}/>
</td>
<td>
- <a href={`/issues/search#id=${f.id}`}>
+ <a href={`${window.baseUrl}/issues/search#id=${f.id}`}>
{f.name}
</a>
</td>
</table>
<div className="spacer-top small">
- <a href="/issues/manage">{translate('see_all')}</a>
+ <a href={`${window.baseUrl}/issues/manage`}>{translate('see_all')}</a>
</div>
</section>
<FavoriteMeasureFilter filter={f} favorite={true}/>
</td>
<td>
- <a href={`/measures/filter/${f.id}`}>
+ <a href={`${window.baseUrl}/measures/filter/${f.id}`}>
{f.name}
</a>
</td>
</table>
<div className="spacer-top small">
- <a href="/measures/manage">{translate('see_all')}</a>
+ <a href={`${window.baseUrl}/measures/manage`}>{translate('see_all')}</a>
</div>
</section>
function getTotalUrl () {
- return '/account/issues#resolved=false';
+ return window.baseUrl + '/account/issues#resolved=false';
}
function getToFixUrl () {
- return '/account/issues#resolved=false|statuses=CONFIRMED';
+ return window.baseUrl + '/account/issues#resolved=false|statuses=CONFIRMED';
}
function getToReviewUrl () {
- return '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED');
+ return window.baseUrl + '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED');
}
function getSeverityUrl (severity) {
- return '/account/issues#resolved=false|severities=' + severity;
+ return window.baseUrl + '/account/issues#resolved=false|severities=' + severity;
}
function getProjectUrl (project) {
- return '/account/issues#resolved=false|projectUuids=' + project;
+ return window.baseUrl + '/account/issues#resolved=false|projectUuids=' + project;
}
function getPeriodUrl (createdAfter, createdBefore) {
- return `/account/issues#resolved=false|createdAfter=${createdAfter}|createdBefore=${createdBefore}`;
+ return window.baseUrl + `/account/issues#resolved=false|createdAfter=${createdAfter}|createdBefore=${createdBefore}`;
}
</li>
<li>
<a
- className={window.location.pathname === '/account/issues' && 'active'}
- href="/account/issues">
+ className={window.location.pathname === `${window.baseUrl}/account/issues` && 'active'}
+ href={`${window.baseUrl}/account/issues`}>
{translate('issues.page')}
</a>
</li>
<p className="big-spacer-bottom">
{translate('notification.dispatcher.information')}
</p>
- <form id="notif_form" method="post" action="/account/update_notifications">
+ <form id="notif_form" method="post" action={`${window.baseUrl}/account/update_notifications`}>
<div className="columns columns-overflow-visible">
<div className="column-half">
<GlobalNotifications
import { translate } from '../../../helpers/l10n';
export default function TaskLogsLink ({ task }) {
- const url = `/api/ce/logs?taskId=${task.id}`;
+ const url = `${window.baseUrl}/api/ce/logs?taskId=${task.id}`;
return (
<a
Backbone.history.start();
};
-const appXHR = $.get('/api/rules/app').done(function (r) {
+const appXHR = $.get(window.baseUrl + '/api/rules/app').done(function (r) {
App.canWrite = r.canWrite;
App.qualityProfiles = _.sortBy(r.qualityprofiles, ['name', 'lang']);
App.languages = _.extend(r.languages, {
onFormSubmit () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
- const url = `/api/qualityprofiles/${this.options.action}_rules`;
+ const url = `${window.baseUrl}/api/qualityprofiles/${this.options.action}_rules`;
const options = _.extend({}, this.options.app.state.get('query'), { wsAction: this.options.action });
const profiles = this.$('#coding-rules-bulk-change-profile').val() || [this.options.param];
this.ui.messagesContainer.empty();
this.hideDetails(firstPage);
const that = this;
- const url = '/api/rules/search';
+ const url = window.baseUrl + '/api/rules/search';
const options = _.extend(this._searchParameters(), this.app.state.get('query'));
return $.get(url, options).done(function (r) {
const rules = that.app.list.parseRules(r);
},
requestFacet (id) {
- const url = '/api/rules/search';
+ const url = window.baseUrl + '/api/rules/search';
const facet = this.app.facets.get(id);
const options = _.extend({ facets: id, ps: 1 }, this.app.state.get('query'));
return $.get(url, options).done(function (r) {
getRuleDetails (rule) {
const that = this;
- const url = '/api/rules/show';
+ const url = window.baseUrl + '/api/rules/show';
const options = {
key: rule.id,
actives: true
},
getUrl () {
- return '';
+ return window.baseUrl;
},
onRender () {
export default CustomValuesFacet.extend({
getUrl () {
- return '/api/languages/list';
+ return window.baseUrl + '/api/languages/list';
},
prepareAjaxSearch () {
export default CustomValuesFacet.extend({
getUrl () {
- return '/api/rules/repositories';
+ return window.baseUrl + '/api/rules/repositories';
},
prepareAjaxSearch () {
export default CustomValuesFacet.extend({
getUrl () {
- return '/api/rules/tags';
+ return window.baseUrl + '/api/rules/tags';
},
prepareAjaxSearch () {
fetchCustomRules () {
const that = this;
- const url = '/api/rules/search';
+ const url = window.baseUrl + '/api/rules/search';
const options = {
template_key: this.model.get('key'),
f: 'name,severity,params'
sendRequest (action, options) {
this.$('.alert').addClass('hidden');
const that = this;
- const url = '/api/rules/' + action;
+ const url = window.baseUrl + '/api/rules/' + action;
return $.ajax({
url,
type: 'POST',
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
canWrite: this.options.app.canWrite,
templateRule: this.options.templateRule,
- permalink: '/coding_rules/#rule_key=' + encodeURIComponent(this.model.id)
+ permalink: window.baseUrl + '/coding_rules/#rule_key=' + encodeURIComponent(this.model.id)
});
}
});
onFormSubmit() {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
- const url = '/api/rules/delete';
+ const url = window.baseUrl + '/api/rules/delete';
const options = { key: this.model.id };
$.post(url, options).done(() => {
this.destroy();
return $.ajax({
type: 'POST',
- url: '/api/qualityprofiles/activate_rule',
+ url: window.baseUrl + '/api/qualityprofiles/activate_rule',
data: {
severity,
profile_key: profileKey,
this.ui.extendDescriptionForm.addClass('hidden');
return $.ajax({
type: 'POST',
- url: '/api/rules/update',
+ url: window.baseUrl + '/api/rules/update',
dataType: 'json',
data: {
key: this.model.get('key'),
requestIssues () {
const that = this;
- const url = '/api/issues/search';
+ const url = window.baseUrl + '/api/issues/search';
const options = {
rules: this.model.id,
resolved: false,
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
total: this.total,
projects: this.projects,
- baseSearchUrl: '/issues/search#resolved=false|rules=' + encodeURIComponent(this.model.id)
+ baseSearchUrl: window.baseUrl + '/issues/search#resolved=false|rules=' + encodeURIComponent(this.model.id)
});
}
});
},
requestTags () {
- const url = '/api/rules/tags';
+ const url = window.baseUrl + '/api/rules/tags';
return $.get(url);
},
const tags = this.ui.tagInput.val();
return $.ajax({
type: 'POST',
- url: '/api/rules/update',
+ url: window.baseUrl + '/api/rules/update',
data: {
key: this.model.get('key'),
tags
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
canWrite: this.options.app.canWrite,
allTags: _.union(this.model.get('sysTags'), this.model.get('tags')),
- permalink: '/coding_rules#rule_key=' + encodeURIComponent(this.model.id)
+ permalink: window.baseUrl + '/coding_rules#rule_key=' + encodeURIComponent(this.model.id)
});
}
});
yesHandler () {
return $.ajax({
type: 'POST',
- url: '/api/qualityprofiles/activate_rule',
+ url: window.baseUrl + '/api/qualityprofiles/activate_rule',
data: {
profile_key: that.model.get('qProfile'),
rule_key: ruleKey,
yesHandler () {
return $.ajax({
type: 'POST',
- url: '/api/qualityprofiles/deactivate_rule',
+ url: window.baseUrl + '/api/qualityprofiles/deactivate_rule',
data: {
profile_key: that.model.get('qProfile'),
rule_key: ruleKey
yesHandler () {
return $.ajax({
type: 'POST',
- url: '/api/qualityprofiles/deactivate_rule',
+ url: window.baseUrl + '/api/qualityprofiles/deactivate_rule',
data: {
profile_key: activation.qProfile,
rule_key: ruleKey
idAttribute: 'id',
urlRoot () {
- return '/api/custom_measures';
+ return window.baseUrl + '/api/custom_measures';
},
sync (method, model, options) {
},
url () {
- return '/api/custom_measures/search';
+ return window.baseUrl + '/api/custom_measures/search';
},
parse (r) {
import '../../components/SelectList';
function getSearchUrl (permission, project) {
- let url = '/api/permissions/groups?ps=100&permission=' + permission;
+ let url = window.baseUrl + '/api/permissions/groups?ps=100&permission=' + permission;
if (project) {
url = url + '&projectId=' + project;
}
},
queryParam: 'q',
searchUrl: getSearchUrl(this.options.permission, this.options.project),
- selectUrl: '/api/permissions/add_group',
- deselectUrl: '/api/permissions/remove_group',
+ selectUrl: window.baseUrl + '/api/permissions/add_group',
+ deselectUrl: window.baseUrl + '/api/permissions/remove_group',
extra: getExtra(this.options.permission, this.options.project),
selectParameter: 'groupName',
selectParameterValue: 'name',
},
requestPermissions() {
- const url = '/api/permissions/search_global_permissions';
+ const url = window.baseUrl + '/api/permissions/search_global_permissions';
$.get(url).done(r => {
this.setState({ ready: true, permissions: r.permissions });
});
},
requestUsers() {
- const url = '/api/permissions/users';
+ const url = window.baseUrl + '/api/permissions/users';
let data = { permission: this.props.permission.key, ps: MAX_ITEMS };
if (this.props.project) {
data.projectId = this.props.project;
},
requestGroups() {
- const url = '/api/permissions/groups';
+ const url = window.baseUrl + '/api/permissions/groups';
let data = { permission: this.props.permission.key, ps: MAX_ITEMS };
if (this.props.project) {
data.projectId = this.props.project;
import '../../components/SelectList';
function getSearchUrl (permission, project) {
- let url = '/api/permissions/users?ps=100&permission=' + permission;
+ let url = window.baseUrl + '/api/permissions/users?ps=100&permission=' + permission;
if (project) {
url = url + '&projectId=' + project;
}
},
queryParam: 'q',
searchUrl: getSearchUrl(this.options.permission, this.options.project),
- selectUrl: '/api/permissions/add_user',
- deselectUrl: '/api/permissions/remove_user',
+ selectUrl: window.baseUrl + '/api/permissions/add_user',
+ deselectUrl: window.baseUrl + '/api/permissions/remove_user',
extra: getExtra(this.options.permission, this.options.project),
selectParameter: 'login',
selectParameterValue: 'login',
export default Backbone.Model.extend({
urlRoot () {
- return '/api/user_groups';
+ return window.baseUrl + '/api/user_groups';
},
sync (method, model, options) {
model: Group,
url () {
- return '/api/user_groups/search';
+ return window.baseUrl + '/api/user_groups/search';
},
parse (r) {
return `${item.name}<br><span class="note">${item.login}</span>`;
},
queryParam: 'q',
- searchUrl: '/api/user_groups/users?ps=100&id=' + this.model.id,
- selectUrl: '/api/user_groups/add_user',
- deselectUrl: '/api/user_groups/remove_user',
+ searchUrl: window.baseUrl + '/api/user_groups/users?ps=100&id=' + this.model.id,
+ selectUrl: window.baseUrl + '/api/user_groups/add_user',
+ deselectUrl: window.baseUrl + '/api/user_groups/remove_user',
extra: {
id: this.model.id
},
if (this.options.app.state.get('isContext')) {
_.extend(data, this.options.app.state.get('contextQuery'));
}
- return $.get('/api/issues/search', data).done(function (r) {
+ return $.get(window.baseUrl + '/api/issues/search', data).done(function (r) {
const issues = that.options.app.list.parseIssues(r);
if (firstPage) {
that.options.app.list.reset(issues);
const that = this;
return $.when(
that.options.app.filters.fetch({ reset: true }),
- $.get('/api/issue_filters/app', function (r) {
+ $.get(window.baseUrl + '/api/issue_filters/app', function (r) {
that.options.app.state.set({
canBulkChange: r.canBulkChange,
canManageFilters: r.canManageFilters
if (this.options.app.state.get('isContext')) {
_.extend(data, this.options.app.state.get('contextQuery'));
}
- return $.get('/api/issues/search', data, function (r) {
+ return $.get(window.baseUrl + '/api/issues/search', data, function (r) {
FACET_DATA_FIELDS.forEach(function (field) {
that.options.app.facets[field] = that._mergeCollections(that.options.app.facets[field], r[field]);
});
if (this.options.app.state.get('isContext')) {
_.extend(data, this.options.app.state.get('contextQuery'));
}
- return $.get('/api/issues/search', data, function (r) {
+ return $.get(window.baseUrl + '/api/issues/search', data, function (r) {
FACET_DATA_FIELDS.forEach(function (field) {
that.options.app.facets[field] = that._mergeCollections(that.options.app.facets[field], r[field]);
});
template: Template,
getUrl () {
- return '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
prepareAjaxSearch () {
export default CustomValuesFacet.extend({
getUrl () {
- return '/api/issues/authors';
+ return window.baseUrl + '/api/issues/authors';
},
prepareSearch () {
export default CustomValuesFacet.extend({
getUrl () {
- return '/api/languages/list';
+ return window.baseUrl + '/api/languages/list';
},
prepareSearch () {
getUrl () {
const q = this.options.app.state.get('contextComponentQualifier');
if (q === 'VW' || q === 'SVW') {
- return '/api/components/search_view_components';
+ return window.baseUrl + '/api/components/search_view_components';
} else {
- return '/api/resources/search?f=s2&q=TRK&display_uuid=true';
+ return window.baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true';
}
},
export default CustomValuesFacet.extend({
getUrl () {
- return '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
prepareAjaxSearch () {
export default CustomValuesFacet.extend({
prepareSearch () {
- let url = '/api/rules/search?f=name,langName';
+ let url = window.baseUrl + '/api/rules/search?f=name,langName';
const languages = this.options.app.state.get('query').languages;
if (languages != null) {
url += '&languages=' + languages;
export default CustomValuesFacet.extend({
prepareSearch () {
- let url = '/api/issues/tags?ps=10';
+ let url = window.baseUrl + '/api/issues/tags?ps=10';
const tags = this.options.app.state.get('query').tags;
if (tags != null) {
url += '&tags=' + tags;
saveAs () {
const query = this.options.app.controller.getQuery('&');
- const url = '/issues/save_as_form?' + query;
+ const url = window.baseUrl + '/issues/save_as_form?' + query;
window.openModalWindow(url, {});
},
save () {
const that = this;
const query = this.options.app.controller.getQuery('&');
- const url = '/issues/save/' + (this.options.app.state.get('filter').id) + '?' + query;
+ const url = window.baseUrl + '/issues/save/' + (this.options.app.state.get('filter').id) + '?' + query;
return $.post(url).done(function () {
return that.options.app.state.set({ changed: false });
});
},
copy () {
- const url = '/issues/copy_form/' + (this.options.app.state.get('filter').id);
+ const url = window.baseUrl + '/issues/copy_form/' + (this.options.app.state.get('filter').id);
window.openModalWindow(url, {});
},
edit () {
- const url = '/issues/edit_form/' + (this.options.app.state.get('filter').id);
+ const url = window.baseUrl + '/issues/edit_form/' + (this.options.app.state.get('filter').id);
window.openModalWindow(url, {});
},
export default Backbone.Model.extend({
url () {
- return '/api/issue_filters/show/' + this.id;
+ return window.baseUrl + '/api/issue_filters/show/' + this.id;
},
parse (r) {
model: Filter,
url () {
- return '/api/issue_filters/search';
+ return window.baseUrl + '/api/issue_filters/search';
},
parse (r) {
model: Issue,
url () {
- return '/api/issues/search';
+ return window.baseUrl + '/api/issues/search';
},
_injectRelational (issue, source, baseField, lookupField) {
bulkChange () {
const query = this.options.app.controller.getQuery('&', true);
- const url = '/issues/bulk_change_form?' + query;
+ const url = window.baseUrl + '/issues/bulk_change_form?' + query;
window.openModalWindow(url, {});
},
const selected = this.options.app.list.where({ selected: true });
const selectedKeys = _.first(_.pluck(selected, 'id'), 200);
const query = 'issues=' + selectedKeys.join();
- const url = '/issues/bulk_change_form?' + query;
+ const url = window.baseUrl + '/issues/bulk_change_form?' + query;
window.openModalWindow(url, {});
},
const that = this;
this.requestOptions = {
type: 'GET',
- url: '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status')
+ url: window.baseUrl + '/api/system/' + (this.options.setup ? 'db_migration_status' : 'status')
};
this.pollingInternal = setInterval(function () {
that.refresh();
startMigration () {
const that = this;
Backbone.ajax({
- url: '/api/system/migrate_db',
+ url: window.baseUrl + '/api/system/migrate_db',
type: 'POST'
}).done(function (r) {
that.model.set(r);
goHome () {
setInterval(function () {
- window.location = '/';
+ window.location = window.baseUrl + '/';
}, 2500);
},
App.requestDomains = function () {
- return $.get('/api/metrics/domains').done(function (r) {
+ return $.get(window.baseUrl + '/api/metrics/domains').done(function (r) {
App.domains = r.domains;
});
};
App.requestTypes = function () {
- return $.get('/api/metrics/types').done(function (r) {
+ return $.get(window.baseUrl + '/api/metrics/types').done(function (r) {
App.types = r.types;
});
};
idAttribute: 'id',
urlRoot () {
- return '/api/metrics';
+ return window.baseUrl + '/api/metrics';
},
sync (method, model, options) {
model: Metric,
url () {
- return '/api/metrics/search';
+ return window.baseUrl + '/api/metrics/search';
},
parse (r) {
export default React.createClass({
render() {
- const qualityGatesUrl = '/quality_gates';
+ const qualityGatesUrl = window.baseUrl + '/quality_gates';
return (
<div className="overview-gate">
import Template from './templates/permission-templates-groups.hbs';
function getSearchUrl (permission, permissionTemplate) {
- return `/api/permissions/template_groups?ps=100&permission=${permission.key}&templateId=${permissionTemplate.id}`;
+ return window.baseUrl +
+ `/api/permissions/template_groups?ps=100&permission=${permission.key}&templateId=${permissionTemplate.id}`;
}
export default Modal.extend({
},
queryParam: 'q',
searchUrl: getSearchUrl(this.options.permission, this.options.permissionTemplate),
- selectUrl: '/api/permissions/add_group_to_template',
- deselectUrl: '/api/permissions/remove_group_from_template',
+ selectUrl: window.baseUrl + '/api/permissions/add_group_to_template',
+ deselectUrl: window.baseUrl + '/api/permissions/remove_group_from_template',
extra: {
permission: this.options.permission.key,
templateId: this.options.permissionTemplate.id
onRender () {
Modal.prototype.onRender.apply(this, arguments);
- const searchUrl = '/api/permissions/template_users?ps=100&permission=' + this.options.permission.key +
- '&templateId=' + this.options.permissionTemplate.id;
+ const searchUrl = window.baseUrl + '/api/permissions/template_users?ps=100&permission=' +
+ this.options.permission.key + '&templateId=' + this.options.permissionTemplate.id;
new window.SelectList({
searchUrl,
el: this.$('#permission-templates-users'),
return `${item.name}<br><span class="note">${item.login}</span>`;
},
queryParam: 'q',
- selectUrl: '/api/permissions/add_user_to_template',
- deselectUrl: '/api/permissions/remove_user_from_template',
+ selectUrl: window.baseUrl + '/api/permissions/add_user_to_template',
+ deselectUrl: window.baseUrl + '/api/permissions/remove_user_from_template',
extra: {
permission: this.options.permission.key,
templateId: this.options.permissionTemplate.id
import Main from './main';
function requestPermissionTemplates () {
- return $.get('/api/permissions/search_templates');
+ return $.get(window.baseUrl + '/api/permissions/search_templates');
}
window.sonarqube.appStarted.then(options => {
import Template from './templates/project-permissions-groups.hbs';
function getSearchUrl (permission, project) {
- return `/api/permissions/groups?ps=100&permission=${permission}&projectId=${project}`;
+ return `${window.baseUrl}/api/permissions/groups?ps=100&permission=${permission}&projectId=${project}`;
}
export default Modal.extend({
},
queryParam: 'q',
searchUrl: getSearchUrl(this.options.permission, this.options.project),
- selectUrl: '/api/permissions/add_group',
- deselectUrl: '/api/permissions/remove_group',
+ selectUrl: window.baseUrl + '/api/permissions/add_group',
+ deselectUrl: window.baseUrl + '/api/permissions/remove_group',
extra: {
permission: this.options.permission,
projectId: this.options.project
},
requestPermissions(page = 1, query = '', filter = this.state.filter) {
- let url = '/api/permissions/search_project_permissions';
+ let url = window.baseUrl + '/api/permissions/search_project_permissions';
let data = { p: page, q: query };
if (filter !== '__ALL__') {
data.qualifier = filter;
onRender () {
Modal.prototype.onRender.apply(this, arguments);
- const searchUrl = '/api/permissions/users?ps=100&permission=' + this.options.permission +
+ const searchUrl = window.baseUrl + '/api/permissions/users?ps=100&permission=' + this.options.permission +
'&projectId=' + this.options.project;
new window.SelectList({
searchUrl,
return `${item.name}<br><span class="note">${item.login}</span>`;
},
queryParam: 'q',
- selectUrl: '/api/permissions/add_user',
- deselectUrl: '/api/permissions/remove_user',
+ selectUrl: window.baseUrl + '/api/permissions/add_user',
+ deselectUrl: window.baseUrl + '/api/permissions/remove_user',
extra: {
permission: this.options.permission,
projectId: this.options.project
const el = document.querySelector(options.el);
const history = useRouterHistory(createHistory)({
- basename: '/quality_gates'
+ basename: window.baseUrl + '/quality_gates'
});
const finalReducer = combineReducers({
format (item) {
return item.name;
},
- searchUrl: '/api/qualitygates/search?gateId=' + qualityGate.id,
- selectUrl: '/api/qualitygates/select',
- deselectUrl: '/api/qualitygates/deselect',
+ searchUrl: window.baseUrl + '/api/qualitygates/search?gateId=' + qualityGate.id,
+ selectUrl: window.baseUrl + '/api/qualitygates/select',
+ deselectUrl: window.baseUrl + '/api/qualitygates/deselect',
extra: {
gateId: qualityGate.id
},
requestLanguages () {
const that = this;
- const url = '/api/languages/list';
+ const url = window.baseUrl + '/api/languages/list';
return $.get(url).done(function (r) {
that.languages = r.languages;
});
requestImporters () {
const that = this;
- const url = '/api/qualityprofiles/importers';
+ const url = window.baseUrl + '/api/qualityprofiles/importers';
return $.get(url).done(function (r) {
that.importers = r.importers;
});
import ProfilesView from './profiles-view';
const App = new Marionette.Application();
-const requestUser = $.get('/api/users/current').done(function (r) {
+const requestUser = $.get(window.baseUrl + '/api/users/current').done(function (r) {
App.canWrite = r.permissions.global.indexOf('profileadmin') !== -1;
});
-const requestExporters = $.get('/api/qualityprofiles/exporters').done(function (r) {
+const requestExporters = $.get(window.baseUrl + '/api/qualityprofiles/exporters').done(function (r) {
App.exporters = r.exporters;
});
const init = function () {
sendRequest () {
const that = this;
- const url = '/api/qualityprofiles/change_parent';
+ const url = window.baseUrl + '/api/qualityprofiles/change_parent';
const parent = this.$('#change-profile-parent').val();
const options = {
profileKey: this.model.get('key'),
onProfileSetAsDefault (profile) {
const that = this;
- const url = '/api/qualityprofiles/set_default';
+ const url = window.baseUrl + '/api/qualityprofiles/set_default';
const key = profile.get('key');
const options = { profileKey: key };
return $.post(url, options).done(function () {
sendRequest () {
const that = this;
- const url = '/api/qualityprofiles/copy';
+ const url = window.baseUrl + '/api/qualityprofiles/copy';
const name = this.$('#copy-profile-name').val();
const options = {
fromKey: this.model.get('key'),
sendRequest () {
const that = this;
- const url = '/api/qualityprofiles/delete';
+ const url = window.baseUrl + '/api/qualityprofiles/delete';
const options = { profileKey: this.model.get('key') };
return $.ajax({
url,
format (item) {
return item.name;
},
- searchUrl: '/api/qualityprofiles/projects?key=' + encodeURIComponent(key),
- selectUrl: '/api/qualityprofiles/add_project',
- deselectUrl: '/api/qualityprofiles/remove_project',
+ searchUrl: window.baseUrl + '/api/qualityprofiles/projects?key=' + encodeURIComponent(key),
+ selectUrl: window.baseUrl + '/api/qualityprofiles/add_project',
+ deselectUrl: window.baseUrl + '/api/qualityprofiles/remove_project',
extra: {
profileKey: key
},
fetchProfileRules () {
const that = this;
- const url = '/api/rules/search';
+ const url = window.baseUrl + '/api/rules/search';
const key = this.id;
const options = {
ps: 1,
fetchInheritance () {
const that = this;
- const url = '/api/qualityprofiles/inheritance';
+ const url = window.baseUrl + '/api/qualityprofiles/inheritance';
const options = { profileKey: this.id };
return $.get(url, options).done(function (r) {
_.extend(that.fetchChanged, r.profile, {
fetchChangelog (options) {
const that = this;
- const url = '/api/qualityprofiles/changelog';
+ const url = window.baseUrl + '/api/qualityprofiles/changelog';
const opts = _.extend({}, options, { profileKey: this.id });
return $.get(url, opts).done(function (r) {
that.set({
fetchMoreChangelog () {
const that = this;
- const url = '/api/qualityprofiles/changelog';
+ const url = window.baseUrl + '/api/qualityprofiles/changelog';
const page = this.get('eventsPage') || 0;
const parameters = this.get('eventsParameters') || {};
const opts = _.extend({}, parameters, { profileKey: this.id, p: page + 1 });
compareWith (withKey) {
const that = this;
- const url = '/api/qualityprofiles/compare';
+ const url = window.baseUrl + '/api/qualityprofiles/compare';
const options = { leftKey: this.id, rightKey: withKey };
return $.get(url, options).done(function (r) {
const comparison = _.extend(r, {
export default Backbone.Collection.extend({
model: Profile,
- url: '/api/qualityprofiles/search',
+ url: window.baseUrl + '/api/qualityprofiles/search',
comparator: 'key',
parse (r) {
sendRequest () {
const that = this;
- const url = '/api/qualityprofiles/rename';
+ const url = window.baseUrl + '/api/qualityprofiles/rename';
const name = this.$('#rename-profile-name').val();
const options = {
key: this.model.get('key'),
sendRequest () {
const that = this;
- const url = '/api/qualityprofiles/restore_built_in';
+ const url = window.baseUrl + '/api/qualityprofiles/restore_built_in';
const lang = this.$('#restore-built-in-profiles-language').val();
const options = { language: lang };
this.selectedLanguage = _.findWhere(this.options.languages, { key: lang }).name;
<header className="page-header">
<h1 className="page-title">{translate('system_info.page')}</h1>
<div className="page-actions">
- <a className="spacer-right" href={'/api/system/logs'} id="logs-link">Logs</a>
- <a href={'/api/system/info'} id="download-link">Download</a>
+ <a className="spacer-right" href={window.baseUrl + '/api/system/logs'} id="logs-link">Logs</a>
+ <a href={window.baseUrl + '/api/system/info'} id="download-link">Download</a>
<button
id="restart-server-button"
className="big-spacer-left"
install () {
return this._action({
- url: '/api/plugins/install',
+ url: window.baseUrl + '/api/plugins/install',
success (model) {
model.set({ _status: 'installing' });
}
update () {
return this._action({
- url: '/api/plugins/update',
+ url: window.baseUrl + '/api/plugins/update',
success (model) {
model.set({ _status: 'installing' });
}
uninstall () {
return this._action({
- url: '/api/plugins/uninstall',
+ url: window.baseUrl + '/api/plugins/uninstall',
success (model) {
model.set({ _status: 'uninstalling' });
}
const that = this;
const opts = {
type: 'GET',
- url: '/api/plugins/installed',
+ url: window.baseUrl + '/api/plugins/installed',
success (r) {
that._installed = that.parse(r);
}
const that = this;
const opts = {
type: 'GET',
- url: '/api/plugins/updates',
+ url: window.baseUrl + '/api/plugins/updates',
success (r) {
that._updates = that.parse(r);
}
const that = this;
const opts = {
type: 'GET',
- url: '/api/plugins/available',
+ url: window.baseUrl + '/api/plugins/available',
success (r) {
that._available = that.parse(r);
}
const that = this;
const opts = {
type: 'GET',
- url: '/api/plugins/pending',
+ url: window.baseUrl + '/api/plugins/pending',
success (r) {
const installing = r.installing.map(function (plugin) {
return { key: plugin.key, _status: 'installing' };
const that = this;
const opts = {
type: 'GET',
- url: '/api/system/upgrades',
+ url: window.baseUrl + '/api/system/upgrades',
success (r) {
that._systemUpdates = r.upgrades.map(function (update) {
return _.extend(update, { _system: true });
const that = this;
const opts = {
type: 'POST',
- url: '/api/plugins/cancel_all',
+ url: window.baseUrl + '/api/plugins/cancel_all',
success () {
that._installedCount = 0;
that._uninstalledCount = 0;
return `${item.name}<br><span class="note">${item.description}</span>`;
},
queryParam: 'q',
- searchUrl: '/api/users/groups?ps=100&login=' + this.model.id,
- selectUrl: '/api/user_groups/add_user',
- deselectUrl: '/api/user_groups/remove_user',
+ searchUrl: window.baseUrl + '/api/users/groups?ps=100&login=' + this.model.id,
+ selectUrl: window.baseUrl + '/api/user_groups/add_user',
+ deselectUrl: window.baseUrl + '/api/user_groups/remove_user',
extra: {
login: this.model.id
},
idAttribute: 'login',
urlRoot () {
- return '/api/users';
+ return window.baseUrl + '/api/users';
},
defaults () {
model: User,
url () {
- return '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
parse (r) {
<div class="markdown-tips">
- <a href="#" onclick="window.open('/markdown/help','markdown','height=300,width=600,scrollbars=1,resizable=1');return false;">{{t 'markdown.helplink'}}</a> :
+ <a href="#" onclick="window.open(window.baseUrl + '/markdown/help','markdown','height=300,width=600,scrollbars=1,resizable=1');return false;">{{t 'markdown.helplink'}}</a> :
*{{t 'bold'}}* ``{{t 'code'}}`` * {{t 'bulleted_point'}}
</div>
model: Issue,
url () {
- return '/api/issues/search';
+ return window.baseUrl + '/api/issues/search';
},
_injectRelational (issue, source, baseField, lookupField) {
this.disableControls();
return $.ajax({
type: 'POST',
- url: '/api/issues/delete_comment?key=' + commentKey
+ url: window.baseUrl + '/api/issues/delete_comment?key=' + commentKey
}).done(function () {
that.updateAfterAction(true);
});
serializeData () {
const issueKey = encodeURIComponent(this.model.get('key'));
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
- permalink: '/issues/search#issues=' + issueKey,
+ permalink: window.baseUrl + '/issues/search#issues=' + issueKey,
hasSecondaryLocations: this.model.get('flows').length
});
}
export default Backbone.Collection.extend({
url () {
- return '/api/issues/changelog';
+ return window.baseUrl + '/api/issues/changelog';
},
parse (r) {
},
url () {
- return '/api/issues';
+ return window.baseUrl + '/api/issues';
},
urlRoot () {
- return '/api/issues';
+ return window.baseUrl + '/api/issues';
},
parse (r) {
search (query) {
const that = this;
if (query.length > 1) {
- $.get('/api/users/search', { q: query }).done(function (data) {
+ $.get(window.baseUrl + '/api/users/search', { q: query }).done(function (data) {
that.resetAssignees(data.users);
});
} else {
const text = this.ui.textarea.val();
const update = this.model && this.model.has('key');
const method = update ? 'edit_comment' : 'add_comment';
- const url = '/api/issues/' + method;
+ const url = window.baseUrl + '/api/issues/' + method;
const data = { text };
if (update) {
data.key = this.model.get('key');
requestTags (query) {
const that = this;
- return $.get('/api/issues/tags', { ps: 10, q: query }).done(function (data) {
+ return $.get(window.baseUrl + '/api/issues/tags', { ps: 10, q: query }).done(function (data) {
that.tags = data.tags;
that.renderTags();
});
this.model.set({ tags });
return $.ajax({
type: 'POST',
- url: '/api/issues/set_tags',
+ url: window.baseUrl + '/api/issues/set_tags',
data: {
key: this.model.id,
tags: tags.join()
const UserSuggestions = Suggestions.extend({
url () {
- return '/api/users/search';
+ return window.baseUrl + '/api/users/search';
},
parse (response) {
const ProjectSuggestions = Suggestions.extend({
url () {
- return '/api/resources/search?f=s2&q=TRK&display_key=true';
+ return window.baseUrl + '/api/resources/search?f=s2&q=TRK&display_key=true';
}
});
const ComponentSuggestions = Suggestions.extend({
url () {
- return '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true';
+ return window.baseUrl + '/api/resources/search?f=s2&qp=supportsGlobalDashboards&display_key=true';
},
parse (r) {
const that = this;
return $
.ajax({
- url: '/api/resources',
+ url: window.baseUrl + '/api/resources',
type: 'GET',
data: { resource: v }
})
const that = this;
return $
.ajax({
- url: '/api/resources',
+ url: window.baseUrl + '/api/resources',
type: 'GET',
data: { resource: v }
})
const that = this;
return $
.ajax({
- url: '/api/users/search',
+ url: window.baseUrl + '/api/users/search',
type: 'GET',
data: { q: v }
})
applyFavorite (e) {
const id = $(e.target).data('id');
- window.location = this.model.get('favoriteUrl') + '/' + id;
+ window.location = window.baseUrl + this.model.get('favoriteUrl') + '/' + id;
},
manage () {
- window.location = this.model.get('manageUrl');
+ window.location = window.baseUrl + this.model.get('manageUrl');
},
},
addFavorite() {
- const url = '/api/favourites';
+ const url = window.baseUrl + '/api/favourites';
const data = { key: this.props.component };
$.ajax({ type: 'POST', url, data }).done(() => this.setState({ favorite: true }));
},
removeFavorite() {
- const url = `/api/favourites/${encodeURIComponent(this.props.component)}`;
+ const url = `${window.baseUrl}/api/favourites/${encodeURIComponent(this.props.component)}`;
$.ajax({ type: 'DELETE', url }).done(() => this.setState({ favorite: false }));
},
export const QualityGateLink = React.createClass({
render() {
- let url = `/quality_gates/show/${this.props.gate}`;
+ let url = `${window.baseUrl}/quality_gates/show/${this.props.gate}`;
return <a href={url}>{this.props.children}</a>;
}
});
export const QualityProfileLink = React.createClass({
render() {
- let url = `/profiles/show?key=${encodeURIComponent(this.props.profile)}`;
+ let url = `${window.baseUrl}/profiles/show?key=${encodeURIComponent(this.props.profile)}`;
return <a href={url}>{this.props.children}</a>;
}
});
import MeasuresOverlay from './measures-overlay';
import Template from './templates/source-viewer-header.hbs';
-const API_FAVORITE = '/api/favourites';
+const API_FAVORITE = window.baseUrl + '/api/favourites';
export default Marionette.ItemView.extend({
template: Template,
if (this.options.viewer.highlightedLine) {
query = query + '&line=' + this.options.viewer.highlightedLine;
}
- window.open('/component/index?' + query, this.model.get('name'), windowParams);
+ window.open(window.baseUrl + '/component/index?' + query, this.model.get('name'), windowParams);
},
showRawSources () {
- const url = '/api/sources/raw?key=' + encodeURIComponent(this.model.get('key'));
+ const url = window.baseUrl + '/api/sources/raw?key=' + encodeURIComponent(this.model.get('key'));
const windowParams = 'resizable=1,scrollbars=1,status=1';
window.open(url, this.model.get('name'), windowParams);
},
requestComponent () {
const that = this;
- const url = '/api/components/app';
+ const url = window.baseUrl + '/api/components/app';
const data = { uuid: this.model.id };
return $.ajax({
url,
requestSource () {
const that = this;
- const url = '/api/sources/lines';
+ const url = window.baseUrl + '/api/sources/lines';
const options = _.extend({ uuid: this.model.id }, this.linesLimit());
return $.get(url, options).done(function (data) {
let source = (data.sources || []).slice(0);
requestDuplications () {
const that = this;
- const url = '/api/duplications/show';
+ const url = window.baseUrl + '/api/duplications/show';
const options = { uuid: this.model.id };
return $.get(url, options, function (data) {
const hasDuplications = (data != null) && (data.duplications != null);
this.clearTooltips();
const line = $(e.currentTarget).data('line-number');
const row = _.findWhere(this.model.get('source'), { line });
- const url = '/api/tests/list';
+ const url = window.baseUrl + '/api/tests/list';
const options = {
sourceFileId: this.model.id,
sourceFileLineNumber: line,
const that = this;
let source = this.model.get('source');
const firstLine = _.first(source).line;
- const url = '/api/sources/lines';
+ const url = window.baseUrl + '/api/sources/lines';
const options = {
uuid: this.model.id,
from: firstLine - this.LINES_AROUND,
const that = this;
let source = this.model.get('source');
const lastLine = _.last(source).line;
- const url = '/api/sources/lines';
+ const url = window.baseUrl + '/api/sources/lines';
const options = {
uuid: this.model.id,
from: lastLine + 1,
getMetrics () {
let metrics = '';
- const url = '/api/metrics/search';
+ const url = window.baseUrl + '/api/metrics/search';
$.ajax({
url,
async: false,
requestMeasures () {
const that = this;
- const url = '/api/resources';
+ const url = window.baseUrl + '/api/resources';
const metrics = this.getMetrics();
const options = {
resource: this.model.key(),
requestIssues () {
const that = this;
- const url = '/api/issues/search';
+ const url = window.baseUrl + '/api/issues/search';
const options = {
componentUuids: this.model.id,
resolved: false,
requestTests () {
const that = this;
- const url = '/api/tests/list';
+ const url = window.baseUrl + '/api/tests/list';
const options = { testFileId: this.model.id };
return $.get(url, options).done(function (data) {
that.model.set({ tests: data.tests });
showTest (e) {
const that = this;
const testId = $(e.currentTarget).data('id');
- const url = '/api/tests/covered_files';
+ const url = window.baseUrl + '/api/tests/covered_files';
const options = { testId };
this.testsScroll = $(e.currentTarget).scrollParent().scrollTop();
return $.get(url, options).done(function (data) {
getPermalink (e) {
e.preventDefault();
- const url = `/component/index?id=${encodeURIComponent(this.model.key())}&line=${this.options.line}`;
+ const url = `${window.baseUrl}/component/index?id=${encodeURIComponent(this.model.key())}&line=${this.options.line}`;
const windowParams = 'resizable=1,scrollbars=1,status=1';
window.open(url, this.model.get('name'), windowParams);
}
},
fetchRule (model) {
- const url = '/api/rules/show';
+ const url = window.baseUrl + '/api/rules/show';
const options = { key: model.get('key') };
return $.get(url, options).done(function (r) {
model.set(r.rule);
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (componentKey) {
- return '/components/index?id=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/components/index?id=' + encodeURIComponent(componentKey);
};
const query = params.map(function (p) {
return p.key + '=' + encodeURIComponent(p.value);
}).join('&');
- return '/dashboard/index?' + query;
+ return window.baseUrl + '/dashboard/index?' + query;
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (componentKey) {
- return '/component_issues/index?id=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(componentKey);
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (componentKey) {
- return '/dashboard/index?id=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey);
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (componentKey, componentQualifier) {
- let url = '/dashboard/index?id=' + encodeURIComponent(componentKey);
+ let url = window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey);
if (componentQualifier === 'FIL' || componentQualifier === 'CLA') {
url += '&metric=sqale_index';
}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (profile, exporterKey) {
- let url = '/api/qualityprofiles/export';
+ let url = window.baseUrl + '/api/qualityprofiles/export';
url += '?language=' + encodeURIComponent(profile.language);
url += '&name=' + encodeURIComponent(profile.name);
if (exporterKey != null) {
const list = args.slice(0, -1);
const prefix = list.join('');
const path = window.location.pathname;
- const match = path.indexOf(prefix) === 0;
+ const match = path.indexOf(window.baseUrl + prefix) === 0;
return match ? options.fn(this) : options.inverse(this);
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (id) {
- return '/issues/search#id=' + id;
+ return window.baseUrl + '/issues/search#id=' + id;
};
r.facetMode = 'debt';
}
if (r.componentKey != null) {
- return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
'#' + getQuery(_.omit(r, 'componentKey'));
} else {
- return '/issues/search#' + getQuery(r);
+ return window.baseUrl + '/issues/search#' + getQuery(r);
}
};
r.facetMode = 'debt';
}
if (r.componentKey != null) {
- return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
'#' + getQuery(_.omit(r, 'componentKey'));
} else {
- return '/issues/search#' + getQuery(r);
+ return window.baseUrl + '/issues/search#' + getQuery(r);
}
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (...args) {
- return args.slice(0, -1).join('');
+ return window.baseUrl + args.slice(0, -1).join('');
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (key) {
- return '/profiles/show?key=' + encodeURIComponent(key);
+ return window.baseUrl + '/profiles/show?key=' + encodeURIComponent(key);
};
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
module.exports = function (ruleKey) {
- return '/coding_rules#rule_key=' + encodeURIComponent(ruleKey);
+ return window.baseUrl + '/coding_rules#rule_key=' + encodeURIComponent(ruleKey);
};
}
function makeRequest (params) {
- const url = `/api/l10n/index?${stringify(params)}`;
+ const url = `${window.baseUrl}/api/l10n/index?${stringify(params)}`;
return fetch(url, { credentials: 'same-origin' }).then(response => {
if (response.status === 304) {
* @returns {string}
*/
export function getComponentUrl (componentKey) {
- return '/dashboard?id=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey);
}
const serializedQuery = Object.keys(query).map(criterion => (
`${encodeURIComponent(criterion)}=${encodeURIComponent(query[criterion])}`
)).join('|');
- return '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery;
+ return window.baseUrl + '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery;
}
* @returns {string}
*/
export function getComponentDrilldownUrl (componentKey, metric) {
- return `/component_measures/metric/${metric}?id=${encodeURIComponent(componentKey)}`;
+ return `${window.baseUrl}/component_measures/metric/${metric}?id=${encodeURIComponent(componentKey)}`;
}
* @returns {string}
*/
export function getComponentDashboardUrl (componentKey, dashboardKey, period) {
- let url = '/dashboard?id=' + encodeURIComponent(componentKey) +
+ let url = window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey) +
'&did=' + encodeURIComponent(dashboardKey);
if (period) {
url += '&period=' + period;
* @returns {string}
*/
export function getComponentFixedDashboardUrl (componentKey, dashboardKey) {
- return '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey);
}
* @returns {string}
*/
export function getComponentDashboardManagementUrl (componentKey) {
- return '/dashboards?resource=' + encodeURIComponent(componentKey);
+ return window.baseUrl + '/dashboards?resource=' + encodeURIComponent(componentKey);
}
function toggleFav (resourceId, elt) {
jQuery.ajax({
- type: 'POST', dataType: 'json', url: '/favourites/toggle/' + resourceId,
+ type: 'POST', dataType: 'json', url: window.baseUrl + '/favourites/toggle/' + resourceId,
success: function (data) {
var star = jQuery(elt);
star.removeClass('icon-favorite icon-not-favorite');
return null;
}
const items = this.props.breadcrumbs.map((item, index) => {
- const url = `/dashboard/index?id=${encodeURIComponent(item.key)}`;
+ const url = `${window.baseUrl}/dashboard/index?id=${encodeURIComponent(item.key)}`;
return (
<li key={index}>
<a href={url}>
isFixedDashboardActive() {
const path = window.location.pathname;
- return path.indexOf('/overview') === 0;
+ return path.indexOf(window.baseUrl + '/overview') === 0;
},
isCustomDashboardActive(customDashboard) {
const path = window.location.pathname;
const params = qs.parse(window.location.search.substr(1));
- return path.indexOf('/dashboard') === 0 && params['did'] === `${customDashboard.key}`;
+ return path.indexOf(window.baseUrl + '/dashboard') === 0 && params['did'] === `${customDashboard.key}`;
},
isCustomDashboardsActive () {
isDefaultDeveloperDashboardActive() {
const path = window.location.pathname;
- return this.isDeveloper() && path.indexOf('/dashboard') === 0;
+ return this.isDeveloper() && path.indexOf(window.baseUrl + '/dashboard') === 0;
},
isDashboardManagementActive () {
const path = window.location.pathname;
- return path.indexOf('/dashboards') === 0;
+ return path.indexOf(window.baseUrl + '/dashboards') === 0;
},
renderOverviewLink() {
render() {
let metaList = [];
let canSeeBackgroundTasks = this.props.conf.showBackgroundTasks;
- let backgroundTasksUrl = `/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`;
+ let backgroundTasksUrl = `${window.baseUrl}/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`;
if (this.props.isInProgress) {
let tooltip = canSeeBackgroundTasks ?
export default React.createClass({
renderLogo() {
- let url = this.props.logoUrl || '/images/logo.svg';
+ let url = this.props.logoUrl || `${window.baseUrl}/images/logo.svg`;
let width = this.props.logoWidth || 100;
let height = 30;
let title = translate('layout.sonar.slogan');
},
render() {
- const homeUrl = '/';
+ const homeUrl = window.baseUrl + '/';
const homeLinkClassName = 'navbar-brand' + (this.props.logoUrl ? ' navbar-brand-custom' : '');
return (
<div className="navbar-header">
},
renderDashboardLink (dashboard) {
- const url = `/dashboard/index?did=${encodeURIComponent(dashboard.key)}`;
+ const url = `${window.baseUrl}/dashboard/index?did=${encodeURIComponent(dashboard.key)}`;
const name = this.getLocalizedDashboardName(dashboard.name);
return (
<li key={dashboard.name}>
},
renderDashboardsManagementLink () {
- const url = '/dashboards';
+ const url = window.baseUrl + '/dashboards';
return (
<li>
<a href={url}>{translate('dashboard.manage_dashboards')}</a>
},
renderIssuesLink () {
- const url = '/issues/search';
+ const url = window.baseUrl + '/issues/search';
return (
<li className={this.activeLink('/issues')}>
<a href={url}>{translate('issues.page')}</a>
},
renderMeasuresLink () {
- const url = '/measures/search?qualifiers[]=TRK';
+ const url = window.baseUrl + '/measures/search?qualifiers[]=TRK';
return (
<li className={this.activeLink('/measures')}>
<a href={url}>{translate('layout.measures')}</a>
},
renderRulesLink () {
- const url = '/coding_rules';
+ const url = window.baseUrl + '/coding_rules';
return (
<li className={this.activeLink('/coding_rules')}>
<a href={url}>{translate('coding_rules.page')}</a>
},
renderProfilesLink() {
- const url = '/profiles';
+ const url = window.baseUrl + '/profiles';
return (
<li className={this.activeLink('/profiles')}>
<a href={url}>{translate('quality_profiles.page')}</a>
},
renderQualityGatesLink () {
- const url = '/quality_gates';
+ const url = window.baseUrl + '/quality_gates';
return (
<li className={this.activeLink('/quality_gates')}>
<a href={url}>{translate('quality_gates.page')}</a>
if (!window.SS.isUserAdmin) {
return null;
}
- const url = '/settings';
+ const url = window.baseUrl + '/settings';
return (
<li className={this.activeLink('/settings')}>
<a className="navbar-admin-link" href={url}>{translate('layout.settings')}</a>
},
renderComparisonLink () {
- const url = '/comparison';
+ const url = window.baseUrl + '/comparison';
return (
<li className={this.activeLink('/comparison')}>
<a href={url}>{translate('comparison_global.page')}</a>
},
renderGlobalPageLink (globalPage, index) {
- const url = globalPage.url;
+ const url = window.baseUrl + globalPage.url;
return (
<li key={index}>
<a href={url}>{globalPage.name}</a>
</a>
<ul className="dropdown-menu dropdown-menu-right">
<li>
- <a href="/account/">{translate('my_account.page')}</a>
+ <a href={`${window.baseUrl}/account/`}>{translate('my_account.page')}</a>
</li>
<li>
<a onClick={this.handleLogout} href="#">{translate('layout.logout')}</a>
handleLogin(e) {
e.preventDefault();
const returnTo = window.location.pathname + window.location.search;
- window.location = `/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`;
+ window.location = `${window.baseUrl}/sessions/new?return_to=${encodeURIComponent(returnTo)}${window.location.hash}`;
},
handleLogout(e) {
e.preventDefault();
RecentHistory.clear();
- window.location = '/sessions/logout';
+ window.location = `${window.baseUrl}/sessions/logout`;
},
render() {
fetchFavorite () {
const that = this;
- return $.get('/api/favourites').done(function (r) {
+ return $.get(window.baseUrl + '/api/favourites').done(function (r) {
that.favorite = r.map(function (f) {
const isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1;
return {
- url: '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true),
+ url: window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true),
name: isFile ? collapsedDirFromPath(f.lname) + fileFromPath(f.lname) : f.name,
icon: 'favorite'
};
resetResultsToDefault () {
const recentHistory = RecentHistory.get();
const history = recentHistory.map(function (historyItem, index) {
- const url = '/dashboard/index?id=' + encodeURIComponent(historyItem.key) +
+ const url = window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) +
window.dashboardParameters(true);
return {
url,
});
const qualifiers = this.model.get('qualifiers').map(function (q, index) {
return {
- url: '/all_projects?qualifier=' + encodeURIComponent(q),
+ url: window.baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q),
name: translate('qualifiers.all', q),
extra: index === 0 ? '' : null
};
return;
}
const that = this;
- const url = '/api/components/suggestions';
+ const url = window.baseUrl + '/api/components/suggestions';
const options = { s: q };
return $.get(url, options).done(function (r) {
const collection = [];
collection.push(_.extend(item, {
q: domain.q,
extra: index === 0 ? domain.name : null,
- url: '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true)
+ url: window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true)
}));
});
});
getNavigationFindings (q) {
const DEFAULT_ITEMS = [
- { name: translate('issues.page'), url: '/issues/search' },
- { name: translate('layout.measures'), url: '/measures/search?qualifiers[]=TRK' },
- { name: translate('coding_rules.page'), url: '/coding_rules' },
- { name: translate('quality_profiles.page'), url: '/profiles' },
- { name: translate('quality_gates.page'), url: '/quality_gates' },
- { name: translate('comparison_global.page'), url: '/comparison' }
+ { name: translate('issues.page'), url: window.baseUrl + '/issues/search' },
+ { name: translate('layout.measures'), url: window.baseUrl + '/measures/search?qualifiers[]=TRK' },
+ { name: translate('coding_rules.page'), url: window.baseUrl + '/coding_rules' },
+ { name: translate('quality_profiles.page'), url: window.baseUrl + '/profiles' },
+ { name: translate('quality_gates.page'), url: window.baseUrl + '/quality_gates' },
+ { name: translate('comparison_global.page'), url: window.baseUrl + '/comparison' }
];
const customItems = [];
if (window.SS.isUserAdmin) {
- customItems.push({ name: translate('layout.settings'), url: '/settings' });
+ customItems.push({ name: translate('layout.settings'), url: window.baseUrl + '/settings' });
}
const findings = [].concat(DEFAULT_ITEMS, customItems).filter(function (f) {
return f.name.match(new RegExp(q, 'i'));
getGlobalDashboardFindings (q) {
const dashboards = this.model.get('globalDashboards') || [];
const items = dashboards.map(function (d) {
- return { name: d.name, url: '/dashboard/index?did=' + encodeURIComponent(d.key) };
+ return { name: d.name, url: window.baseUrl + '/dashboard/index?did=' + encodeURIComponent(d.key) };
});
const findings = items.filter(function (f) {
return f.name.match(new RegExp(q, 'i'));
export default {
activeLink(url) {
- return window.location.pathname.indexOf(url) === 0 ? 'active' : null;
+ return window.location.pathname.indexOf(window.baseUrl + url) === 0 ? 'active' : null;
},
renderLink(url, title, highlightUrl = url) {
- let fullUrl = url;
+ let fullUrl = window.baseUrl + url;
let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink;
return (
<li key={url} className={check(highlightUrl)}>
},
renderNewLink(url, title, highlightUrl = url) {
- let fullUrl = url;
+ let fullUrl = window.baseUrl + url;
let check = _.isFunction(highlightUrl) ? highlightUrl : this.activeLink;
return (
<li key={highlightUrl} className={check(highlightUrl)}>
r.facetMode = 'debt';
}
if (r.componentKey != null) {
- return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
'#' + getQuery(_.omit(r, 'componentKey'));
} else {
- return '/issues/search#' + getQuery(r);
+ return window.baseUrl + '/issues/search#' + getQuery(r);
}
};
r.facetMode = 'debt';
}
if (r.componentKey != null) {
- return '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ return window.baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
'#' + getQuery(_.omit(r, 'componentKey'));
} else {
- return '/issues/search#' + getQuery(r);
+ return window.baseUrl + '/issues/search#' + getQuery(r);
}
}
}
requestIssues () {
const that = this;
const facetMode = this.options.displayMode;
- const url = '/api/issues/search';
+ const url = window.baseUrl + '/api/issues/search';
const options = _.extend({}, this.query, {
facetMode,
ps: 1,
Treemap.prototype.requestChildren = function (d) {
const that = this;
const metrics = this.metricsPriority().join(',');
- const RESOURCES_URL = '/api/resources/index';
+ const RESOURCES_URL = window.baseUrl + '/api/resources/index';
return $.get(RESOURCES_URL, {
resource: d.key,
depth: 1,
end
end
- redirect_to "/account/notifications"
+ redirect_to "#{ApplicationController.root_context}/account/notifications"
end
private
rescue_from Errors::AccessDenied, :with => :render_access_denied # See lib/authenticated_system.rb#access_denied()
def self.root_context
- ''
+ ActionController::Base.relative_url_root || ''
end
def java_facade
# url_for_static(:plugin => 'myplugin', :path => 'image.png')
def url_for_static(options={})
if options[:plugin]
- "/static/#{options[:plugin]}/#{options[:path]}"
+ "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}"
else
- "/#{options[:path]}"
+ "#{ApplicationController.root_context}/#{options[:path]}"
end
end
period_index=nil if period_index && period_index<=0
if resource.display_dashboard?
if options[:dashboard]
- root = "/dashboard/index?"
+ root = "#{ApplicationController.root_context}/dashboard/index?"
else
# stay on the same page (for example components)
- root = "/#{u params[:controller]}/#{u params[:action]}?"
+ root = "#{ApplicationController.root_context}/#{u params[:controller]}/#{u params[:action]}?"
end
path = ''
query = request.query_parameters
end
"<a class='#{options[:class]}' title='#{options[:title]}' href='#{root + path}'>#{name || resource.name}</a>"
else
- url = "/dashboard/index?id=#{u resource.key}"
+ url = "#{ApplicationController.root_context}/dashboard/index?id=#{u resource.key}"
url += "&period=#{u period_index}" if period_index
url += "&metric=#{u options[:metric]}" if options[:metric]
"<a class='#{options[:class]}' title='#{options[:title]}' " +
end
def chart(parameters, options={})
- image_tag("/chart?#{parameters}", options)
+ image_tag("#{ApplicationController.root_context}/chart?#{parameters}", options)
end
def link_to_favourite(resource, deprecated_options=nil)
# see limitation in /api/resources/search
options[:min_length]=2
- ws_url="/api/resources/search?f=s2&"
+ ws_url="#{ApplicationController::root_context}/api/resources/search?f=s2&"
if options[:qualifiers]
ws_url+="q=#{options[:qualifiers].join(',')}"
elsif options[:resource_type_property]
# see limitation in /api/resources/search
options[:min_length]=2
- ws_url="/api/resources/search?f=s2&"
+ ws_url="#{ApplicationController::root_context}/api/resources/search?f=s2&"
if options[:qualifiers]
ws_url+="q=#{options[:qualifiers].join(',')}"
elsif options[:resource_type_property]
# * <tt>:select2_options</tt> - hash of select2 options
#
def user_select_tag(name, options={})
- ws_url="/api/users/search"
+ ws_url="#{ApplicationController::root_context}/api/users/search"
options[:min_length]=2
options[:select2_ajax_options]={
'data' => 'function (term, page) { return { q: term, p: page } }',
message_params = options[:confirm_msg_params]
width = options[:confirm_width]||500
- url = "/confirm?url=#{u post_url}"
+ url = "#{ApplicationController.root_context}/confirm?url=#{u post_url}"
url += "&tk=#{u title_key}" if title_key
if message_key
url += "&mk=#{u message_key}&"
html += " colspan='#{options[:colspan]}'" if options[:colspan]
html += '>'
if options[:include_loading_icon] && options[:id]
- html += "<img src='/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>"
+ html += "<img src='#{ApplicationController.root_context}/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>"
end
html += '<div'
html += " id='#{options[:id]}_pages'" if options[:id]
html += " colspan='#{options[:colspan]}'" if options[:colspan]
html += '>'
if options[:include_loading_icon] && options[:id]
- html += "<img src='/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>"
+ html += "<img src='#{ApplicationController.root_context}/images/loading-small.gif' style='display: none' id='#{options[:id]}_loading'>"
end
html += '<div'
html += " id='#{options[:id]}_pages'" if options[:id]
end
def url_for_issues(params)
- url = '/issues/search#'
+ url = ApplicationController.root_context + '/issues/search#'
params.each_with_index do |(key, value), index|
if key == 'filter'
key = 'id'
if component.blank?
url_for_issues(params)
else
- url = '/component_issues/index?id=' + url_encode(component.key) + '#'
+ url = ApplicationController.root_context + '/component_issues/index?id=' + url_encode(component.key) + '#'
params.each_with_index do |(key, value), index|
if key != 'componentUuids'
url += key.to_s + '=' + value.to_s
-<form id="pass_form_tag" name="pass_form_tag" method="post" action="/account/change_password">
+<form id="pass_form_tag" name="pass_form_tag" method="post" action="<%= ApplicationController.root_context -%>/account/change_password">
<div class="modal-head">
<h2><%= message('my_profile.password.title') -%></h2>
</div>
<td class="thin"><%= link_to_favourite f -%></td>
<td>
<%
- url = '/dashboard?id=' + url_encode(f.key)
+ url = ApplicationController.root_context + '/dashboard?id=' + url_encode(f.key)
%>
<a href="<%= url -%>" class="link-with-icon">
<%= qualifier_icon f %>
]
};
</script>
- <script src="/js/bundles/account.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/account.js?v=<%= sonar_version -%>"></script>
<% end %>
</section>
<% end %>
- <form id="notif_form" method="post" action="/account/update_notifications">
+ <form id="notif_form" method="post" action="<%= ApplicationController.root_context -%>/account/update_notifications">
<% unless @global_dispatchers.empty? -%>
<section class="big-spacer-bottom">
<%= render "account/global_notifications" -%>
</div>
<% content_for :extra_script do %>
- <script src="/js/bundles/account.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/account.js?v=<%= sonar_version -%>"></script>
<% end %>
<script>
window.sonarqube.urlRoot = window.baseUrl + '/web_api';
</script>
- <script src="/js/bundles/api-documentation.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/api-documentation.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/code.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/code.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/coding-rules.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/coding-rules.js?v=<%= sonar_version -%>"></script>
<% end %>
<header class="page-header">
<h1 class="page-title"><%= h message('comparison.page') -%></h1>
</header>
- <form method="GET" id="compare-form" action="/comparison/index">
+ <form method="GET" id="compare-form" action="<%= ApplicationController.root_context -%>/comparison/index">
<input type="hidden" name="sids" id="sids" value="<%= @snapshots.map { |s| s.id.to_s }.join(',') -%>">
<input type="hidden" name="metrics" id="metrics" value="<%= @metrics.map { |m| m.key }.join(',') -%>">
$j('#version_loading').show();
$j.ajax({
type:'GET',
- url:'/comparison/versions?resource='
+ url:'<%= ApplicationController.root_context -%>/comparison/versions?resource='
+ id + '&sids='
+ $j('#sids').val(),
success:function (data) {
<% if index > 0 %>
<a class="icon-move-left" href="#" onclick="moveLeft(<%= index -%>)" id="left-<%= index -%>"></a>
<% else %>
- <img src="/images/transparent_16.gif"/>
+ <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/>
<% end %>
</td>
<td style="text-align: center; min-width: 100px">
<% if index < last_index %>
<a class="icon-move-right" href="#" onclick="moveRight(<%= index -%>)" id="right-<%= index -%>"></a>
<% else %>
- <img src="/images/transparent_16.gif"/>
+ <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/>
<% end %>
</td>
</tr>
%>
<th style="text-align: center; vertical-align: top; line-height: 1.5;">
<span class="no-transform">
- <a href="/dashboard/index/<%= s.resource.key -%>"><%= h s.resource.name(true) -%></a>
+ <a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= s.resource.key -%>"><%= h s.resource.name(true) -%></a>
<br/>
<span class="note"><b><%= event ? h(event.name) : message('comparison.version.latest') -%></b></span>
<br/>
};
})();
</script>
- <script src="/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script>
<% end %>
};
})();
</script>
- <script src="/js/bundles/component-issues.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/component-issues.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/component-measures.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/component-measures.js?v=<%= sonar_version -%>"></script>
<% end %>
</div>
<div class="modal-body">
<div class="info">
- <img src="/images/information.png" style="vertical-align: text-bottom"/>
+ <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/>
<%= h message(message_key, :params => message_params) -%>
</div>
</div>
<script>
window.sonarqube.projectId = '<%= @resource.uuid -%>';
</script>
- <script src="/js/bundles/custom-measures.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/custom-measures.js?v=<%= sonar_version -%>"></script>
<% end %>
-<form id="configure-widget-<%= widget.id -%>" method="post" action="/dashboard/save_widget?wid=<%= widget.id -%>">
+<form id="configure-widget-<%= widget.id -%>" method="post" action="<%= ApplicationController.root_context -%>/dashboard/save_widget?wid=<%= widget.id -%>">
<div id="error<%= widget.id -%>" class="error" style="display: none"></div>
<table class="table width100">
<tbody>
$('#error<%= widget.id -%>').show();
} else {
$.ajax({
- url: baseUrl + '/dashboard/save_widget?wid=<%= widget.id -%>&id=<%= params[:id] -%>',
+ url: window.baseUrl + '/dashboard/save_widget?wid=<%= widget.id -%>&id=<%= params[:id] -%>',
type: 'POST',
data: form.serialize(),
error: function (request) {
<% content_for :script do %>
- <script src="/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script>
- <script src="/js/bundles/widgets.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script>
<% end %>
<div class="page" id="dashboard">
<% content_for :script do %>
- <script src="/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script>
- <script src="/js/bundles/widgets.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script>
<% end %>
};
})();
</script>
- <script src="/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script>
<% end %>
-<form id="create-dashboard-form" method="post" action="/dashboards/create">
+<form id="create-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/create">
<% if @global %>
<input type="hidden" name="global" value="true" />
<% else %>
<script>
$j("#create-dashboard-form").modalForm({success: function (data) {
var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
- window.location = baseUrl + '/dashboards' + contextParams;
+ window.location = window.baseUrl + '/dashboards' + contextParams;
}});
</script>
-<form id="delete-dashboard-form" method="post" action="/dashboards/delete">
+<form id="delete-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/delete">
<input type="hidden" name="id" value="<%= @dashboard.id -%>">
<% if @dashboard.global %>
<input type="hidden" name="global" value="true" />
<script>
$j("#delete-dashboard-form").modalForm({success: function (data) {
var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
- window.location = baseUrl + '/dashboards' + contextParams;
+ window.location = window.baseUrl + '/dashboards' + contextParams;
}});
</script>
-<form id="edit-dashboard-form" method="post" action="/dashboards/update">
+<form id="edit-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/update">
<input type="hidden" name="id" value="<%= @dashboard.id -%>">
<% if @dashboard.global %>
<input type="hidden" name="global" value="true" />
<script>
$j("#edit-dashboard-form").modalForm({success: function (data) {
var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
- window.location = baseUrl + '/dashboards' + contextParams;
+ window.location = window.baseUrl + '/dashboards' + contextParams;
}});
</script>
severity: <% if @severity %>'<%= @severity -%>'<% else %>null<% end %>,
periodDate: <% if @period %>'<%= @snapshot.period_datetime(@period) -%>'<% else %>null<% end %>
},
- url = baseUrl + '/component_issues/index?id=<%= @resource.key -%>#resolved=false';
+ url = window.baseUrl + '/component_issues/index?id=<%= @resource.key -%>#resolved=false';
if (config.rule) {
url = url + '|rules=' + config.rule;
}
-<form method="post" action="/email_configuration/save" class="marginbottom10">
+<form method="post" action="<%= ApplicationController.root_context -%>/email_configuration/save" class="marginbottom10">
<table class="marginbottom10">
<tbody>
<tr class="property">
</table>
</form>
-<form method="post" action="/email_configuration/send_test_email">
+<form method="post" action="<%= ApplicationController.root_context -%>/email_configuration/send_test_email">
<table class="data marginbottom10">
<thead>
<tr>
type="button"
value="Generate secret key"
onclick="$j.ajax({
- url:'/encryption_configuration/generate_secret',
+ url:'<%=ApplicationController.root_context-%>/encryption_configuration/generate_secret',
type:'post',
success:function(response){$j('#secret_content').html(response);},
error:function(response){$j('#secret_error').html(response.responseText); $j('#secret_error').show();}
<form class="spacer-bottom"
onsubmit=
"$j.ajax({
- url:'/encryption_configuration/encrypt',
+ url:'<%=ApplicationController.root_context-%>/encryption_configuration/encrypt',
type:'post',
success:function(response)
{
});
return false;"
method="post"
- action="/encryption_configuration/encrypt" >
+ action="<%=ApplicationController.root_context-%>/encryption_configuration/encrypt" >
<!-- for our lovely Chrome -->
<input style="display:none">
<input type="password" name="fake" style="display:none">
<% content_for :extra_script do %>
- <script src="/js/bundles/groups.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/groups.js?v=<%= sonar_version -%>"></script>
<% end %>
all_issues_are_assigned_to_current_user &&= issue.assignee() == current_user.login
end
%>
-<form id="bulk-change-form" method="post" action="/issues/bulk_change">
+<form id="bulk-change-form" method="post" action="<%= ApplicationController.root_context -%>/issues/bulk_change">
<input type="hidden" name="issues" value="<%= @issues.map { |issue| issue.key() }.join(',') -%>">
<input type="hidden" name="actions[]" id="bulk-change-transition-action">
<fieldset>
-<form id="copy-filter-form" method="post" action="/issues/copy">
+<form id="copy-filter-form" method="post" action="<%= ApplicationController.root_context -%>/issues/copy">
<input type="hidden" name="id" value="<%= @filter.id -%>">
<fieldset>
<div class="modal-head">
-<form id="edit-filter-form" method="post" action="/issues/edit">
+<form id="edit-filter-form" method="post" action="<%= ApplicationController.root_context -%>/issues/edit">
<input type="hidden" name="id" value="<%= @filter.id -%>">
<fieldset>
<div class="modal-head">
-<form id="save-as-filter-form" method="post" action="/issues/save_as">
+<form id="save-as-filter-form" method="post" action="<%= ApplicationController.root_context -%>/issues/save_as">
<input type="hidden" name="data" value="<%= u(@filter_query_serialized) -%>">
<fieldset>
<div class="modal-head">
var star = $j(this);
$j.ajax({
type: 'POST',
- url: baseUrl + "/issues/toggle_fav",
+ url: window.baseUrl + "/issues/toggle_fav",
data: {id: filterId},
success: function (data) {
if (data == 'true') {
});
function onSaveAs(data) {
- window.location = baseUrl + '/issues/search#id=' + data;
+ window.location = window.baseUrl + '/issues/search#id=' + data;
}
function onCopy(data) {
- window.location = baseUrl + '/issues/search#id=' + data;
+ window.location = window.baseUrl + '/issues/search#id=' + data;
}
function onEdit(data) {
- window.location = baseUrl + '/issues/search#id=' + data;
+ window.location = window.baseUrl + '/issues/search#id=' + data;
}
</script>
<% end %>
<%= issue_filter_star(filter, @favourite_filter_ids.include?(filter.id)) -%>
</td>
<td>
- <a href="/issues/search#id=<%= h filter.id -%>"><%= h filter.name -%></a>
+ <a href="<%= ApplicationController.root_context -%>/issues/search#id=<%= h filter.id -%>"><%= h filter.name -%></a>
<% if filter.description %>
<div class="note"><%= h filter.description -%></div>
<% end %>
<% end %>
</td>
<td class="thin nowrap text-right">
- <a id="copy-<%= filter.name.parameterize -%>" href="/issues/copy_form/<%= filter.id -%>"
+ <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/copy_form/<%= filter.id -%>"
class="link-action open-modal"><%= message('copy') -%></a>
- <a id="edit_<%= filter.name.parameterize -%>" href="/issues/edit_form/<%= filter.id -%>"
+ <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/edit_form/<%= filter.id -%>"
class="link-action open-modal"><%= message('edit') -%></a>
- <%= link_to_action message('delete'), "/issues/delete/#{filter.id}",
+ <%= link_to_action message('delete'), "#{ApplicationController.root_context}/issues/delete/#{filter.id}",
:class => 'link-action link-red',
:id => "delete_#{filter.name.parameterize}",
:confirm_button => message('delete'),
<%= issue_filter_star(filter, @favourite_filter_ids.include?(filter.id)) -%>
</td>
<td>
- <a href="/issues/search#id=<%= h filter.id -%>|<%= h filter.data -%>"><%= h filter.name -%></a>
+ <a href="<%= ApplicationController.root_context -%>/issues/search#id=<%= h filter.id -%>|<%= h filter.data -%>"><%= h filter.name -%></a>
<% if filter.description %>
<div class="note"><%= h filter.description -%></div>
<% end %>
<%= filter.userLogin ? h(Api.users.findByLogin(filter.userLogin).name) : '[SonarQube]' -%>
</td>
<td class="thin nowrap text-right">
- <a id="copy-<%= filter.name.parameterize -%>" href="/issues/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
+ <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
<% if has_role?(:admin) %>
- <a id="edit_shared_<%= filter.name.parameterize -%>" href="/issues/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
+ <a id="edit_shared_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/issues/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
- <%= link_to_action message('delete'), "/issues/delete/#{filter.id}",
+ <%= link_to_action message('delete'), "#{ApplicationController.root_context}/issues/delete/#{filter.id}",
:class => 'link-action link-red',
:id => "delete_system_#{filter.name.parameterize}",
:confirm_button => message('delete'),
<% content_for :extra_script do %>
- <script src="/js/bundles/issues.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/issues.js?v=<%= sonar_version -%>"></script>
<% end %>
</script>
<% end %>
-<script src="/js/bundles/main.js?v=<%= sonar_version -%>"></script>
+<script src="<%= ApplicationController.root_context -%>/js/bundles/main.js?v=<%= sonar_version -%>"></script>
<%= yield :extra_script -%>
</body>
%>
<title><%= title -%></title>
- <link href="/css/sonar.css?v=<%= sonar_version -%>" rel="stylesheet" media="all">
+ <link href="<%= ApplicationController.root_context -%>/css/sonar.css?v=<%= sonar_version -%>" rel="stylesheet" media="all">
<%= yield :style -%>
<script>
updateCenterActive: <%= configuration('sonar.updatecenter.activate', true) %>
};
</script>
- <script src="/js/bundles/vendor.js?v=<%= sonar_version -%>"></script>
- <script src="/js/bundles/sonar.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/vendor.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/sonar.js?v=<%= sonar_version -%>"></script>
<script>
- window.baseUrl = '';
+ window.baseUrl = '<%= ApplicationController.root_context -%>';
</script>
<%= yield :script -%>
</head>
<a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
<a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
<a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> -
- <a href="/web_api">Web API</a>
+ <a href="<%= ApplicationController.root_context -%>/web_api">Web Service API</a>
</div>
<!--[if lte IE 8 ]><p class="spacer-top alert alert-danger">IE 8 is not supported. Some widgets may not be properly displayed. Please switch to a <a target="_blank" href="http://redirect.sonarsource.com/doc/requirements.html">supported version or another supported browser</a>.</p><!--<![endif]-->
</div>
<nav class="navbar navbar-global page-container" id="global-navigation">
<div class="navbar-header">
- <a class="navbar-brand" href="/">
- <img src="/images/logo.svg" height="30"
+ <a class="navbar-brand" href="<%= ApplicationController.root_context -%>/">
+ <img src="<%= ApplicationController.root_context -%>/images/logo.svg" height="30"
alt="<%= h message('layout.sonar.slogan') -%>"
title="<%= h message('layout.sonar.slogan') -%>">
</a>
<a href="http://www.sonarqube.org/documentation" target="sonar_doc">Documentation</a> -
<a href="http://www.sonarqube.org/support" target="support">Get Support</a> -
<a href="http://redirect.sonarsource.com/doc/plugin-library.html" target="plugins">Plugins</a> -
- <a href="/web_api">Web API</a>
+ <a href="<%= ApplicationController.root_context -%>/web_api">Web API</a>
</div>
<%= render 'branding/footer' -%>
</div>
})(window.jQuery);
</script>
-<script src="/js/bundles/main.js?v=<%= sonar_version -%>"></script>
+<script src="<%= ApplicationController.root_context -%>/js/bundles/main.js?v=<%= sonar_version -%>"></script>
<%= yield :extra_script -%>
</body></html>
<script>
window.sonarqube.setup = false;
</script>
- <script src="/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script>
<% end %>
<script>
window.sonarqube.el = '#markdown-full-help';
</script>
- <script src="/js/bundles/markdown.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/markdown.js?v=<%= sonar_version -%>"></script>
<% end %>
-<form id="copy-filter-form" method="post" action="/measures/copy">
+<form id="copy-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/copy">
<input type="hidden" name="id" value="<%= @filter.id -%>">
<fieldset>
<div class="modal-head">
</form>
<script>
$j("#copy-filter-form").modalForm({success: function (data) {
- window.location = baseUrl + '/measures/filter/' + data;
+ window.location = window.baseUrl + '/measures/filter/' + data;
}});
</script>
filterCriteria<%= widget_id -%>['sort']=sort;
filterCriteria<%= widget_id -%>['asc']=asc;
filterCriteria<%= widget_id -%>['page']=page;
- var url=baseUrl + '/measures/search/<%= filter.id -%>?widget_id=<%= widget_id -%>&' + $j.param(filterCriteria<%= widget_id -%>);
+ var url = window.baseUrl + '/measures/search/<%= filter.id -%>?widget_id=<%= widget_id -%>&' + $j.param(filterCriteria<%= widget_id -%>);
<% if widget_id %>
$j('#measure_filter_list<%= widget_id -%>').load(url);
}
cols.push(columnKey);
filterCriteria['edit']='true';
- window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
+ window.location = window.baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
$j("#add-metric").attr("disabled", "disabled");
$j("#exit-edit").on("click", function (e) {
delete filterCriteria['edit'];
- window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
+ window.location = window.baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
});
</script>
-<form id="edit-filter-form" method="post" action="/measures/edit">
+<form id="edit-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/edit">
<input type="hidden" name="id" value="<%= @filter.id -%>">
<fieldset>
<div class="modal-head">
</form>
<script>
$j("#edit-filter-form").modalForm({success: function (data) {
- window.location = baseUrl + '/measures/filter/' + data;
+ window.location = window.baseUrl + '/measures/filter/' + data;
}});
</script>
<li class="sidebar-title"><%= message('measure_filter.favourite_filters') -%></li>
<% current_user.favourited_measure_filters.each do |filter| %>
<li <%= "class='active'" if @filter && filter.id==@filter.id -%>>
- <a href="/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a>
+ <a href="<%= ApplicationController.root_context -%>/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a>
</li>
<% end %>
- <li><a href="/measures/manage" class="link-action"><%= message('manage') %></a></li>
+ <li><a href="<%= ApplicationController.root_context -%>/measures/manage" class="link-action"><%= message('manage') %></a></li>
<li class="spacer"></li>
<% end %>
</div>
-<form id="save-as-filter-form" method="post" action="/measures/save_as">
+<form id="save-as-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/save_as">
<input type="hidden" name="id" value="<%= @filter.id -%>">
<input type="hidden" name="data" value="<%= u(@filter.data) -%>">
<fieldset>
</form>
<script>
$j("#save-as-filter-form").modalForm({success:function (data) {
- window.location = baseUrl + '/measures/filter/' + data;
+ window.location = window.baseUrl + '/measures/filter/' + data;
}});
</script>
<div class="page-actions">
<div class="button-group">
- <button onclick="window.location='/measures/search?qualifiers[]=TRK';"><%= message 'measure_filter.new_search' -%></button>
+ <button onclick="window.location='<%= ApplicationController.root_context -%>/measures/search?qualifiers[]=TRK';"><%= message 'measure_filter.new_search' -%></button>
<% unless edit_mode %>
<% if logged_in? %>
var star = $j(this);
$j.ajax({
type: 'POST',
- url: baseUrl + "/measures/toggle_fav",
+ url: window.baseUrl + "/measures/toggle_fav",
data: {id: filterId},
success: function (data) {
if (data == 'true') {
<% end %>
</td>
<td class="text-thin nowrap text-right">
- <a id="copy-<%= filter.name.parameterize -%>" href="/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
+ <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
- <a id="edit_<%= filter.name.parameterize -%>" href="/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
+ <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
- <%= link_to_action message('delete'), "/measures/delete/#{filter.id}",
+ <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}",
:class => 'link-action link-red',
:id => "delete_#{filter.name.parameterize}",
:confirm_button => message('delete'),
<%= filter.user ? h(filter.user.name) : '[SonarQube]' -%>
</td>
<td class="thin nowrap text-right">
- <a id="copy-<%= filter.name.parameterize -%>" href="/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
+ <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a>
<% if has_role?(:admin) %>
- <a id="edit_system_<%= filter.name.parameterize -%>" href="/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
+ <a id="edit_system_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a>
- <%= link_to_action message('delete'), "/measures/delete/#{filter.id}",
+ <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}",
:class => 'link-action link-red',
:id => "delete_system_#{filter.name.parameterize}",
:confirm_button => message('delete'),
<script id="filter-bar-template" type="text/x-handlebars-template">
- <form method="get" action="/measures/search">
+ <form method="get" action="<%= ApplicationController.root_context -%>/measures/search">
<% if @filter.id %>
<input type="hidden" name="id" value="<%= h @filter.id -%>">
<% end %>
];
</script>
- <script src="/js/bundles/measures.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/measures.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/metrics.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/metrics.js?v=<%= sonar_version -%>"></script>
<% end %>
};
})();
</script>
- <script src="/js/bundles/overview.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/overview.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/permission-templates.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/permission-templates.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
<script>
- window.sonarqube.urlRoot = baseUrl + '/profiles';
+ window.sonarqube.urlRoot = window.baseUrl + '/profiles';
</script>
- <script src="/js/bundles/quality-profiles.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/quality-profiles.js?v=<%= sonar_version -%>"></script>
<% end %>
<% resource_qualifier = message('qualifier.' + @project.qualifier) %>
-<form id="delete-project-form" method="post" action="/project/delete">
+<form id="delete-project-form" method="post" action="<%= ApplicationController.root_context -%>/project/delete">
<fieldset>
<div class="modal-head">
<h2><%= message('project_deletion.page', :params => resource_qualifier) -%></h2>
$j("#delete-project-form").modalForm({
success: function () {
$j.ajax({
- url: "/project/delete/<%= h(@project.id) -%>",
+ url: "<%= ApplicationController.root_context-%>/project/delete/<%= h(@project.id) -%>",
success: function (request) {
window.location = '<%= url_for(:action => 'pending_deletion',:id => @project.id)-%>';
},
<script>
window.sonarqube.componentId = '<%= @project.uuid -%>';
</script>
- <script src="/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/background-tasks.js?v=<%= sonar_version -%>"></script>
<% end %>
<div class="yui-g widget" id="widget_delete_project">
<div class="alert alert-warning spacer-bottom"><%= message('project_deletion.operation_cannot_be_undone') -%></div>
<a id="delete_resource" class="open-modal button button-red"
- href="/project/delete_form/<%= h(@project.id) -%>"><%= delete_resource_message -%></a>
+ href="<%= ApplicationController.root_context -%>/project/delete_form/<%= h(@project.id) -%>"><%= delete_resource_message -%></a>
</div>
<% end %>
</div>
<tr class="<%= cycle 'even', 'odd' -%>">
<td class="thin" nowrap><%= h language.getName() -%></td>
<td>
- <form id="form-<%= language.getKey().parameterize -%>" method="POST" action="/project/set_profile">
+ <form id="form-<%= language.getKey().parameterize -%>" method="POST" action="<%= ApplicationController.root_context -%>/project/set_profile">
<input type="hidden" name="id" value="<%= @project_id -%>"/>
<input type="hidden" name="language" value="<%= language.getKey() -%>"/>
<p class="page-description"><%= message('project_quality_gate.page.description') -%></p>
</header>
- <form id="select-quality-gate" method="POST" action="/project/set_qualitygate">
+ <form id="select-quality-gate" method="POST" action="<%= ApplicationController.root_context -%>/project/set_qualitygate">
<input type="hidden" name="id" value="<%= @project_id -%>"/>
<input type="hidden" name="previous_qgate_id" value="<%= @selected_qgate -%>"/>
<%= h truncate(issue.message, :length => 100) -%></a>
<% if last_comment && last_comment.userLogin() %>
<div class="comment-excerpt">
- <img src="/images/reviews/comment.png"/>
+ <img src="<%= ApplicationController.root_context -%>/images/reviews/comment.png"/>
<% commentAuthor = users_by_login[last_comment.userLogin()] %>
<b><%= h( commentAuthor.nil? ? last_comment.userLogin() : commentAuthor.name() ) -%> :</b>
<%= Internal.text.markdownToHtml(last_comment.markdownText) -%>
<script>
window.sonarqube.componentId = '<%= @project.uuid -%>';
</script>
- <script src="/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/projects.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/projects.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
<script>
- window.sonarqube.urlRoot = baseUrl + '/quality_gates';
+ window.sonarqube.urlRoot = window.baseUrl + '/quality_gates';
</script>
- <script src="/js/bundles/quality-gates.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/quality-gates.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/global-permissions.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/global-permissions.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/project-permissions.js?v=<%= sonar_version -%>"></script>
<% end %>
-<form method="post" action="/server_id_configuration/generate">
+<form method="post" action="<%= ApplicationController.root_context -%>/server_id_configuration/generate">
<table class="marginbottom10">
<thead>
<tr>
<div class="marginbottom10" style="padding-left: 5px;">
<%= hidden_field_tag('page_version', (params[:page_version] || 0).to_i + 1) -%>
<%= submit_tag(message('settings.save_category', :params => [subcategory_name(@category, @subcategory)]), :id => 'submit_settings') -%>
- <img src="/images/loading.gif" id="loading_settings" style="display:none;">
+ <img src="<%= ApplicationController.root_context -%>/images/loading.gif" id="loading_settings" style="display:none;">
</div>
<% end %>
<script>
window.sonarqube.setup = true;
</script>
- <script src="/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/maintenance.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
-<script src="/js/bundles/system.js?v=<%= sonar_version -%>"></script>
+<script src="<%= ApplicationController.root_context -%>/js/bundles/system.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
<script>
- window.sonarqube.urlRoot = baseUrl + '/updatecenter';
+ window.sonarqube.urlRoot = window.baseUrl + '/updatecenter';
</script>
- <script src="/js/bundles/update-center.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/update-center.js?v=<%= sonar_version -%>"></script>
<% end %>
-<form id="user_edit_form" method="post" action="/users/update">
+<form id="user_edit_form" method="post" action="<%= ApplicationController.root_context -%>/users/update">
<fieldset>
<div class="modal-head">
<h2>Edit user: <%= h @user.login() -%></h2>
}
return label;
},
- searchUrl: baseUrl + '/user_groups/search?user=<%= @user.login -%>',
- selectUrl: baseUrl + '/groups/add_member',
- deselectUrl: baseUrl + '/groups/remove_member',
+ searchUrl: window.baseUrl + '/user_groups/search?user=<%= @user.login -%>',
+ selectUrl: window.baseUrl + '/groups/add_member',
+ deselectUrl: window.baseUrl + '/groups/remove_member',
extra: {
user: '<%= @user.login -%>'
},
<% content_for :extra_script do %>
- <script src="/js/bundles/users.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/users.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
- <script src="/js/bundles/code.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/code.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :extra_script do %>
<script>
- window.sonarqube.urlRoot = '/web_api';
+ window.sonarqube.urlRoot = window.baseUrl + '/web_api';
</script>
- <script src="/js/bundles/web-api.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/web-api.js?v=<%= sonar_version -%>"></script>
<% end %>
<% content_for :script do %>
- <script src="/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script>
- <script src="/js/bundles/widgets.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script>
<% end %>
<div id="block_1" class="block" style="width: <%= @widget_width -%>">
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 () {
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 () {
expect(getComponentDrilldownUrl(COMPLEX_COMPONENT_KEY, METRIC)).to.equal(
'/component_measures/metric/' + METRIC + '?id=' + COMPLEX_COMPONENT_KEY_ENCODED);
});
+
+ it('should take baseUrl into account', function () {
+ window.baseUrl = '/context';
+ expect(getComponentDrilldownUrl(SIMPLE_COMPONENT_KEY, METRIC)).to.equal(
+ '/context/component_measures/metric/' + METRIC + '?id=' + SIMPLE_COMPONENT_KEY);
+ });
});
});
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('.');