mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Select: Don't portal by default * Select: Portal all the Selects * Fix indendentation in this comment * Select: Remove @example docs until formatting is correct * Docs: Add some documentation for the Select changes * Update docs/sources/whatsnew/whats-new-in-v8-1.md Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Update docs/sources/whatsnew/whats-new-in-v8-1.md Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Update packages/grafana-ui/src/components/Select/types.ts Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Update public/app/core/components/TransformersUI/configFromQuery/ConfigFromQueryTransformerEditor.tsx Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Update public/app/core/components/TransformersUI/configFromQuery/ConfigFromQueryTransformerEditor.tsx Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Update public/app/core/components/TransformersUI/configFromQuery/ConfigFromQueryTransformerEditor.tsx Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Update public/app/core/components/TransformersUI/prepareTimeSeries/PrepareTimeSeriesEditor.tsx Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> * Docs: Variants instead of varients * Update public/app/core/components/TransformersUI/configFromQuery/ConfigFromQueryTransformerEditor.tsx Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com> Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com>
26 lines
963 B
TypeScript
26 lines
963 B
TypeScript
import { SelectableValue } from '@grafana/data';
|
|
import { Select } from '@grafana/ui';
|
|
import { SelectBaseProps } from '@grafana/ui/src/components/Select/types';
|
|
import { GrafanaAlertStateDecision } from 'app/types/unified-alerting-dto';
|
|
import React, { FC, useMemo } from 'react';
|
|
|
|
type Props = Omit<SelectBaseProps<GrafanaAlertStateDecision>, 'options'> & {
|
|
includeNoData: boolean;
|
|
};
|
|
|
|
const options: SelectableValue[] = [
|
|
{ value: GrafanaAlertStateDecision.Alerting, label: 'Alerting' },
|
|
{ value: GrafanaAlertStateDecision.NoData, label: 'No Data' },
|
|
{ value: GrafanaAlertStateDecision.OK, label: 'OK' },
|
|
];
|
|
|
|
export const GrafanaAlertStatePicker: FC<Props> = ({ includeNoData, ...props }) => {
|
|
const opts = useMemo(() => {
|
|
if (includeNoData) {
|
|
return options;
|
|
}
|
|
return options.filter((opt) => opt.value !== GrafanaAlertStateDecision.NoData);
|
|
}, [includeNoData]);
|
|
return <Select menuShouldPortal options={opts} {...props} />;
|
|
};
|