[Telem] add backwards compat and warning

Add backwards compatibility for x/y hints, and log a warning to
console when x/y hints are encountered.

Fixes https://github.com/nasa/openmct/issues/1546
This commit is contained in:
Pete Richards 2017-05-09 19:15:15 -07:00
parent 81208d617f
commit 0a3d51c6b5

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define([
'lodash'
@ -76,6 +76,30 @@ define([
valueMetadata.source = valueMetadata.source || valueMetadata.key;
valueMetadata.hints = valueMetadata.hints || {};
if (valueMetadata.hints.hasOwnProperty('x')) {
console.warn(
'DEPRECIATION WARNING: `x` hints should be replaced with ' +
'`domain` hints moving forward. ' +
'https://github.com/nasa/openmct/issues/1546'
);
if (!valueMetadata.hints.hasOwnProperty('domain')) {
valueMetadata.hints.domain = valueMetadata.hints.x;
}
delete valueMetadata.hints.x;
}
if (valueMetadata.hints.hasOwnProperty('y')) {
console.warn(
'DEPRECIATION WARNING: `y` hints should be replaced with ' +
'`range` hints moving forward. ' +
'https://github.com/nasa/openmct/issues/1546'
);
if (!valueMetadata.hints.hasOwnProperty('range')) {
valueMetadata.hints.range = valueMetadata.hints.y;
}
delete valueMetadata.hints.y;
}
if (!valueMetadata.hints.hasOwnProperty('priority')) {
valueMetadata.hints.priority = index;
}