From 5b5d8fe7061fbb5723327913f506d336476560c3 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 16 Oct 2017 13:55:19 +0200 Subject: avoid displaying too long branch names --- .../app/components/nav/component/ComponentNav.css | 1 + .../nav/component/ComponentNavBranchesMenuItem.tsx | 45 +-- .../ComponentNavBranchesMenuItem-test.tsx.snap | 314 +++++++++++---------- 3 files changed, 191 insertions(+), 169 deletions(-) (limited to 'server/sonar-web/src') diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.css b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.css index 347ea1a3df7..72b8cbb1c27 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.css +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.css @@ -30,6 +30,7 @@ .navbar-context-meta-branch-menu-item-name { flex: 1; + max-width: 300px; } .navbar-context-meta-branch-menu-item-actions { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx index 46f9a02957e..4d07db53532 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranchesMenuItem.tsx @@ -26,6 +26,7 @@ import BranchIcon from '../../../../components/icons-components/BranchIcon'; import { isShortLivingBranch } from '../../../../helpers/branches'; import { translate } from '../../../../helpers/l10n'; import { getProjectBranchUrl } from '../../../../helpers/urls'; +import Tooltip from '../../../../components/controls/Tooltip'; export interface Props { branch: Branch; @@ -41,27 +42,29 @@ export default function ComponentNavBranchesMenuItem({ branch, ...props }: Props return (
  • - -
    - - {branch.name} - {branch.isMain && ( -
    {translate('branches.main_branch')}
    - )} -
    -
    - -
    - + + +
    + + {branch.name} + {branch.isMain && ( +
    {translate('branches.main_branch')}
    + )} +
    +
    + +
    + +
  • ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap index ee665153336..1f6d81e9883 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenuItem-test.tsx.snap @@ -4,52 +4,58 @@ exports[`renders main branch 1`] = `
  • - -
    - - master + } + >
    - branches.main_branch + + master +
    + branches.main_branch +
    -
    -
    - + -
    - + concise={true} + /> + + +
  • `; @@ -57,63 +63,69 @@ exports[`renders short-living branch 1`] = `
  • - -
    - - foo -
    -
    - + -
    - + className="little-spacer-right big-spacer-left" + /> + foo + +
    + +
    + +
  • `; @@ -121,64 +133,70 @@ exports[`renders short-living orhpan branch 1`] = `
  • - -
    - - foo -
    -
    - + -
    - + className="little-spacer-right" + /> + foo + +
    + +
    + +
  • `; -- cgit v1.2.3