aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-09-01 15:44:40 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 11:34:57 +0200
commit422e26e20affebc29921f6bd5adf5a72fb95daf1 (patch)
tree72948260fbbc5c41eaf803add2ba032d734055dc
parent44fa970b790a3b8734e65a08e50be54499afe4af (diff)
downloadsonarqube-422e26e20affebc29921f6bd5adf5a72fb95daf1.tar.gz
sonarqube-422e26e20affebc29921f6bd5adf5a72fb95daf1.zip
SONAR-9702 better display of orphan branches
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap26
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties3
4 files changed, 52 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
index cf293b64b4a..cad8419bc56 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
@@ -29,6 +29,7 @@ import { isShortLivingBranch } from '../../../../helpers/branches';
import { translate } from '../../../../helpers/l10n';
import HelpIcon from '../../../../components/icons-components/HelpIcon';
import BubblePopupHelper from '../../../../components/common/BubblePopupHelper';
+import Tooltip from '../../../../components/controls/Tooltip';
interface Props {
branches: Branch[];
@@ -127,11 +128,19 @@ export default class ComponentNavBranch extends React.PureComponent<Props, State
renderMergeBranch = () => {
const { currentBranch } = this.props;
- return isShortLivingBranch(currentBranch) && !currentBranch.isOrphan
+ if (!isShortLivingBranch(currentBranch)) {
+ return null;
+ }
+ return currentBranch.isOrphan
? <span className="note big-spacer-left text-lowercase">
- {translate('from')} <strong>{currentBranch.mergeBranch}</strong>
+ {translate('branches.orphan_branch')}
+ <Tooltip overlay={translate('branches.orphan_branches.tooltip')}>
+ <i className="icon-help spacer-left" />
+ </Tooltip>
</span>
- : null;
+ : <span className="note big-spacer-left text-lowercase">
+ {translate('from')} <strong>{currentBranch.mergeBranch}</strong>
+ </span>;
};
renderSingleBranchPopup = () =>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
index e58e796e9a0..3085c1212f9 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenu.tsx
@@ -29,6 +29,7 @@ import {
import { translate } from '../../../../helpers/l10n';
import { getProjectBranchUrl } from '../../../../helpers/urls';
import { Link } from 'react-router';
+import Tooltip from '../../../../components/controls/Tooltip';
interface Props {
branches: Branch[];
@@ -168,6 +169,16 @@ export default class ComponentNavBranchesMenu extends React.PureComponent<Props,
if (isLongLivingBranch(branch) || (isOrphan && !isPreviousOrphan)) {
menu.push(<li key={`divider-${branch.name}`} className="divider" />);
}
+ if (isOrphan && !isPreviousOrphan) {
+ menu.push(
+ <li className="dropdown-header" key="orphans">
+ {translate('branches.orphan_branches')}
+ <Tooltip overlay={translate('branches.orphan_branches.tooltip')}>
+ <i className="icon-help spacer-left" />
+ </Tooltip>
+ </li>
+ );
+ }
menu.push(
<ComponentNavBranchesMenuItem
branch={branch}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap
index 2974d68eb61..463fb48d493 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap
@@ -45,6 +45,19 @@ exports[`renders list 1`] = `
<li
className="divider"
/>
+ <li
+ className="dropdown-header"
+ >
+ branches.orphan_branches
+ <Tooltip
+ overlay="branches.orphan_branches.tooltip"
+ placement="bottom"
+ >
+ <i
+ className="icon-help spacer-left"
+ />
+ </Tooltip>
+ </li>
<ComponentNavBranchesMenuItem
branch={
Object {
@@ -113,6 +126,19 @@ exports[`renders list 1`] = `
<li
className="divider"
/>
+ <li
+ className="dropdown-header"
+ >
+ branches.orphan_branches
+ <Tooltip
+ overlay="branches.orphan_branches.tooltip"
+ placement="bottom"
+ >
+ <i
+ className="icon-help spacer-left"
+ />
+ </Tooltip>
+ </li>
<ComponentNavBranchesMenuItem
branch={
Object {
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 8917fc328fa..1f910f09b52 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -3171,3 +3171,6 @@ branches.delete=Delete Branch
branches.delete.are_you_sure=Are you sure you want to delete branch "{0}"?
branches.rename=Rename Branch
branches.manage=Manage branches
+branches.orphan_branch=Orphan Branch
+branches.orphan_branches=Orphan Branches
+branches.orphan_branches.tooltip=When a target branch of a short-living branch was deleted, this short-living branch becomes orphan.