Alignments.tsx 1023 B

123456789101112131415161718192021222324252627282930313233
  1. import React, { FC } from 'react';
  2. import _ from 'lodash';
  3. import { MetricSelect } from 'app/core/components/Select/MetricSelect';
  4. import { TemplateSrv } from 'app/features/templating/template_srv';
  5. import { SelectOptionItem } from '@grafana/ui';
  6. export interface Props {
  7. onChange: (perSeriesAligner: any) => void;
  8. templateSrv: TemplateSrv;
  9. alignOptions: Array<SelectOptionItem<string>>;
  10. perSeriesAligner: string;
  11. }
  12. export const Alignments: FC<Props> = ({ perSeriesAligner, templateSrv, onChange, alignOptions }) => {
  13. return (
  14. <>
  15. <div className="gf-form-group">
  16. <div className="gf-form offset-width-9">
  17. <label className="gf-form-label query-keyword width-15">Aligner</label>
  18. <MetricSelect
  19. onChange={onChange}
  20. value={perSeriesAligner}
  21. variables={templateSrv.variables}
  22. options={alignOptions}
  23. placeholder="Select Alignment"
  24. className="width-15"
  25. />
  26. </div>
  27. </div>
  28. </>
  29. );
  30. };