mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Improve typing for onPanelConfigChange (#80710)
This commit is contained in:
parent
7c74ab7059
commit
8872a004e2
@ -125,7 +125,7 @@ export function getPanelFrameCategory(props: OptionPaneRenderProps): OptionsPane
|
||||
<RepeatRowSelect
|
||||
id="repeat-by-variable-select"
|
||||
repeat={panel.repeat}
|
||||
onChange={(value?: string | null) => {
|
||||
onChange={(value?: string) => {
|
||||
onPanelConfigChange('repeat', value);
|
||||
}}
|
||||
/>
|
||||
|
@ -56,7 +56,7 @@ export interface OptionPaneRenderProps {
|
||||
data?: PanelData;
|
||||
dashboard: DashboardModel;
|
||||
instanceState: unknown;
|
||||
onPanelConfigChange: (configKey: keyof PanelModel, value: unknown) => void;
|
||||
onPanelConfigChange: <T extends keyof PanelModel>(configKey: T, value: PanelModel[T]) => void;
|
||||
onPanelOptionsChanged: (options: PanelModel['options']) => void;
|
||||
onFieldConfigsChange: (config: FieldConfigSource) => void;
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import { getLastKey, getVariablesByKey } from '../../../variables/state/selector
|
||||
|
||||
export interface Props {
|
||||
id?: string;
|
||||
repeat?: string | null;
|
||||
onChange: (name: string | null) => void;
|
||||
repeat?: string;
|
||||
onChange: (name?: string) => void;
|
||||
}
|
||||
|
||||
export const RepeatRowSelect = ({ repeat, onChange, id }: Props) => {
|
||||
|
@ -7,7 +7,7 @@ import { RowOptionsModal } from './RowOptionsModal';
|
||||
|
||||
export interface RowOptionsButtonProps {
|
||||
title: string;
|
||||
repeat?: string | null;
|
||||
repeat?: string;
|
||||
onUpdate: OnRowOptionsUpdate;
|
||||
warning?: React.ReactNode;
|
||||
}
|
||||
|
@ -9,15 +9,15 @@ export type OnRowOptionsUpdate = (title: string, repeat?: string | null) => void
|
||||
|
||||
export interface Props {
|
||||
title: string;
|
||||
repeat?: string | null;
|
||||
repeat?: string;
|
||||
onUpdate: OnRowOptionsUpdate;
|
||||
onCancel: () => void;
|
||||
warning?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const RowOptionsForm = ({ repeat, title, warning, onUpdate, onCancel }: Props) => {
|
||||
const [newRepeat, setNewRepeat] = useState<string | null | undefined>(repeat);
|
||||
const onChangeRepeat = useCallback((name?: string | null) => setNewRepeat(name), [setNewRepeat]);
|
||||
const [newRepeat, setNewRepeat] = useState<string | undefined>(repeat);
|
||||
const onChangeRepeat = useCallback((name?: string) => setNewRepeat(name), [setNewRepeat]);
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
@ -7,7 +7,7 @@ import { OnRowOptionsUpdate, RowOptionsForm } from './RowOptionsForm';
|
||||
|
||||
export interface RowOptionsModalProps {
|
||||
title: string;
|
||||
repeat?: string | null;
|
||||
repeat?: string;
|
||||
warning?: React.ReactNode;
|
||||
onDismiss: () => void;
|
||||
onUpdate: OnRowOptionsUpdate;
|
||||
|
Loading…
Reference in New Issue
Block a user