diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-12-13 13:44:12 +0100 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2018-01-02 10:38:10 +0100 |
commit | 027514e6f94607fcd7df8e69e668fe32aeb2873e (patch) | |
tree | b73db22c100713df85f1a790c4a772300b41a7f5 /server/sonar-web/src/main/js/helpers | |
parent | 492cd3de03d14aaf91b54e96531d77079c0db7f1 (diff) | |
download | sonarqube-027514e6f94607fcd7df8e69e668fe32aeb2873e.tar.gz sonarqube-027514e6f94607fcd7df8e69e668fe32aeb2873e.zip |
SONAR-10182 Users should be able to choose their homepage
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, 21 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index ffe6fa17794..10ab02703cb 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -21,7 +21,7 @@ import { stringify } from 'querystring'; import { omitBy, isNil } from 'lodash'; import { isShortLivingBranch } from './branches'; import { getProfilePath } from '../apps/quality-profiles/utils'; -import { Branch } from '../app/types'; +import { Branch, HomePage } from '../app/types'; interface Query { [x: string]: string | undefined; @@ -167,3 +167,23 @@ export function getMarkdownHelpUrl(): string { export function getCodeUrl(project: string, branch?: string, selected?: string) { return { pathname: '/code', query: { id: project, branch, selected } }; } + +export function getOrganizationUrl(organization: string) { + return `/organizations/${organization}`; +} + +export function getHomePageUrl(homepage: HomePage) { + switch (homepage.type) { + case 'project': + return getProjectUrl(homepage.key!); + case 'organization': + return getOrganizationUrl(homepage.key!); + case 'my-projects': + return '/projects'; + case 'my-issues': + return { pathname: '/issues', query: { resolved: 'false' } }; + } + + // should never happen, but just in case... + return '/projects'; +} |