mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Switch deprecared toggle group for radio buttons * Create transparent version of field, label and witch * Replace divs wiith components * Move styling from scss to js * Update buttons * Remove log generating file * Update level button
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
import { css, cx } from 'emotion';
|
|
import { GrafanaTheme } from '@grafana/data';
|
|
import { stylesFactory, Button, HorizontalGroup, useTheme } from '@grafana/ui';
|
|
|
|
type Props = {
|
|
addQueryRowButtonDisabled?: boolean;
|
|
addQueryRowButtonHidden?: boolean;
|
|
richHistoryButtonActive?: boolean;
|
|
queryInspectorButtonActive?: boolean;
|
|
|
|
onClickAddQueryRowButton: () => void;
|
|
onClickRichHistoryButton: () => void;
|
|
onClickQueryInspectorButton: () => void;
|
|
};
|
|
|
|
const getStyles = stylesFactory((theme: GrafanaTheme) => {
|
|
return {
|
|
containerMargin: css`
|
|
margin-top: ${theme.spacing.md};
|
|
`,
|
|
};
|
|
});
|
|
export function SecondaryActions(props: Props) {
|
|
const theme = useTheme();
|
|
const styles = getStyles(theme);
|
|
return (
|
|
<div className={styles.containerMargin}>
|
|
<HorizontalGroup>
|
|
{!props.addQueryRowButtonHidden && (
|
|
<Button
|
|
variant="secondary"
|
|
aria-label="Add row button"
|
|
onClick={props.onClickAddQueryRowButton}
|
|
disabled={props.addQueryRowButtonDisabled}
|
|
icon="plus"
|
|
>
|
|
Add query
|
|
</Button>
|
|
)}
|
|
<Button
|
|
variant="secondary"
|
|
aria-label="Rich history button"
|
|
className={cx({ ['explore-active-button']: props.richHistoryButtonActive })}
|
|
onClick={props.onClickRichHistoryButton}
|
|
icon="history"
|
|
>
|
|
Query history
|
|
</Button>
|
|
<Button
|
|
variant="secondary"
|
|
aria-label="Query inspector button"
|
|
className={cx({ ['explore-active-button']: props.queryInspectorButtonActive })}
|
|
onClick={props.onClickQueryInspectorButton}
|
|
icon="info-circle"
|
|
>
|
|
Query inspector
|
|
</Button>
|
|
</HorizontalGroup>
|
|
</div>
|
|
);
|
|
}
|