Creating a const for telemetry value

This commit is contained in:
Khalid Adil 2024-09-30 19:10:24 -05:00
parent 4b39ea232a
commit b97555445e
3 changed files with 9 additions and 5 deletions

View File

@ -25,6 +25,7 @@ import { v4 as uuid } from 'uuid';
import Condition from './Condition.js';
import HistoricalTelemetryProvider from './HistoricalTelemetryProvider.js';
import { TELEMETRY_VALUE } from './utils/constants.js';
import { getLatestTimestamp } from './utils/time.js';
export default class ConditionManager extends EventEmitter {
@ -392,7 +393,7 @@ export default class ConditionManager extends EventEmitter {
const currentCondition = this.getCurrentConditionLAD(conditionResults);
let output = currentCondition?.configuration?.output;
if (output === 'telemetry value') {
if (output === TELEMETRY_VALUE) {
const { outputTelemetry, outputMetadata } = currentCondition.configuration;
const outputTelemetryObject = await this.openmct.objects.get(outputTelemetry);
const telemetryOptions = {

View File

@ -113,7 +113,7 @@
@change="persist"
/>
</span>
<span v-if="selectedOutputSelection === 'telemetry value'" class="c-cdef__control">
<span v-if="selectedOutputSelection === TELEMETRY_VALUE" class="c-cdef__control">
<select
v-model="condition.configuration.outputTelemetry"
aria-label="Output Telemetry Selection"
@ -233,6 +233,7 @@ import { v4 as uuid } from 'uuid';
import { TRIGGER, TRIGGER_LABEL } from '@/plugins/condition/utils/constants';
import { TELEMETRY_VALUE } from '../utils/constants.js';
import ConditionDescription from './ConditionDescription.vue';
import Criterion from './CriterionItem.vue';
@ -288,7 +289,7 @@ export default {
expanded: true,
trigger: 'all',
selectedOutputSelection: '',
outputOptions: ['none', 'false', 'true', 'string', 'telemetry value'],
outputOptions: ['none', 'false', 'true', 'string', TELEMETRY_VALUE],
criterionIndex: 0,
draggingOver: false,
isDefault: this.condition.isDefault,
@ -329,7 +330,7 @@ export default {
watch: {
condition: {
handler() {
if (this.condition.configuration.output !== 'telemetry value') {
if (this.condition.configuration.output !== TELEMETRY_VALUE) {
this.condition.configuration.outputTelemetry = null;
this.condition.configuration.outputMetadata = null;
}
@ -354,7 +355,7 @@ export default {
let conditionOutput = this.condition.configuration.output;
if (conditionOutput === undefined) {
this.selectedOutputSelection = 'none';
} else if (['false', 'true', 'telemetry value'].includes(conditionOutput)) {
} else if (['false', 'true', TELEMETRY_VALUE].includes(conditionOutput)) {
this.selectedOutputSelection = conditionOutput;
} else {
this.selectedOutputSelection = 'string';

View File

@ -62,3 +62,5 @@ export const ERROR = {
export const IS_OLD_KEY = 'isStale';
export const IS_STALE_KEY = 'isStale.new';
export const TELEMETRY_VALUE = 'telemetry value';