aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2018-03-12 12:06:11 +0100
committerTeryk Bellahsene <teryk@users.noreply.github.com>2018-03-13 14:05:36 +0100
commit913c82c8772fd4747626a1fbe665ccda2e5ca9f1 (patch)
treed48784851df80905ce125cc60ac8aec8570751a9 /server/sonar-web/src/main/js/components/common/BranchStatus.tsx
parent751e4000e40a4af66b80767d632b1bef64dc5647 (diff)
downloadsonarqube-913c82c8772fd4747626a1fbe665ccda2e5ca9f1.tar.gz
sonarqube-913c82c8772fd4747626a1fbe665ccda2e5ca9f1.zip
SONAR-10374 Support pull request in the web app
Diffstat (limited to 'server/sonar-web/src/main/js/components/common/BranchStatus.tsx')
-rw-r--r--server/sonar-web/src/main/js/components/common/BranchStatus.tsx28
1 files changed, 15 insertions, 13 deletions
diff --git a/server/sonar-web/src/main/js/components/common/BranchStatus.tsx b/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
index 45b271f6179..d2e3f992973 100644
--- a/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
+++ b/server/sonar-web/src/main/js/components/common/BranchStatus.tsx
@@ -19,27 +19,27 @@
*/
import * as React from 'react';
import StatusIndicator from './StatusIndicator';
-import { Branch } from '../../app/types';
import Level from '../ui/Level';
import BugIcon from '../icons-components/BugIcon';
import CodeSmellIcon from '../icons-components/CodeSmellIcon';
import VulnerabilityIcon from '../icons-components/VulnerabilityIcon';
-import { isShortLivingBranch } from '../../helpers/branches';
+import { BranchLike } from '../../app/types';
+import { isShortLivingBranch, isPullRequest, isLongLivingBranch } from '../../helpers/branches';
import './BranchStatus.css';
interface Props {
- branch: Branch;
+ branchLike: BranchLike;
concise?: boolean;
}
-export default function BranchStatus({ branch, concise = false }: Props) {
- if (isShortLivingBranch(branch)) {
- if (!branch.status) {
+export default function BranchStatus({ branchLike, concise = false }: Props) {
+ if (isShortLivingBranch(branchLike) || isPullRequest(branchLike)) {
+ if (!branchLike.status) {
return null;
}
const totalIssues =
- branch.status.bugs + branch.status.vulnerabilities + branch.status.codeSmells;
+ branchLike.status.bugs + branchLike.status.vulnerabilities + branchLike.status.codeSmells;
const indicatorColor = totalIssues > 0 ? 'red' : 'green';
@@ -56,24 +56,26 @@ export default function BranchStatus({ branch, concise = false }: Props) {
<StatusIndicator color={indicatorColor} size="small" />
</li>
<li className="spacer-left">
- {branch.status.bugs}
+ {branchLike.status.bugs}
<BugIcon />
</li>
<li className="spacer-left">
- {branch.status.vulnerabilities}
+ {branchLike.status.vulnerabilities}
<VulnerabilityIcon />
</li>
<li className="spacer-left">
- {branch.status.codeSmells}
+ {branchLike.status.codeSmells}
<CodeSmellIcon />
</li>
</ul>
);
- } else {
- if (!branch.status) {
+ } else if (isLongLivingBranch(branchLike)) {
+ if (!branchLike.status) {
return null;
}
- return <Level level={branch.status.qualityGateStatus} small={true} />;
+ return <Level level={branchLike.status.qualityGateStatus} small={true} />;
+ } else {
+ return null;
}
}