Skip to content

Commit

Permalink
Canvas: Improve resource picker initialization (grafana#57319)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmarrs authored Oct 24, 2022
1 parent 37b011d commit 9d857f4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .betterer.results
Original file line number Diff line number Diff line change
Expand Up @@ -3955,8 +3955,7 @@ exports[`better eslint`] = {
],
"public/app/features/dimensions/editors/ResourceDimensionEditor.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/features/dimensions/editors/ResourcePicker.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useCallback } from 'react';
import React, { useCallback } from 'react';

import { FieldNamePickerConfigSettings, StandardEditorProps, StandardEditorsRegistryItem } from '@grafana/data';
import { InlineField, InlineFieldRow, RadioButtonGroup } from '@grafana/ui';
Expand All @@ -25,9 +25,9 @@ const dummyFieldSettings: StandardEditorsRegistryItem<string, FieldNamePickerCon
settings: {},
} as any;

export const ResourceDimensionEditor: FC<
StandardEditorProps<ResourceDimensionConfig, ResourceDimensionOptions, any>
> = (props) => {
export const ResourceDimensionEditor = (
props: StandardEditorProps<ResourceDimensionConfig, ResourceDimensionOptions, unknown>
) => {
const { value, context, onChange, item } = props;
const labelWidth = 9;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ export const ResourcePickerPopover = (props: Props) => {
const { dialogProps } = useDialog({}, ref);
const { overlayProps } = useOverlay({ onClose, isDismissable: true, isOpen: true }, ref);

const isURL = value && value.includes('://');
const [newValue, setNewValue] = useState<string>(value ?? '');
const [activePicker, setActivePicker] = useState<PickerTabType>(PickerTabType.Folder);
const [activePicker, setActivePicker] = useState<PickerTabType>(isURL ? PickerTabType.URL : PickerTabType.Folder);
const [formData, setFormData] = useState<FormData>(new FormData());
const [upload, setUpload] = useState<boolean>(false);
const [error, setError] = useState<ErrorResponse>({ message: '' });
Expand Down

0 comments on commit 9d857f4

Please sign in to comment.