diff --git a/dist/partials/config.html b/dist/partials/config.html index cb03db6..6d1e60a 100644 --- a/dist/partials/config.html +++ b/dist/partials/config.html @@ -16,6 +16,35 @@
Wavefront Settings
+
+
+ CSP OAuth Token +
+
+ Configured + Reset + + + + Paste your CSP OAuth token here. You can find and manage your tokens on your profile page in the Wavefront app + +
+
+qqq +
+
+ CSP API Token +
+
+ Configured + Reset + + + Paste your CSP API token here. You can find and manage your tokens on your profile page in the Wavefront app + +
+
+
Timeout (seconds) diff --git a/dist/plugin/configCtrl.d.ts b/dist/plugin/configCtrl.d.ts index e451cd9..e03e4ac 100644 --- a/dist/plugin/configCtrl.d.ts +++ b/dist/plugin/configCtrl.d.ts @@ -2,6 +2,10 @@ export declare class WavefrontConfigCtrl { static templateUrl: string; current: any; wavefrontTokenExists: boolean; + cspApiTokenExists: boolean; + cspOAuthExists: boolean; constructor(); resetWavefrontToken(): void; + resetCspApiToken(): void; + resetCspOAuth(): void; } diff --git a/dist/plugin/configCtrl.js b/dist/plugin/configCtrl.js index ba086b1..098e2da 100644 --- a/dist/plugin/configCtrl.js +++ b/dist/plugin/configCtrl.js @@ -8,12 +8,25 @@ System.register([], function (exports_1, context_1) { WavefrontConfigCtrl = (function () { function WavefrontConfigCtrl() { this.wavefrontTokenExists = false; + this.cspApiTokenExists = false; + this.cspOAuthExists = false; this.wavefrontTokenExists = (this.current.jsonData.wavefrontToken != null && this.current.jsonData.wavefrontToken !== ""); + this.cspApiTokenExists = (this.current.jsonData.cspAPIToken != null && this.current.jsonData.cspAPIToken !== ""); + this.cspOAuthExists = (this.current.jsonData.cspOAuthClientId != null && this.current.jsonData.cspOAuthClientSecret !== ""); } WavefrontConfigCtrl.prototype.resetWavefrontToken = function () { this.current.jsonData.wavefrontToken = ""; this.wavefrontTokenExists = false; }; + WavefrontConfigCtrl.prototype.resetCspApiToken = function () { + this.current.jsonData.cspAPIToken = ""; + this.cspApiTokenExists = false; + }; + WavefrontConfigCtrl.prototype.resetCspOAuth = function () { + this.current.jsonData.cspOAuthClientId = ""; + this.current.jsonData.cspOAuthClientSecret = ""; + this.cspOAuthExists = false; + }; WavefrontConfigCtrl.templateUrl = "partials/config.html"; return WavefrontConfigCtrl; }()); diff --git a/dist/plugin/configCtrl.js.map b/dist/plugin/configCtrl.js.map index a2e4655..1be4ef3 100644 --- a/dist/plugin/configCtrl.js.map +++ b/dist/plugin/configCtrl.js.map @@ -1 +1 @@ -{"version":3,"file":"configCtrl.js","sourceRoot":"","sources":["../../src/plugin/configCtrl.ts"],"names":[],"mappings":";;;;;;;;gBAMI;oBAFO,yBAAoB,GAAG,KAAK,CAAC;oBAGhC,IAAI,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC;gBAC9H,CAAC;gBAEM,iDAAmB,GAA1B;oBACI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,GAAG,EAAE,CAAC;oBAC1C,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;gBACtC,CAAC;gBAZM,+BAAW,GAAG,sBAAsB,CAAC;gBAahD,0BAAC;aAAA,AAdD"} \ No newline at end of file +{"version":3,"file":"configCtrl.js","sourceRoot":"","sources":["../../src/plugin/configCtrl.ts"],"names":[],"mappings":";;;;;;;;gBAQI;oBAJO,yBAAoB,GAAG,KAAK,CAAC;oBAC7B,sBAAiB,GAAG,KAAK,CAAC;oBAC1B,mBAAc,GAAG,KAAK,CAAC;oBAG1B,IAAI,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC;oBAC1H,IAAI,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,EAAE,CAAC,CAAC;oBACjH,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,KAAK,EAAE,CAAC,CAAC;gBAChI,CAAC;gBAEM,iDAAmB,GAA1B;oBACI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,GAAG,EAAE,CAAC;oBAC1C,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;gBACtC,CAAC;gBAEM,8CAAgB,GAAvB;oBACI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,GAAG,EAAE,CAAC;oBACvC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;gBACnC,CAAC;gBAEM,2CAAa,GAApB;oBACI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,GAAG,EAAE,CAAC;oBAC5C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,GAAG,EAAE,CAAC;oBAChD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;gBAChC,CAAC;gBA3BM,+BAAW,GAAG,sBAAsB,CAAC;gBA4BhD,0BAAC;aAAA,AA7BD"} \ No newline at end of file diff --git a/dist/plugin/datasource.js b/dist/plugin/datasource.js index d05bad1..177f1f6 100644 --- a/dist/plugin/datasource.js +++ b/dist/plugin/datasource.js @@ -8,7 +8,7 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr } return t; }; - var lodash_1, functions_1, helpers_1, backendSrvCanelledRetriesDecorator_1, queryKeyLookbackMillis; + var lodash_1, functions_1, helpers_1, backendSrvCanelledRetriesDecorator_1, queryKeyLookbackMillis, CSP_API_TOKEN_URL, CSP_OAUTH_TOKEN_URL; var __moduleName = context_1 && context_1.id; function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSrv) { var _this = this; @@ -19,6 +19,9 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr this.backendSrv = new backendSrvCanelledRetriesDecorator_1.default(backendSrv, $q); this.templateSrv = templateSrv; this.defaultRequestTimeoutSecs = 15; + var appId = instanceSettings.jsonData.cspOAuthClientId; + var appSecret = instanceSettings.jsonData.cspOAuthClientSecret; + var credentials = "Basic " + btoa(appId + ":" + appSecret); this.requestConfigProto = { headers: { "Content-Type": "application/json", @@ -28,6 +31,45 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr if (instanceSettings.jsonData.wavefrontToken) { this.requestConfigProto.headers["X-AUTH-TOKEN"] = instanceSettings.jsonData.wavefrontToken; } + else if (instanceSettings.jsonData.cspAPIToken) { + try { + fetch(CSP_API_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "api_token": instanceSettings.jsonData.cspAPIToken, + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + } + }) + .then(function (response) { return response.json(); }) + .then(function (json) { return console.log(json); }); + } + catch (e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } + else if (instanceSettings.jsonData.cspOAuthClientId && instanceSettings.jsonData.cspOAuthClientSecret) { + try { + fetch(CSP_OAUTH_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "grant_type": "client_credentials", + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "Authorization": credentials + } + }) + .then(function (response) { return response.json(); }) + .then(function (json) { return console.log(json); }); + } + catch (e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } else { this.requestConfigProto.withCredentials = true; } @@ -407,6 +449,50 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }); return _this.backendSrv.datasourceRequest(reqConfig); }; + function refreshToken() { + if (instanceSettings.jsonData.cspAPIToken) { + try { + fetch(CSP_API_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "api_token": instanceSettings.jsonData.cspAPIToken, + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + } + }) + .then(function (response) { return response.json(); }) + .then(function (json) { return console.log(json); }); + } + catch (e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } + else if (instanceSettings.jsonData.cspOAuthClientId && instanceSettings.jsonData.cspOAuthClientSecret) { + try { + fetch(CSP_OAUTH_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "grant_type": "client_credentials", + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "Authorization": credentials + } + }) + .then(function (response) { return response.json(); }) + .then(function (json) { return console.log(json); }); + } + catch (e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } + console.log("Refreshed token!"); + } + refreshToken(); + var interval = setInterval(refreshToken, 25 * 60 * 1000); } exports_1("WavefrontDatasource", WavefrontDatasource); return { @@ -426,6 +512,8 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr ], execute: function () { queryKeyLookbackMillis = 7 * 24 * 60 * 60 * 1000; + CSP_API_TOKEN_URL = "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize"; + CSP_OAUTH_TOKEN_URL = "https://console.cloud.vmware.com/csp/gateway/am/api/auth/authorize"; } }; }); diff --git a/dist/plugin/datasource.js.map b/dist/plugin/datasource.js.map index 66f44f0..d79c262 100644 --- a/dist/plugin/datasource.js.map +++ b/dist/plugin/datasource.js.map @@ -1 +1 @@ -{"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../src/plugin/datasource.ts"],"names":[],"mappings":";;;;;;;;;;;;IAQA,6BAAoC,gBAAgB,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW;QAAjF,iBA6fC;QA5fG,IAAI,CAA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BACrC,CAAC;wBACF,OAAO,EAAE;4BACL,cAAc,EAAE,kDAAkD;4BAClE,eAAe,EAAE,WAAW;yBAC/B;qBACJ,CAAC;yBACD,IAAI,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,IAAI,EAAE,EAAf,CAAe,CAAC;yBACnC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAjB,CAAiB,CAAC,CAAC;iBACtC;gBAAC,OAAM,CAAC,EAAE;oBACP,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBACpB;gBACD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC;aACxG;YACD,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC;QAGD,YAAY,EAAE,CAAC;QAGf,IAAM,QAAQ,GAAG,WAAW,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAEjE,CAAC;;;;;;;;;;;;;;;;;;YA1mBK,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YACjD,iBAAiB,GAAG,+EAA+E,CAAC;YACpG,mBAAmB,GAAG,oEAAoE,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index d709af0..91c9a2e 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,12 @@ "author": "", "license": "ISC", "dependencies": { - "@types/angular": "^1.6.2", - "@types/lodash": "^4.14.50", + "@types/angular": "^1.6.56", "@types/jquery": "^2.0.41", "typescript": "^2.1.5" }, "devDependencies": { + "@types/lodash": "^4.14.112", "tslint": "^4.3.1" } } diff --git a/src/partials/config.html b/src/partials/config.html index cb03db6..6d1e60a 100644 --- a/src/partials/config.html +++ b/src/partials/config.html @@ -16,6 +16,35 @@
Wavefront Settings
+
+
+ CSP OAuth Token +
+
+ Configured + Reset + + + + Paste your CSP OAuth token here. You can find and manage your tokens on your profile page in the Wavefront app + +
+
+qqq +
+
+ CSP API Token +
+
+ Configured + Reset + + + Paste your CSP API token here. You can find and manage your tokens on your profile page in the Wavefront app + +
+
+
Timeout (seconds) diff --git a/src/plugin/configCtrl.ts b/src/plugin/configCtrl.ts index 127264a..4dde513 100644 --- a/src/plugin/configCtrl.ts +++ b/src/plugin/configCtrl.ts @@ -3,13 +3,28 @@ export class WavefrontConfigCtrl { public current: any; public wavefrontTokenExists = false; + public cspApiTokenExists = false; + public cspOAuthExists = false; constructor() { this.wavefrontTokenExists = (this.current.jsonData.wavefrontToken != null && this.current.jsonData.wavefrontToken !== ""); + this.cspApiTokenExists = (this.current.jsonData.cspAPIToken != null && this.current.jsonData.cspAPIToken !== ""); + this.cspOAuthExists = (this.current.jsonData.cspOAuthClientId != null && this.current.jsonData.cspOAuthClientSecret !== ""); } public resetWavefrontToken() { this.current.jsonData.wavefrontToken = ""; this.wavefrontTokenExists = false; } + + public resetCspApiToken() { + this.current.jsonData.cspAPIToken = ""; + this.cspApiTokenExists = false; + } + + public resetCspOAuth() { + this.current.jsonData.cspOAuthClientId = ""; + this.current.jsonData.cspOAuthClientSecret = ""; + this.cspOAuthExists = false; + } } diff --git a/src/plugin/datasource.ts b/src/plugin/datasource.ts index 4676bdf..eef5205 100644 --- a/src/plugin/datasource.ts +++ b/src/plugin/datasource.ts @@ -5,6 +5,8 @@ import angular from "angular"; import BackendSrvCancelledRetriesDecorator from './backendSrvCanelledRetriesDecorator'; const queryKeyLookbackMillis = 7 * 24 * 60 * 60 * 1000; +const CSP_API_TOKEN_URL = "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize"; +const CSP_OAUTH_TOKEN_URL = "https://console.cloud.vmware.com/csp/gateway/am/api/auth/authorize"; export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSrv) { this.url = sanitizeUrl(instanceSettings.url); @@ -15,6 +17,9 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr this.backendSrv = new BackendSrvCancelledRetriesDecorator(backendSrv, $q); this.templateSrv = templateSrv; this.defaultRequestTimeoutSecs = 15; + const appId = instanceSettings.jsonData.cspOAuthClientId + const appSecret = instanceSettings.jsonData.cspOAuthClientSecret + const credentials = `Basic ${btoa(`${appId}:${appSecret}`)}`; this.requestConfigProto = { headers: { @@ -25,11 +30,47 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr if (instanceSettings.jsonData.wavefrontToken) { this.requestConfigProto.headers["X-AUTH-TOKEN"] = instanceSettings.jsonData.wavefrontToken; - } else { + } else if (instanceSettings.jsonData.cspAPIToken) { + try { + fetch(CSP_API_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "api_token": instanceSettings.jsonData.cspAPIToken, + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + } + }) + .then((response) => response.json()) + .then((json) => console.log(json)); + } catch(e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } else if (instanceSettings.jsonData.cspOAuthClientId && instanceSettings.jsonData.cspOAuthClientSecret) { + try { + fetch(CSP_OAUTH_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "grant_type": "client_credentials", + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "Authorization": credentials + } + }) + .then((response) => response.json()) + .then((json) => console.log(json)); + } catch(e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + }else { this.requestConfigProto.withCredentials = true; } const getUserString = () => { + let result = ""; const span = $("span[class='dashboard-title ng-binding']"); @@ -54,12 +95,13 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr const userString = getUserString(); this.query = (options: IGrafanaPluginDataSourceQueryOptions): angular.IPromise => { + // Query Window const startSecs = dateToEpochSeconds(options.range.from); + const endSecs = dateToEpochSeconds(options.range.to); const intervalSecs = intervalToSeconds(options.interval); const numPoints = Math.floor(Math.min(options.maxDataPoints, Math.floor((endSecs - startSecs) / intervalSecs))) || 4000; - const baseEvent = { autoEvents: false, e: endSecs, i: true, listMode: false, n: userString, p: numPoints, s: startSecs, strict: true, }; @@ -117,6 +159,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.testDatasource = () => { + return this.requestAutocomplete("grafanaDatasourceTest").then((result) => { return { message: "Successfully connected to Wavefront! " + "(" + result.status + ")", status: "success", title: "Success", @@ -159,6 +202,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.metricFindQuery = (options: any) => { + const target = typeof (options) === "string" ? options : options.target; const boundedQuery = this.templateSrv.replace(target); @@ -228,6 +272,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchQuery = (query: string, position: number) => { + query = query || ""; const boundedQuery = this.templateSrv.replace(query); @@ -239,6 +284,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.interpolateVariablesInQueries = (queries: DataQuery[]): DataQuery[] => { + if (queries && queries.length > 0) { return queries.map(query => { return { @@ -251,6 +297,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr } this.matchMetric = (metric: string) => { + metric = metric || ""; const metricQuery = "ts(" + metric.trim(); @@ -263,12 +310,14 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchMetricTS = (query: string) => { + return this.requestQueryKeysLookup(query.trim()).then((result) => { return result.data.metrics || []; }, (result) => []); }; this.matchSource = (metric: string, host: string, scopedVars: any) => { + let query = "ts(\"" + stripQuotesAndTrim(metric) + "\", source=\"" + sanitizePartial(host) + "\")"; query = this.templateSrv.replace(query, scopedVars); @@ -278,12 +327,14 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchSourceTS = (query: string) => { + return this.requestQueryKeysLookup(query.trim()).then((result) => { return result.data.hosts || []; }, (result) => []); }; this.matchSourceTag = (partialName: any) => { + partialName = partialName || ""; partialName = partialName.toLowerCase(); @@ -300,18 +351,21 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchSourceTagTS = (query: string) => { + return this.requestQueryKeysLookup(query.trim(), true).then((result) => { return result.data.hostTags || []; }, (result) => []); }; this.matchMatchingSourceTagTS = (query: string) => { + return this.requestQueryKeysLookup(query.trim(), true).then((result) => { return result.data.matchingHostTags || []; }, (result) => []); }; this.matchPointTag = (partialTag: any, target: any, scopedVars: any) => { + partialTag = partialTag || ""; partialTag = partialTag.toLowerCase(); if (partialTag === "*") { @@ -339,6 +393,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTagTS = (query: string) => { + return this.requestQueryKeysLookup(query.trim()).then((result) => { // Generate all Point tags for the query const allTags = {}; @@ -350,6 +405,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTagValue = (tag: any, partialValue: any, target: any, scopedVars: any) => { + // Don't try to autocomplete if the corresponding tag name is empty if (!tag) { return []; @@ -378,6 +434,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTagValueTS = (tag: string, query: string) => { + return this.requestQueryKeysLookup(query.trim()).then((result) => { // Generate all Point tag values under the tag for the query const allValues = {}; @@ -391,6 +448,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.requestQueryKeysLookup = (query, includeHostTags?) => { + const lookbackStartSecs = Math.floor((new Date().getTime() - queryKeyLookbackMillis) / 1000); const request = { @@ -415,6 +473,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.makeQuery = (target, scopedVars?, ignoreFunctions?, ...args: any[]) => { + let query; if (target.textEditor) { @@ -429,6 +488,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.buildQuery = (target, ignoreFunctions?, ...args: any[]) => { + if (!target.metric) { return ""; } @@ -461,6 +521,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.buildFilterString = (tags) => { + let result = ""; _.each(tags, (component) => { switch (component.type) { @@ -502,7 +563,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr */ this.requestAutocomplete = (expression, position?) => { let pos = position; - // default is to autocomplete the last symbol if (!pos && pos !== 0) { pos = expression.length; @@ -515,4 +575,51 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr return this.backendSrv.datasourceRequest(reqConfig); }; + + function refreshToken() { + if (instanceSettings.jsonData.cspAPIToken) { + try { + fetch(CSP_API_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "api_token": instanceSettings.jsonData.cspAPIToken, + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + } + }) + .then((response) => response.json()) + .then((json) => console.log(json)); + } catch(e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } else if (instanceSettings.jsonData.cspOAuthClientId && instanceSettings.jsonData.cspOAuthClientSecret) { + try { + fetch(CSP_OAUTH_TOKEN_URL, { + method: "POST", + body: JSON.stringify({ + "grant_type": "client_credentials", + }), + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "Authorization": credentials + } + }) + .then((response) => response.json()) + .then((json) => console.log(json)); + } catch(e) { + console.error(e); + } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; + } + console.log("Refreshed token!"); + } + + // Execute the function initially + refreshToken(); + + // Execute the function every 25 minutes (25 * 60 * 1000 milliseconds) + const interval = setInterval(refreshToken, 25 * 60 * 1000); + }