fix: avoid error on typing colon (#6056)
* fix: avoid error on typing colon * Fix eslint errors * Update CHANGELOG.md * fix eslint error * Requested changes from reviewpull/6060/head
parent
5b27f15d64
commit
ff78803fa9
|
@ -1,3 +1,7 @@
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
1. [#6056](https://github.com/influxdata/chronograf/pull/6056): Fix error on typing colon
|
||||||
|
|
||||||
## v1.10.1
|
## v1.10.1
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
"@types/react-dnd": "^2.0.36",
|
"@types/react-dnd": "^2.0.36",
|
||||||
"@types/react-dnd-html5-backend": "^2.1.9",
|
"@types/react-dnd-html5-backend": "^2.1.9",
|
||||||
"@types/react-dom": "^16.8.4",
|
"@types/react-dom": "^16.8.4",
|
||||||
|
"@types/react-onclickoutside": "^6.7.4",
|
||||||
"@types/react-router": "^3.0.15",
|
"@types/react-router": "^3.0.15",
|
||||||
"@types/react-router-redux": "4",
|
"@types/react-router-redux": "4",
|
||||||
"@types/react-virtualized": "^9.18.3",
|
"@types/react-virtualized": "^9.18.3",
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
import React, {FunctionComponent, MouseEvent} from 'react'
|
import React, {Component, MouseEvent} from 'react'
|
||||||
import OnClickOutside from 'react-onclickoutside'
|
import OnClickOutside from 'react-onclickoutside'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import {Template} from 'src/types'
|
import {Template} from 'src/types'
|
||||||
|
|
||||||
|
interface TempVar {
|
||||||
|
tempVar: string
|
||||||
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
templates: Template[]
|
templates: Template[]
|
||||||
selected: Template
|
selected: TempVar
|
||||||
onMouseOverTempVar: (
|
onMouseOverTempVar: (
|
||||||
template: Template
|
template: Template
|
||||||
) => (e: MouseEvent<HTMLDivElement>) => void
|
) => (e: MouseEvent<HTMLDivElement>) => void
|
||||||
|
@ -14,27 +18,35 @@ interface Props {
|
||||||
template: Template
|
template: Template
|
||||||
) => (e: MouseEvent<HTMLDivElement>) => void
|
) => (e: MouseEvent<HTMLDivElement>) => void
|
||||||
}
|
}
|
||||||
const TemplateDrawer: FunctionComponent<Props> = ({
|
|
||||||
templates,
|
// TemplateDrawer must be a class component,
|
||||||
selected,
|
// functional components are not supported by react-onclickoutside
|
||||||
onMouseOverTempVar,
|
class TemplateDrawer extends Component<Props> {
|
||||||
onClickTempVar,
|
constructor(props: Props | Readonly<Props>) {
|
||||||
}) => (
|
super(props)
|
||||||
<div className="template-drawer">
|
}
|
||||||
{templates.map(t => (
|
|
||||||
<div
|
public render(): React.ReactNode {
|
||||||
className={classnames('template-drawer--item', {
|
const {templates, selected, onMouseOverTempVar, onClickTempVar} = this.props
|
||||||
'template-drawer--selected': t.tempVar === selected.tempVar,
|
|
||||||
})}
|
return (
|
||||||
onMouseOver={onMouseOverTempVar(t)}
|
<div className="template-drawer">
|
||||||
onMouseDown={onClickTempVar(t)}
|
{templates.map(t => (
|
||||||
key={t.tempVar}
|
<div
|
||||||
>
|
className={classnames('template-drawer--item', {
|
||||||
{' '}
|
'template-drawer--selected': t.tempVar === selected.tempVar,
|
||||||
{t.tempVar}{' '}
|
})}
|
||||||
|
onMouseOver={onMouseOverTempVar(t)}
|
||||||
|
onMouseDown={onClickTempVar(t)}
|
||||||
|
key={t.tempVar}
|
||||||
|
>
|
||||||
|
{' '}
|
||||||
|
{t.tempVar}{' '}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
))}
|
)
|
||||||
</div>
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
export default OnClickOutside(TemplateDrawer)
|
export default OnClickOutside(TemplateDrawer)
|
||||||
|
|
|
@ -2663,6 +2663,13 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "^16"
|
"@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":
|
"@types/react-redux@^7.1.20":
|
||||||
version "7.1.23"
|
version "7.1.23"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.23.tgz#3c2bb1bcc698ae69d70735f33c5a8e95f41ac528"
|
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.23.tgz#3c2bb1bcc698ae69d70735f33c5a8e95f41ac528"
|
||||||
|
|
Loading…
Reference in New Issue