diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-09-01 16:18:43 +0200 |
---|---|---|
committer | Janos Gyerik <janos.gyerik@sonarsource.com> | 2017-09-12 11:34:57 +0200 |
commit | b231b4fc2515d121e64b37fa52fbd5bbb0a9b440 (patch) | |
tree | 292aa7c8379165fc412056f436e7242d2eef475e /server/sonar-web | |
parent | 422e26e20affebc29921f6bd5adf5a72fb95daf1 (diff) | |
download | sonarqube-b231b4fc2515d121e64b37fa52fbd5bbb0a9b440.tar.gz sonarqube-b231b4fc2515d121e64b37fa52fbd5bbb0a9b440.zip |
SONAR-9736 simplify long-living branch settings
Diffstat (limited to 'server/sonar-web')
4 files changed, 60 insertions, 62 deletions
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx index 3b8dc6d64a1..af1ef904984 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx @@ -189,16 +189,35 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { } renderAdministration() { - if (this.props.branch && isShortLivingBranch(this.props.branch)) { + const { branch } = this.props; + + if (branch && isShortLivingBranch(branch)) { return null; } + const isSettingsActive = SETTINGS_URLS.some(url => window.location.href.indexOf(url) !== -1); + + if (branch && isLongLivingBranch(branch)) { + return ( + <li> + <Link + className={classNames('is-admin', { active: isSettingsActive })} + id="component-navigation-admin" + to={{ + pathname: '/project/settings', + query: { branch: getBranchName(branch), id: this.props.component.key } + }}> + {translate('layout.settings')} + </Link> + </li> + ); + } + const adminLinks = this.renderAdministrationLinks(); if (!adminLinks.some(link => link != null)) { return null; } - const isSettingsActive = SETTINGS_URLS.some(url => window.location.href.indexOf(url) !== -1); return ( <li className="dropdown"> <a @@ -217,21 +236,19 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { } renderAdministrationLinks() { - return this.props.branch && isLongLivingBranch(this.props.branch) - ? [this.renderSettingsLink()] - : [ - this.renderSettingsLink(), - this.renderBranchesLink(), - this.renderProfilesLink(), - this.renderQualityGateLink(), - this.renderCustomMeasuresLink(), - this.renderLinksLink(), - this.renderPermissionsLink(), - this.renderBackgroundTasksLink(), - this.renderUpdateKeyLink(), - ...this.renderAdminExtensions(), - this.renderDeletionLink() - ]; + return [ + this.renderSettingsLink(), + this.renderBranchesLink(), + this.renderProfilesLink(), + this.renderQualityGateLink(), + this.renderCustomMeasuresLink(), + this.renderLinksLink(), + this.renderPermissionsLink(), + this.renderBackgroundTasksLink(), + this.renderUpdateKeyLink(), + ...this.renderAdminExtensions(), + this.renderDeletionLink() + ]; } renderSettingsLink() { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap index a331e992eb6..bad199992da 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap @@ -93,43 +93,25 @@ exports[`should work for long-living branches 1`] = ` project_activity.page </Link> </li> - <li - className="dropdown" - > - <a - className="dropdown-toggle is-admin" - data-toggle="dropdown" - href="#" + <li> + <Link + className="is-admin" id="component-navigation-admin" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/settings", + "query": Object { + "branch": "release", + "id": "foo", + }, + } + } > layout.settings - <i - className="icon-dropdown" - /> - </a> - <ul - className="dropdown-menu" - > - <li> - <Link - activeClassName="active" - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/settings", - "query": Object { - "branch": "release", - "id": "foo", - }, - } - } - > - project_settings.page - </Link> - </li> - </ul> + </Link> </li> </NavBarTabs> `; diff --git a/server/sonar-web/src/main/js/apps/settings/components/App.js b/server/sonar-web/src/main/js/apps/settings/components/App.js index 793ca7370eb..2e53e8c87ab 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/App.js +++ b/server/sonar-web/src/main/js/apps/settings/components/App.js @@ -87,16 +87,17 @@ export default class App extends React.PureComponent { <div id="settings-page" className="page page-limited"> <Helmet title={translate('settings.page')} /> - <PageHeader branch={branchName} component={this.props.component} /> + {branchName == null && <PageHeader branch={branchName} component={this.props.component} />} <div className="side-tabs-layout settings-layout"> - <div className="side-tabs-side"> - <AllCategoriesList - branch={branchName} - component={this.props.component} - selectedCategory={selectedCategory} - defaultCategory={this.props.defaultCategory} - /> - </div> + {branchName == null && + <div className="side-tabs-side"> + <AllCategoriesList + branch={branchName} + component={this.props.component} + selectedCategory={selectedCategory} + defaultCategory={this.props.defaultCategory} + /> + </div>} <div className="side-tabs-main"> <CategoryDefinitionsList branch={branchName} diff --git a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js index 4ae3b8fc858..e7bc08f10e3 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js @@ -36,9 +36,7 @@ export default class PageHeader extends React.PureComponent { const description = this.props.component != null - ? this.props.branch - ? translate('branch_settings.page.description') - : translate('project_settings.page.') + ? translate('project_settings.page.description') : translate('settings.page.description'); return ( |