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 () {
}
}
- fetchMore () {
- const { metric, component, onFetchMore } = this.props;
- onFetchMore(component, metric);
- }
-
scrollToViewer () {
const { container } = this.refs;
const top = container.getBoundingClientRect().top + window.scrollY - 95 - 10;
}
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];
) : (
<Spinner/>
)}
- <ListFooter
- count={components.length}
- total={total}
- loadMore={this.fetchMore.bind(this)}
- ready={!fetching}/>
</div>
)}
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, [
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))
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 () {
}
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;
) : (
<Spinner/>
)}
- <ListFooter
- count={components.length}
- total={total}
- loadMore={onFetchMore}
- ready={!fetching}/>
</div>
)}
import TreeView from './TreeView';
import {
start,
- fetchMore,
drilldown,
useBreadcrumbs,
selectComponent,
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)),
* 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';
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) {
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,
};
}
-/**
- * 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
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';
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,
};
}
-/**
- * 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
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);
+}