Realtime should not show if there are no clocks

This commit is contained in:
Jamie V 2024-11-21 10:48:46 -08:00
parent 38457fd262
commit 47892b9641
6 changed files with 22 additions and 8 deletions

View File

@ -356,7 +356,7 @@ export class MCT extends EventEmitter {
this.element = domElement;
if (!this.time.getClock()) {
if (this.time.clocks.size !== 0 && !this.time.getClock()) {
this.time.setClock(this.defaultClock);
}

View File

@ -33,11 +33,11 @@
<ConductorModeIcon class="c-conductor__mode-icon" />
<div class="c-compact-tc__setting-value u-fade-truncate">
<ConductorMode :read-only="true" />
<ConductorClock :read-only="true" />
<ConductorClock v-if="openmct.time.clocks.size > 0" :read-only="true" />
<ConductorTimeSystem :read-only="true" />
</div>
<ConductorInputsFixed v-if="isFixedTimeMode" :input-bounds="viewBounds" :read-only="true" />
<ConductorInputsRealtime v-else :input-bounds="viewBounds" :read-only="true" />
<ConductorInputsRealtime v-else-if="openmct.time.clocks.size > 0" :input-bounds="viewBounds" :read-only="true" />
<ConductorAxis
v-if="isFixedTimeMode"
class="c-conductor__ticks"

View File

@ -12,12 +12,12 @@
title="Sets the Time Conductor's mode."
/>
<IndependentClock
v-if="isIndependent"
v-if="isIndependent && openmct.time.clocks.size > 0"
class="c-conductor__mode-select"
title="Sets the Time Conductor's clock."
/>
<ConductorClock
v-else
v-else-if="openmct.time.clocks.size > 0"
class="c-conductor__mode-select"
title="Sets the Time Conductor's clock."
/>

View File

@ -3,7 +3,14 @@ import { FIXED_MODE_KEY, REALTIME_MODE_KEY } from '../../api/time/constants.js';
export default {
methods: {
loadModes() {
this.modes = [FIXED_MODE_KEY, REALTIME_MODE_KEY].map(this.getModeMetadata);
const modes = [FIXED_MODE_KEY];
const clockCount = this.openmct.time.clocks.size;
if (clockCount > 1) {
modes.push(REALTIME_MODE_KEY);
}
this.modes = modes.map(this.getModeMetadata);
},
getModeMetadata(mode, testIds = false) {
let modeOptions;

View File

@ -65,7 +65,14 @@ export function useTimeMode(openmct, timeContext) {
}
function getAllModeMetadata() {
return [FIXED_MODE_KEY, REALTIME_MODE_KEY].map(getModeMetadata);
const clockCount = openmct.time.clocks.size;
const modes = [FIXED_MODE_KEY];
if (clockCount > 0) {
modes.push(REALTIME_MODE_KEY);
}
return modes.map(getModeMetadata);
}
function getModeMetadata(key) {

View File

@ -33,7 +33,7 @@ export default function () {
return function (openmct) {
const timeSystem = new UTCTimeSystem();
openmct.time.addTimeSystem(timeSystem);
openmct.time.addClock(new LocalClock(100));
openmct.telemetry.addFormat(new UTCTimeFormat());
openmct.telemetry.addFormat(new DurationFormat());
};