mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* AzureMonitor: tweak experimental-ui after UX discussions. - move metrics up to resource row - allow resources field to take an inlineField prop and a labelWidth prop. Eventually once the feature toggle is removed the inlineField prop will be the only code branch in Field.tsx. * AzureMonitor: remove devmode req for azureMonitorExperimentalUI flag * refactor: consolidate logic branch for inline Field
25 lines
785 B
TypeScript
25 lines
785 B
TypeScript
import React from 'react';
|
|
|
|
import { EditorField } from '@grafana/experimental';
|
|
import { config } from '@grafana/runtime';
|
|
import { InlineField } from '@grafana/ui';
|
|
import { Props as InlineFieldProps } from '@grafana/ui/src/components/Forms/InlineField';
|
|
|
|
interface Props extends InlineFieldProps {
|
|
label: string;
|
|
inlineField?: boolean;
|
|
labelWidth?: number;
|
|
}
|
|
|
|
const DEFAULT_LABEL_WIDTH = 18;
|
|
|
|
export const Field = (props: Props) => {
|
|
const { labelWidth, inlineField, ...remainingProps } = props;
|
|
|
|
if (config.featureToggles.azureMonitorExperimentalUI && !inlineField) {
|
|
return <EditorField width={labelWidth || DEFAULT_LABEL_WIDTH} {...remainingProps} />;
|
|
} else {
|
|
return <InlineField labelWidth={labelWidth || DEFAULT_LABEL_WIDTH} {...remainingProps} />;
|
|
}
|
|
};
|