Merge remote-tracking branch 'khalidadil/extend-conditional' into combined-rodap-stuff

This commit is contained in:
Scott Bell 2024-10-01 18:05:10 +02:00
commit dba2cc236f
5 changed files with 17 additions and 31 deletions

View File

@ -24,7 +24,8 @@ import { EventEmitter } from 'eventemitter3';
import { v4 as uuid } from 'uuid';
import Condition from './Condition.js';
import HistoricalTelemetryProvider from './historicalTelemetryProvider.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;
}
@ -352,18 +353,12 @@ export default {
methods: {
setOutputSelection() {
let conditionOutput = this.condition.configuration.output;
if (conditionOutput) {
if (
conditionOutput !== 'false' &&
conditionOutput !== 'true' &&
conditionOutput !== 'telemetry value'
) {
this.selectedOutputSelection = 'string';
} else {
this.selectedOutputSelection = conditionOutput;
}
} else if (conditionOutput === undefined) {
if (conditionOutput === undefined) {
this.selectedOutputSelection = 'none';
} else if (['false', 'true', TELEMETRY_VALUE].includes(conditionOutput)) {
this.selectedOutputSelection = conditionOutput;
} else {
this.selectedOutputSelection = 'string';
}
},
setOutputValue() {

View File

@ -63,7 +63,7 @@
:key="index"
:value="telemetryOption.identifier"
>
{{ telemetryPaths[index] || telemetryOption.name }}
{{ telemetryOption.path || telemetryOption.name }}
</option>
</select>
</span>
@ -201,10 +201,6 @@ export default {
this.telemetryMetadataOptions[id] = [];
}
});
this.telemetry.forEach(async (telemetryOption, index) => {
const telemetryPath = await this.getFullTelemetryPath(telemetryOption);
this.telemetryPaths[index] = telemetryPath;
});
},
addTestInput(testInput) {
this.testInputs.push(

View File

@ -15,14 +15,6 @@ export default class HistoricalTelemetryProvider {
this.bounds = bounds;
}
refreshAllHistoricalTelemetries() {
const refreshPromises = [];
for (const [, value] of Object.entries(this.telemetryObjects)) {
refreshPromises.push(this.refreshHistoricalTelemetry(value));
}
return Promise.all(refreshPromises);
}
async refreshHistoricalTelemetry(domainObject, identifier) {
console.log('refreshHistoricalTelemetry');
if (!domainObject && identifier) {
@ -201,7 +193,7 @@ export default class HistoricalTelemetryProvider {
const conditionDetails = conditionCollectionMap.get(id);
const { isDefault } = conditionDetails;
const conditionConfiguration = conditionDetails?.configuration;
const { outputTelemetry, outputMetadata, output } = conditionConfiguration;
const { output } = conditionConfiguration;
if (isDefault) {
const conditionOutput = {
condition,
@ -277,7 +269,7 @@ export default class HistoricalTelemetryProvider {
const outputTelemetryList = [];
const domainObject = this.conditionSetDomainObject;
outputTelemetryMap.forEach((outputMetadata, timestamp) => {
const { condition, telemetry, value, result, isDefault } = outputMetadata;
const { condition, value, result, isDefault } = outputMetadata;
outputTelemetryList.push({
conditionId: condition.id,
id: domainObject.identifier,

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';