mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 21:28:12 +00:00
Independent time conductor (#3988)
* Independent time API implementation * Independent time conductor in plan view Co-authored-by: charlesh88 <charles.f.hacskaylo@nasa.gov> Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -173,7 +173,7 @@ export default {
|
||||
MctTicks,
|
||||
MctChart
|
||||
},
|
||||
inject: ['openmct', 'domainObject'],
|
||||
inject: ['openmct', 'domainObject', 'path'],
|
||||
props: {
|
||||
options: {
|
||||
type: Object,
|
||||
@ -244,6 +244,9 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
eventHelpers.extend(this);
|
||||
this.updateRealTime = this.updateRealTime.bind(this);
|
||||
this.updateDisplayBounds = this.updateDisplayBounds.bind(this);
|
||||
this.setTimeContext = this.setTimeContext.bind(this);
|
||||
|
||||
this.config = this.getConfig();
|
||||
this.legend = this.config.legend;
|
||||
@ -261,7 +264,7 @@ export default {
|
||||
this.removeStatusListener = this.openmct.status.observe(this.domainObject.identifier, this.updateStatus);
|
||||
|
||||
this.openmct.objectViews.on('clearData', this.clearData);
|
||||
this.followTimeConductor();
|
||||
this.setTimeContext();
|
||||
|
||||
this.loaded = true;
|
||||
|
||||
@ -274,11 +277,27 @@ export default {
|
||||
this.destroy();
|
||||
},
|
||||
methods: {
|
||||
followTimeConductor() {
|
||||
this.openmct.time.on('clock', this.updateRealTime);
|
||||
this.openmct.time.on('bounds', this.updateDisplayBounds);
|
||||
setTimeContext() {
|
||||
this.stopFollowingTimeContext();
|
||||
|
||||
this.timeContext = this.openmct.time.getContextForView(this.path);
|
||||
this.timeContext.on('timeContext', this.setTimeContext);
|
||||
this.followTimeContext();
|
||||
|
||||
},
|
||||
followTimeContext() {
|
||||
this.updateDisplayBounds(this.timeContext.bounds());
|
||||
this.timeContext.on('clock', this.updateRealTime);
|
||||
this.timeContext.on('bounds', this.updateDisplayBounds);
|
||||
this.synchronized(true);
|
||||
},
|
||||
stopFollowingTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off("clock", this.updateRealTime);
|
||||
this.timeContext.off("bounds", this.updateDisplayBounds);
|
||||
this.timeContext.off("timeContext", this.setTimeContext);
|
||||
}
|
||||
},
|
||||
getConfig() {
|
||||
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||
let config = configStore.get(configId);
|
||||
@ -485,7 +504,7 @@ export default {
|
||||
* displays can update accordingly.
|
||||
*/
|
||||
synchronized(value) {
|
||||
const isLocalClock = this.openmct.time.clock();
|
||||
const isLocalClock = this.timeContext.clock();
|
||||
|
||||
if (typeof value !== 'undefined') {
|
||||
this._synchronized = value;
|
||||
@ -958,7 +977,7 @@ export default {
|
||||
},
|
||||
|
||||
showSynchronizeDialog() {
|
||||
const isLocalClock = this.openmct.time.clock();
|
||||
const isLocalClock = this.timeContext.clock();
|
||||
if (isLocalClock !== undefined) {
|
||||
const message = `
|
||||
This action will change the Time Conductor to Fixed Timespan mode with this plot view's current time bounds.
|
||||
@ -993,9 +1012,9 @@ export default {
|
||||
},
|
||||
|
||||
synchronizeTimeConductor() {
|
||||
this.openmct.time.stopClock();
|
||||
this.timeContext.stopClock();
|
||||
const range = this.config.xAxis.get('displayRange');
|
||||
this.openmct.time.bounds({
|
||||
this.timeContext.bounds({
|
||||
start: range.min,
|
||||
end: range.max
|
||||
});
|
||||
@ -1006,6 +1025,7 @@ export default {
|
||||
configStore.deleteStore(this.config.id);
|
||||
|
||||
this.stopListening();
|
||||
|
||||
if (this.checkForSize) {
|
||||
clearInterval(this.checkForSize);
|
||||
delete this.checkForSize;
|
||||
@ -1021,8 +1041,7 @@ export default {
|
||||
|
||||
this.plotContainerResizeObserver.disconnect();
|
||||
|
||||
this.openmct.time.off('clock', this.updateRealTime);
|
||||
this.openmct.time.off('bounds', this.updateDisplayBounds);
|
||||
this.stopFollowingTimeContext();
|
||||
this.openmct.objectViews.off('clearData', this.clearData);
|
||||
},
|
||||
updateStatus(status) {
|
||||
|
@ -80,7 +80,7 @@ export default {
|
||||
components: {
|
||||
MctPlot
|
||||
},
|
||||
inject: ['openmct', 'domainObject'],
|
||||
inject: ['openmct', 'domainObject', 'path'],
|
||||
props: {
|
||||
options: {
|
||||
type: Object,
|
||||
|
@ -68,7 +68,8 @@ export default function PlotViewProvider(openmct) {
|
||||
},
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject
|
||||
domainObject,
|
||||
path: objectPath
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -53,7 +53,8 @@ export default function OverlayPlotViewProvider(openmct) {
|
||||
},
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject
|
||||
domainObject,
|
||||
path: objectPath
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -570,7 +570,8 @@ describe("the plugin", function () {
|
||||
provide: {
|
||||
openmct: openmct,
|
||||
domainObject: stackedPlotObject,
|
||||
composition: openmct.composition.get(stackedPlotObject)
|
||||
composition: openmct.composition.get(stackedPlotObject),
|
||||
path: [stackedPlotObject]
|
||||
},
|
||||
template: "<stacked-plot></stacked-plot>"
|
||||
});
|
||||
|
@ -75,7 +75,7 @@ export default {
|
||||
components: {
|
||||
StackedPlotItem
|
||||
},
|
||||
inject: ['openmct', 'domainObject', 'composition'],
|
||||
inject: ['openmct', 'domainObject', 'composition', 'path'],
|
||||
props: {
|
||||
options: {
|
||||
type: Object,
|
||||
|
@ -28,7 +28,7 @@ import MctPlot from '../MctPlot.vue';
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
inject: ['openmct', 'domainObject', 'path'],
|
||||
props: {
|
||||
object: {
|
||||
type: Object,
|
||||
@ -94,6 +94,7 @@ export default {
|
||||
|
||||
const openmct = this.openmct;
|
||||
const object = this.object;
|
||||
const path = this.path;
|
||||
|
||||
const getProps = this.getProps;
|
||||
let viewContainer = document.createElement('div');
|
||||
@ -106,7 +107,8 @@ export default {
|
||||
},
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject: object
|
||||
domainObject: object,
|
||||
path
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -55,7 +55,8 @@ export default function StackedPlotViewProvider(openmct) {
|
||||
provide: {
|
||||
openmct,
|
||||
domainObject,
|
||||
composition: openmct.composition.get(domainObject)
|
||||
composition: openmct.composition.get(domainObject),
|
||||
path: objectPath
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
Reference in New Issue
Block a user