mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 14:18:16 +00:00
do not apply test data when edit mode changes to false
This commit is contained in:
@ -21,55 +21,69 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="c-comps" aria-label="Derived Telemetry">
|
<div class="c-cs" aria-label="Derived Telemetry">
|
||||||
<section class="c-cs__current-output c-section">
|
<section class="c-cs__current-output c-section">
|
||||||
<div class="c-cs__content c-cs__current-output-value">
|
<div class="c-cs__content c-cs__current-output-value">
|
||||||
<span class="c-cs__current-output-value__label">Current Output</span>
|
<span class="c-cs__current-output-value__label">Current Output</span>
|
||||||
<span class="c-cs__current-output-value__value" aria-label="Current Output Value">
|
<span class="c-cs__current-output-value__value" aria-label="Current Output Value">
|
||||||
<template v-if="testDataApplied && currentTestOutput">
|
<template
|
||||||
|
v-if="testDataApplied && currentTestOutput !== undefined && currentTestOutput !== null"
|
||||||
|
>
|
||||||
{{ currentTestOutput }}
|
{{ currentTestOutput }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="currentCompOutput && !testDataApplied">
|
<template
|
||||||
|
v-else-if="
|
||||||
|
!testDataApplied && currentCompOutput !== undefined && currentCompOutput !== null
|
||||||
|
"
|
||||||
|
>
|
||||||
{{ currentCompOutput }}
|
{{ currentCompOutput }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else> --- </template>
|
<template v-else> --- </template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section
|
<section id="telemetryReferenceSection" aria-label="Derived Telemetry References">
|
||||||
id="telemetryReferenceSection"
|
|
||||||
class="c-comps__section c-comps__refs-and-controls"
|
|
||||||
aria-label="Derived Telemetry References"
|
|
||||||
>
|
|
||||||
<div class="c-cs__header c-section__header">
|
<div class="c-cs__header c-section__header">
|
||||||
<div class="c-cs__header-label c-section__label">Telemetry References</div>
|
<div class="c-cs__header-label c-section__label">Telemetry References</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
<div :class="['c-comps__refs-controls c-cdef__controls', { disabled: !parameters?.length }]">
|
:class="['c-cs__test-data__controls c-cdef__controls', { disabled: !parameters?.length }]"
|
||||||
|
>
|
||||||
<label v-if="isEditing" class="c-toggle-switch">
|
<label v-if="isEditing" class="c-toggle-switch">
|
||||||
<input type="checkbox" :checked="testDataApplied" @change="toggleTestData" />
|
<input type="checkbox" :checked="testDataApplied" @change="toggleTestData" />
|
||||||
<span class="c-toggle-switch__slider" aria-label="Apply Test Data"></span>
|
<span class="c-toggle-switch__slider" aria-label="Apply Test Data"></span>
|
||||||
<span class="c-toggle-switch__label">Apply Test Values</span>
|
<span class="c-toggle-switch__label">Apply Test Values</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="c-comps__refs">
|
<div class="c-cs__content">
|
||||||
<div v-for="parameter in parameters" :key="parameter.keyString" class="c-comps__ref">
|
<div class="hint" :class="{ 's-status-icon-warning-lo': !parameters?.length && isEditing }">
|
||||||
<span class="c-test-datum__string">Reference</span>
|
<div
|
||||||
<input
|
v-for="parameter in parameters"
|
||||||
v-if="isEditing"
|
:key="parameter.keyString"
|
||||||
v-model="parameter.name"
|
class="telemery-reference"
|
||||||
type="text"
|
>
|
||||||
class="c-input--md"
|
Reference
|
||||||
@change="updateParameters"
|
<input
|
||||||
/>
|
v-if="isEditing"
|
||||||
<div v-else class="--em">{{ parameter.name }}</div>
|
v-model="parameter.name"
|
||||||
<span class="c-test-datum__string">=</span>
|
class="telemery-reference-variable-input"
|
||||||
<span class="c-comps__path-and-field">
|
@change="updateParameters"
|
||||||
<ObjectPathString
|
|
||||||
:domain-object="compsManager.getTelemetryObjectForParameter(parameter.keyString)"
|
|
||||||
:show-object-itself="true"
|
|
||||||
class="--em"
|
|
||||||
/>
|
/>
|
||||||
|
<div v-else> {{ parameter.name }}</div>
|
||||||
|
<ObjectPath
|
||||||
|
:domain-object="compsManager.getTelemetryObjectForParameter(parameter.keyString)"
|
||||||
|
/>
|
||||||
|
<div class="parametery-telemetry">
|
||||||
|
<div
|
||||||
|
class="parameter-telemetry-icon"
|
||||||
|
:class="
|
||||||
|
getIconForType(compsManager.getTelemetryObjectForParameter(parameter.keyString))
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<div class="parametery-telemetry-name">
|
||||||
|
{{ compsManager.getTelemetryObjectForParameter(parameter.keyString)?.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- drop down to select value from telemetry -->
|
<!-- drop down to select value from telemetry -->
|
||||||
<select v-if="isEditing" v-model="parameter.valueToUse" @change="updateParameters">
|
<select v-if="isEditing" v-model="parameter.valueToUse" @change="updateParameters">
|
||||||
<option
|
<option
|
||||||
@ -82,36 +96,28 @@
|
|||||||
{{ parameterValueOption.name }}
|
{{ parameterValueOption.name }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<div v-else>{{ parameter.valueToUse }}</div>
|
<div v-else> {{ parameter.valueToUse }}</div>
|
||||||
</span>
|
<input
|
||||||
|
v-if="isEditing"
|
||||||
<span v-if="isEditing" class="c-test-datum__string">Test value</span>
|
v-model="parameter.testValue"
|
||||||
<input
|
class="telemery-reference-variable-input"
|
||||||
v-if="isEditing"
|
@change="updateParameters"
|
||||||
v-model="parameter.testValue"
|
/>
|
||||||
type="text"
|
<div v-else> {{ parameter.testValue }}</div>
|
||||||
class="c-input--md"
|
</div>
|
||||||
@change="updateParameters"
|
<template v-if="!parameters?.length && isEditing"
|
||||||
/>
|
>Drag telemetry into Telemetry References to add variables for an expression</template
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section
|
<section id="expressionSection" aria-label="Derived Telemetry Expression">
|
||||||
id="expressionSection"
|
|
||||||
aria-label="Derived Telemetry Expression"
|
|
||||||
class="c-comps__section c-comps__expression"
|
|
||||||
>
|
|
||||||
<div class="c-cs__header c-section__header">
|
<div class="c-cs__header c-section__header">
|
||||||
<div class="c-cs__header-label c-section__label">Expression</div>
|
<div class="c-cs__header-label c-section__label">Expression</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!parameters?.length && isEditing" class="hint">
|
|
||||||
Drag in telemetry to add references for an expression.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="c-cs__content">
|
<div class="c-cs__content">
|
||||||
<textarea
|
<textarea
|
||||||
v-if="parameters?.length && isEditing"
|
v-if="isEditing"
|
||||||
v-model="expression"
|
v-model="expression"
|
||||||
class="expression-input"
|
class="expression-input"
|
||||||
placeholder="Enter an expression"
|
placeholder="Enter an expression"
|
||||||
@ -136,9 +142,9 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { evaluate } from 'mathjs';
|
import { evaluate } from 'mathjs';
|
||||||
import { inject, onBeforeMount, onBeforeUnmount, ref } from 'vue';
|
import { inject, onBeforeMount, onBeforeUnmount, ref, watch } from 'vue';
|
||||||
|
|
||||||
import ObjectPathString from '../../../ui/components/ObjectPathString.vue';
|
import ObjectPath from '../../../ui/components/ObjectPath.vue';
|
||||||
import CompsManager from '../CompsManager';
|
import CompsManager from '../CompsManager';
|
||||||
|
|
||||||
const openmct = inject('openmct');
|
const openmct = inject('openmct');
|
||||||
@ -155,11 +161,8 @@ const outputFormat = ref(null);
|
|||||||
|
|
||||||
let outputTelemetryCollection;
|
let outputTelemetryCollection;
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
isEditing: {
|
isEditing: { type: Boolean, required: true }
|
||||||
type: Boolean,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
@ -182,6 +185,16 @@ onBeforeUnmount(() => {
|
|||||||
outputTelemetryCollection.destroy();
|
outputTelemetryCollection.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.isEditing,
|
||||||
|
(editMode) => {
|
||||||
|
console.debug(`📢 Edit mode is: ${editMode}`);
|
||||||
|
if (!editMode) {
|
||||||
|
testDataApplied.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function reloadParameters() {
|
function reloadParameters() {
|
||||||
parameters.value = compsManager.getParameters();
|
parameters.value = compsManager.getParameters();
|
||||||
domainObject.configuration.comps.parameters = parameters.value;
|
domainObject.configuration.comps.parameters = parameters.value;
|
||||||
@ -195,6 +208,10 @@ function updateParameters() {
|
|||||||
applyTestData();
|
applyTestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getIconForType(telemetryObject) {
|
||||||
|
return openmct.types.get(telemetryObject.type).definition.cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
function toggleTestData() {
|
function toggleTestData() {
|
||||||
testDataApplied.value = !testDataApplied.value;
|
testDataApplied.value = !testDataApplied.value;
|
||||||
if (testDataApplied.value) {
|
if (testDataApplied.value) {
|
||||||
|
Reference in New Issue
Block a user