2019-01-17 16:27:43 +08:00
|
|
|
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';
|
2019-01-15 06:43:31 +08:00
|
|
|
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;
|
2019-01-15 06:43:31 +08:00
|
|
|
templateSrv: TemplateSrv;
|
|
|
|
|
alignOptions: SelectOptionItem[];
|
2018-12-20 00:12:50 +08:00
|
|
|
perSeriesAligner: string;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-17 16:27:43 +08:00
|
|
|
export const Alignments: FC<Props> = ({ perSeriesAligner, templateSrv, onChange, alignOptions }) => {
|
2018-12-20 18:26:05 +08:00
|
|
|
return (
|
2019-01-08 20:00:31 +08:00
|
|
|
<>
|
2018-12-20 18:26:05 +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
|
2019-01-15 01:23:01 +08:00
|
|
|
onChange={onChange}
|
2019-01-02 22:07:38 +08:00
|
|
|
value={perSeriesAligner}
|
|
|
|
|
variables={templateSrv.variables}
|
2018-12-20 18:26:05 +08:00
|
|
|
options={alignOptions}
|
|
|
|
|
placeholder="Select Alignment"
|
|
|
|
|
className="width-15"
|
|
|
|
|
/>
|
2018-12-20 00:12:50 +08:00
|
|
|
</div>
|
2018-12-20 18:26:05 +08:00
|
|
|
</div>
|
2019-01-08 20:00:31 +08:00
|
|
|
</>
|
2018-12-20 18:26:05 +08:00
|
|
|
);
|
|
|
|
|
};
|