Cleanup
Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Chris Henn <chris.henn@influxdata.com>pull/3546/head
parent
53d0de11c0
commit
0327e5d359
|
@ -71,7 +71,10 @@ export default class TagListItem extends PureComponent<Props, State> {
|
||||||
</div>
|
</div>
|
||||||
{this.state.isOpen && (
|
{this.state.isOpen && (
|
||||||
<>
|
<>
|
||||||
<div className="tag-value-list--header">
|
<div
|
||||||
|
className="tag-value-list--header"
|
||||||
|
onClick={this.handleInputClick}
|
||||||
|
>
|
||||||
<div className="ifql-schema--filter">
|
<div className="ifql-schema--filter">
|
||||||
<input
|
<input
|
||||||
className="form-control input-sm"
|
className="form-control input-sm"
|
||||||
|
@ -80,7 +83,6 @@ export default class TagListItem extends PureComponent<Props, State> {
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
value={searchTerm}
|
value={searchTerm}
|
||||||
onClick={this.handleInputClick}
|
|
||||||
onChange={this.onSearch}
|
onChange={this.onSearch}
|
||||||
/>
|
/>
|
||||||
{this.isSearching && (
|
{this.isSearching && (
|
||||||
|
@ -101,6 +103,7 @@ export default class TagListItem extends PureComponent<Props, State> {
|
||||||
onLoadMoreValues={this.handleLoadMoreValues}
|
onLoadMoreValues={this.handleLoadMoreValues}
|
||||||
isLoadingMoreValues={loadingMore === RemoteDataState.Loading}
|
isLoadingMoreValues={loadingMore === RemoteDataState.Loading}
|
||||||
shouldShowMoreValues={limit < count}
|
shouldShowMoreValues={limit < count}
|
||||||
|
loadMoreCount={this.loadMoreCount}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -136,7 +139,7 @@ export default class TagListItem extends PureComponent<Props, State> {
|
||||||
|
|
||||||
private debouncedOnSearch() {} // See constructor
|
private debouncedOnSearch() {} // See constructor
|
||||||
|
|
||||||
private handleInputClick = (e: MouseEvent<HTMLInputElement>): void => {
|
private handleInputClick = (e: MouseEvent<HTMLDivElement>): void => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +240,12 @@ export default class TagListItem extends PureComponent<Props, State> {
|
||||||
const parsed = parseValuesColumn(response)
|
const parsed = parseValuesColumn(response)
|
||||||
|
|
||||||
if (parsed.length !== 1) {
|
if (parsed.length !== 1) {
|
||||||
throw new Error('Unexpected count response')
|
// We expect to never reach this state; instead, the IFQL server should
|
||||||
|
// return a non-200 status code is handled earlier (after fetching).
|
||||||
|
// This return guards against some unexpected behavior---the IFQL server
|
||||||
|
// returning a 200 status code but ALSO having an error in the CSV
|
||||||
|
// response body
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const count = Number(parsed[0])
|
const count = Number(parsed[0])
|
||||||
|
|
|
@ -3,7 +3,6 @@ import React, {PureComponent, MouseEvent} from 'react'
|
||||||
import TagValueListItem from 'src/ifql/components/TagValueListItem'
|
import TagValueListItem from 'src/ifql/components/TagValueListItem'
|
||||||
import LoadingSpinner from 'src/ifql/components/LoadingSpinner'
|
import LoadingSpinner from 'src/ifql/components/LoadingSpinner'
|
||||||
import {Service, SchemaFilter} from 'src/types'
|
import {Service, SchemaFilter} from 'src/types'
|
||||||
import {explorer} from 'src/ifql/constants'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
service: Service
|
service: Service
|
||||||
|
|
|
@ -12,6 +12,11 @@ const parseValuesColumn = (resp: string): string[] => {
|
||||||
|
|
||||||
const tags = results.reduce<string[]>((acc, result: ScriptResult) => {
|
const tags = results.reduce<string[]>((acc, result: ScriptResult) => {
|
||||||
const colIndex = result.data[0].findIndex(header => header === '_value')
|
const colIndex = result.data[0].findIndex(header => header === '_value')
|
||||||
|
|
||||||
|
if (colIndex === -1) {
|
||||||
|
return [...acc]
|
||||||
|
}
|
||||||
|
|
||||||
const resultTags = result.data.slice(1).map(row => row[colIndex])
|
const resultTags = result.data.slice(1).map(row => row[colIndex])
|
||||||
|
|
||||||
return [...acc, ...resultTags]
|
return [...acc, ...resultTags]
|
||||||
|
|
Loading…
Reference in New Issue