mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Improve some types (#64675)
* some type fixes * few more * more type fixes * fix the majority of (window as any) calls * don't make new variable for event * few more * MOAR
This commit is contained in:
@@ -13,7 +13,7 @@ export interface OptionsPaneItemProps {
|
||||
value?: any;
|
||||
description?: string;
|
||||
popularRank?: number;
|
||||
render: () => React.ReactNode;
|
||||
render: () => React.ReactElement;
|
||||
skipField?: boolean;
|
||||
showIf?: () => boolean;
|
||||
overrides?: OptionPaneItemOverrideInfo[];
|
||||
@@ -94,7 +94,7 @@ export class OptionsPaneItemDescriptor {
|
||||
key={key}
|
||||
aria-label={selectors.components.PanelEditor.OptionsPane.fieldLabel(key)}
|
||||
>
|
||||
{render() as React.ReactElement}
|
||||
{render()}
|
||||
</Field>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -167,13 +167,13 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
|
||||
});
|
||||
};
|
||||
|
||||
onPanelOptionsChanged = (options: any) => {
|
||||
onPanelOptionsChanged = (options: PanelModel['options']) => {
|
||||
// we do not need to trigger force update here as the function call below
|
||||
// fires PanelOptionsChangedEvent which we subscribe to above
|
||||
this.props.panel.updateOptions(options);
|
||||
};
|
||||
|
||||
onPanelConfigChanged = (configKey: keyof PanelModel, value: any) => {
|
||||
onPanelConfigChanged = (configKey: keyof PanelModel, value: unknown) => {
|
||||
this.props.panel.setProperty(configKey, value);
|
||||
this.props.panel.render();
|
||||
this.forceUpdate();
|
||||
|
||||
@@ -155,7 +155,7 @@ export function getFieldOverrideCategories(
|
||||
continue;
|
||||
}
|
||||
|
||||
const onPropertyChange = (value: any) => {
|
||||
const onPropertyChange = (value: DynamicConfigValue) => {
|
||||
override.properties[propIdx].value = value;
|
||||
onOverrideChange(idx, override);
|
||||
};
|
||||
|
||||
@@ -82,8 +82,8 @@ export function getVisualizationOptions(props: OptionPaneRenderProps): OptionsPa
|
||||
};
|
||||
|
||||
const access: NestedValueAccess = {
|
||||
getValue: (path: string) => lodashGet(currentOptions, path),
|
||||
onChange: (path: string, value: any) => {
|
||||
getValue: (path) => lodashGet(currentOptions, path),
|
||||
onChange: (path, value) => {
|
||||
const newOptions = setOptionImmutably(currentOptions, path, value);
|
||||
onPanelOptionsChanged(newOptions);
|
||||
},
|
||||
|
||||
@@ -56,8 +56,8 @@ export interface OptionPaneRenderProps {
|
||||
data?: PanelData;
|
||||
dashboard: DashboardModel;
|
||||
instanceState: any;
|
||||
onPanelConfigChange: (configKey: keyof PanelModel, value: any) => void;
|
||||
onPanelOptionsChanged: (options: any) => void;
|
||||
onPanelConfigChange: (configKey: keyof PanelModel, value: unknown) => void;
|
||||
onPanelOptionsChanged: (options: PanelModel['options']) => void;
|
||||
onFieldConfigsChange: (config: FieldConfigSource) => void;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user