mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Fixed query status issue (#18791)
* Explore: Fixed query status issue, fixes #18778 * Added test for QueryStatus
This commit is contained in:
parent
65a6eda93b
commit
a147aedb10
20
public/app/features/explore/QueryStatus.test.tsx
Normal file
20
public/app/features/explore/QueryStatus.test.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { LoadingState } from '@grafana/data';
|
||||
import { PanelData } from '@grafana/ui';
|
||||
|
||||
import QueryStatus from './QueryStatus';
|
||||
|
||||
describe('<QueryStatus />', () => {
|
||||
it('should render with a latency', () => {
|
||||
const res: PanelData = { series: [], state: LoadingState.Done };
|
||||
const wrapper = shallow(<QueryStatus latency={0} queryResponse={res} />);
|
||||
expect(wrapper.find('div').exists()).toBeTruthy();
|
||||
});
|
||||
it('should not render when query has not started', () => {
|
||||
const res: PanelData = { series: [], state: LoadingState.NotStarted };
|
||||
const wrapper = shallow(<QueryStatus latency={0} queryResponse={res} />);
|
||||
expect(wrapper.getElement()).toBe(null);
|
||||
});
|
||||
});
|
@ -39,9 +39,14 @@ interface QueryStatusProps {
|
||||
export default class QueryStatus extends PureComponent<QueryStatusProps> {
|
||||
render() {
|
||||
const { queryResponse, latency } = this.props;
|
||||
|
||||
if (queryResponse.state === LoadingState.NotStarted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="query-transactions">
|
||||
{queryResponse && <QueryStatusItem queryResponse={queryResponse} latency={latency} />}
|
||||
<QueryStatusItem queryResponse={queryResponse} latency={latency} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@
|
||||
|
||||
.query-transaction {
|
||||
display: table-row;
|
||||
color: $text-color-faint;
|
||||
color: $text-color-weak;
|
||||
line-height: 1.44;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user