The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/packages/grafana-ui/src/components/Tabs/TabsBar.tsx

44 lines
1.1 KiB

import { css, cx } from '@emotion/css';
import { forwardRef, ReactNode } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
import { useStyles2 } from '../../themes';
export interface Props {
/** Children should be a single <Tab /> or an array of <Tab /> */
children: ReactNode;
className?: string;
/** For hiding the bottom border (on PageHeader for example) */
hideBorder?: boolean;
}
export const TabsBar = forwardRef<HTMLDivElement, Props>(({ children, className, hideBorder = false }, ref) => {
const styles = useStyles2(getStyles);
return (
<div className={cx(styles.tabsWrapper, hideBorder && styles.noBorder, className)} ref={ref}>
<div className={styles.tabs} role="tablist">
Query History: Move local storage specific settings to persistence layer (#47500) * Load Rich History when the container is opened * Store rich history for each pane separately * Do not update currently opened query history when an item is added It's impossible to figure out if the item should be added or not, because filters are applied in the backend. We don't want to replicate that filtering logic in frontend. One way to make it work could be by refreshing both panes. * Test starring and deleting query history items when both panes are open * Remove e2e dependency on ExploreId * Fix unit test * Assert exact queries * Simplify test * Fix e2e tests * Fix toolbar a11y * Reload the history after an item is added * Fix unit test * Remove references to Explore from generic PageToolbar component * Update test name * Fix test assertion * Add issue item to TODO * Improve test assertion * Simplify test setup * Move query history settings to persistence layer * Fix test import * Fix unit test * Fix unit test * Test local storage settings API * Code formatting * Fix linting errors * Add an integration test * Add missing aria role * Fix a11y issues * Fix a11y issues * Use divs instead of ul/li Otherwis,e pa11y-ci reports the error below claiming there are no children with role=tab: Certain ARIA roles must contain particular children (https://dequeuniversity.com/rules/axe/4.3/aria-required-children?application=axeAPI) (#reactRoot > div > main > div:nth-child(3) > div > div:nth-child(1) > div > div:nth-child(1) > div > div > nav > div:nth-child(2) > ul) <ul class="css-af3vye" role="tablist"><li class="css-1ciwanz"><a href...</ul> * Clean up settings tab * Remove redundant aria label * Remove redundant container * Clean up test assertions
3 years ago
{children}
</div>
</div>
);
});
const getStyles = (theme: GrafanaTheme2) => ({
tabsWrapper: css({
borderBottom: `1px solid ${theme.colors.border.weak}`,
overflowX: 'auto',
}),
noBorder: css({
borderBottom: 0,
}),
tabs: css({
position: 'relative',
display: 'flex',
alignItems: 'center',
}),
});
TabsBar.displayName = 'TabsBar';