summaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-04-07 11:51:56 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-04-07 13:33:29 +0200
commit6c3f7ea1622a00e75bdb5070df2ae0cac6dcb52a (patch)
tree1f22478c98ad644fad833c439073e582c43f1e3f /server/sonar-web/src/main/js
parentf000dcc41b8171cfbf5576efa81311efecfbd16c (diff)
downloadsonarqube-6c3f7ea1622a00e75bdb5070df2ae0cac6dcb52a.tar.gz
sonarqube-6c3f7ea1622a00e75bdb5070df2ae0cac6dcb52a.zip
SONAR-7402 drop pagination, filter out components with no measure value
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js13
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListViewContainer.js3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js10
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeViewContainer.js2
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/store/listViewActions.js23
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js21
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.js4
7 files changed, 13 insertions, 63 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js
index 789ae2ac494..c0fcc23de7d 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js
@@ -24,7 +24,6 @@ import ComponentsList from './ComponentsList';
import ListHeader from './ListHeader';
import Spinner from '../../components/Spinner';
import SourceViewer from '../../../code/components/SourceViewer';
-import ListFooter from '../../../../components/shared/list-footer';
export default class ListView extends React.Component {
componentDidMount () {
@@ -43,11 +42,6 @@ export default class ListView extends React.Component {
}
}
- fetchMore () {
- const { metric, component, onFetchMore } = this.props;
- onFetchMore(component, metric);
- }
-
scrollToViewer () {
const { container } = this.refs;
const top = container.getBoundingClientRect().top + window.scrollY - 95 - 10;
@@ -87,7 +81,7 @@ export default class ListView extends React.Component {
}
render () {
- const { component, components, metrics, metric, leakPeriod, selected, fetching, total } = this.props;
+ const { component, components, metrics, metric, leakPeriod, selected, fetching } = this.props;
const { onSelectNext, onSelectPrevious } = this.props;
const breadcrumbs = [component];
@@ -120,11 +114,6 @@ export default class ListView extends React.Component {
) : (
<Spinner/>
)}
- <ListFooter
- count={components.length}
- total={total}
- loadMore={this.fetchMore.bind(this)}
- ready={!fetching}/>
</div>
)}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListViewContainer.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListViewContainer.js
index 1d789b5c887..b3333a13d7a 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListViewContainer.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListViewContainer.js
@@ -21,7 +21,7 @@ import { connect } from 'react-redux';
import pick from '../../../../../../../node_modules/lodash/pick';
import ListView from './ListView';
-import { fetchList, fetchMore, selectComponent, selectNext, selectPrevious } from '../../store/listViewActions';
+import { fetchList, selectComponent, selectNext, selectPrevious } from '../../store/listViewActions';
const mapStateToProps = state => {
const drilldown = pick(state.list, [
@@ -42,7 +42,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
onFetchList: (baseComponent, metric, periodIndex) => dispatch(fetchList(baseComponent, metric, periodIndex)),
- onFetchMore: (baseComponent, metric) => dispatch(fetchMore(baseComponent, metric)),
onSelect: component => dispatch(selectComponent(component)),
onSelectNext: component => dispatch(selectNext(component)),
onSelectPrevious: component => dispatch(selectPrevious(component))
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js
index c4e62fdccb3..91381904947 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js
@@ -23,7 +23,6 @@ import ComponentsList from './ComponentsList';
import ListHeader from './ListHeader';
import Spinner from '../../components/Spinner';
import SourceViewer from '../../../code/components/SourceViewer';
-import ListFooter from '../../../../components/shared/list-footer';
export default class TreeView extends React.Component {
componentDidMount () {
@@ -89,8 +88,8 @@ export default class TreeView extends React.Component {
}
render () {
- const { components, metrics, breadcrumbs, metric, leakPeriod, selected, fetching, total } = this.props;
- const { onSelectNext, onSelectPrevious, onFetchMore } = this.props;
+ const { components, metrics, breadcrumbs, metric, leakPeriod, selected, fetching } = this.props;
+ const { onSelectNext, onSelectPrevious } = this.props;
const selectedIndex = components.indexOf(selected);
const sourceViewerPeriod = metric.key.indexOf('new_') === 0 && !!leakPeriod ? leakPeriod : null;
@@ -118,11 +117,6 @@ export default class TreeView extends React.Component {
) : (
<Spinner/>
)}
- <ListFooter
- count={components.length}
- total={total}
- loadMore={onFetchMore}
- ready={!fetching}/>
</div>
)}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeViewContainer.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeViewContainer.js
index b707563d12b..f21cc86f0c4 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeViewContainer.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeViewContainer.js
@@ -23,7 +23,6 @@ import pick from '../../../../../../../node_modules/lodash/pick';
import TreeView from './TreeView';
import {
start,
- fetchMore,
drilldown,
useBreadcrumbs,
selectComponent,
@@ -51,7 +50,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
onStart: (rootComponent, metric, periodIndex) => dispatch(start(rootComponent, metric, periodIndex)),
- onFetchMore: () => dispatch(fetchMore()),
onDrilldown: component => dispatch(drilldown(component)),
onUseBreadcrumbs: component => dispatch(useBreadcrumbs(component)),
onSelect: component => dispatch(selectComponent(component)),
diff --git a/server/sonar-web/src/main/js/apps/component-measures/store/listViewActions.js b/server/sonar-web/src/main/js/apps/component-measures/store/listViewActions.js
index 17b1d63cd54..18037ac3c68 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/store/listViewActions.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/store/listViewActions.js
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getComponentTree } from '../../../api/components';
-import { enhanceWithMeasure } from '../utils';
+import { enhanceWithMeasure, filterOutEmptyMeasures } from '../utils';
import { startFetching, stopFetching } from './statusActions';
import complementary from '../config/complementary';
@@ -35,7 +35,7 @@ function getComplementary (metric) {
function makeRequest (baseComponent, metric, options, periodIndex = 1) {
const asc = metric.direction === 1;
- const ps = 100;
+ const ps = 200;
const finalOptions = { asc, ps };
if (metric.key.indexOf('new_') === 0) {
@@ -59,7 +59,7 @@ function fetchLeaves (baseComponent, metric, pageIndex = 1, periodIndex = 1) {
const options = { p: pageIndex };
return makeRequest(baseComponent, metric, options, periodIndex).then(r => {
- const nextComponents = enhanceWithMeasure(r.components, metric.key, periodIndex);
+ const nextComponents = filterOutEmptyMeasures(enhanceWithMeasure(r.components, metric.key, periodIndex));
return {
components: nextComponents,
@@ -95,23 +95,6 @@ export function fetchList (baseComponent, metric, periodIndex = 1) {
}
/**
- * Fetch next page of components
- * @param baseComponent
- * @param metric
- */
-export function fetchMore (baseComponent, metric) {
- return (dispatch, getState) => {
- const { components, pageIndex } = getState().list;
- dispatch(startFetching());
- return fetchLeaves(baseComponent, metric, pageIndex + 1).then(r => {
- const diff = { ...r, components: [...components, ...r.components] };
- dispatch(updateStore(diff));
- dispatch(stopFetching());
- });
- };
-}
-
-/**
* Select specified component from the list
* @param component A component to select
*/
diff --git a/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js b/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js
index 32253d909c8..cd1382c271a 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js
@@ -20,7 +20,7 @@
import initial from 'lodash/initial';
import { getComponentTree } from '../../../api/components';
-import { enhanceWithMeasure } from '../utils';
+import { filterOutEmptyMeasures, enhanceWithMeasure } from '../utils';
import { startFetching, stopFetching } from './statusActions';
import complementary from '../config/complementary';
@@ -91,7 +91,7 @@ function fetchComponents (baseComponent, metric, pageIndex = 1, periodIndex = 1)
const options = { p: pageIndex };
return makeRequest(baseComponent, metric, options, periodIndex).then(r => {
- const nextComponents = enhanceWithMeasure(r.components, metric.key, periodIndex);
+ const nextComponents = filterOutEmptyMeasures(enhanceWithMeasure(r.components, metric.key, periodIndex));
return {
baseComponent,
@@ -143,23 +143,6 @@ export function start (rootComponent, metric, periodIndex = 1) {
}
/**
- * Fetch next page of components
- */
-export function fetchMore () {
- return (dispatch, getState) => {
- const { metric, baseComponent, components, pageIndex, periodIndex } = getState().tree;
- dispatch(startFetching());
- return fetchComponents(baseComponent, metric, pageIndex + 1, periodIndex).then(r => {
- dispatch(updateStore({
- ...r,
- components: [...components, ...r.components]
- }));
- dispatch(stopFetching());
- });
- };
-}
-
-/**
* Drilldown to the component
* @param component
*/
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.js b/server/sonar-web/src/main/js/apps/component-measures/utils.js
index 5a6db31f29e..c7bd18ca7e3 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.js
@@ -109,3 +109,7 @@ export function hasBubbleChart (domainName) {
export function hasTreemap (metric) {
return ['PERCENT', 'RATING', 'LEVEL'].indexOf(metric.type) !== -1;
}
+
+export function filterOutEmptyMeasures (components) {
+ return components.filter(component => component.value !== null || component.leak !== null);
+}