Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitor Tab: Cannot choose another timeframe #898

Merged
merged 6 commits into from
Mar 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const getLoopbackInterval = (interval: number) => {
// export for tests
export class MonitorATMServicesViewImpl extends React.PureComponent<TProps, StateType> {
graphDivWrapper: React.RefObject<HTMLInputElement>;
graphXDomain: number[];
graphXDomain: number[] = [];
serviceSelectorValue: string = '';
endTime: number = Date.now();
state = {
Expand All @@ -101,9 +101,6 @@ export class MonitorATMServicesViewImpl extends React.PureComponent<TProps, Stat
constructor(props: TProps) {
super(props);
this.graphDivWrapper = React.createRef();

const currentTime = Date.now();
this.graphXDomain = [currentTime - props.selectedTimeFrame, currentTime];
}

componentDidMount() {
Expand All @@ -114,6 +111,7 @@ export class MonitorATMServicesViewImpl extends React.PureComponent<TProps, Stat
}
window.addEventListener('resize', this.updateDimensions.bind(this));
this.updateDimensions.apply(this);
this.calcGraphXDomain();
}

componentDidUpdate(nextProps: TProps) {
Expand All @@ -124,12 +122,19 @@ export class MonitorATMServicesViewImpl extends React.PureComponent<TProps, Stat
} else if (!_isEqual(nextProps.services, services)) {
this.fetchMetrics();
}

this.calcGraphXDomain();
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateDimensions.bind(this));
}

calcGraphXDomain() {
const currentTime = Date.now();
this.graphXDomain = [currentTime - this.props.selectedTimeFrame, currentTime];
}

updateDimensions() {
if (this.graphDivWrapper.current) {
this.setState({
Expand Down