Help.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import React from 'react';
  2. import { Project } from './Project';
  3. export interface Props {
  4. datasource: any;
  5. }
  6. interface State {
  7. displayHelp: boolean;
  8. displaRawQuery: boolean;
  9. }
  10. export class Help extends React.Component<Props, State> {
  11. state: State = {
  12. displayHelp: false,
  13. displaRawQuery: false,
  14. };
  15. handleHelpClicked() {
  16. this.setState({ displayHelp: !this.state.displayHelp });
  17. }
  18. handleRawQueryClicked() {
  19. this.setState({ displayHelp: !this.state.displayHelp });
  20. }
  21. render() {
  22. const { displayHelp, displaRawQuery } = this.state;
  23. const { datasource } = this.props;
  24. return (
  25. <div className="gf-form-inline">
  26. <Project datasource={datasource} />
  27. {/* {displayHelp && ( */}
  28. <div className="gf-form" ng-show="ctrl.lastQueryMeta">
  29. <label className="gf-form-label query-keyword" ng-click="ctrl.showHelp = !ctrl.showHelp">
  30. Show Help
  31. <i className={`fa fa-caret-${displayHelp ? 'down' : 'right'}`} />
  32. </label>
  33. </div>
  34. {/* )} */}
  35. {displaRawQuery && (
  36. <div className="gf-form">
  37. <label className="gf-form-label query-keyword" ng-click="ctrl.showLastQuery = !ctrl.showLastQuery">
  38. Raw Query
  39. <i className={`fa fa-caret-${displaRawQuery ? 'down' : 'right'}`} ng-show="ctrl.showHelp" />
  40. {/* <i className="fa fa-caret-down" ng-show="ctrl.showLastQuery" />
  41. <i className="fa fa-caret-right" ng-hide="ctrl.showLastQuery" /> */}
  42. </label>
  43. </div>
  44. )}
  45. <div className="gf-form gf-form--grow">
  46. <div className="gf-form-label gf-form-label--grow" />
  47. </div>
  48. </div>
  49. );
  50. }
  51. }