Google Cloud Monitoring: Ensure selectors fit in the screen (#57817)

This commit is contained in:
Andres Martinez Gotor 2022-10-31 12:52:25 +01:00 committed by GitHub
parent 2546437e20
commit ce38840f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 29 deletions

View File

@ -39,6 +39,7 @@ export const Aggregation: FC<Props> = (props) => {
]}
placeholder="Select Reducer"
inputId={`${props.refId}-group-by-function`}
menuPlacement="top"
/>
</EditorField>
);

View File

@ -37,6 +37,7 @@ export const AlignmentFunction: FC<Props> = ({ inputId, query, templateVariableO
]}
placeholder="Select Alignment"
inputId={inputId}
menuPlacement="top"
/>
);
};

View File

@ -1,28 +0,0 @@
import React, { FC, useMemo } from 'react';
import { rangeUtil } from '@grafana/data';
import { ALIGNMENTS } from '../constants';
import CloudMonitoringDatasource from '../datasource';
import { CustomMetaData } from '../types';
export interface Props {
customMetaData: CustomMetaData;
datasource: CloudMonitoringDatasource;
}
export const AlignmentPeriodLabel: FC<Props> = ({ customMetaData, datasource }) => {
const { perSeriesAligner, alignmentPeriod } = customMetaData;
const formatAlignmentText = useMemo(() => {
if (!alignmentPeriod || !perSeriesAligner) {
return '';
}
const alignment = ALIGNMENTS.find((ap) => ap.value === datasource.templateSrv.replace(perSeriesAligner));
const seconds = parseInt(alignmentPeriod ?? ''.replace(/[^0-9]/g, ''), 10);
const hms = rangeUtil.secondsToHms(seconds);
return `${hms} interval (${alignment?.text ?? ''})`;
}, [datasource, perSeriesAligner, alignmentPeriod]);
return <label>{formatAlignmentText}</label>;
};

View File

@ -47,6 +47,7 @@ export const GroupBy: FunctionComponent<Props> = ({
onChange={(options) => {
onChange({ ...query, groupBys: options.map((o) => o.value!) });
}}
menuPlacement="top"
/>
</EditorField>
<Aggregation

View File

@ -54,6 +54,7 @@ export function PeriodSelect({
inputId={inputId}
disabled={disabled}
allowCustomValue
menuPlacement="top"
/>
);
}

View File

@ -5,7 +5,6 @@ export { Alignment } from './Alignment';
export { LabelFilter } from './LabelFilter';
export { AnnotationsHelp } from './AnnotationsHelp';
export { AlignmentFunction } from './AlignmentFunction';
export { AlignmentPeriodLabel } from './AlignmentPeriodLabel';
export { AliasBy } from './AliasBy';
export { Aggregation } from './Aggregation';
export { MetricQueryEditor } from './MetricQueryEditor';