mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Let kbn util infer types (#26907)
* Chore: Let kbn util infer types Type fixes where needed * Address review comments + test fix * Modify kbn method and property names to pascalCase
This commit is contained in:
@@ -13,7 +13,7 @@ export interface Props {
|
||||
templateVariableOptions: Array<SelectableValue<string>>;
|
||||
alignmentPeriod: string;
|
||||
perSeriesAligner: string;
|
||||
usedAlignmentPeriod: string;
|
||||
usedAlignmentPeriod?: number;
|
||||
}
|
||||
|
||||
export const AlignmentPeriods: FC<Props> = ({
|
||||
@@ -25,7 +25,9 @@ export const AlignmentPeriods: FC<Props> = ({
|
||||
usedAlignmentPeriod,
|
||||
}) => {
|
||||
const alignment = alignOptions.find(ap => ap.value === templateSrv.replace(perSeriesAligner));
|
||||
const formatAlignmentText = `${kbn.secondsToHms(usedAlignmentPeriod)} interval (${alignment ? alignment.text : ''})`;
|
||||
const formatAlignmentText = usedAlignmentPeriod
|
||||
? `${kbn.secondsToHms(usedAlignmentPeriod)} interval (${alignment ? alignment.text : ''})`
|
||||
: '';
|
||||
const options = alignmentPeriods.map(ap => ({
|
||||
...ap,
|
||||
label: ap.text,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SelectableValue } from '@grafana/data';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
usedAlignmentPeriod: string;
|
||||
usedAlignmentPeriod?: number;
|
||||
variableOptionGroup: SelectableValue<string>;
|
||||
onChange: (query: MetricQuery) => void;
|
||||
onRunQuery: () => void;
|
||||
|
||||
@@ -67,7 +67,7 @@ export class QueryEditor extends PureComponent<Props, State> {
|
||||
const sloQuery = { ...defaultSLOQuery, ...query.sloQuery, projectName: datasource.getDefaultProject() };
|
||||
const queryType = query.queryType || QueryType.METRICS;
|
||||
const meta = this.props.data?.series.length ? this.props.data?.series[0].meta : {};
|
||||
const usedAlignmentPeriod = meta?.alignmentPeriod as string;
|
||||
const usedAlignmentPeriod = meta?.alignmentPeriod;
|
||||
const variableOptionGroup = {
|
||||
label: 'Template Variables',
|
||||
expanded: false,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SLOQuery } from '../types';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
|
||||
export interface Props {
|
||||
usedAlignmentPeriod: string;
|
||||
usedAlignmentPeriod?: number;
|
||||
variableOptionGroup: SelectableValue<string>;
|
||||
onChange: (query: SLOQuery) => void;
|
||||
onRunQuery: () => void;
|
||||
|
||||
Reference in New Issue
Block a user