Skip to content

Commit

Permalink
Merge branch 'simplify-timers' of https://github.com/nasa/openmct int…
Browse files Browse the repository at this point in the history
…o simplify-timers
  • Loading branch information
akhenry committed Aug 2, 2023
2 parents 24f8781 + 1c4fa7f commit 6358b9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/api/time/TimeContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/plot/chart/MctChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand All @@ -585,7 +585,7 @@ export default {
line.destroy();
}, this);
this.seriesLimits.delete(series);
this.seriesLimits.delete(toRaw(series));
}
},
canDraw(yAxisId) {
Expand Down

0 comments on commit 6358b9c

Please sign in to comment.