diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2017-05-31 10:15:52 +0200 |
---|---|---|
committer | Eric Hartmann <hartmann.eric@gmail.com> | 2017-06-14 15:43:12 +0200 |
commit | ae85f66a8dbef6f7533cb6cb1eb9ab623ad8d447 (patch) | |
tree | 6b3662f55e2c0083519e317800cf8c1067299dcc /server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js | |
parent | c23644d8c6f3e93f1ef6cda4ec973e2e9ded72c2 (diff) | |
download | sonarqube-ae85f66a8dbef6f7533cb6cb1eb9ab623ad8d447.tar.gz sonarqube-ae85f66a8dbef6f7533cb6cb1eb9ab623ad8d447.zip |
SONAR-9302 Display inheritance hints for built-in quality profiles
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js index 6c0113f1e7b..591466fa0f6 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.js @@ -37,6 +37,7 @@ type Props = { type ProfileInheritanceDetails = { activeRuleCount: number, + isBuiltIn: boolean, key: string, language: string, name: string, @@ -104,16 +105,20 @@ export default class ProfileInheritance extends React.PureComponent { render() { const { profile, profiles } = this.props; + const { ancestors } = this.state; const highlightCurrent = !this.state.loading && - this.state.ancestors != null && + ancestors != null && this.state.children != null && - (this.state.ancestors.length > 0 || this.state.children.length > 0); + (ancestors.length > 0 || this.state.children.length > 0); + const currentClassName = classNames('js-inheritance-current', { selected: highlightCurrent }); + const extendsBuiltIn = ancestors != null && ancestors.some(profile => profile.isBuiltIn); + return ( <div className="quality-profile-inheritance"> <header className="big-spacer-bottom clearfix"> @@ -130,8 +135,8 @@ export default class ProfileInheritance extends React.PureComponent { {!this.state.loading && <table className="data zebra"> <tbody> - {this.state.ancestors != null && - this.state.ancestors.map((ancestor, index) => ( + {ancestors != null && + ancestors.map((ancestor, index) => ( <ProfileInheritanceBox className="js-inheritance-ancestor" depth={index} @@ -144,8 +149,9 @@ export default class ProfileInheritance extends React.PureComponent { <ProfileInheritanceBox className={currentClassName} - depth={this.state.ancestors ? this.state.ancestors.length : 0} + depth={ancestors ? ancestors.length : 0} displayLink={false} + extendsBuiltIn={extendsBuiltIn} language={profile.language} organization={this.props.organization} profile={this.state.profile} @@ -155,7 +161,7 @@ export default class ProfileInheritance extends React.PureComponent { this.state.children.map(child => ( <ProfileInheritanceBox className="js-inheritance-child" - depth={this.state.ancestors ? this.state.ancestors.length + 1 : 0} + depth={ancestors ? ancestors.length + 1 : 0} key={child.key} language={profile.language} organization={this.props.organization} |