mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
[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:
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/*global console*/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'lodash'
|
'lodash'
|
||||||
@ -76,6 +76,30 @@ define([
|
|||||||
valueMetadata.source = valueMetadata.source || valueMetadata.key;
|
valueMetadata.source = valueMetadata.source || valueMetadata.key;
|
||||||
valueMetadata.hints = valueMetadata.hints || {};
|
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')) {
|
if (!valueMetadata.hints.hasOwnProperty('priority')) {
|
||||||
valueMetadata.hints.priority = index;
|
valueMetadata.hints.priority = index;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user