mirror of
https://github.com/nasa/openmct.git
synced 2025-04-09 20:31:26 +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:
parent
7282792da1
commit
f0fd0a9cc7
@ -9,7 +9,8 @@ define([
|
||||
values: [
|
||||
{
|
||||
key: "name",
|
||||
name: "Name"
|
||||
name: "Name",
|
||||
format: "string"
|
||||
},
|
||||
{
|
||||
key: "utc",
|
||||
|
@ -60,9 +60,14 @@ describe("The telemetry criterion", function () {
|
||||
};
|
||||
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||
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.subscribe.and.returnValue(function () {});
|
||||
openmct.telemetry.getValueFormatter.and.returnValue({
|
||||
parse: function (value) {
|
||||
return value;
|
||||
}
|
||||
});
|
||||
openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry);
|
||||
|
||||
openmct.time = jasmine.createSpyObj('timeAPI',
|
||||
|
@ -4,7 +4,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'equalTo',
|
||||
operation: function (input) {
|
||||
return input[0] === input[1];
|
||||
return input[0] === parseInt(input[1]);
|
||||
},
|
||||
text: 'is equal to',
|
||||
appliesTo: ['number'],
|
||||
@ -16,7 +16,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'notEqualTo',
|
||||
operation: function (input) {
|
||||
return input[0] !== input[1];
|
||||
return input[0] !== parseInt(input[1]);
|
||||
},
|
||||
text: 'is not equal to',
|
||||
appliesTo: ['number'],
|
||||
@ -28,7 +28,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'greaterThan',
|
||||
operation: function (input) {
|
||||
return input[0] > input[1];
|
||||
return input[0] > parseInt(input[1]);
|
||||
},
|
||||
text: 'is greater than',
|
||||
appliesTo: ['number'],
|
||||
@ -40,7 +40,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'lessThan',
|
||||
operation: function (input) {
|
||||
return input[0] < input[1];
|
||||
return input[0] < parseInt(input[1]);
|
||||
},
|
||||
text: 'is less than',
|
||||
appliesTo: ['number'],
|
||||
@ -52,7 +52,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'greaterThanOrEq',
|
||||
operation: function (input) {
|
||||
return input[0] >= input[1];
|
||||
return input[0] >= parseInt(input[1]);
|
||||
},
|
||||
text: 'is greater than or equal to',
|
||||
appliesTo: ['number'],
|
||||
@ -64,7 +64,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'lessThanOrEq',
|
||||
operation: function (input) {
|
||||
return input[0] <= input[1];
|
||||
return input[0] <= parseInt(input[1]);
|
||||
},
|
||||
text: 'is less than or equal to',
|
||||
appliesTo: ['number'],
|
||||
@ -76,7 +76,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'between',
|
||||
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',
|
||||
appliesTo: ['number'],
|
||||
@ -88,7 +88,7 @@ export const OPERATIONS = [
|
||||
{
|
||||
name: 'notBetween',
|
||||
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',
|
||||
appliesTo: ['number'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user