]> source.dussan.org Git - sonarqube.git/commitdiff
display a special message on the projects page on empty instances
authorStas Vilchik <vilchiks@gmail.com>
Fri, 11 Nov 2016 09:32:05 +0000 (10:32 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 11 Nov 2016 09:32:05 +0000 (10:32 +0100)
server/sonar-web/src/main/js/apps/projects/components/AllProjects.js
server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/projects/components/ProjectsList.js
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 248f2f7bbbbfc8bbfe09e1b1ac4c802eb7ec7fbd..bf1be5abe52d8889d798945825177c8d94276915 100644 (file)
@@ -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 (file)
index 0000000..8b3833f
--- /dev/null
@@ -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>
+    );
+  }
+}
index 76274465b25f43b180bd96787740e8283378930e..4ac5b7ef4004ec65b5ef3080e2f992eba94b1165 100644 (file)
@@ -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 () {
index 8545459e8e46fda486b23ee2b04a631c089e709e..f751c42fa5ed87c2ab84193ad85fdc79fafc8cc6 100644 (file)
@@ -807,6 +807,7 @@ projects.page.description=Explore projects by coverage, duplications or size.
 projects._projects=projects
 projects.no_projects.1=We couldn't find any projects matching selected criteria.
 projects.no_projects.2=Try to change filters to get some results.
+projects.no_projects.empty_instance=Once you analyze some projects, they will show up here.
 projects.clear_all_filters=Clear All Filters
 projects.no_favorite_projects=You don't have any favorite projects yet.
 projects.no_favorite_projects.engagement=Discover and mark as favorites projects you are interested in to have a quick access to them.