소스 검색

Changes after PR comments

Hugo Häggmark 7 년 전
부모
커밋
236d7b1213

+ 5 - 9
public/app/features/alerting/TestRuleButton.tsx

@@ -15,10 +15,10 @@ interface State {
 }
 
 export class TestRuleButton extends PureComponent<Props, State> {
-  constructor(props) {
-    super(props);
-    this.state = { isLoading: false, testRuleResponse: {} };
-  }
+  readonly state: State = {
+    isLoading: false,
+    testRuleResponse: {},
+  };
 
   componentDidMount() {
     this.testRule();
@@ -39,10 +39,6 @@ export class TestRuleButton extends PureComponent<Props, State> {
       return <LoadingPlaceholder text="Evaluating rule" />;
     }
 
-    return (
-      <>
-        <JSONFormatter json={testRuleResponse} />
-      </>
-    );
+    return <JSONFormatter json={testRuleResponse} />;
   }
 }

+ 8 - 10
public/app/features/alerting/__snapshots__/TestRuleButton.test.tsx.snap

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

+ 1 - 1
public/app/features/dashboard/dashgrid/EditorTabBody.tsx

@@ -52,7 +52,7 @@ export class EditorTabBody extends PureComponent<Props, State> {
   onToggleToolBarView = (item: EditorToolbarView) => {
     this.setState({
       openView: item,
-      isOpen: this.state.openView !== item ? true : !this.state.isOpen,
+      isOpen: this.state.openView !== item || !this.state.isOpen,
     });
   };