diff --git a/src/ConfigEditor.tsx b/src/ConfigEditor.tsx index 194b87a..eba3249 100644 --- a/src/ConfigEditor.tsx +++ b/src/ConfigEditor.tsx @@ -1,10 +1,8 @@ import React, { ChangeEvent } from 'react'; -import { LegacyForms } from '@grafana/ui'; +import { InlineField, SecretInput } from '@grafana/ui'; import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; import { MyDataSourceOptions, MySecureJsonData } from './shared/types'; -const { SecretFormField } = LegacyForms; - interface Props extends DataSourcePluginOptionsEditorProps {} export const ConfigEditor: React.FC = ({ onOptionsChange, options }) => { @@ -34,19 +32,15 @@ export const ConfigEditor: React.FC = ({ onOptionsChange, options }) => { }; return ( -
-
- -
-
+ + + ); }; diff --git a/src/QueryEditor.tsx b/src/QueryEditor.tsx index a8dd98e..e7f1a9c 100644 --- a/src/QueryEditor.tsx +++ b/src/QueryEditor.tsx @@ -1,10 +1,10 @@ import React, { useState } from 'react'; -import { Input, LegacyForms, Select } from '@grafana/ui'; +import { Input, InlineField, InlineFieldRow, Select, useStyles2 } from '@grafana/ui'; import { QueryEditorProps, SelectableValue } from '@grafana/data'; +import { css } from '@emotion/css'; import { DataSource } from './datasource'; import { MyDataSourceOptions, MyQuery } from './shared/types'; import { useFetchSpaces } from 'shared/hooks/useFetchSpaces'; -import './styles.css'; import { useFetchRooms } from 'shared/hooks/useFetchRooms'; import { useFetchContexts } from 'shared/hooks/useFetchContexts'; import { useFetchNodes } from 'shared/hooks/useFetchNodes'; @@ -15,9 +15,14 @@ import PubSub from 'pubsub-js'; type Props = QueryEditorProps; -const { FormField } = LegacyForms; +const getStyles = () => ({ + mt: css` + margin-top: 8px; + `, +}); const QueryEditor: React.FC = ({ datasource, query, range, onChange, onRunQuery }) => { + const styles = useStyles2(getStyles); const { baseUrl } = datasource; const from = range!.from.valueOf(); const to = range!.to.valueOf(); @@ -266,143 +271,117 @@ const QueryEditor: React.FC = ({ datasource, query, range, onChange, onRu return ( <> -
- - } - /> - - - } - /> -
- -
- - } - /> -
-
- - } - /> - - - } - /> -
- -
- - } - /> - + + + + + + + + + + + + + + + - } - /> - - } - /> -
- -
- - } - /> - - } - /> -
- -
- } /> + grow + > + + + + + + + + + + + + + +
-
+
); }; diff --git a/src/styles.css b/src/styles.css deleted file mode 100644 index 0b5a333..0000000 --- a/src/styles.css +++ /dev/null @@ -1,14 +0,0 @@ -.mt { - margin-top: 1em; -} - -.flex { - display: flex; - justify-content: space-between; -} -.flex > * { - flex: 1; -} -.flex .gf-form-input { - width: 100% !important; -} diff --git a/yarn.lock b/yarn.lock index edee5db..f476e81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6621,7 +6621,7 @@ react-custom-scrollbars-2@4.5.0: prop-types "^15.5.10" raf "^3.1.0" -"react-data-grid@github:grafana/react-data-grid#a922856b5ede21d55db3fdffb6d38dc76bdc7c58": +react-data-grid@grafana/react-data-grid#a922856b5ede21d55db3fdffb6d38dc76bdc7c58: version "7.0.0-beta.56" resolved "https://codeload.github.com/grafana/react-data-grid/tar.gz/a922856b5ede21d55db3fdffb6d38dc76bdc7c58" dependencies: @@ -7460,8 +7460,16 @@ string-template@~0.2.1: resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" integrity sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -7543,7 +7551,14 @@ string_decoder@0.10: resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" integrity sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -8249,8 +8264,16 @@ word-wrap@^1.2.5: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==