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.ts11
1 files changed, 11 insertions, 0 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 b332e9acd2e..ce6cc4ec13f 100644
--- a/server/sonar-web/src/main/js/helpers/branch-like.ts
+++ b/server/sonar-web/src/main/js/helpers/branch-like.ts
@@ -23,9 +23,11 @@ import {
BranchLike,
BranchLikeTree,
BranchParameters,
+ BranchStatusData,
MainBranch,
PullRequest
} from '../types/branch-like';
+import { Dict } from '../types/types';
export function isBranch(branchLike?: BranchLike): branchLike is Branch {
return branchLike !== undefined && (branchLike as Branch).isMain !== undefined;
@@ -136,3 +138,12 @@ export function fillBranchLike(
}
return undefined;
}
+
+export function getBranchStatusByBranchLike(
+ branchStatusByComponent: Dict<Dict<BranchStatusData>>,
+ component: string,
+ branchLike: BranchLike
+): BranchStatusData {
+ const branchLikeKey = getBranchLikeKey(branchLike);
+ return branchStatusByComponent[component] && branchStatusByComponent[component][branchLikeKey];
+}