import _ from 'lodash';
import PropTypes from 'prop-types';
import React from 'react';
import { withContext } from './util/AppContext.jsx';
import { Col, Radio, Row } from 'antd';
class PageHeader extends React.Component {
static defaultProps = {
hideButtons: false,
subHeader: null,
subHeaderTitle: null,
subMessage: null,
}
static propTypes = {
api: PropTypes.shape({
getMetricsWindow: PropTypes.func.isRequired,
getValidMetricsWindows: PropTypes.func.isRequired,
setMetricsWindow: PropTypes.func.isRequired,
}).isRequired,
header: PropTypes.string.isRequired,
hideButtons: PropTypes.bool,
subHeader: PropTypes.string,
subHeaderTitle: PropTypes.string,
subMessage: PropTypes.string,
}
constructor(props) {
super(props);
this.onTimeWindowClick = this.onTimeWindowClick.bind(this);
this.state = {
selectedWindow: this.props.api.getMetricsWindow()
};
}
onTimeWindowClick(e) {
let window = e.target.value;
this.props.api.setMetricsWindow(window);
this.setState({selectedWindow: window});
}
// don't use time window changing until the results of Telemetry Scalability are in
// https://github.com/runconduit/conduit/milestone/4
renderMetricWindowButtons() {
if (this.props.hideButtons) {return null;}
const buttons = _.map(this.props.api.getValidMetricsWindows(), (w, i) => {
return