mirror of
https://github.com/nasa/openmct.git
synced 2025-06-03 08:00:52 +00:00
Revert "do not apply test data when edit mode changes to false"
This reverts commit eac4676cadb62eb77b998a56cf3af02c17ffd770.
This commit is contained in:
parent
eac4676cad
commit
02cf70135e
@ -21,69 +21,55 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="c-cs" aria-label="Derived Telemetry">
|
<div class="c-comps" 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
|
<template v-if="testDataApplied && currentTestOutput">
|
||||||
v-if="testDataApplied && currentTestOutput !== undefined && currentTestOutput !== null"
|
|
||||||
>
|
|
||||||
{{ currentTestOutput }}
|
{{ currentTestOutput }}
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-else-if="currentCompOutput && !testDataApplied">
|
||||||
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 id="telemetryReferenceSection" aria-label="Derived Telemetry References">
|
<section
|
||||||
|
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
|
|
||||||
:class="['c-cs__test-data__controls c-cdef__controls', { disabled: !parameters?.length }]"
|
<div :class="['c-comps__refs-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-cs__content">
|
<div class="c-comps__refs">
|
||||||
<div class="hint" :class="{ 's-status-icon-warning-lo': !parameters?.length && isEditing }">
|
<div v-for="parameter in parameters" :key="parameter.keyString" class="c-comps__ref">
|
||||||
<div
|
<span class="c-test-datum__string">Reference</span>
|
||||||
v-for="parameter in parameters"
|
<input
|
||||||
:key="parameter.keyString"
|
v-if="isEditing"
|
||||||
class="telemery-reference"
|
v-model="parameter.name"
|
||||||
>
|
type="text"
|
||||||
Reference
|
class="c-input--md"
|
||||||
<input
|
@change="updateParameters"
|
||||||
v-if="isEditing"
|
/>
|
||||||
v-model="parameter.name"
|
<div v-else class="--em">{{ parameter.name }}</div>
|
||||||
class="telemery-reference-variable-input"
|
<span class="c-test-datum__string">=</span>
|
||||||
@change="updateParameters"
|
<span class="c-comps__path-and-field">
|
||||||
/>
|
<ObjectPathString
|
||||||
<div v-else> {{ parameter.name }}</div>
|
|
||||||
<ObjectPath
|
|
||||||
:domain-object="compsManager.getTelemetryObjectForParameter(parameter.keyString)"
|
:domain-object="compsManager.getTelemetryObjectForParameter(parameter.keyString)"
|
||||||
|
:show-object-itself="true"
|
||||||
|
class="--em"
|
||||||
/>
|
/>
|
||||||
<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
|
||||||
@ -96,28 +82,36 @@
|
|||||||
{{ parameterValueOption.name }}
|
{{ parameterValueOption.name }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<div v-else> {{ parameter.valueToUse }}</div>
|
<div v-else>{{ parameter.valueToUse }}</div>
|
||||||
<input
|
</span>
|
||||||
v-if="isEditing"
|
|
||||||
v-model="parameter.testValue"
|
<span v-if="isEditing" class="c-test-datum__string">Test value</span>
|
||||||
class="telemery-reference-variable-input"
|
<input
|
||||||
@change="updateParameters"
|
v-if="isEditing"
|
||||||
/>
|
v-model="parameter.testValue"
|
||||||
<div v-else> {{ parameter.testValue }}</div>
|
type="text"
|
||||||
</div>
|
class="c-input--md"
|
||||||
<template v-if="!parameters?.length && isEditing"
|
@change="updateParameters"
|
||||||
>Drag telemetry into Telemetry References to add variables for an expression</template
|
/>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section id="expressionSection" aria-label="Derived Telemetry Expression">
|
<section
|
||||||
|
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="isEditing"
|
v-if="parameters?.length && isEditing"
|
||||||
v-model="expression"
|
v-model="expression"
|
||||||
class="expression-input"
|
class="expression-input"
|
||||||
placeholder="Enter an expression"
|
placeholder="Enter an expression"
|
||||||
@ -142,9 +136,9 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { evaluate } from 'mathjs';
|
import { evaluate } from 'mathjs';
|
||||||
import { inject, onBeforeMount, onBeforeUnmount, ref, watch } from 'vue';
|
import { inject, onBeforeMount, onBeforeUnmount, ref } from 'vue';
|
||||||
|
|
||||||
import ObjectPath from '../../../ui/components/ObjectPath.vue';
|
import ObjectPathString from '../../../ui/components/ObjectPathString.vue';
|
||||||
import CompsManager from '../CompsManager';
|
import CompsManager from '../CompsManager';
|
||||||
|
|
||||||
const openmct = inject('openmct');
|
const openmct = inject('openmct');
|
||||||
@ -161,8 +155,11 @@ const outputFormat = ref(null);
|
|||||||
|
|
||||||
let outputTelemetryCollection;
|
let outputTelemetryCollection;
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
isEditing: { type: Boolean, required: true }
|
isEditing: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
@ -185,16 +182,6 @@ 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;
|
||||||
@ -208,10 +195,6 @@ 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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user