Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nasa/openmct.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Bell <scott@traclabs.com>2022-10-21 21:19:41 +0300
committerGitHub <noreply@github.com>2022-10-21 21:19:41 +0300
commitbd1e869f6a9864bdec75641bdce88360d5842020 (patch)
tree02b65d3120034d09968e488c16978e5dd073d655
parente4a36532e7b8cb36effdbb12ad2cd4398330aa0c (diff)
fix timing issue (#5896)
-rw-r--r--src/plugins/plot/chart/MctChart.vue2
-rw-r--r--src/plugins/plot/configuration/PlotSeries.js68
2 files changed, 25 insertions, 45 deletions
diff --git a/src/plugins/plot/chart/MctChart.vue b/src/plugins/plot/chart/MctChart.vue
index 2f53255a1..7459c83a7 100644
--- a/src/plugins/plot/chart/MctChart.vue
+++ b/src/plugins/plot/chart/MctChart.vue
@@ -382,7 +382,7 @@ export default {
makeLimitLines(series) {
this.clearLimitLines(series);
- if (!series.get('limitLines')) {
+ if (!series || !series.get('limitLines')) {
return;
}
diff --git a/src/plugins/plot/configuration/PlotSeries.js b/src/plugins/plot/configuration/PlotSeries.js
index 5e3c8cc43..5923c2c15 100644
--- a/src/plugins/plot/configuration/PlotSeries.js
+++ b/src/plugins/plot/configuration/PlotSeries.js
@@ -151,16 +151,6 @@ export default class PlotSeries extends Model {
this.limitEvaluator = this.openmct.telemetry.limitEvaluator(options.domainObject);
this.limitDefinition = this.openmct.telemetry.limitDefinition(options.domainObject);
this.limits = [];
- this.limitDefinition.limits().then(response => {
- this.limits = [];
-
- if (response) {
- this.limits = response;
- }
-
- this.emit('limits', this);
-
- });
this.openmct.time.on('bounds', this.updateLimits);
this.removeMutationListener = this.openmct.objects.observe(
this.domainObject,
@@ -176,15 +166,6 @@ export default class PlotSeries extends Model {
this.emit('limitBounds', bounds);
}
- locateOldObject(oldStyleParent) {
- return oldStyleParent.useCapability('composition')
- .then(function (children) {
- this.oldObject = children
- .filter(function (child) {
- return child.getId() === this.keyString;
- }, this)[0];
- }.bind(this));
- }
/**
* Fetch historical data and establish a realtime subscription. Returns
* a promise that is resolved when all connections have been successfully
@@ -192,7 +173,7 @@ export default class PlotSeries extends Model {
*
* @returns {Promise}
*/
- fetch(options) {
+ async fetch(options) {
let strategy;
if (this.model.interpolate !== 'none') {
@@ -217,23 +198,19 @@ export default class PlotSeries extends Model {
);
}
- /* eslint-disable you-dont-need-lodash-underscore/concat */
- return this.openmct
- .telemetry
- .request(this.domainObject, options)
- .then((points) => {
- const data = this.getSeriesData();
- const newPoints = _(data)
- .concat(points)
- .sortBy(this.getXVal)
- .uniq(true, point => [this.getXVal(point), this.getYVal(point)].join())
- .value();
- this.reset(newPoints);
- })
- .catch((error) => {
- console.warn('Error fetching data', error);
- });
- /* eslint-enable you-dont-need-lodash-underscore/concat */
+ try {
+ const points = await this.openmct.telemetry.request(this.domainObject, options);
+ const data = this.getSeriesData();
+ // eslint-disable-next-line you-dont-need-lodash-underscore/concat
+ const newPoints = _(data)
+ .concat(points)
+ .sortBy(this.getXVal)
+ .uniq(true, point => [this.getXVal(point), this.getYVal(point)].join())
+ .value();
+ this.reset(newPoints);
+ } catch (error) {
+ console.warn('Error fetching data', error);
+ }
}
updateName(name) {
@@ -334,16 +311,19 @@ export default class PlotSeries extends Model {
* Override this to implement plot series loading functionality. Must return
* a promise that is resolved when loading is completed.
*
- * @private
* @returns {Promise}
*/
- load(options) {
- return this.fetch(options)
- .then(function (res) {
- this.emit('load');
+ async load(options) {
+ await this.fetch(options);
+ this.emit('load');
+ const limitsResponse = await this.limitDefinition.limits();
+ this.limits = [];
+ if (limitsResponse) {
+ this.limits = limitsResponse;
+ }
- return res;
- }.bind(this));
+ this.emit('limits', this);
+ this.emit('change:limitLines', this);
}
/**