mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Datasource: updates PromExploreQueryEditor - rewrite to functional component * Datasource: updates PromQueryField - moves an extra field from children to the separate prop * Datasource: adds PromExploreExtraField * Datasource: updates PromExploreQueryEditor - fixes typo * Datasource: updates prometheus explore editor snapshots * Datasource: updates PromExploreExtraField export * Datasource: removes unnecessary div from PromExploreQueryEditor * Datasource: adds basic PromExploreExtraField snapshot test * Datasource: adds basic PromExploreQueryEditor test * Datasource: updates PromExploreQueryEditor snapshot to fix timezone issues * Datasource: updates PromExploreQueryEditor - onChangeQueryStep cleanup * Datasource: updates PromExploreQueryEditor test to check ExtraFieldElement render * Datasource: simplified PromExploreQueryEditor onStepChange method * Datasource: updates Prometheus module import * Datasource: updates PromExploreQueryEditor test * Datasource: updates PromExploreQueryEditor tests * Datasource: fixes PromExploreQueryEditor error on empty interval init * Datasource: adds a tooltip to PromExploreExtraField mounted in PromExploreQueryEditor * Datasource: updates PromExploreQueryEditor snapshots
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
// Libraries
|
|
import React, { memo } from 'react';
|
|
|
|
// Types
|
|
import { FormLabel } from '@grafana/ui';
|
|
|
|
export interface PromExploreExtraFieldProps {
|
|
label: string;
|
|
onChangeFunc: (e: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
onKeyDownFunc: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
value: string;
|
|
hasTooltip?: boolean;
|
|
tooltipContent?: string;
|
|
}
|
|
|
|
export function PromExploreExtraField(props: PromExploreExtraFieldProps) {
|
|
const { label, onChangeFunc, onKeyDownFunc, value, hasTooltip, tooltipContent } = props;
|
|
|
|
return (
|
|
<div className="gf-form-inline explore-input--ml">
|
|
<div className="gf-form">
|
|
<FormLabel width={5} tooltip={hasTooltip ? tooltipContent : null}>
|
|
{label}
|
|
</FormLabel>
|
|
<input
|
|
type={'text'}
|
|
className="gf-form-input width-4"
|
|
placeholder={'auto'}
|
|
onChange={onChangeFunc}
|
|
onKeyDown={onKeyDownFunc}
|
|
value={value}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default memo(PromExploreExtraField);
|