Skip to content

Instantly share code, notes, and snippets.

@torkelo
Last active November 16, 2021 09:02
Show Gist options
  • Save torkelo/bcf1e5d2ad466bd77602dfdf41dfe648 to your computer and use it in GitHub Desktop.
Save torkelo/bcf1e5d2ad466bd77602dfdf41dfe648 to your computer and use it in GitHub Desktop.
Run button fixed width
diff --git a/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx b/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx
index 1c215b7668..70331efb08 100644
--- a/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx
+++ b/packages/grafana-ui/src/components/RefreshPicker/RefreshPicker.tsx
@@ -1,4 +1,4 @@
-import React, { PureComponent } from 'react';
+import React, { CSSProperties, PureComponent } from 'react';
import formatDuration from 'date-fns/formatDuration';
import { SelectableValue, parseDuration } from '@grafana/data';
import { ButtonSelect } from '../Dropdown/ButtonSelect';
@@ -54,7 +54,7 @@ export class RefreshPicker extends PureComponent<Props> {
}
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 variant = this.getVariant();
@@ -74,6 +74,7 @@ export class RefreshPicker extends PureComponent<Props> {
variant={variant}
icon={isLoading ? 'fa fa-spinner' : 'sync'}
data-testid={selectors.components.RefreshPicker.runButtonV2}
+ style={width ? { width } : undefined}
>
{text}
</ToolbarButton>
diff --git a/public/app/features/explore/RunButton.tsx b/public/app/features/explore/RunButton.tsx
index 25be71ae58..1ad5aea158 100644
--- a/public/app/features/explore/RunButton.tsx
+++ b/public/app/features/explore/RunButton.tsx
@@ -36,6 +36,7 @@ export function RunButton(props: Props) {
onRefresh={() => onRun(loading)}
noIntervalPicker={!showDropdown}
primary={true}
+ width={'108px'}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment