diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-11-11 10:32:05 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-11-11 10:32:05 +0100 |
commit | 2ea97723f0329c529d358b777f8942a7ebd6485c (patch) | |
tree | df25d1dcff8fad4c7038fc8d8335421d0b56a339 /server | |
parent | 511a1bc7e72d8571063601e732c30bdffdc32e24 (diff) | |
download | sonarqube-2ea97723f0329c529d358b777f8942a7ebd6485c.tar.gz sonarqube-2ea97723f0329c529d358b777f8942a7ebd6485c.zip |
display a special message on the projects page on empty instances
Diffstat (limited to 'server')
3 files changed, 44 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js index 248f2f7bbbb..bf1be5abe52 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js @@ -55,8 +55,7 @@ export default class AllProjects extends React.Component { return null; } - const favoriteAndNoFilters = this.props.isFavorite && - !Object.keys(this.state.query).some(key => this.state.query[key] != null); + const isFiltered = Object.keys(this.state.query).some(key => this.state.query[key] != null); return ( <div className="page-with-sidebar page-with-left-sidebar projects-page"> @@ -64,7 +63,7 @@ export default class AllProjects extends React.Component { <PageSidebar query={this.state.query} isFavorite={this.props.isFavorite}/> </aside> <div className="page-main"> - <ProjectsListContainer favoriteAndNoFilters={favoriteAndNoFilters}/> + <ProjectsListContainer isFavorite={this.props.isFavorite} isFiltered={isFiltered}/> <ProjectsListFooterContainer query={this.state.query} isFavorite={this.props.isFavorite}/> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js new file mode 100644 index 00000000000..8b3833fc301 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import React from 'react'; +import { translate } from '../../../helpers/l10n'; + +export default class EmptyInstance extends React.Component { + render () { + return ( + <div className="projects-empty-list"> + <h3>{translate('projects.no_projects.1')}</h3> + <p className="big-spacer-top">{translate('projects.no_projects.empty_instance')}</p> + </div> + ); + } +} diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js index 76274465b25..4ac5b7ef400 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js @@ -21,19 +21,23 @@ import React from 'react'; import ProjectCardContainer from './ProjectCardContainer'; import NoProjects from './NoProjects'; import NoFavoriteProjects from './NoFavoriteProjects'; +import EmptyInstance from './EmptyInstance'; export default class ProjectsList extends React.Component { static propTypes = { projects: React.PropTypes.arrayOf(React.PropTypes.string), - favoriteAndNoFilters: React.PropTypes.bool.isRequired + isFavorite: React.PropTypes.bool.isRequired, + isFiltered: React.PropTypes.bool.isRequired }; renderNoProjects () { - return this.props.favoriteAndNoFilters ? ( - <NoFavoriteProjects/> - ) : ( - <NoProjects/> - ); + if (this.props.isFavorite && !this.props.isFiltered) { + return <NoFavoriteProjects/>; + } else if (!this.props.isFiltered) { + return <EmptyInstance/>; + } else { + return <NoProjects/>; + } } render () { |