aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-05-05 15:23:00 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-05-09 11:14:36 +0200
commit7be7dcb2cbd44fa3594035dfb5423cf13fd7a17d (patch)
tree26b6bf4326ad44c0198ccfa42b382279bf31ce78 /server
parentc77289e05dbaec17653ddb7f739af06327782c8a (diff)
downloadsonarqube-7be7dcb2cbd44fa3594035dfb5423cf13fd7a17d.tar.gz
sonarqube-7be7dcb2cbd44fa3594035dfb5423cf13fd7a17d.zip
SONAR-8886 Collapse directory path in component header
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js6
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap2
2 files changed, 6 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
index 6a8b16d5e36..a425f010268 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
@@ -24,6 +24,7 @@ import QualifierIcon from '../../../../components/shared/QualifierIcon';
import { getOrganizationByKey, areThereCustomOrganizations } from '../../../../store/rootReducer';
import OrganizationLink from '../../../../components/ui/OrganizationLink';
import PrivateBadge from '../../../../components/common/PrivateBadge';
+import { collapsePath, limitComponentName } from '../../../../helpers/path';
class ComponentNavBreadcrumbs extends React.PureComponent {
static propTypes = {
@@ -53,11 +54,12 @@ class ComponentNavBreadcrumbs extends React.PureComponent {
<QualifierIcon qualifier={lastItem.qualifier} />
</span>}
<Link
+ title={item.name}
to={{ pathname: '/dashboard', query: { id: item.key } }}
className="link-base-color">
{index === breadcrumbs.length - 1
- ? <strong>{item.name}</strong>
- : <span>{item.name}</span>}
+ ? <strong>{collapsePath(item.name, 15)}</strong>
+ : <span>{limitComponentName(item.name)}</span>}
</Link>
{index < breadcrumbs.length - 1 && <span className="slash-separator" />}
</span>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap
index 5d6110501ae..02834a1f242 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBreadcrumbs-test.js.snap
@@ -16,6 +16,7 @@ exports[`should not render breadcrumbs with one element 1`] = `
className="link-base-color"
onlyActiveOnIndex={false}
style={Object {}}
+ title="My Project"
to={
Object {
"pathname": "/dashboard",
@@ -65,6 +66,7 @@ exports[`should render organization 1`] = `
className="link-base-color"
onlyActiveOnIndex={false}
style={Object {}}
+ title="My Project"
to={
Object {
"pathname": "/dashboard",