diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-09-11 17:01:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-26 23:49:37 +0200 |
commit | 74c8a8ac5e83144fab7291b9ad57c14742fe8bbf (patch) | |
tree | 191311ab4f4df1faf2c1eac16e2f018b1c77be5a /server/sonar-web/src/main/js/helpers | |
parent | d7df6d3c31db2ca875d8dec2c0b873cc04b7738e (diff) | |
download | sonarqube-74c8a8ac5e83144fab7291b9ad57c14742fe8bbf.tar.gz sonarqube-74c8a8ac5e83144fab7291b9ad57c14742fe8bbf.zip |
SONAR-9802 Add nodes to system info in cluster mode
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/urls.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index 8deba26fcad..773448fad23 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -31,21 +31,23 @@ interface Location { query?: Query; } +export function getBaseUrl(): string { + return (window as any).baseUrl; +} + /** * Generate URL for a component's home page */ export function getComponentUrl(componentKey: string, branch?: string): string { const branchQuery = branch ? `&branch=${encodeURIComponent(branch)}` : ''; - return ( - (window as any).baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey) + branchQuery - ); + return getBaseUrl() + '/dashboard?id=' + encodeURIComponent(componentKey) + branchQuery; } export function getProjectUrl(key: string, branch?: string): Location { return { pathname: '/dashboard', query: { id: key, branch } }; } -export function getProjectBranchUrl(key: string, branch: Branch) { +export function getProjectBranchUrl(key: string, branch: Branch): Location { if (isShortLivingBranch(branch)) { return { pathname: '/project/issues', @@ -74,13 +76,17 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Loca export function getComponentIssuesUrlAsString(componentKey: string, query?: Query): string { const path = getComponentIssuesUrl(componentKey, query); - return `${(window as any).baseUrl}${path.pathname}?${stringify(path.query)}`; + return `${getBaseUrl()}${path.pathname}?${stringify(path.query)}`; } /** * Generate URL for a component's drilldown page */ -export function getComponentDrilldownUrl(componentKey: string, metric: string, branch?: string) { +export function getComponentDrilldownUrl( + componentKey: string, + metric: string, + branch?: string +): Location { return { pathname: '/component_measures', query: { id: componentKey, metric, branch } }; } @@ -159,9 +165,9 @@ export function getDeprecatedActiveRulesUrl(query = {}, organization?: string | } export function getProjectsUrl(): string { - return (window as any).baseUrl + '/projects'; + return getBaseUrl() + '/projects'; } export function getMarkdownHelpUrl(): string { - return (window as any).baseUrl + '/markdown/help'; + return getBaseUrl() + '/markdown/help'; } |