aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r--server/sonar-web/src/main/js/helpers/branch-like.ts30
-rw-r--r--server/sonar-web/src/main/js/helpers/urls.ts3
2 files changed, 4 insertions, 29 deletions
diff --git a/server/sonar-web/src/main/js/helpers/branch-like.ts b/server/sonar-web/src/main/js/helpers/branch-like.ts
index afa621317ca..2e4474e19ca 100644
--- a/server/sonar-web/src/main/js/helpers/branch-like.ts
+++ b/server/sonar-web/src/main/js/helpers/branch-like.ts
@@ -18,22 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { orderBy } from 'lodash';
-import {
- Branch,
- BranchLike,
- BranchLikeTree,
- BranchParameters,
- MainBranch,
- PullRequest,
-} from '../types/branch-like';
-
-export function isBranch(branchLike?: BranchLike): branchLike is Branch {
- return branchLike !== undefined && (branchLike as Branch).isMain !== undefined;
-}
-
-export function isMainBranch(branchLike?: BranchLike): branchLike is MainBranch {
- return isBranch(branchLike) && branchLike.isMain;
-}
+import { isBranch, isMainBranch } from '../sonar-aligned/helpers/branch-like';
+import { Branch, BranchLike, BranchLikeTree, PullRequest } from '../types/branch-like';
export function sortBranches(branches: Branch[]) {
return orderBy(branches, [(b) => b.isMain, (b) => b.name], ['desc', 'asc']);
@@ -113,18 +99,6 @@ export function getBrancheLikesAsTree(branchLikes: BranchLike[]): BranchLikeTree
}
}
-export function getBranchLikeQuery(
- branchLike?: BranchLike,
- includeMainBranch = false,
-): BranchParameters {
- if (isBranch(branchLike) && (includeMainBranch || !isMainBranch(branchLike))) {
- return { branch: branchLike.name };
- } else if (isPullRequest(branchLike)) {
- return { pullRequest: branchLike.key };
- }
- return {};
-}
-
// Create branch object from branch name or pull request key
export function fillBranchLike(
branch?: string,
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts
index 2899b7999dd..d48bf47f45e 100644
--- a/server/sonar-web/src/main/js/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/helpers/urls.ts
@@ -21,6 +21,7 @@ import { isArray, mapValues, omitBy, pick } from 'lodash';
import { Path, To } from 'react-router-dom';
import { getProfilePath } from '../apps/quality-profiles/utils';
import { DEFAULT_ISSUES_QUERY } from '../components/shared/utils';
+import { getBranchLikeQuery, isBranch, isMainBranch } from '../sonar-aligned/helpers/branch-like';
import { BranchLike, BranchParameters } from '../types/branch-like';
import { ComponentQualifier, isApplication, isPortfolioLike } from '../types/component';
import { MeasurePageView } from '../types/measures';
@@ -28,7 +29,7 @@ import { GraphType } from '../types/project-activity';
import { SecurityStandard } from '../types/security';
import { Dict, RawQuery } from '../types/types';
import { HomePage } from '../types/users';
-import { getBranchLikeQuery, isBranch, isMainBranch, isPullRequest } from './branch-like';
+import { isPullRequest } from './branch-like';
import { serializeOptionalBoolean } from './query';
import { getBaseUrl } from './system';