Merge pull request #18165 from influxdata/update-flux-lsp-0.5.8

chore: update flux-lsp to 0.5.8
pull/18172/head
Brandon Farmer 2020-05-19 14:19:40 -07:00 committed by GitHub
commit ebbc8025b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 5 deletions

View File

@ -132,7 +132,7 @@
"dependencies": {
"@influxdata/clockface": "2.2.0",
"@influxdata/flux": "^0.5.1",
"@influxdata/flux-lsp-browser": "^0.5.6",
"@influxdata/flux-lsp-browser": "^0.5.8",
"@influxdata/giraffe": "0.18.0",
"@influxdata/influx": "0.5.5",
"@influxdata/influxdb-templates": "0.9.0",

View File

@ -90,6 +90,22 @@ const queryTagKeys = async (orgID, bucket) => {
return raw
}
const queryTagValues = async (orgID, bucket, tag) => {
if (!orgID || orgID === '') {
throw new Error('no org is provided')
}
const query = `import "influxdata/influxdb/v1"
v1.tagValues(bucket:"${bucket}", tag: "${tag}")`
const raw = await runQuery(orgID, query).promise
if (raw.type !== 'SUCCESS') {
throw new Error('failed to get tagKeys')
}
return raw
}
export class LSPServer {
private server: WASMServer
private messageID: number = 0
@ -103,6 +119,7 @@ export class LSPServer {
this.server.register_buckets_callback(this.getBuckets)
this.server.register_measurements_callback(this.getMeasurements)
this.server.register_tag_keys_callback(this.getTagKeys)
this.server.register_tag_values_callback(this.getTagValues)
this.store = reduxStore
}
@ -116,6 +133,16 @@ export class LSPServer {
}
}
getTagValues = async (bucket, tag) => {
try {
const response = await queryTagValues(this.orgID, bucket, tag)
return parseQueryResponse(response)
} catch (e) {
console.error(e)
return []
}
}
getBuckets = () => {
return Promise.resolve(this.buckets)
}

View File

@ -1016,10 +1016,10 @@
resolved "https://registry.yarnpkg.com/@influxdata/clockface/-/clockface-2.2.0.tgz#73f09f4832d6b6bad53af029844a11dd6562527e"
integrity sha512-pIQPJXjvVgzcryhAjgZPSoC5BRLbQb1sIIY9l6KQCg4DWJkxqFC/sPI7qJItRXd8kiPXbfbHvXGAwqIY+TdWNQ==
"@influxdata/flux-lsp-browser@^0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@influxdata/flux-lsp-browser/-/flux-lsp-browser-0.5.6.tgz#ca0d57c713ca4bbca4828b9c26b86c3ec4781249"
integrity sha512-9NP4zl2nLNy4C9lyGfqf09C41w1ENINXg1X5O+LZFgqbc2oRF3HyZFgDbUfPRgsWUAQrjahSNm29bt/KnOgy2w==
"@influxdata/flux-lsp-browser@^0.5.8":
version "0.5.8"
resolved "https://registry.yarnpkg.com/@influxdata/flux-lsp-browser/-/flux-lsp-browser-0.5.8.tgz#95372a08d0d6179efcbed58bc0c4230a17ad9d5b"
integrity sha512-uaza9uZ6IBt9CWNJs4Cfpa3uSt3AsErfy9xKpjUVkuUYOWmJb3qtqAj7mnWzSjvOjRBXbB3ghHkgOnivxTis+g==
"@influxdata/flux@^0.4.0":
version "0.4.0"