mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
Removes the functionality of being able to collapse/expand the logs container. When both graph and table are collapsed and you reload the page then the start page should not be displayed. When both graph and table are collapsed and you reload the page then the graph and table panels should be displayed. Fix so that reducer tests are run. On of the test used fit() instead of it() which had the consequence of only 1 reducer test was executed and the rest skipped. There was some failing tests that now is updated and now passes. Fixes #17098
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import React, { PureComponent } from 'react';
|
|
import { hot } from 'react-hot-loader';
|
|
import { connect } from 'react-redux';
|
|
|
|
import { ExploreId, ExploreItemState } from 'app/types/explore';
|
|
import { StoreState } from 'app/types';
|
|
|
|
import { toggleTable } from './state/actions';
|
|
import Table from './Table';
|
|
import Panel from './Panel';
|
|
import TableModel from 'app/core/table_model';
|
|
|
|
interface TableContainerProps {
|
|
exploreId: ExploreId;
|
|
loading: boolean;
|
|
onClickCell: (key: string, value: string) => void;
|
|
showingTable: boolean;
|
|
tableResult?: TableModel;
|
|
toggleTable: typeof toggleTable;
|
|
}
|
|
|
|
export class TableContainer extends PureComponent<TableContainerProps> {
|
|
onClickTableButton = () => {
|
|
this.props.toggleTable(this.props.exploreId, this.props.showingTable);
|
|
};
|
|
|
|
render() {
|
|
const { loading, onClickCell, showingTable, tableResult } = this.props;
|
|
|
|
return (
|
|
<Panel label="Table" loading={loading} collapsible isOpen={showingTable} onToggle={this.onClickTableButton}>
|
|
{tableResult && <Table data={tableResult} loading={loading} onClickCell={onClickCell} />}
|
|
</Panel>
|
|
);
|
|
}
|
|
}
|
|
|
|
function mapStateToProps(state: StoreState, { exploreId }) {
|
|
const explore = state.explore;
|
|
const item: ExploreItemState = explore[exploreId];
|
|
const { tableIsLoading, showingTable, tableResult } = item;
|
|
const loading = tableIsLoading;
|
|
return { loading, showingTable, tableResult };
|
|
}
|
|
|
|
const mapDispatchToProps = {
|
|
toggleTable,
|
|
};
|
|
|
|
export default hot(module)(
|
|
connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(TableContainer)
|
|
);
|