diff --git a/grafana-plugin/src/components/GForm/GForm.module.scss b/grafana-plugin/src/components/GForm/GForm.module.scss deleted file mode 100644 index 66629f6a..00000000 --- a/grafana-plugin/src/components/GForm/GForm.module.scss +++ /dev/null @@ -1,7 +0,0 @@ -.collapse { - margin-bottom: 16px; -} - -.label { - margin-bottom: 16px; -} diff --git a/grafana-plugin/src/components/GForm/GForm.tsx b/grafana-plugin/src/components/GForm/GForm.tsx deleted file mode 100644 index 317ca06e..00000000 --- a/grafana-plugin/src/components/GForm/GForm.tsx +++ /dev/null @@ -1,306 +0,0 @@ -import React from 'react'; - -import { Field, Form, FormFieldErrors, Input, InputControl, Label, Select, Switch, TextArea } from '@grafana/ui'; -import { capitalCase } from 'change-case'; -import cn from 'classnames/bind'; -import { isEmpty } from 'lodash-es'; - -import { Collapse } from 'components/Collapse/Collapse'; -import { FormItem, FormItemType } from 'components/GForm/GForm.types'; -import { MonacoEditor } from 'components/MonacoEditor/MonacoEditor'; -import { MONACO_READONLY_CONFIG } from 'components/MonacoEditor/MonacoEditor.config'; -import { Text } from 'components/Text/Text'; -import { GSelect } from 'containers/GSelect/GSelect'; -import { RemoteSelect } from 'containers/RemoteSelect/RemoteSelect'; - -import styles from './GForm.module.scss'; - -const cx = cn.bind(styles); - -export interface CustomFieldSectionRendererProps { - control: any; - formItem: FormItem; - errors: any; - register: any; - setValue: (fieldName: string, fieldValue: any) => void; - getValues: (fieldName: string | string[]) => T; -} - -interface GFormProps { - form: { name: string; fields: FormItem[] }; - data: any; - onSubmit: (data: any) => void; - onChange?: (formIsValid: boolean) => void; - - customFieldSectionRenderer?: React.FC; - onFieldRender?: ( - formItem: FormItem, - disabled: boolean, - renderedControl: React.ReactElement, - values: any, - setValue: (value: string) => void - ) => React.ReactElement; -} - -const nullNormalizer = (value: string) => { - return value || null; -}; - -function renderFormControl( - formItem: FormItem, - register: any, - control: any, - disabled: boolean, - onChangeFn: (field, value) => void -) { - switch (formItem.type) { - case FormItemType.Input: - return ( - onChangeFn(undefined, value)} - /> - ); - - case FormItemType.Password: - return ( - onChangeFn(undefined, value)} - /> - ); - - case FormItemType.TextArea: - return ( -