From fc0389dabd0ecdd8d592afc3b8907dc3ec09c935 Mon Sep 17 00:00:00 2001 From: Kuldeep Doneriya Date: Sun, 26 Nov 2023 22:13:19 +0530 Subject: [PATCH] fixing build issue --- dist/partials/config.html | 15 +++++ dist/plugin/configCtrl.d.ts | 2 + dist/plugin/configCtrl.js | 7 +++ dist/plugin/configCtrl.js.map | 2 +- dist/plugin/datasource.js | 101 +++++++++++++++++++++++----------- dist/plugin/datasource.js.map | 2 +- src/plugin/datasource.ts | 94 +++++++++++++++++-------------- 7 files changed, 149 insertions(+), 74 deletions(-) diff --git a/dist/partials/config.html b/dist/partials/config.html index a6c3599..6d1e60a 100644 --- a/dist/partials/config.html +++ b/dist/partials/config.html @@ -16,6 +16,21 @@
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 diff --git a/dist/plugin/configCtrl.d.ts b/dist/plugin/configCtrl.d.ts index c65ef6c..e03e4ac 100644 --- a/dist/plugin/configCtrl.d.ts +++ b/dist/plugin/configCtrl.d.ts @@ -3,7 +3,9 @@ export declare class WavefrontConfigCtrl { 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 d34994d..098e2da 100644 --- a/dist/plugin/configCtrl.js +++ b/dist/plugin/configCtrl.js @@ -9,8 +9,10 @@ System.register([], function (exports_1, context_1) { 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 = ""; @@ -20,6 +22,11 @@ System.register([], function (exports_1, context_1) { 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 c98e505..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":";;;;;;;;gBAOI;oBAHO,yBAAoB,GAAG,KAAK,CAAC;oBAC7B,sBAAiB,GAAG,KAAK,CAAC;oBAG7B,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;gBACrH,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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C5C,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 3b70a20..177f1f6 100644 --- a/dist/plugin/datasource.js +++ b/dist/plugin/datasource.js @@ -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", @@ -33,7 +36,7 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr fetch(CSP_API_TOKEN_URL, { method: "POST", body: JSON.stringify({ - api_token: instanceSettings.jsonData.cspAPIToken, + "api_token": instanceSettings.jsonData.cspAPIToken, }), headers: { "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" @@ -45,12 +48,32 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr 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; } var getUserString = function () { - console.log("-------getUserString----"); var result = ""; var span = $("span[class='dashboard-title ng-binding']"); if (window && window.grafanaBootData && window.grafanaBootData.user) { @@ -72,20 +95,13 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }; var userString = getUserString(); this.query = function (options) { - console.log("-------query----"); var startSecs = helpers_1.dateToEpochSeconds(options.range.from); var endSecs = helpers_1.dateToEpochSeconds(options.range.to); - console.log("********endSecs", endSecs); - console.log("********options.interval", options.interval); var intervalSecs = helpers_1.intervalToSeconds(options.interval); - console.log("********intervalSecs", intervalSecs); - console.log("*********options.maxDataPoints", options.maxDataPoints); var numPoints = Math.floor(Math.min(options.maxDataPoints, Math.floor((endSecs - startSecs) / intervalSecs))) || 4000; - console.log("********numPoints", numPoints); var baseEvent = { autoEvents: false, e: endSecs, i: true, listMode: false, n: userString, p: numPoints, s: startSecs, strict: true, }; - console.log("********baseEvent", baseEvent); var reqs = options.targets.map(function (target) { if (target.hide) { return _this.q.when([]); @@ -120,8 +136,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr return []; }); }, _this); - console.log("********reqs", reqs); - console.log("********q", _this.q); return _this.q.all(reqs).then(function (results) { var resultSeries = lodash_1.default.flatten(results); var filteredSeries = lodash_1.default.filter(resultSeries, function (d) { return d.datapoints.length > 0; }); @@ -129,7 +143,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }); }; this.testDatasource = function () { - console.log("-------testDatasource----"); return _this.requestAutocomplete("grafanaDatasourceTest").then(function (result) { return { message: "Successfully connected to Wavefront! " + "(" + result.status + ")", status: "success", title: "Success", @@ -139,7 +152,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }); }); }; this.annotationQuery = function (options) { - console.log("------annotationQuery----"); var startSecs = helpers_1.dateToEpochSeconds(options.range.from); var endSecs = helpers_1.dateToEpochSeconds(options.range.to); var reqConfig = _this.baseRequestConfig("GET", "api/v2/chart/api", { @@ -168,7 +180,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }); }; this.metricFindQuery = function (options) { - console.log("-------metricFindQuery----"); var target = typeof (options) === "string" ? options : options.target; var boundedQuery = _this.templateSrv.replace(target); if (target === "") { @@ -220,7 +231,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }); }; this.matchQuery = function (query, position) { - console.log("-------matchQuery----"); query = query || ""; var boundedQuery = _this.templateSrv.replace(query); return _this.requestAutocomplete(boundedQuery, position).then(function (result) { @@ -230,7 +240,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.interpolateVariablesInQueries = function (queries) { - console.log("-------interpolateVariablesInQueries----"); if (queries && queries.length > 0) { return queries.map(function (query) { return __assign({}, query, { query: _this.templateSrv.replace(query.query) }); @@ -239,7 +248,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr return queries; }; this.matchMetric = function (metric) { - console.log("-------matchMetric----"); metric = metric || ""; var metricQuery = "ts(" + metric.trim(); return _this.requestAutocomplete(metricQuery).then(function (result) { @@ -249,13 +257,11 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.matchMetricTS = function (query) { - console.log("-------matchMetricTS----"); return _this.requestQueryKeysLookup(query.trim()).then(function (result) { return result.data.metrics || []; }, function (result) { return []; }); }; this.matchSource = function (metric, host, scopedVars) { - console.log("-------matchSource----"); var query = "ts(\"" + helpers_1.stripQuotesAndTrim(metric) + "\", source=\"" + helpers_1.sanitizePartial(host) + "\")"; query = _this.templateSrv.replace(query, scopedVars); return _this.requestQueryKeysLookup(query).then(function (result) { @@ -263,13 +269,11 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.matchSourceTS = function (query) { - console.log("-------matchSourceTS----"); return _this.requestQueryKeysLookup(query.trim()).then(function (result) { return result.data.hosts || []; }, function (result) { return []; }); }; this.matchSourceTag = function (partialName) { - console.log("-------matchSourceTag----"); partialName = partialName || ""; partialName = partialName.toLowerCase(); var reqConfig = _this.baseRequestConfig("GET", "api/manage/source"); @@ -283,19 +287,16 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.matchSourceTagTS = function (query) { - console.log("-------matchSourceTagTS----"); return _this.requestQueryKeysLookup(query.trim(), true).then(function (result) { return result.data.hostTags || []; }, function (result) { return []; }); }; this.matchMatchingSourceTagTS = function (query) { - console.log("-------matchMatchingSourceTagTS----"); return _this.requestQueryKeysLookup(query.trim(), true).then(function (result) { return result.data.matchingHostTags || []; }, function (result) { return []; }); }; this.matchPointTag = function (partialTag, target, scopedVars) { - console.log("-------matchPointTag----"); partialTag = partialTag || ""; partialTag = partialTag.toLowerCase(); if (partialTag === "*") { @@ -316,7 +317,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.matchPointTagTS = function (query) { - console.log("-------matchPointTagTS----"); return _this.requestQueryKeysLookup(query.trim()).then(function (result) { var allTags = {}; lodash_1.default.forEach(result.data.queryKeys, function (qk) { @@ -326,7 +326,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.matchPointTagValue = function (tag, partialValue, target, scopedVars) { - console.log("-------matchPointTagValue----"); if (!tag) { return []; } @@ -348,7 +347,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.matchPointTagValueTS = function (tag, query) { - console.log("-------matchPointTagValueTS----"); return _this.requestQueryKeysLookup(query.trim()).then(function (result) { var allValues = {}; lodash_1.default.forEach(result.data.queryKeys, function (qk) { @@ -360,7 +358,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }, function (result) { return []; }); }; this.requestQueryKeysLookup = function (query, includeHostTags) { - console.log("-------requestQueryKeysLookup----"); var lookbackStartSecs = Math.floor((new Date().getTime() - queryKeyLookbackMillis) / 1000); var request = { queries: [ @@ -384,7 +381,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr for (var _i = 3; _i < arguments.length; _i++) { args[_i - 3] = arguments[_i]; } - console.log("-------makeQuery----"); var query; if (target.textEditor) { query = target.query; @@ -400,7 +396,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } - console.log("-------buildQuery----"); if (!target.metric) { return ""; } @@ -423,7 +418,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr return query; }; this.buildFilterString = function (tags) { - console.log("-------buildFilterString----"); var result = ""; lodash_1.default.each(tags, function (component) { switch (component.type) { @@ -447,7 +441,6 @@ System.register(["lodash", "./functions", "./helpers", "./backendSrvCanelledRetr }; this.requestAutocomplete = function (expression, position) { var pos = position; - console.log("-------requestAutocomplete----"); if (!pos && pos !== 0) { pos = expression.length; } @@ -456,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 { diff --git a/dist/plugin/datasource.js.map b/dist/plugin/datasource.js.map index 1616c34..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":";;;;;;;;;;;;IAUA,6BAAoC,gBAAgB,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW;QAAjF,iBAikBC;QAhkBG,IAAI,CAAC,GAAG,GAAG,qBAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAE7C,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;QACZ,IAAI,CAAC,UAAU,GAAG,IAAI,4CAAmC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC1E,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;QAEpC,IAAI,CAAC,kBAAkB,GAAG;YACtB,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;YACD,OAAO,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,yBAAyB,CAAC,GAAG,IAAI;SAC5F,CAAC;QAEF,IAAI,gBAAgB,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC1C,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,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jD,iBAAiB,GAAG,+EAA+E,CAAC;YACpG,mBAAmB,GAAG,oEAAoE,CAAC"} \ No newline at end of file diff --git a/src/plugin/datasource.ts b/src/plugin/datasource.ts index 4f5ae87..eef5205 100644 --- a/src/plugin/datasource.ts +++ b/src/plugin/datasource.ts @@ -8,10 +8,6 @@ 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"; -const appSecret = "" - - - export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSrv) { this.url = sanitizeUrl(instanceSettings.url); @@ -23,7 +19,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr this.defaultRequestTimeoutSecs = 15; const appId = instanceSettings.jsonData.cspOAuthClientId const appSecret = instanceSettings.jsonData.cspOAuthClientSecret - const credentials = `Basic ${Buffer.from(`${appId}:${appSecret}`).toString('base64')}`; + const credentials = `Basic ${btoa(`${appId}:${appSecret}`)}`; this.requestConfigProto = { headers: { @@ -39,7 +35,7 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr fetch(CSP_API_TOKEN_URL, { method: "POST", body: JSON.stringify({ - api_token: instanceSettings.jsonData.cspAPIToken, + "api_token": instanceSettings.jsonData.cspAPIToken, }), headers: { "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" @@ -50,15 +46,17 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr } 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", + "grant_type": "client_credentials", }), headers: { - "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "Authorization": credentials } }) .then((response) => response.json()) @@ -66,12 +64,12 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr } catch(e) { console.error(e); } + this.requestConfigProto.headers["Authorization"] = "Bearer " + instanceSettings.jsonData.cspAPIToken; }else { this.requestConfigProto.withCredentials = true; } const getUserString = () => { - console.log("-------getUserString----"); let result = ""; const span = $("span[class='dashboard-title ng-binding']"); @@ -97,23 +95,16 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr const userString = getUserString(); this.query = (options: IGrafanaPluginDataSourceQueryOptions): angular.IPromise => { - console.log("-------query----"); // Query Window const startSecs = dateToEpochSeconds(options.range.from); const endSecs = dateToEpochSeconds(options.range.to); - console.log("********endSecs", endSecs); - console.log("********options.interval", options.interval); const intervalSecs = intervalToSeconds(options.interval); - console.log("********intervalSecs", intervalSecs); - console.log("*********options.maxDataPoints", options.maxDataPoints); const numPoints = Math.floor(Math.min(options.maxDataPoints, Math.floor((endSecs - startSecs) / intervalSecs))) || 4000; - console.log("********numPoints", numPoints); const baseEvent = { autoEvents: false, e: endSecs, i: true, listMode: false, n: userString, p: numPoints, s: startSecs, strict: true, }; - console.log("********baseEvent", baseEvent); // Create queries for each target and determine active count const reqs = options.targets.map((target) => { @@ -160,9 +151,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }); }, this); - console.log("********reqs", reqs); - console.log("********q", this.q); - return this.q.all(reqs).then((results) => { var resultSeries = _.flatten(results); var filteredSeries = _.filter(resultSeries, function (d) { return (d as any).datapoints.length > 0; }); @@ -171,7 +159,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.testDatasource = () => { - console.log("-------testDatasource----"); return this.requestAutocomplete("grafanaDatasourceTest").then((result) => { return { @@ -184,7 +171,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr this.annotationQuery = (options: IGrafanaPluginDataSourceAnnotationOptions) => { // Query Window - console.log("------annotationQuery----"); const startSecs = dateToEpochSeconds(options.range.from); const endSecs = dateToEpochSeconds(options.range.to); @@ -216,7 +202,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.metricFindQuery = (options: any) => { - console.log("-------metricFindQuery----"); const target = typeof (options) === "string" ? options : options.target; @@ -287,7 +272,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchQuery = (query: string, position: number) => { - console.log("-------matchQuery----"); query = query || ""; const boundedQuery = this.templateSrv.replace(query); @@ -300,7 +284,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.interpolateVariablesInQueries = (queries: DataQuery[]): DataQuery[] => { - console.log("-------interpolateVariablesInQueries----"); if (queries && queries.length > 0) { return queries.map(query => { @@ -314,7 +297,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr } this.matchMetric = (metric: string) => { - console.log("-------matchMetric----"); metric = metric || ""; @@ -328,7 +310,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchMetricTS = (query: string) => { - console.log("-------matchMetricTS----"); return this.requestQueryKeysLookup(query.trim()).then((result) => { return result.data.metrics || []; @@ -336,7 +317,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchSource = (metric: string, host: string, scopedVars: any) => { - console.log("-------matchSource----"); let query = "ts(\"" + stripQuotesAndTrim(metric) + "\", source=\"" + sanitizePartial(host) + "\")"; query = this.templateSrv.replace(query, scopedVars); @@ -347,7 +327,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchSourceTS = (query: string) => { - console.log("-------matchSourceTS----"); return this.requestQueryKeysLookup(query.trim()).then((result) => { return result.data.hosts || []; @@ -355,7 +334,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchSourceTag = (partialName: any) => { - console.log("-------matchSourceTag----"); partialName = partialName || ""; partialName = partialName.toLowerCase(); @@ -373,7 +351,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchSourceTagTS = (query: string) => { - console.log("-------matchSourceTagTS----"); return this.requestQueryKeysLookup(query.trim(), true).then((result) => { return result.data.hostTags || []; @@ -381,7 +358,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchMatchingSourceTagTS = (query: string) => { - console.log("-------matchMatchingSourceTagTS----"); return this.requestQueryKeysLookup(query.trim(), true).then((result) => { return result.data.matchingHostTags || []; @@ -389,7 +365,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTag = (partialTag: any, target: any, scopedVars: any) => { - console.log("-------matchPointTag----"); partialTag = partialTag || ""; partialTag = partialTag.toLowerCase(); @@ -418,7 +393,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTagTS = (query: string) => { - console.log("-------matchPointTagTS----"); return this.requestQueryKeysLookup(query.trim()).then((result) => { // Generate all Point tags for the query @@ -431,7 +405,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTagValue = (tag: any, partialValue: any, target: any, scopedVars: any) => { - console.log("-------matchPointTagValue----"); // Don't try to autocomplete if the corresponding tag name is empty if (!tag) { @@ -461,7 +434,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.matchPointTagValueTS = (tag: string, query: string) => { - console.log("-------matchPointTagValueTS----"); return this.requestQueryKeysLookup(query.trim()).then((result) => { // Generate all Point tag values under the tag for the query @@ -476,7 +448,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.requestQueryKeysLookup = (query, includeHostTags?) => { - console.log("-------requestQueryKeysLookup----"); const lookbackStartSecs = Math.floor((new Date().getTime() - queryKeyLookbackMillis) / 1000); @@ -502,7 +473,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.makeQuery = (target, scopedVars?, ignoreFunctions?, ...args: any[]) => { - console.log("-------makeQuery----"); let query; @@ -518,7 +488,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.buildQuery = (target, ignoreFunctions?, ...args: any[]) => { - console.log("-------buildQuery----"); if (!target.metric) { return ""; @@ -552,7 +521,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr }; this.buildFilterString = (tags) => { - console.log("-------buildFilterString----"); let result = ""; _.each(tags, (component) => { @@ -595,7 +563,6 @@ export function WavefrontDatasource(instanceSettings, $q, backendSrv, templateSr */ this.requestAutocomplete = (expression, position?) => { let pos = position; - console.log("-------requestAutocomplete----"); // default is to autocomplete the last symbol if (!pos && pos !== 0) { pos = expression.length; @@ -608,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); + }