aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/branch-like.ts
diff options
context:
space:
mode:
authorViktor Vorona <viktor.vorona@sonarsource.com>2024-04-23 14:47:22 +0200
committerMatteo Mara <matteo.mara@sonarsource.com>2024-04-30 10:59:03 +0200
commita5599ff112362c822a669d965c6a9fc85d633e37 (patch)
tree0adf85450226f7c7882f6066fedd8bed2203d720 /server/sonar-web/src/main/js/helpers/branch-like.ts
parent5c472713af0075201739c2e50663eefa01464fd6 (diff)
downloadsonarqube-a5599ff112362c822a669d965c6a9fc85d633e37.tar.gz
sonarqube-a5599ff112362c822a669d965c6a9fc85d633e37.zip
SONAR-22049 Align branch-like helper
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,