Fixing test and small refactor

This commit is contained in:
Peter Holmberg 2019-01-10 22:15:37 +00:00
parent 08ac2959a4
commit 2f0ab99ae5
7 changed files with 11 additions and 22 deletions

View File

@ -6,7 +6,6 @@ import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoa
import appEvents from 'app/core/app_events';
// Components
import { LoadingPlaceholder } from '@grafana/ui';
import { EditorTabBody, EditorToolbarView } from '../dashboard/dashgrid/EditorTabBody';
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
import StateHistory from './StateHistory';
@ -113,7 +112,7 @@ export class AlertTab extends PureComponent<Props> {
renderTestRuleResult = () => {
const { panel, dashboard } = this.props;
return <TestRuleResult panelId={panel.id} dashboard={dashboard} LoadingPlaceholder={LoadingPlaceholder} />;
return <TestRuleResult panelId={panel.id} dashboard={dashboard} />;
};
testRule = (): EditorToolbarView => ({

View File

@ -13,7 +13,6 @@ const setup = (propOverrides?: object) => {
const props: Props = {
panelId: 1,
dashboard: new DashboardModel({ panels: [{ id: 1 }] }),
LoadingPlaceholder: {},
};
Object.assign(props, propOverrides);

View File

@ -2,11 +2,11 @@ import React, { PureComponent } from 'react';
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
import { getBackendSrv } from 'app/core/services/backend_srv';
import { DashboardModel } from '../dashboard/dashboard_model';
import { LoadingPlaceholder } from '@grafana/ui/src';
export interface Props {
panelId: number;
dashboard: DashboardModel;
LoadingPlaceholder: any;
}
interface State {
@ -35,7 +35,6 @@ export class TestRuleResult extends PureComponent<Props, State> {
render() {
const { testRuleResponse, isLoading } = this.state;
const { LoadingPlaceholder } = this.props;
if (isLoading === true) {
return <LoadingPlaceholder text="Evaluating rule" />;

View File

@ -1,13 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render should render component 1`] = `
<JSONFormatter
config={
Object {
"animateOpen": true,
}
}
json={Object {}}
open={3}
/>
`;

View File

@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render should render component 1`] = `
<Component
text="Evaluating rule"
/>
`;

View File

@ -10,7 +10,6 @@ import { QueryInspector } from './QueryInspector';
import { QueryOptions } from './QueryOptions';
import { AngularQueryComponentScope } from 'app/features/panel/metrics_tab';
import { PanelOptionSection } from './PanelOptionSection';
import { LoadingPlaceholder } from '@grafana/ui';
// Services
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
@ -129,7 +128,7 @@ export class QueriesTab extends PureComponent<Props, State> {
renderQueryInspector = () => {
const { panel } = this.props;
return <QueryInspector panel={panel} LoadingPlaceholder={LoadingPlaceholder} />;
return <QueryInspector panel={panel} />;
};
renderHelp = () => {

View File

@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
import appEvents from 'app/core/app_events';
import { CopyToClipboard } from 'app/core/components/CopyToClipboard/CopyToClipboard';
import { LoadingPlaceholder } from '@grafana/ui';
interface DsQuery {
isLoading: boolean;
@ -10,7 +11,6 @@ interface DsQuery {
interface Props {
panel: any;
LoadingPlaceholder: any;
}
interface State {
@ -177,7 +177,6 @@ export class QueryInspector extends PureComponent<Props, State> {
render() {
const { response, isLoading } = this.state.dsQuery;
const { LoadingPlaceholder } = this.props;
const { isMocking } = this.state;
const openNodes = this.getNrOfOpenNodes();