fromProjectsApp.getState(state.projectsApp)
);
-export const getProjectsAppFilterStatus = (state, key) => (
- fromProjectsApp.getFilterStatus(state.projectsApp, key)
-);
-
export const getProjectsAppFacetByProperty = (state, property) => (
fromProjectsApp.getFacetByProperty(state.projectsApp, property)
);
import PageHeaderContainer from './PageHeaderContainer';
import ProjectsListContainer from './ProjectsListContainer';
import ProjectsListFooterContainer from './ProjectsListFooterContainer';
-import PageSidebarContainer from './PageSidebarContainer';
+import PageSidebar from './PageSidebar';
import ProjectsListHeaderContainer from './ProjectsListHeaderContainer';
import GlobalMessagesContainer from '../../../app/components/GlobalMessagesContainer';
import { parseUrlQuery } from '../store/utils';
</div>
<aside className="page-sidebar-fixed projects-sidebar">
<PageHeaderContainer/>
- <PageSidebarContainer query={this.state.query}/>
+ <PageSidebar query={this.state.query}/>
</aside>
</div>
</div>
export default class PageSidebar extends React.Component {
static propTypes = {
- query: React.PropTypes.object.isRequired,
- closeAllFilters: React.PropTypes.func.isRequired
+ query: React.PropTypes.object.isRequired
};
render () {
<div className="projects-facets-header clearfix">
{isFiltered && (
<div className="projects-facets-reset">
- <Link to="/projects" className="button button-red" onClick={this.props.closeAllFilters}>
+ <Link to="/projects" className="button button-red">
Clear All Filters
</Link>
</div>
+++ /dev/null
-/*
- * 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 { connect } from 'react-redux';
-import PageSidebar from './PageSidebar';
-import { closeAllFilters } from '../store/filters/statuses/actions';
-
-export default connect(
- () => ({}),
- { closeAllFilters }
-)(PageSidebar);
export default class Filter extends React.Component {
static propTypes = {
- isOpen: React.PropTypes.bool.isRequired,
value: React.PropTypes.any,
property: React.PropTypes.string.isRequired,
options: React.PropTypes.array.isRequired,
halfWidth: React.PropTypes.bool,
getFilterUrl: React.PropTypes.func.isRequired,
- openFilter: React.PropTypes.func.isRequired,
- closeFilter: React.PropTypes.func.isRequired,
router: React.PropTypes.object
};
halfWidth: false
};
- handleHeaderClick = e => {
- e.preventDefault();
- e.target.blur();
-
- const { value, isOpen, property } = this.props;
- const hasValue = value != null;
- const isDisplayedOpen = isOpen || hasValue;
-
- if (isDisplayedOpen) {
- this.props.closeFilter();
- } else {
- this.props.openFilter();
- }
-
- if (hasValue) {
- this.props.router.push(this.props.getFilterUrl({ [property]: null }));
- }
- };
-
renderHeader () {
- const { value, isOpen, renderName } = this.props;
- const hasValue = value != null;
- const checkboxClassName = classNames('icon-checkbox', {
- 'icon-checkbox-checked': hasValue || isOpen
- });
-
return (
- <a className="search-navigator-facet-header projects-facet-header" href="#" onClick={this.handleHeaderClick}>
- <i className={checkboxClassName}/> {renderName()}
- </a>
+ <div className="search-navigator-facet-header projects-facet-header">
+ {this.props.renderName()}
+ </div>
);
}
}
renderOptions () {
- const { value, isOpen, options } = this.props;
- const hasValue = value != null;
-
- if (!hasValue && !isOpen) {
- return null;
- }
-
return (
<div className="search-navigator-facet-list">
- {this.props.children}
-
- {options.map(option => this.renderOption(option))}
+ {this.props.options.map(option => this.renderOption(option))}
</div>
);
}
render () {
- const { value, isOpen } = this.props;
- const hasValue = value != null;
- const className = classNames('search-navigator-facet-box', {
- 'search-navigator-facet-box-collapsed': !hasValue && !isOpen
- });
-
return (
- <div className={className}>
+ <div className="search-navigator-facet-box">
{this.renderHeader()}
{this.renderOptions()}
</div>
import { withRouter } from 'react-router';
import omitBy from 'lodash/omitBy';
import isNil from 'lodash/isNil';
-import {
- getProjectsAppFilterStatus,
- getProjectsAppFacetByProperty,
- getProjectsAppMaxFacetValue
-} from '../../../app/store/rootReducer';
-import { openFilter, closeFilter } from '../store/filters/statuses/actions';
-import { OPEN } from '../store/filters/statuses/reducer';
+import { getProjectsAppFacetByProperty, getProjectsAppMaxFacetValue } from '../../../app/store/rootReducer';
const mapStateToProps = (state, ownProps) => ({
- isOpen: getProjectsAppFilterStatus(state, ownProps.property) === OPEN,
value: ownProps.query[ownProps.property],
facet: getProjectsAppFacetByProperty(state, ownProps.property),
maxFacetValue: getProjectsAppMaxFacetValue(state),
}
});
-const mapDispatchToProps = (dispatch, ownProps) => ({
- openFilter: () => dispatch(openFilter(ownProps.property)),
- closeFilter: () => dispatch(closeFilter(ownProps.property))
-});
-
-export default connect(mapStateToProps, mapDispatchToProps)(withRouter(Filter));
+export default connect(mapStateToProps)(withRouter(Filter));
+++ /dev/null
-/*
- * 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 { combineReducers } from 'redux';
-import statuses, * as fromStatuses from './statuses/reducer';
-
-const reducer = combineReducers({ statuses });
-
-export default reducer;
-
-export const getFilterStatus = (state, key) => (
- fromStatuses.getStatus(state.statuses, key)
-);
+++ /dev/null
-/*
- * 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.
- */
-export const OPEN_FILTER = 'projects/OPEN_FILTER';
-
-export const openFilter = key => ({
- type: OPEN_FILTER,
- key
-});
-
-export const CLOSE_FILTER = 'projects/CLOSE_FILTER';
-
-export const closeFilter = key => ({
- type: CLOSE_FILTER,
- key
-});
-
-export const CLOSE_ALL_FILTERS = 'projects/CLOSE_ALL_FILTERS';
-
-export const closeAllFilters = () => ({
- type: CLOSE_ALL_FILTERS
-});
+++ /dev/null
-/*
- * 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 { OPEN_FILTER, CLOSE_FILTER, CLOSE_ALL_FILTERS } from './actions';
-
-export const OPEN = 'OPEN';
-export const CLOSED = 'CLOSED';
-
-const closeAll = state => {
- const newState = { ...state };
- Object.keys(newState).forEach(key => newState[key] = CLOSED);
- return newState;
-};
-
-const reducer = (state = {}, action = {}) => {
- switch (action.type) {
- case OPEN_FILTER:
- return { ...state, [action.key]: OPEN };
- case CLOSE_FILTER:
- return { ...state, [action.key]: CLOSED };
- case CLOSE_ALL_FILTERS:
- return closeAll(state);
- default:
- return state;
- }
-};
-
-export default reducer;
-
-export const getStatus = (state, key) => (
- state[key]
-);
import { combineReducers } from 'redux';
import projects, * as fromProjects from './projects/reducer';
import state from './state/reducer';
-import filters, * as fromFilters from './filters/reducer';
import facets, * as fromFacets from './facets/reducer';
-export default combineReducers({ projects, state, filters, facets });
+export default combineReducers({ projects, state, facets });
export const getProjects = state => (
fromProjects.getProjects(state.projects)
state.state
);
-export const getFilterStatus = (state, key) => (
- fromFilters.getFilterStatus(state.filters, key)
-);
-
export const getFacetByProperty = (state, property) => (
fromFacets.getFacetByProperty(state.facets, property)
);