mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixing test and small refactor
This commit is contained in:
@@ -6,7 +6,6 @@ import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoa
|
|||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { LoadingPlaceholder } from '@grafana/ui';
|
|
||||||
import { EditorTabBody, EditorToolbarView } from '../dashboard/dashgrid/EditorTabBody';
|
import { EditorTabBody, EditorToolbarView } from '../dashboard/dashgrid/EditorTabBody';
|
||||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||||
import StateHistory from './StateHistory';
|
import StateHistory from './StateHistory';
|
||||||
@@ -113,7 +112,7 @@ export class AlertTab extends PureComponent<Props> {
|
|||||||
|
|
||||||
renderTestRuleResult = () => {
|
renderTestRuleResult = () => {
|
||||||
const { panel, dashboard } = this.props;
|
const { panel, dashboard } = this.props;
|
||||||
return <TestRuleResult panelId={panel.id} dashboard={dashboard} LoadingPlaceholder={LoadingPlaceholder} />;
|
return <TestRuleResult panelId={panel.id} dashboard={dashboard} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
testRule = (): EditorToolbarView => ({
|
testRule = (): EditorToolbarView => ({
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ const setup = (propOverrides?: object) => {
|
|||||||
const props: Props = {
|
const props: Props = {
|
||||||
panelId: 1,
|
panelId: 1,
|
||||||
dashboard: new DashboardModel({ panels: [{ id: 1 }] }),
|
dashboard: new DashboardModel({ panels: [{ id: 1 }] }),
|
||||||
LoadingPlaceholder: {},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.assign(props, propOverrides);
|
Object.assign(props, propOverrides);
|
||||||
@@ -2,11 +2,11 @@ import React, { PureComponent } from 'react';
|
|||||||
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
|
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { DashboardModel } from '../dashboard/dashboard_model';
|
import { DashboardModel } from '../dashboard/dashboard_model';
|
||||||
|
import { LoadingPlaceholder } from '@grafana/ui/src';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
panelId: number;
|
panelId: number;
|
||||||
dashboard: DashboardModel;
|
dashboard: DashboardModel;
|
||||||
LoadingPlaceholder: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@@ -35,7 +35,6 @@ export class TestRuleResult extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { testRuleResponse, isLoading } = this.state;
|
const { testRuleResponse, isLoading } = this.state;
|
||||||
const { LoadingPlaceholder } = this.props;
|
|
||||||
|
|
||||||
if (isLoading === true) {
|
if (isLoading === true) {
|
||||||
return <LoadingPlaceholder text="Evaluating rule" />;
|
return <LoadingPlaceholder text="Evaluating rule" />;
|
||||||
|
|||||||
@@ -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}
|
|
||||||
/>
|
|
||||||
`;
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Render should render component 1`] = `
|
||||||
|
<Component
|
||||||
|
text="Evaluating rule"
|
||||||
|
/>
|
||||||
|
`;
|
||||||
@@ -10,7 +10,6 @@ import { QueryInspector } from './QueryInspector';
|
|||||||
import { QueryOptions } from './QueryOptions';
|
import { QueryOptions } from './QueryOptions';
|
||||||
import { AngularQueryComponentScope } from 'app/features/panel/metrics_tab';
|
import { AngularQueryComponentScope } from 'app/features/panel/metrics_tab';
|
||||||
import { PanelOptionSection } from './PanelOptionSection';
|
import { PanelOptionSection } from './PanelOptionSection';
|
||||||
import { LoadingPlaceholder } from '@grafana/ui';
|
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||||
@@ -129,7 +128,7 @@ export class QueriesTab extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
renderQueryInspector = () => {
|
renderQueryInspector = () => {
|
||||||
const { panel } = this.props;
|
const { panel } = this.props;
|
||||||
return <QueryInspector panel={panel} LoadingPlaceholder={LoadingPlaceholder} />;
|
return <QueryInspector panel={panel} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
renderHelp = () => {
|
renderHelp = () => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
|
|||||||
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
|
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { CopyToClipboard } from 'app/core/components/CopyToClipboard/CopyToClipboard';
|
import { CopyToClipboard } from 'app/core/components/CopyToClipboard/CopyToClipboard';
|
||||||
|
import { LoadingPlaceholder } from '@grafana/ui';
|
||||||
|
|
||||||
interface DsQuery {
|
interface DsQuery {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
@@ -10,7 +11,6 @@ interface DsQuery {
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
panel: any;
|
panel: any;
|
||||||
LoadingPlaceholder: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@@ -177,7 +177,6 @@ export class QueryInspector extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { response, isLoading } = this.state.dsQuery;
|
const { response, isLoading } = this.state.dsQuery;
|
||||||
const { LoadingPlaceholder } = this.props;
|
|
||||||
const { isMocking } = this.state;
|
const { isMocking } = this.state;
|
||||||
const openNodes = this.getNrOfOpenNodes();
|
const openNodes = this.getNrOfOpenNodes();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user