Consume types from client 1.5 (#14372)

* Bump js client version

* Fix types after client version
pull/14378/head
Deniz Kusefoglu 2019-07-18 10:19:08 -07:00 committed by GitHub
parent 331b1dbd3b
commit 403e97c460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 19 deletions

View File

@ -141,7 +141,7 @@
"dependencies": {
"@influxdata/clockface": "0.0.13",
"@influxdata/giraffe": "0.16.0",
"@influxdata/influx": "0.4.0",
"@influxdata/influx": "0.5.0",
"@influxdata/influxdb-templates": "0.2.0",
"@influxdata/react-custom-scrollbars": "4.3.8",
"axios": "^0.19.0",

View File

@ -2,24 +2,24 @@
import {isInQuery} from 'src/variables/utils/hydrateVars'
// Types
import {QueryView} from 'src/types/dashboards'
import {IVariable as Variable, View} from '@influxdata/influx'
import {QueryViewProperties, View, ViewProperties} from 'src/types'
import {IVariable as Variable} from '@influxdata/influx'
function isQueryViewProperties(vp: ViewProperties): vp is QueryViewProperties {
return (vp as QueryViewProperties).queries !== undefined
}
/*
Given a collection variables and a collection of views, return only the
variables that are used in at least one of the view queries.
*/
export const filterUnusedVars = (variables: Variable[], views: View[]) => {
const queryViews: QueryView[] = views.filter(
view => !!view.properties.queries
)
const viewProperties = views.map(v => v.properties)
const queryViewProperties = viewProperties.filter(isQueryViewProperties)
const queryTexts = queryViews.reduce(
(acc, view) => [
...acc,
...view.properties.queries.map(query => query.text),
],
[]
const queryTexts = queryViewProperties.reduce(
(acc, vp) => [...acc, ...vp.queries.map(query => query.text)],
[] as Array<string>
)
const varsInUse = variables.filter(variable =>

View File

@ -3,8 +3,8 @@ import {Color} from 'src/types/colors'
import {
IDashboard as DashboardAPI,
View as ViewAPI,
Cell as CellAPI,
ViewLinks,
} from '@influxdata/influx'
export enum Scale {
@ -94,8 +94,10 @@ export interface MarkDownProperties {
text: string
}
export interface View<T extends ViewProperties = ViewProperties>
extends ViewAPI {
export interface View<T extends ViewProperties = ViewProperties> {
links?: ViewLinks
id?: string
name?: string
properties?: T
dashboardID?: string
cellID?: string
@ -135,6 +137,7 @@ export type QueryViewProperties = Extract<
>
export type WorkingView<T extends ViewProperties> = View<T> | NewView<T>
export type QueryView = WorkingView<QueryViewProperties>
/**

View File

@ -753,10 +753,10 @@
resolved "https://registry.yarnpkg.com/@influxdata/giraffe/-/giraffe-0.16.0.tgz#b04a304460a7c9449fe1a9fa2a3f5db97949e916"
integrity sha512-nDVQgx5Lq3fjsMXTzYwzf0HXKjSxzsBJibitObwtE0wefpzU4LW0IEUrcCBNIQyXj1OxyBNL9a67gZ4DyV7M2w==
"@influxdata/influx@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@influxdata/influx/-/influx-0.4.0.tgz#8ca2a8696134d2a9c326b600dcebfacc95c63473"
integrity sha512-zNtqrjP/FmtrzxUPC3erRtIxJjuQPLhEc1w/dVKsgL4nkS+NsfEnZ1M2dMDWp0qrirS1JZir0ejFod1MuwenbA==
"@influxdata/influx@0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@influxdata/influx/-/influx-0.5.0.tgz#dedf688d84a50b526a15362633bd5ee7f1e7a95b"
integrity sha512-P24C5j20RRMX2JT43vTdoSozjZp01rcXxOAoIMR+sDMSMG4XuuckIEEOsdTnP1w+N2ivhjC74MjzmswxKeO0fw==
dependencies:
axios "^0.19.0"