aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-11-09 10:04:13 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-11-09 15:51:40 +0100
commita2892186843864f467b97a6d3f1a21c3576002bb (patch)
tree8b0ff8452b504057075c6d7c687c0d2f34bee15d /server/sonar-web/src/main/js/apps/projects/components/AllProjects.js
parentf662a342d352376b9cc6854e20c58b205f184e45 (diff)
downloadsonarqube-a2892186843864f467b97a6d3f1a21c3576002bb.tar.gz
sonarqube-a2892186843864f467b97a6d3f1a21c3576002bb.zip
SONAR-8360 Add favorite projects filter
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/components/AllProjects.js')
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/AllProjects.js13
1 files changed, 8 insertions, 5 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 fbbfb11fd56..cc303887e71 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
@@ -21,12 +21,12 @@ import React from 'react';
import ProjectsListContainer from './ProjectsListContainer';
import ProjectsListFooterContainer from './ProjectsListFooterContainer';
import PageSidebar from './PageSidebar';
-import NoProjects from './NoProjects';
import { parseUrlQuery } from '../store/utils';
export default class AllProjects extends React.Component {
static propTypes = {
user: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.bool]),
+ isFavorite: React.PropTypes.bool.isRequired,
fetchProjects: React.PropTypes.func.isRequired
};
@@ -47,7 +47,7 @@ export default class AllProjects extends React.Component {
handleQueryChange () {
const query = parseUrlQuery(this.props.location.query);
this.setState({ query });
- this.props.fetchProjects(query);
+ this.props.fetchProjects(query, this.props.isFavorite);
}
render () {
@@ -55,14 +55,17 @@ 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);
+
return (
<div className="page-with-sidebar projects-page">
<div className="page-main">
- <ProjectsListContainer noProjectsComponent={<NoProjects/>}/>
- <ProjectsListFooterContainer query={this.state.query}/>
+ <ProjectsListContainer favoriteAndNoFilters={favoriteAndNoFilters}/>
+ <ProjectsListFooterContainer query={this.state.query} isFavorite={this.props.isFavorite}/>
</div>
<aside className="page-sidebar-fixed projects-sidebar">
- <PageSidebar query={this.state.query}/>
+ <PageSidebar query={this.state.query} isFavorite={this.props.isFavorite}/>
</aside>
</div>
);