From 6310be623af851c88504b0128899d32bd56bc7f3 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 10 May 2017 17:22:01 -0700 Subject: [PATCH] [Telem] ensure request has minimum fields Ensure telemetry request options always have a certain number of fields-- start, end, and domain. This allows telemetry providers to implement necessary filtering for these types of requests. --- src/api/telemetry/TelemetryAPI.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/api/telemetry/TelemetryAPI.js b/src/api/telemetry/TelemetryAPI.js index 952e068562..0ccc12dbe7 100644 --- a/src/api/telemetry/TelemetryAPI.js +++ b/src/api/telemetry/TelemetryAPI.js @@ -196,6 +196,21 @@ define([ return this.requestProviders.filter(supportsDomainObject)[0]; }; + /** + * @private + */ + TelemetryAPI.prototype.standardizeRequestOptions = function (options) { + if (!options.hasOwnProperty('start')) { + options.start = this.MCT.time.bounds().start; + } + if (!options.hasOwnProperty('end')) { + options.end = this.MCT.time.bounds().end; + } + if (!options.hasOwnProperty('domain')) { + options.domain = this.MCT.time.timeSystem().key; + } + }; + /** * Request historical telemetry for a domain object. * The `options` argument allows you to specify filters @@ -212,6 +227,7 @@ define([ * telemetry data */ TelemetryAPI.prototype.request = function (domainObject, options) { + this.standardizeRequestOptions(options); var provider = this.findRequestProvider.apply(this, arguments); return provider.request.apply(provider, arguments); };