aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-03-10 15:32:25 +0100
committerGrégoire Aubert <gregaubert@users.noreply.github.com>2017-03-13 10:03:16 +0100
commit35c9fca6f04c5bf3e9da0841f142005ea37ec1d6 (patch)
treec84e2155b937c5c6255e332b7fdf6bc1a84535e6 /server/sonar-web
parentdf0aad09cff6801af52be40e993cb2a57009676e (diff)
downloadsonarqube-35c9fca6f04c5bf3e9da0841f142005ea37ec1d6.tar.gz
sonarqube-35c9fca6f04c5bf3e9da0841f142005ea37ec1d6.zip
Revert some changes of 788f8da breaking the project search
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js101
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js26
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js24
3 files changed, 79 insertions, 72 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js b/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js
index f4f2614ac60..a7e2788bc44 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js
+++ b/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.js
@@ -40,62 +40,61 @@ export default class PageSidebar extends React.PureComponent {
render () {
const isFiltered = Object.keys(this.props.query).some(key => this.props.query[key] != null);
- const basePathName = this.props.organization ?
- `/organizations/${this.props.organization.key}/projects` :
- '/projects';
+ const basePathName = this.props.organization
+ ? `/organizations/${this.props.organization.key}/projects`
+ : '/projects';
const pathname = basePathName + (this.props.isFavorite ? '/favorite' : '');
return (
- <div className="search-navigator-facets-list">
- <div className="projects-facets-header clearfix">
- {isFiltered && (
- <div className="projects-facets-reset">
- <Link to={pathname} className="button button-red">
- {translate('projects.clear_all_filters')}
- </Link>
- </div>
- )}
+ <div className="search-navigator-facets-list">
+ <div className="projects-facets-header clearfix">
+ {isFiltered &&
+ <div className="projects-facets-reset">
+ <Link to={pathname} className="button button-red">
+ {translate('projects.clear_all_filters')}
+ </Link>
+ </div>}
- <h3>{translate('filters')}</h3>
- <SearchFilterContainer
- query={this.props.query.search}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- </div>
-
- <QualityGateFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <ReliabilityFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <SecurityFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <MaintainabilityFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <CoverageFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <DuplicationsFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <SizeFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
- <LanguageFilter
- query={this.props.query}
- isFavorite={this.props.isFavorite}
- organization={this.props.organization}/>
+ <h3>{translate('filters')}</h3>
+ <SearchFilterContainer
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
</div>
+
+ <QualityGateFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <ReliabilityFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <SecurityFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <MaintainabilityFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <CoverageFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <DuplicationsFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <SizeFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ <LanguageFilter
+ query={this.props.query}
+ isFavorite={this.props.isFavorite}
+ organization={this.props.organization}/>
+ </div>
);
}
}
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js
index 1bfd44d5e9f..ea5a493b33f 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js
+++ b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilter.js
@@ -17,24 +17,32 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+// @flow
import React from 'react';
import classNames from 'classnames';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-export default class SearchFilter extends React.Component {
- static propTypes = {
- query: React.PropTypes.object.isRequired,
- handleSearch: React.PropTypes.func.isRequired
- }
+type Props = {
+ handleSearch: (userString?: string) => void,
+ query: {}
+};
+
+type State = {
+ userQuery?: string
+};
- constructor (props) {
+export default class SearchFilter extends React.PureComponent {
+ props: Props;
+ state: State;
+
+ constructor (props: Props) {
super(props);
this.state = {
userQuery: props.query.search
};
}
- componentWillReceiveProps (nextProps) {
+ componentWillReceiveProps (nextProps: Props) {
if (this.props.query.search === this.state.userQuery && nextProps.query.search !== this.props.query.search) {
this.setState({
userQuery: nextProps.query.search || ''
@@ -47,12 +55,12 @@ export default class SearchFilter extends React.Component {
if (!target.value || target.value.length >= 2) {
this.props.handleSearch(target.value);
}
- }
+ };
render () {
const { userQuery } = this.state;
const inputClassName = classNames('input-super-large', {
- 'touched': userQuery && userQuery.length < 2
+ touched: userQuery && userQuery.length < 2
});
return (
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js
index c65d92c2180..696bf7acc12 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js
+++ b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js
@@ -23,29 +23,29 @@ import debounce from 'lodash/debounce';
import { getFilterUrl } from './utils';
import SearchFilter from './SearchFilter';
+type Props = {
+ query: {},
+ router: { push: (string) => void },
+ isFavorite?: boolean,
+ organization?: {}
+};
+
class SearchFilterContainer extends React.Component {
- static propTypes = {
- query: React.PropTypes.object.isRequired,
- isFavorite: React.PropTypes.bool,
- organization: React.PropTypes.object
- }
+ handleSearch: (userQuery?: string) => void;
+ props: Props;
- constructor (props) {
+ constructor (props: Props) {
super(props);
this.handleSearch = debounce(this.handleSearch.bind(this), 250);
}
- handleSearch (userQuery) {
+ handleSearch (userQuery?: string) {
const path = getFilterUrl(this.props, { search: userQuery || null });
this.props.router.push(path);
}
render () {
- return (
- <SearchFilter
- query={this.props.query}
- handleSearch={this.handleSearch}/>
- );
+ return <SearchFilter query={this.props.query} handleSearch={this.handleSearch}/>;
}
}