diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f254e21ca..83a23a5928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### Bug Fixes + +1. [#6056](https://github.com/influxdata/chronograf/pull/6056): Fix error on typing colon + ## v1.10.1 ### Features diff --git a/ui/package.json b/ui/package.json index 4a4a2e9553..599a31770d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -71,6 +71,7 @@ "@types/react-dnd": "^2.0.36", "@types/react-dnd-html5-backend": "^2.1.9", "@types/react-dom": "^16.8.4", + "@types/react-onclickoutside": "^6.7.4", "@types/react-router": "^3.0.15", "@types/react-router-redux": "4", "@types/react-virtualized": "^9.18.3", diff --git a/ui/src/shared/components/TemplateDrawer.tsx b/ui/src/shared/components/TemplateDrawer.tsx index 590cd0e33a..0a8ae56f18 100644 --- a/ui/src/shared/components/TemplateDrawer.tsx +++ b/ui/src/shared/components/TemplateDrawer.tsx @@ -1,12 +1,16 @@ -import React, {FunctionComponent, MouseEvent} from 'react' +import React, {Component, MouseEvent} from 'react' import OnClickOutside from 'react-onclickoutside' import classnames from 'classnames' import {Template} from 'src/types' +interface TempVar { + tempVar: string +} + interface Props { templates: Template[] - selected: Template + selected: TempVar onMouseOverTempVar: ( template: Template ) => (e: MouseEvent) => void @@ -14,27 +18,35 @@ interface Props { template: Template ) => (e: MouseEvent) => void } -const TemplateDrawer: FunctionComponent = ({ - templates, - selected, - onMouseOverTempVar, - onClickTempVar, -}) => ( -
- {templates.map(t => ( -
- {' '} - {t.tempVar}{' '} + +// TemplateDrawer must be a class component, +// functional components are not supported by react-onclickoutside +class TemplateDrawer extends Component { + constructor(props: Props | Readonly) { + super(props) + } + + public render(): React.ReactNode { + const {templates, selected, onMouseOverTempVar, onClickTempVar} = this.props + + return ( +
+ {templates.map(t => ( +
+ {' '} + {t.tempVar}{' '} +
+ ))}
- ))} -
-) + ) + } +} export default OnClickOutside(TemplateDrawer) diff --git a/yarn.lock b/yarn.lock index d066086326..dc73246b61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2663,6 +2663,13 @@ dependencies: "@types/react" "^16" +"@types/react-onclickoutside@^6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@types/react-onclickoutside/-/react-onclickoutside-6.7.4.tgz#05b1ec0d31a85999873c51e166f57aefa3f037a4" + integrity sha512-N7EnMhxqb+TaUOGJQUV8YJeL3n5qP5+cXwtWRS/FYW+DSEAb8T3xwNsgZ6wEJMHP4/QpfVHcBaFopFjJ9XBuOg== + dependencies: + "@types/react" "*" + "@types/react-redux@^7.1.20": version "7.1.23" resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.23.tgz#3c2bb1bcc698ae69d70735f33c5a8e95f41ac528"