Consume types from client 1.5 (#14372)
* Bump js client version * Fix types after client versionpull/14378/head
parent
331b1dbd3b
commit
403e97c460
|
@ -141,7 +141,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@influxdata/clockface": "0.0.13",
|
"@influxdata/clockface": "0.0.13",
|
||||||
"@influxdata/giraffe": "0.16.0",
|
"@influxdata/giraffe": "0.16.0",
|
||||||
"@influxdata/influx": "0.4.0",
|
"@influxdata/influx": "0.5.0",
|
||||||
"@influxdata/influxdb-templates": "0.2.0",
|
"@influxdata/influxdb-templates": "0.2.0",
|
||||||
"@influxdata/react-custom-scrollbars": "4.3.8",
|
"@influxdata/react-custom-scrollbars": "4.3.8",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
|
|
|
@ -2,24 +2,24 @@
|
||||||
import {isInQuery} from 'src/variables/utils/hydrateVars'
|
import {isInQuery} from 'src/variables/utils/hydrateVars'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {QueryView} from 'src/types/dashboards'
|
import {QueryViewProperties, View, ViewProperties} from 'src/types'
|
||||||
import {IVariable as Variable, View} from '@influxdata/influx'
|
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
|
Given a collection variables and a collection of views, return only the
|
||||||
variables that are used in at least one of the view queries.
|
variables that are used in at least one of the view queries.
|
||||||
*/
|
*/
|
||||||
export const filterUnusedVars = (variables: Variable[], views: View[]) => {
|
export const filterUnusedVars = (variables: Variable[], views: View[]) => {
|
||||||
const queryViews: QueryView[] = views.filter(
|
const viewProperties = views.map(v => v.properties)
|
||||||
view => !!view.properties.queries
|
const queryViewProperties = viewProperties.filter(isQueryViewProperties)
|
||||||
)
|
|
||||||
|
|
||||||
const queryTexts = queryViews.reduce(
|
const queryTexts = queryViewProperties.reduce(
|
||||||
(acc, view) => [
|
(acc, vp) => [...acc, ...vp.queries.map(query => query.text)],
|
||||||
...acc,
|
[] as Array<string>
|
||||||
...view.properties.queries.map(query => query.text),
|
|
||||||
],
|
|
||||||
[]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const varsInUse = variables.filter(variable =>
|
const varsInUse = variables.filter(variable =>
|
||||||
|
|
|
@ -3,8 +3,8 @@ import {Color} from 'src/types/colors'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IDashboard as DashboardAPI,
|
IDashboard as DashboardAPI,
|
||||||
View as ViewAPI,
|
|
||||||
Cell as CellAPI,
|
Cell as CellAPI,
|
||||||
|
ViewLinks,
|
||||||
} from '@influxdata/influx'
|
} from '@influxdata/influx'
|
||||||
|
|
||||||
export enum Scale {
|
export enum Scale {
|
||||||
|
@ -94,8 +94,10 @@ export interface MarkDownProperties {
|
||||||
text: string
|
text: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface View<T extends ViewProperties = ViewProperties>
|
export interface View<T extends ViewProperties = ViewProperties> {
|
||||||
extends ViewAPI {
|
links?: ViewLinks
|
||||||
|
id?: string
|
||||||
|
name?: string
|
||||||
properties?: T
|
properties?: T
|
||||||
dashboardID?: string
|
dashboardID?: string
|
||||||
cellID?: string
|
cellID?: string
|
||||||
|
@ -135,6 +137,7 @@ export type QueryViewProperties = Extract<
|
||||||
>
|
>
|
||||||
|
|
||||||
export type WorkingView<T extends ViewProperties> = View<T> | NewView<T>
|
export type WorkingView<T extends ViewProperties> = View<T> | NewView<T>
|
||||||
|
|
||||||
export type QueryView = WorkingView<QueryViewProperties>
|
export type QueryView = WorkingView<QueryViewProperties>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -753,10 +753,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@influxdata/giraffe/-/giraffe-0.16.0.tgz#b04a304460a7c9449fe1a9fa2a3f5db97949e916"
|
resolved "https://registry.yarnpkg.com/@influxdata/giraffe/-/giraffe-0.16.0.tgz#b04a304460a7c9449fe1a9fa2a3f5db97949e916"
|
||||||
integrity sha512-nDVQgx5Lq3fjsMXTzYwzf0HXKjSxzsBJibitObwtE0wefpzU4LW0IEUrcCBNIQyXj1OxyBNL9a67gZ4DyV7M2w==
|
integrity sha512-nDVQgx5Lq3fjsMXTzYwzf0HXKjSxzsBJibitObwtE0wefpzU4LW0IEUrcCBNIQyXj1OxyBNL9a67gZ4DyV7M2w==
|
||||||
|
|
||||||
"@influxdata/influx@0.4.0":
|
"@influxdata/influx@0.5.0":
|
||||||
version "0.4.0"
|
version "0.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/@influxdata/influx/-/influx-0.4.0.tgz#8ca2a8696134d2a9c326b600dcebfacc95c63473"
|
resolved "https://registry.yarnpkg.com/@influxdata/influx/-/influx-0.5.0.tgz#dedf688d84a50b526a15362633bd5ee7f1e7a95b"
|
||||||
integrity sha512-zNtqrjP/FmtrzxUPC3erRtIxJjuQPLhEc1w/dVKsgL4nkS+NsfEnZ1M2dMDWp0qrirS1JZir0ejFod1MuwenbA==
|
integrity sha512-P24C5j20RRMX2JT43vTdoSozjZp01rcXxOAoIMR+sDMSMG4XuuckIEEOsdTnP1w+N2ivhjC74MjzmswxKeO0fw==
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "^0.19.0"
|
axios "^0.19.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue