Dismiss the independent time conductor popup on unmount (#6859)

* Don't set conductor popup to null unless the view is being destroyed

* Replace beforeDestroy with beforeUnmount

* Propagate plot tick widths to timeline view

* Check if conductor popup exists before trying to remove it from the dom

* Fix imagery e2e test

* Revert accidental commit

---------

Co-authored-by: Jesse Mazzella <ozyx@users.noreply.github.com>
This commit is contained in:
Shefali Joshi 2023-08-07 16:19:13 -07:00 committed by GitHub
parent accfbc96ab
commit 6a9ff91d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 17 deletions

View File

@ -97,7 +97,7 @@ test.describe('Example Imagery Object', () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
// check image date // check image date
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible(); await expect(page.getByText('2021-12-30 01:01:00.000Z').first()).toBeVisible();
// flip it off // flip it off
await page.getByRole('switch', { name: 'Disable Independent Time Conductor' }).click(); await page.getByRole('switch', { name: 'Disable Independent Time Conductor' }).click();

View File

@ -92,7 +92,7 @@ export default {
this.openmct.time.on(TIME_CONTEXT_EVENTS.timeSystemChanged, this.setViewFromTimeSystem); this.openmct.time.on(TIME_CONTEXT_EVENTS.timeSystemChanged, this.setViewFromTimeSystem);
this.resizeTimer = setInterval(this.resize, RESIZE_POLL_INTERVAL); this.resizeTimer = setInterval(this.resize, RESIZE_POLL_INTERVAL);
}, },
beforeDestroy() { beforeUnmount() {
clearInterval(this.resizeTimer); clearInterval(this.resizeTimer);
}, },
methods: { methods: {

View File

@ -102,7 +102,7 @@ export default {
this.openmct.time.on(TIME_CONTEXT_EVENTS.timeSystemChanged, this.updateTimeSystem); this.openmct.time.on(TIME_CONTEXT_EVENTS.timeSystemChanged, this.updateTimeSystem);
this.openmct.time.on(TIME_CONTEXT_EVENTS.modeChanged, this.updateMode); this.openmct.time.on(TIME_CONTEXT_EVENTS.modeChanged, this.updateMode);
}, },
beforeDestroy() { beforeUnmount() {
this.openmct.time.off(TIME_CONTEXT_EVENTS.boundsChanged, this.addTimespan); this.openmct.time.off(TIME_CONTEXT_EVENTS.boundsChanged, this.addTimespan);
this.openmct.time.off(TIME_CONTEXT_EVENTS.clockOffsetsChanged, this.addTimespan); this.openmct.time.off(TIME_CONTEXT_EVENTS.clockOffsetsChanged, this.addTimespan);
this.openmct.time.off(TIME_CONTEXT_EVENTS.timeSystemChanged, this.updateTimeSystem); this.openmct.time.off(TIME_CONTEXT_EVENTS.timeSystemChanged, this.updateTimeSystem);

View File

@ -184,7 +184,7 @@ export default {
this.$emit('popupLoaded'); this.$emit('popupLoaded');
this.setTimeContext(); this.setTimeContext();
}, },
beforeDestroy() { beforeUnmount() {
this.stopFollowingTimeContext(); this.stopFollowingTimeContext();
}, },
methods: { methods: {

View File

@ -75,7 +75,7 @@ export default {
} }
} }
}, },
beforeDestroy() { beforeUnmount() {
this.openmct.time.off(TIME_CONTEXT_EVENTS.clockChanged, this.setViewFromClock); this.openmct.time.off(TIME_CONTEXT_EVENTS.clockChanged, this.setViewFromClock);
}, },
mounted: function () { mounted: function () {

View File

@ -31,14 +31,17 @@ export default {
conductorPopup: null conductorPopup: null
}; };
}, },
beforeUnmount() {
if (this.conductorPopup && this.conductorPopup.parentNode === document.body) {
document.body.removeChild(this.conductorPopup);
this.conductorPopup = null;
}
},
mounted() { mounted() {
this.positionBox = debounce(raf(this.positionBox), 250); this.positionBox = debounce(raf(this.positionBox), 250);
this.timeConductorOptionsHolder = this.$el; this.timeConductorOptionsHolder = this.$el;
this.timeConductorOptionsHolder.addEventListener('click', this.showPopup); this.timeConductorOptionsHolder.addEventListener('click', this.showPopup);
}, },
beforeDestroy() {
this.clearPopup();
},
methods: { methods: {
initializePopup() { initializePopup() {
this.conductorPopup = this.$refs.conductorPopup.$el; this.conductorPopup = this.$refs.conductorPopup.$el;
@ -60,12 +63,7 @@ export default {
// itc toggled, // itc toggled,
// something is emitting a dupe event with pointer id = -1, want to ignore those // something is emitting a dupe event with pointer id = -1, want to ignore those
// itc is currently enabled // itc is currently enabled
if ( if (!isToggle && clickEvent.pointerId !== -1 && this.independentTCEnabled) {
!this.conductorPopup &&
!isToggle &&
clickEvent.pointerId !== -1 &&
this.independentTCEnabled
) {
this.showConductorPopup = true; this.showConductorPopup = true;
} }
}, },
@ -101,7 +99,6 @@ export default {
return; return;
} }
this.showConductorPopup = false; this.showConductorPopup = false;
this.conductorPopup = null;
this.positionX = -10000; // reset it off screan this.positionX = -10000; // reset it off screan
document.removeEventListener('click', this.handleClickAway); document.removeEventListener('click', this.handleClickAway);

View File

@ -157,7 +157,7 @@ export default {
this.handleNewBounds = _.throttle(this.handleNewBounds, 300); this.handleNewBounds = _.throttle(this.handleNewBounds, 300);
this.setTimeSystem(JSON.parse(JSON.stringify(this.openmct.time.getTimeSystem()))); this.setTimeSystem(JSON.parse(JSON.stringify(this.openmct.time.getTimeSystem())));
}, },
beforeDestroy() { beforeUnmount() {
this.clearAllValidation(); this.clearAllValidation();
}, },
methods: { methods: {

View File

@ -173,7 +173,7 @@ export default {
this.setOffsets(); this.setOffsets();
document.addEventListener('click', this.hide); document.addEventListener('click', this.hide);
}, },
beforeDestroy() { beforeUnmount() {
document.removeEventListener('click', this.hide); document.removeEventListener('click', this.hide);
}, },
methods: { methods: {