mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Reduce spacing for Explore/Logs switches (#44935)
This commit is contained in:
@@ -47,12 +47,11 @@ export interface InlineSwitchProps extends Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const InlineSwitch = React.forwardRef<HTMLInputElement, InlineSwitchProps>(
|
export const InlineSwitch = React.forwardRef<HTMLInputElement, InlineSwitchProps>(
|
||||||
({ transparent, showLabel, label, value, id, ...props }, ref) => {
|
({ transparent, className, showLabel, label, value, id, ...props }, ref) => {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = getSwitchStyles(theme, transparent);
|
const styles = getSwitchStyles(theme, transparent);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.inlineContainer}>
|
<div className={cx(styles.inlineContainer, className)}>
|
||||||
{showLabel && (
|
{showLabel && (
|
||||||
<label
|
<label
|
||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
|
|||||||
@@ -316,24 +316,43 @@ class UnthemedLogs extends PureComponent<Props, State> {
|
|||||||
) : undefined}
|
) : undefined}
|
||||||
<div className={styles.logOptions} ref={this.topLogsRef}>
|
<div className={styles.logOptions} ref={this.topLogsRef}>
|
||||||
<InlineFieldRow>
|
<InlineFieldRow>
|
||||||
<InlineField label="Time" transparent>
|
<InlineField label="Time" className={styles.horizontalInlineLabel} transparent>
|
||||||
<InlineSwitch value={showTime} onChange={this.onChangeTime} transparent id="show-time" />
|
<InlineSwitch
|
||||||
|
value={showTime}
|
||||||
|
onChange={this.onChangeTime}
|
||||||
|
className={styles.horizontalInlineSwitch}
|
||||||
|
transparent
|
||||||
|
id="show-time"
|
||||||
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="Unique labels" transparent>
|
<InlineField label="Unique labels" className={styles.horizontalInlineLabel} transparent>
|
||||||
<InlineSwitch value={showLabels} onChange={this.onChangeLabels} transparent id="unique-labels" />
|
<InlineSwitch
|
||||||
|
value={showLabels}
|
||||||
|
onChange={this.onChangeLabels}
|
||||||
|
className={styles.horizontalInlineSwitch}
|
||||||
|
transparent
|
||||||
|
id="unique-labels"
|
||||||
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="Wrap lines" transparent>
|
<InlineField label="Wrap lines" className={styles.horizontalInlineLabel} transparent>
|
||||||
<InlineSwitch value={wrapLogMessage} onChange={this.onChangewrapLogMessage} transparent id="wrap-lines" />
|
<InlineSwitch
|
||||||
|
value={wrapLogMessage}
|
||||||
|
onChange={this.onChangewrapLogMessage}
|
||||||
|
className={styles.horizontalInlineSwitch}
|
||||||
|
transparent
|
||||||
|
id="wrap-lines"
|
||||||
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="Prettify JSON" transparent>
|
<InlineField label="Prettify JSON" className={styles.horizontalInlineLabel} transparent>
|
||||||
<InlineSwitch
|
<InlineSwitch
|
||||||
value={prettifyLogMessage}
|
value={prettifyLogMessage}
|
||||||
onChange={this.onChangePrettifyLogMessage}
|
onChange={this.onChangePrettifyLogMessage}
|
||||||
|
className={styles.horizontalInlineSwitch}
|
||||||
transparent
|
transparent
|
||||||
id="prettify"
|
id="prettify"
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="Dedup" transparent>
|
<InlineField label="Dedup" className={styles.horizontalInlineLabel} transparent>
|
||||||
<RadioButtonGroup
|
<RadioButtonGroup
|
||||||
options={Object.values(LogsDedupStrategy).map((dedupType) => ({
|
options={Object.values(LogsDedupStrategy).map((dedupType) => ({
|
||||||
label: capitalize(dedupType),
|
label: capitalize(dedupType),
|
||||||
@@ -452,8 +471,16 @@ const getStyles = (theme: GrafanaTheme2, wrapLogMessage: boolean) => {
|
|||||||
headerButton: css`
|
headerButton: css`
|
||||||
margin: ${theme.spacing(0.5, 0, 0, 1)};
|
margin: ${theme.spacing(0.5, 0, 0, 1)};
|
||||||
`,
|
`,
|
||||||
|
horizontalInlineLabel: css`
|
||||||
|
> label {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
horizontalInlineSwitch: css`
|
||||||
|
padding: 0 ${theme.spacing(1)} 0 0;
|
||||||
|
`,
|
||||||
radioButtons: css`
|
radioButtons: css`
|
||||||
margin: 0 ${theme.spacing(1)};
|
margin: 0;
|
||||||
`,
|
`,
|
||||||
logsSection: css`
|
logsSection: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user