Commit 9e24c094 by Dominik Prokop Committed by GitHub

Transformations: Make transform dropdowns not cropped (#24615)

parent ab12c908
......@@ -14,6 +14,7 @@ interface Props {
allowMultiple?: boolean;
defaultStat?: string;
className?: string;
menuPlacement?: 'auto' | 'bottom' | 'top';
}
export class StatsPicker extends PureComponent<Props> {
......@@ -62,7 +63,7 @@ export class StatsPicker extends PureComponent<Props> {
};
render() {
const { stats, allowMultiple, defaultStat, placeholder, className } = this.props;
const { stats, allowMultiple, defaultStat, placeholder, className, menuPlacement } = this.props;
const select = fieldReducers.selectOptions(stats);
return (
......@@ -75,6 +76,7 @@ export class StatsPicker extends PureComponent<Props> {
options={select.options}
placeholder={placeholder}
onChange={this.onSelectionChange}
menuPlacement={menuPlacement}
/>
);
}
......
......@@ -17,6 +17,7 @@ interface ValuePickerProps<T> {
variant?: ButtonVariant;
size?: ComponentSize;
isFullWidth?: boolean;
menuPlacement?: 'auto' | 'bottom' | 'top';
}
export function ValuePicker<T>({
......@@ -27,6 +28,7 @@ export function ValuePicker<T>({
variant,
size = 'sm',
isFullWidth = true,
menuPlacement,
}: ValuePickerProps<T>) {
const [isPicking, setIsPicking] = useState(false);
......@@ -50,6 +52,7 @@ export function ValuePicker<T>({
setIsPicking(false);
onChange(value);
}}
menuPlacement={menuPlacement}
/>
)}
</>
......
......@@ -201,6 +201,7 @@ export class CalculateFieldTransformerEditor extends React.PureComponent<
stats={[options.reducer]}
onChange={this.onStatsChange}
defaultStat={ReducerID.sum}
menuPlacement="bottom"
/>
</div>
</div>
......@@ -279,12 +280,14 @@ export class CalculateFieldTransformerEditor extends React.PureComponent<
className="min-width-18 gf-form-spacing"
value={options?.left}
onChange={this.onBinaryLeftChanged}
menuPlacement="bottom"
/>
<Select
className="width-8 gf-form-spacing"
options={ops}
value={options.operator ?? ops[0].value}
onChange={this.onBinaryOperationChanged}
menuPlacement="bottom"
/>
<Select
allowCustomValue
......@@ -293,6 +296,7 @@ export class CalculateFieldTransformerEditor extends React.PureComponent<
options={rightNames}
value={options?.right}
onChange={this.onBinaryRightChanged}
menuPlacement="bottom"
/>
</div>
</div>
......@@ -318,6 +322,7 @@ export class CalculateFieldTransformerEditor extends React.PureComponent<
options={calculationModes}
value={calculationModes.find(v => v.value === mode)}
onChange={this.onModeChanged}
menuPlacement="bottom"
/>
</div>
</div>
......
......@@ -30,6 +30,7 @@ export const ReduceTransformerEditor: React.FC<TransformerUIProps<ReduceTransfor
reducers: stats as ReducerID[],
});
}}
menuPlacement="bottom"
/>
</div>
</div>
......
......@@ -33,7 +33,13 @@ export const SeriesToFieldsTransformerEditor: React.FC<TransformerUIProps<Series
<div className="gf-form-inline">
<div className="gf-form gf-form--grow">
<div className="gf-form-label width-8">Field name</div>
<Select options={fieldNameOptions} value={options.byField} onChange={onSelectField} isClearable />
<Select
options={fieldNameOptions}
value={options.byField}
onChange={onSelectField}
isClearable
menuPlacement="bottom"
/>
</div>
</div>
);
......
......@@ -65,6 +65,11 @@ export class TransformationsEditor extends React.PureComponent<Props> {
});
return (
<div
className={css`
max-width: 66%;
`}
>
<ValuePicker
size="md"
variant="secondary"
......@@ -72,7 +77,9 @@ export class TransformationsEditor extends React.PureComponent<Props> {
options={availableTransformers}
onChange={this.onTransformationAdd}
isFullWidth={false}
menuPlacement="bottom"
/>
</div>
);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment