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/public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx

29 lines
812 B

import { Input } from '@grafana/ui';
import { debounce } from 'lodash';
import React, { FunctionComponent, useState } from 'react';
import { QueryEditorRow } from '.';
import { INPUT_WIDTH } from '../constants';
export interface Props {
refId: string;
onChange: (alias: any) => void;
value?: string;
}
export const AliasBy: FunctionComponent<Props> = ({ refId, value = '', onChange }) => {
const [alias, setAlias] = useState(value ?? '');
const propagateOnChange = debounce(onChange, 1000);
onChange = (e: any) => {
setAlias(e.target.value);
propagateOnChange(e.target.value);
};
return (
<QueryEditorRow label="Alias by" htmlFor={`${refId}-alias-by`}>
<Input id={`${refId}-alias-by`} width={INPUT_WIDTH} value={alias} onChange={onChange} />
</QueryEditorRow>
);
};