From e9f120a4809750735a56376259032bc8af44383b Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Thu, 12 Dec 2024 14:55:31 +0100 Subject: [PATCH] button works --- .../events/components/EventTimelineView.vue | 27 ++++++++++++++----- src/plugins/timeline/ExtendedLinesBus.js | 2 -- src/plugins/timeline/TimelineObjectView.vue | 2 -- src/plugins/timeline/TimelineViewLayout.vue | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/plugins/events/components/EventTimelineView.vue b/src/plugins/events/components/EventTimelineView.vue index 8bfe8f8dcb..b456837d72 100644 --- a/src/plugins/events/components/EventTimelineView.vue +++ b/src/plugins/events/components/EventTimelineView.vue @@ -119,12 +119,18 @@ export default { }, enableExtendEventLines(keyStringToEnable) { if (this.keyString === keyStringToEnable) { + console.debug('πŸš„ enabling extending event lines'); this.extendLines = true; + // now emit our lines + this.emitExtendedLines(); } }, disableExtendEventLines(keyStringToDisable) { if (this.keyString === keyStringToDisable) { + console.debug('πŸš„ disabling extended event lines'); this.extendLines = false; + // now emit an empty array to clear the lines + this.emitExtendedLines(); } }, firstNonDomainAttribute(metadata) { @@ -422,13 +428,20 @@ export default { return eventWrapper; }, emitExtendedLines() { - const lines = this.eventHistory - .filter((e) => this.isEventInBounds(e)) - .map((e) => ({ x: this.xScale(e.time) })); - this.timelineEventBus.emit('update-extended-lines', { - lines, - keyString: this.keyString - }); + if (this.extendLines) { + const lines = this.eventHistory + .filter((e) => this.isEventInBounds(e)) + .map((e) => ({ x: this.xScale(e.time) })); + this.extendedLinesBus.emit('update-extended-lines', { + lines, + keyString: this.keyString + }); + } else { + this.extendedLinesBus.emit('update-extended-lines', { + lines: [], + keyString: this.keyString + }); + } } } }; diff --git a/src/plugins/timeline/ExtendedLinesBus.js b/src/plugins/timeline/ExtendedLinesBus.js index 3745cd8431..f4041bc0cf 100644 --- a/src/plugins/timeline/ExtendedLinesBus.js +++ b/src/plugins/timeline/ExtendedLinesBus.js @@ -27,11 +27,9 @@ export default class ExtendedLinesBus extends EventEmitter { this.emit('update-extended-lines', { lineData, keyString }); } disableExtendEventLines(keyString) { - console.debug('🍯 ExtendedLines#disableExtendedLines'); this.emit('disable-extended-lines', keyString); } enableExtendEventLines(keyString) { - console.debug('🍯 ExtendedLines#enableExtendedLines'); this.emit('enable-extended-lines', keyString); } } diff --git a/src/plugins/timeline/TimelineObjectView.vue b/src/plugins/timeline/TimelineObjectView.vue index 72fdd40f74..02ad672519 100644 --- a/src/plugins/timeline/TimelineObjectView.vue +++ b/src/plugins/timeline/TimelineObjectView.vue @@ -140,12 +140,10 @@ export default { this.status = this.openmct.status.get(this.domainObject.identifier); }, enableExtendEventLines() { - console.debug('πŸš„ extending event lines'); const keyString = this.openmct.objects.makeKeyString(this.item.domainObject.identifier); this.extendedLinesBus.enableExtendEventLines(keyString); }, disableExtendEventLines() { - console.debug('πŸš„ disabling extended event lines'); const keyString = this.openmct.objects.makeKeyString(this.item.domainObject.identifier); this.extendedLinesBus.disableExtendEventLines(keyString); }, diff --git a/src/plugins/timeline/TimelineViewLayout.vue b/src/plugins/timeline/TimelineViewLayout.vue index cf09a4dc6f..79d9c2e9db 100644 --- a/src/plugins/timeline/TimelineViewLayout.vue +++ b/src/plugins/timeline/TimelineViewLayout.vue @@ -234,7 +234,7 @@ export default { this.timeContext.off('clockChanged', this.updateViewBounds); } }, - updateExtendedLines(lines) { + updateExtendedLines({ keyString, lines }) { console.debug('πŸ—ΊοΈ Updating extended lines', lines); this.extendedLines = lines; }