diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-09-01 15:44:40 +0200 |
---|---|---|
committer | Janos Gyerik <janos.gyerik@sonarsource.com> | 2017-09-12 11:34:57 +0200 |
commit | 422e26e20affebc29921f6bd5adf5a72fb95daf1 (patch) | |
tree | 72948260fbbc5c41eaf803add2ba032d734055dc | |
parent | 44fa970b790a3b8734e65a08e50be54499afe4af (diff) | |
download | sonarqube-422e26e20affebc29921f6bd5adf5a72fb95daf1.tar.gz sonarqube-422e26e20affebc29921f6bd5adf5a72fb95daf1.zip |
SONAR-9702 better display of orphan branches
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. |