From 44415b37697a3cd4b28ea789ffce265dd0da7823 Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Tue, 1 Aug 2023 14:16:20 -0700 Subject: [PATCH 1/9] cherry-pick(#6868): fix: toggling markers, alarm markers, marker style + update `Vue.extend()` usage to Vue 3 (#6873) * fix: update to `defineComponent` from `Vue.extend()` * fix: unwrap Proxy arg before WeakMap.get() * refactor: `defineComponent` not needed here --- src/plugins/plot/chart/MctChart.vue | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/plugins/plot/chart/MctChart.vue b/src/plugins/plot/chart/MctChart.vue index b5eec1e203b..b40b2b9f1ae 100644 --- a/src/plugins/plot/chart/MctChart.vue +++ b/src/plugins/plot/chart/MctChart.vue @@ -42,7 +42,8 @@ import configStore from '../configuration/ConfigStore'; import PlotConfigurationModel from '../configuration/PlotConfigurationModel'; import LimitLine from './LimitLine.vue'; import LimitLabel from './LimitLabel.vue'; -import Vue from 'vue'; +import mount from 'utils/mount'; +import { toRaw } from 'vue'; const MARKER_SIZE = 6.0; const HIGHLIGHT_SIZE = MARKER_SIZE * 2.0; @@ -315,7 +316,7 @@ export default { return; } - const elements = this.seriesElements.get(series); + const elements = this.seriesElements.get(toRaw(series)); elements.lines.forEach(function (line) { this.lines.splice(this.lines.indexOf(line), 1); line.destroy(); @@ -333,7 +334,7 @@ export default { return; } - const elements = this.seriesElements.get(series); + const elements = this.seriesElements.get(toRaw(series)); if (elements.alarmSet) { elements.alarmSet.destroy(); this.alarmSets.splice(this.alarmSets.indexOf(elements.alarmSet), 1); @@ -349,7 +350,7 @@ export default { return; } - const elements = this.seriesElements.get(series); + const elements = this.seriesElements.get(toRaw(series)); elements.pointSets.forEach(function (pointSet) { this.pointSets.splice(this.pointSets.indexOf(pointSet), 1); pointSet.destroy(); @@ -473,7 +474,7 @@ export default { this.$emit('plotReinitializeCanvas'); }, removeChartElement(series) { - const elements = this.seriesElements.get(series); + const elements = this.seriesElements.get(toRaw(series)); elements.lines.forEach(function (line) { this.lines.splice(this.lines.indexOf(line), 1); @@ -576,7 +577,7 @@ export default { this.seriesLimits.set(series, limitElements); }, clearLimitLines(series) { - const seriesLimits = this.seriesLimits.get(series); + const seriesLimits = this.seriesLimits.get(toRaw(series)); if (seriesLimits) { seriesLimits.limitLines.forEach(function (line) { @@ -747,16 +748,14 @@ export default { left: 0, top: this.drawAPI.y(limit.point.y) }; - let LimitLineClass = Vue.extend(LimitLine); - const component = new LimitLineClass({ - propsData: { + const { vNode } = mount(LimitLine, { + props: { point, limit } }); - component.$mount(); - return component.$el; + return vNode.el; }, getLimitOverlap(limit, overlapMap) { //calculate if limit lines are too close to each other @@ -792,16 +791,14 @@ export default { left: 0, top: this.drawAPI.y(limit.point.y) }; - let LimitLabelClass = Vue.extend(LimitLabel); - const component = new LimitLabelClass({ - propsData: { + const { vNode } = mount(LimitLabel, { + props: { limit: Object.assign({}, overlap, limit), point } }); - component.$mount(); - return component.$el; + return vNode.el; }, drawAlarmPoints(alarmSet) { this.drawAPI.drawLimitPoints( From 0f5d3afc4a0e747aa261f0652711670acb03188a Mon Sep 17 00:00:00 2001 From: Andrew Henry Date: Wed, 2 Aug 2023 09:50:29 -0700 Subject: [PATCH 2/9] cherry pick (#6875) suppress deprecation warnings to once per unique args (#6881) fix: suppress deprecation warnings to once per unique args (#6875) Co-authored-by: Jesse Mazzella --- src/api/time/TimeContext.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/api/time/TimeContext.js b/src/api/time/TimeContext.js index 8ff1657696f..e18530331f4 100644 --- a/src/api/time/TimeContext.js +++ b/src/api/time/TimeContext.js @@ -42,6 +42,7 @@ class TimeContext extends EventEmitter { this.activeClock = undefined; this.offsets = undefined; this.mode = undefined; + this.warnCounts = {}; this.tick = this.tick.bind(this); } @@ -648,6 +649,17 @@ class TimeContext extends EventEmitter { } #warnMethodDeprecated(method, newMethod) { + const MAX_CALLS = 1; // Only warn once per unique method and newMethod combination + + const key = `${method}.${newMethod}`; + const currentWarnCount = this.warnCounts[key] || 0; + + if (currentWarnCount >= MAX_CALLS) { + return; // Don't warn if already warned once + } + + this.warnCounts[key] = currentWarnCount + 1; + let message = `[DEPRECATION WARNING]: The ${method} API method is deprecated and will be removed in a future version of Open MCT.`; if (newMethod) { From 796616fe3f6813cec1d35c14a4d59dd7de5cfcdb Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Wed, 2 Aug 2023 10:00:51 -0700 Subject: [PATCH 3/9] cherry-pick(#6877): Set the raw series limits so that we can get the raw series limits (#6883) * Set the raw series limits so that we can get the raw series limits * fix: `toRaw()` the other gets/sets/deletes --------- Co-authored-by: Shefali Joshi --- src/plugins/plot/chart/MctChart.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/plot/chart/MctChart.vue b/src/plugins/plot/chart/MctChart.vue index b40b2b9f1ae..1cc3438aa2e 100644 --- a/src/plugins/plot/chart/MctChart.vue +++ b/src/plugins/plot/chart/MctChart.vue @@ -489,7 +489,7 @@ export default { this.alarmSets.splice(this.alarmSets.indexOf(elements.alarmSet), 1); } - this.seriesElements.delete(series); + this.seriesElements.delete(toRaw(series)); this.clearLimitLines(series); }, @@ -555,7 +555,7 @@ export default { this.alarmSets.push(elements.alarmSet); } - this.seriesElements.set(series, elements); + this.seriesElements.set(toRaw(series), elements); }, makeLimitLines(series) { this.clearLimitLines(series); @@ -574,7 +574,7 @@ export default { this.limitLines.push(limitLine); } - this.seriesLimits.set(series, limitElements); + this.seriesLimits.set(toRaw(series), limitElements); }, clearLimitLines(series) { const seriesLimits = this.seriesLimits.get(toRaw(series)); @@ -585,7 +585,7 @@ export default { line.destroy(); }, this); - this.seriesLimits.delete(series); + this.seriesLimits.delete(toRaw(series)); } }, canDraw(yAxisId) { From 492e8055e57607a1ab0d818de2c3446089af8cbd Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Wed, 2 Aug 2023 16:45:47 -0700 Subject: [PATCH 4/9] cherry-pick(#6885): Synchronize timers between multiple users (#6886) * created a throttle util and using it in timer plugin to throttle refreshing the timer domain object * Simplify timer logic * Clarify code a little * refactor: lint:fix * Fix linting issue --------- Co-authored-by: Andrew Henry Co-authored-by: Jamie V --- src/plugins/timer/components/Timer.vue | 58 ++++++++------------------ src/utils/throttle.js | 34 +++++++++++++++ 2 files changed, 52 insertions(+), 40 deletions(-) create mode 100644 src/utils/throttle.js diff --git a/src/plugins/timer/components/Timer.vue b/src/plugins/timer/components/Timer.vue index 8a28d895488..ec74cc1a2d4 100644 --- a/src/plugins/timer/components/Timer.vue +++ b/src/plugins/timer/components/Timer.vue @@ -43,9 +43,11 @@