AlignmentPeriods.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import React, { SFC } from 'react';
  2. import _ from 'lodash';
  3. import { StackdriverPicker } from './StackdriverPicker';
  4. import { alignmentPeriods } from '../constants';
  5. export interface Props {
  6. onChange: (alignmentPeriod) => void;
  7. templateSrv: any;
  8. alignmentPeriod: string;
  9. }
  10. export const AlignmentPeriods: SFC<Props> = ({ alignmentPeriod, templateSrv, onChange }) => {
  11. return (
  12. <React.Fragment>
  13. <div className="gf-form-inline">
  14. <div className="gf-form">
  15. <label className="gf-form-label query-keyword width-9">Alignment Period</label>
  16. <StackdriverPicker
  17. onChange={value => onChange(value)}
  18. selected={alignmentPeriod}
  19. templateVariables={templateSrv.variables}
  20. options={alignmentPeriods.map(ap => ({
  21. ...ap,
  22. label: ap.text,
  23. }))}
  24. searchable={true}
  25. placeholder="Select Alignment"
  26. className="width-15"
  27. groupName="Alignment Options"
  28. />
  29. </div>
  30. </div>
  31. </React.Fragment>
  32. );
  33. };