aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-04 15:43:17 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-05 10:40:08 +0200
commit86cc25a54c33de34b3588c1e230709c4bf54436e (patch)
tree55086a416ccbd5e444d3995a8bd445d5959e5bef
parent07b59f8361992acb5da2dd0ae4fbb08979bc691b (diff)
downloadsonarqube-86cc25a54c33de34b3588c1e230709c4bf54436e.tar.gz
sonarqube-86cc25a54c33de34b3588c1e230709c4bf54436e.zip
Fix bad urls that didn't work with a context
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js4
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/main-view.js2
-rw-r--r--server/sonar-web/src/main/js/helpers/urls.ts13
3 files changed, 8 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js
index aa7fa92452a..883c106f646 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js
@@ -28,7 +28,7 @@ import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import TreeMap from '../../../components/charts/TreeMap';
import { translate, translateWithParameters, getLocalizedMetricName } from '../../../helpers/l10n';
import { formatMeasure, isDiffMetric } from '../../../helpers/measures';
-import { getComponentUrl } from '../../../helpers/urls';
+import { getProjectUrl } from '../../../helpers/urls';
/*:: import type { Metric } from '../../../store/metrics/actions'; */
/*:: import type { ComponentEnhanced } from '../types'; */
/*:: import type { TreeMapItem } from '../../../components/charts/TreeMap'; */
@@ -94,7 +94,7 @@ export default class TreeMapView extends React.PureComponent {
sizeValue
),
label: component.name,
- link: getComponentUrl(component.refKey || component.key, branch)
+ link: getProjectUrl(component.refKey || component.key, branch)
};
})
.filter(Boolean);
diff --git a/server/sonar-web/src/main/js/apps/maintenance/main-view.js b/server/sonar-web/src/main/js/apps/maintenance/main-view.js
index 26ed8f944ba..d3bf4f8c64c 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/main-view.js
+++ b/server/sonar-web/src/main/js/apps/maintenance/main-view.js
@@ -82,7 +82,7 @@ export default Marionette.ItemView.extend({
loadPreviousPage() {
setInterval(() => {
- window.location = window.baseUrl + (this.options.returnTo || '/');
+ window.location = this.options.returnTo || window.baseUrl;
}, 2500);
},
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts
index b125e48533d..91c5bc35d35 100644
--- a/server/sonar-web/src/main/js/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/helpers/urls.ts
@@ -37,20 +37,21 @@ export function getBaseUrl(): string {
/**
* Generate URL for a component's home page
+ * Deprecated : use getProjectUrl
*/
export function getComponentUrl(componentKey: string, branch?: string): string {
const branchQuery = branch ? `&branch=${encodeURIComponent(branch)}` : '';
return getBaseUrl() + '/dashboard?id=' + encodeURIComponent(componentKey) + branchQuery;
}
-export function getComponentBackgroundTaskUrl(componentKey: string): string {
- return getBaseUrl() + '/project/background_tasks?id=' + encodeURIComponent(componentKey);
-}
-
export function getProjectUrl(key: string, branch?: string): Location {
return { pathname: '/dashboard', query: { id: key, branch } };
}
+export function getComponentBackgroundTaskUrl(componentKey: string): Location {
+ return { pathname: '/project/background_tasks', query: { id: componentKey } };
+}
+
export function getProjectBranchUrl(key: string, branch: Branch): Location {
if (isShortLivingBranch(branch)) {
return {
@@ -168,10 +169,6 @@ export function getDeprecatedActiveRulesUrl(query = {}, organization?: string |
return getRulesUrl({ ...query, ...baseQuery }, organization);
}
-export function getProjectsUrl(): string {
- return getBaseUrl() + '/projects';
-}
-
export function getMarkdownHelpUrl(): string {
return getBaseUrl() + '/markdown/help';
}