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/panel/graph3/HideSeriesConfigEditor.tsx

32 lines
972 B

import React, { useCallback } from 'react';
import _ from 'lodash';
import { FilterPill, HorizontalGroup } from '@grafana/ui';
import { FieldConfigEditorProps } from '@grafana/data';
import { HideSeriesConfig } from '@grafana/ui/src/components/uPlot/config';
export const SeriesConfigEditor: React.FC<FieldConfigEditorProps<HideSeriesConfig, {}>> = props => {
const { value, onChange } = props;
const onChangeToggle = useCallback(
(prop: keyof HideSeriesConfig) => {
onChange({ ...value, [prop]: !value[prop] });
},
[value, onChange]
);
return (
<HorizontalGroup spacing="xs">
{Object.keys(value).map((key: keyof HideSeriesConfig) => {
return (
<FilterPill
icon={value[key] ? 'eye-slash' : 'eye'}
onClick={() => onChangeToggle(key)}
key={key}
label={_.startCase(key)}
selected={value[key]}
/>
);
})}
</HorizontalGroup>
);
};