aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/branch-like.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/branch-like.ts')
-rw-r--r--server/sonar-web/src/main/js/helpers/branch-like.ts30
1 files changed, 2 insertions, 28 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,