mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
32 lines
999 B
TypeScript
32 lines
999 B
TypeScript
import React, { PureComponent } from 'react';
|
|
|
|
import { LinkButton, FilterInput } from '@grafana/ui';
|
|
|
|
export interface Props {
|
|
searchQuery: string;
|
|
setSearchQuery: (value: string) => void;
|
|
linkButton?: { href: string; title: string; disabled?: boolean };
|
|
target?: string;
|
|
placeholder?: string;
|
|
}
|
|
|
|
export default class PageActionBar extends PureComponent<Props> {
|
|
render() {
|
|
const { searchQuery, linkButton, setSearchQuery, target, placeholder = 'Search by name or type' } = this.props;
|
|
const linkProps: typeof LinkButton.defaultProps = { href: linkButton?.href, disabled: linkButton?.disabled };
|
|
|
|
if (target) {
|
|
linkProps.target = target;
|
|
}
|
|
|
|
return (
|
|
<div className="page-action-bar">
|
|
<div className="gf-form gf-form--grow">
|
|
<FilterInput value={searchQuery} onChange={setSearchQuery} placeholder={placeholder} />
|
|
</div>
|
|
{linkButton && <LinkButton {...linkProps}>{linkButton.title}</LinkButton>}
|
|
</div>
|
|
);
|
|
}
|
|
}
|