grafana/public/app/plugins/datasource/stackdriver/components/Alignments.tsx

34 lines
1005 B
TypeScript
Raw Normal View History

import React, { FC } from 'react';
2018-12-20 00:12:50 +08:00
import _ from 'lodash';
2019-01-02 22:07:38 +08:00
import { MetricSelect } from 'app/core/components/Select/MetricSelect';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { SelectOptionItem } from '@grafana/ui';
2018-12-20 00:12:50 +08:00
export interface Props {
2018-12-22 06:21:55 +08:00
onChange: (perSeriesAligner) => void;
templateSrv: TemplateSrv;
alignOptions: SelectOptionItem[];
2018-12-20 00:12:50 +08:00
perSeriesAligner: string;
}
export const Alignments: FC<Props> = ({ perSeriesAligner, templateSrv, onChange, alignOptions }) => {
return (
2019-01-08 20:00:31 +08:00
<>
<div className="gf-form-group">
<div className="gf-form offset-width-9">
<label className="gf-form-label query-keyword width-15">Aligner</label>
2019-01-02 22:07:38 +08:00
<MetricSelect
onChange={onChange}
2019-01-02 22:07:38 +08:00
value={perSeriesAligner}
variables={templateSrv.variables}
options={alignOptions}
placeholder="Select Alignment"
className="width-15"
/>
2018-12-20 00:12:50 +08:00
</div>
</div>
2019-01-08 20:00:31 +08:00
</>
);
};