Squash merge no-realtime branch

This commit is contained in:
Jamie V 2024-11-21 16:06:45 -08:00
parent 38457fd262
commit 5cc3cd4310
5 changed files with 32 additions and 8 deletions

View File

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

View File

@ -33,11 +33,11 @@
<ConductorModeIcon class="c-conductor__mode-icon" /> <ConductorModeIcon class="c-conductor__mode-icon" />
<div class="c-compact-tc__setting-value u-fade-truncate"> <div class="c-compact-tc__setting-value u-fade-truncate">
<ConductorMode :read-only="true" /> <ConductorMode :read-only="true" />
<ConductorClock :read-only="true" /> <ConductorClock v-if="hasRegisteredClocks" :read-only="true" />
<ConductorTimeSystem :read-only="true" /> <ConductorTimeSystem :read-only="true" />
</div> </div>
<ConductorInputsFixed v-if="isFixedTimeMode" :input-bounds="viewBounds" :read-only="true" /> <ConductorInputsFixed v-if="isFixedTimeMode" :input-bounds="viewBounds" :read-only="true" />
<ConductorInputsRealtime v-else :input-bounds="viewBounds" :read-only="true" /> <ConductorInputsRealtime v-else-if="hasRegisteredClocks" :input-bounds="viewBounds" :read-only="true" />
<ConductorAxis <ConductorAxis
v-if="isFixedTimeMode" v-if="isFixedTimeMode"
class="c-conductor__ticks" class="c-conductor__ticks"
@ -138,6 +138,8 @@ export default {
}; };
}, },
data() { data() {
const hasRegisteredClocks = this.openmct.time.clocks.size > 0;
return { return {
viewBounds: { viewBounds: {
start: this.bounds.start, start: this.bounds.start,
@ -147,7 +149,8 @@ export default {
showConductorPopup: false, showConductorPopup: false,
altPressed: false, altPressed: false,
isPanning: false, isPanning: false,
isZooming: false isZooming: false,
hasRegisteredClocks
}; };
}, },
computed: { computed: {

View File

@ -12,12 +12,12 @@
title="Sets the Time Conductor's mode." title="Sets the Time Conductor's mode."
/> />
<IndependentClock <IndependentClock
v-if="isIndependent" v-if="isIndependent && hasRegisteredClocks"
class="c-conductor__mode-select" class="c-conductor__mode-select"
title="Sets the Time Conductor's clock." title="Sets the Time Conductor's clock."
/> />
<ConductorClock <ConductorClock
v-else v-else-if="hasRegisteredClocks"
class="c-conductor__mode-select" class="c-conductor__mode-select"
title="Sets the Time Conductor's clock." title="Sets the Time Conductor's clock."
/> />
@ -76,6 +76,13 @@ export default {
} }
}, },
emits: ['popup-loaded', 'dismiss'], emits: ['popup-loaded', 'dismiss'],
data() {
const hasRegisteredClocks = this.openmct.time.clocks.size > 0;
return {
hasRegisteredClocks
};
},
computed: { computed: {
position() { position() {
const position = { const position = {

View File

@ -3,7 +3,14 @@ import { FIXED_MODE_KEY, REALTIME_MODE_KEY } from '../../api/time/constants.js';
export default { export default {
methods: { methods: {
loadModes() { 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 > 0) {
modes.push(REALTIME_MODE_KEY);
}
this.modes = modes.map(this.getModeMetadata);
}, },
getModeMetadata(mode, testIds = false) { getModeMetadata(mode, testIds = false) {
let modeOptions; let modeOptions;

View File

@ -65,7 +65,14 @@ export function useTimeMode(openmct, timeContext) {
} }
function getAllModeMetadata() { 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) { function getModeMetadata(key) {