mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Fix button "Run query" width (#32655) * Minor refactoring for simpler fix * Removed new prop Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
parent
0da6ac2efa
commit
e4cc41dd5b
@ -54,7 +54,7 @@ export class RefreshPicker extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { onRefresh, intervals, tooltip, value, text, isLoading, noIntervalPicker } = this.props;
|
const { onRefresh, intervals, tooltip, value, text, isLoading, noIntervalPicker, width } = this.props;
|
||||||
|
|
||||||
const currentValue = value || '';
|
const currentValue = value || '';
|
||||||
const variant = this.getVariant();
|
const variant = this.getVariant();
|
||||||
@ -73,6 +73,7 @@ export class RefreshPicker extends PureComponent<Props> {
|
|||||||
onClick={onRefresh}
|
onClick={onRefresh}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
icon={isLoading ? 'fa fa-spinner' : 'sync'}
|
icon={isLoading ? 'fa fa-spinner' : 'sync'}
|
||||||
|
style={width ? { width } : undefined}
|
||||||
data-testid={selectors.components.RefreshPicker.runButtonV2}
|
data-testid={selectors.components.RefreshPicker.runButtonV2}
|
||||||
>
|
>
|
||||||
{text}
|
{text}
|
||||||
|
@ -15,14 +15,16 @@ export type Props = {
|
|||||||
export function RunButton(props: Props) {
|
export function RunButton(props: Props) {
|
||||||
const { isSmall, loading, onRun, onChangeRefreshInterval, refreshInterval, showDropdown, isLive } = props;
|
const { isSmall, loading, onRun, onChangeRefreshInterval, refreshInterval, showDropdown, isLive } = props;
|
||||||
const intervals = getTimeSrv().getValidIntervals(defaultIntervals);
|
const intervals = getTimeSrv().getValidIntervals(defaultIntervals);
|
||||||
let text: string | undefined;
|
let text: string | undefined = loading ? 'Cancel' : 'Run query';
|
||||||
|
let width = '108px';
|
||||||
|
|
||||||
if (isLive) {
|
if (isLive) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSmall) {
|
if (isSmall) {
|
||||||
text = loading ? 'Cancel' : 'Run query';
|
text = undefined;
|
||||||
|
width = '35px';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -36,6 +38,7 @@ export function RunButton(props: Props) {
|
|||||||
onRefresh={() => onRun(loading)}
|
onRefresh={() => onRun(loading)}
|
||||||
noIntervalPicker={!showDropdown}
|
noIntervalPicker={!showDropdown}
|
||||||
primary={true}
|
primary={true}
|
||||||
|
width={width}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user