Canvas: Add all options to inline editor (#52834)

Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
Ryan McKinley
2022-07-27 16:20:39 -07:00
committed by GitHub
parent cb3f7ccd09
commit 8a2d40c2bc
6 changed files with 46 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
import React, { FC, useCallback } from 'react';
import React, { useCallback } from 'react';
import { AppEvents, StandardEditorProps, StandardEditorsRegistryItem, StringFieldConfigSettings } from '@grafana/data';
import { config, getBackendSrv } from '@grafana/runtime';
@@ -39,8 +39,9 @@ export const callApi = (api: APIEditorConfig, isTest = false) => {
}
};
export const APIEditor: FC<StandardEditorProps<APIEditorConfig, any, any>> = (props) => {
const { value, context, onChange } = props;
type Props = StandardEditorProps<APIEditorConfig, any, any>;
export function APIEditor({ value, context, onChange }: Props) {
const labelWidth = 9;
const onEndpointChange = useCallback(
@@ -117,4 +118,4 @@ export const APIEditor: FC<StandardEditorProps<APIEditorConfig, any, any>> = (pr
) : (
<>Must enable disableSanitizeHtml feature flag to access</>
);
};
}

View File

@@ -1,4 +1,4 @@
import React, { FC } from 'react';
import React from 'react';
import { useObservable } from 'react-use';
import { Subject } from 'rxjs';
@@ -31,7 +31,9 @@ const verticalOptions: Array<SelectableValue<VerticalConstraint>> = [
{ label: 'Scale', value: VerticalConstraint.Scale },
];
export const PlacementEditor: FC<StandardEditorProps<any, CanvasEditorOptions, PanelOptions>> = ({ item }) => {
type Props = StandardEditorProps<any, CanvasEditorOptions, PanelOptions>;
export function PlacementEditor({ item }: Props) {
const settings = item.settings;
// Will force a rerender whenever the subject changes
@@ -136,4 +138,4 @@ export const PlacementEditor: FC<StandardEditorProps<any, CanvasEditorOptions, P
</Field>
</div>
);
};
}