mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
Use parsed telemetry data values for condition evaluations (#2783)
* Use parsed telemetry data values for condition evaluations * Addresses comments - handles undefined value and implements format and validate formatter methods * Merge topic-conditionals
This commit is contained in:
@ -9,7 +9,8 @@ define([
|
|||||||
values: [
|
values: [
|
||||||
{
|
{
|
||||||
key: "name",
|
key: "name",
|
||||||
name: "Name"
|
name: "Name",
|
||||||
|
format: "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "utc",
|
key: "utc",
|
||||||
|
@ -60,9 +60,14 @@ describe("The telemetry criterion", function () {
|
|||||||
};
|
};
|
||||||
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||||
openmct.objects.makeKeyString.and.returnValue(testTelemetryObject.identifier.key);
|
openmct.objects.makeKeyString.and.returnValue(testTelemetryObject.identifier.key);
|
||||||
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject', "subscribe", "getMetadata"]);
|
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject', "subscribe", "getMetadata", "getValueFormatter"]);
|
||||||
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
||||||
openmct.telemetry.subscribe.and.returnValue(function () {});
|
openmct.telemetry.subscribe.and.returnValue(function () {});
|
||||||
|
openmct.telemetry.getValueFormatter.and.returnValue({
|
||||||
|
parse: function (value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry);
|
openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry);
|
||||||
|
|
||||||
openmct.time = jasmine.createSpyObj('timeAPI',
|
openmct.time = jasmine.createSpyObj('timeAPI',
|
||||||
|
@ -4,7 +4,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'equalTo',
|
name: 'equalTo',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] === input[1];
|
return input[0] === parseInt(input[1]);
|
||||||
},
|
},
|
||||||
text: 'is equal to',
|
text: 'is equal to',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -16,7 +16,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'notEqualTo',
|
name: 'notEqualTo',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] !== input[1];
|
return input[0] !== parseInt(input[1]);
|
||||||
},
|
},
|
||||||
text: 'is not equal to',
|
text: 'is not equal to',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -28,7 +28,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'greaterThan',
|
name: 'greaterThan',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] > input[1];
|
return input[0] > parseInt(input[1]);
|
||||||
},
|
},
|
||||||
text: 'is greater than',
|
text: 'is greater than',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -40,7 +40,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'lessThan',
|
name: 'lessThan',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] < input[1];
|
return input[0] < parseInt(input[1]);
|
||||||
},
|
},
|
||||||
text: 'is less than',
|
text: 'is less than',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -52,7 +52,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'greaterThanOrEq',
|
name: 'greaterThanOrEq',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] >= input[1];
|
return input[0] >= parseInt(input[1]);
|
||||||
},
|
},
|
||||||
text: 'is greater than or equal to',
|
text: 'is greater than or equal to',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -64,7 +64,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'lessThanOrEq',
|
name: 'lessThanOrEq',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] <= input[1];
|
return input[0] <= parseInt(input[1]);
|
||||||
},
|
},
|
||||||
text: 'is less than or equal to',
|
text: 'is less than or equal to',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -76,7 +76,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'between',
|
name: 'between',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] > input[1] && input[0] < input[2];
|
return input[0] > parseInt(input[1]) && input[0] < parseInt(input[2]);
|
||||||
},
|
},
|
||||||
text: 'is between',
|
text: 'is between',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
@ -88,7 +88,7 @@ export const OPERATIONS = [
|
|||||||
{
|
{
|
||||||
name: 'notBetween',
|
name: 'notBetween',
|
||||||
operation: function (input) {
|
operation: function (input) {
|
||||||
return input[0] < input[1] || input[0] > input[2];
|
return input[0] < parseInt(input[1]) || input[0] > parseInt(input[2]);
|
||||||
},
|
},
|
||||||
text: 'is not between',
|
text: 'is not between',
|
||||||
appliesTo: ['number'],
|
appliesTo: ['number'],
|
||||||
|
Reference in New Issue
Block a user