mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 09:08:43 +00:00
Emit indices of out of order telemetry collection items (#6342)
* Emit the indices of items added by the telemetry collections * Handle added item indices for imagery
This commit is contained in:
@ -180,6 +180,7 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
let beforeStartOfBounds;
|
||||
let afterEndOfBounds;
|
||||
let added = [];
|
||||
let addedIndices = [];
|
||||
|
||||
// loop through, sort and dedupe
|
||||
for (let datum of data) {
|
||||
@ -212,6 +213,7 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
let index = endIndex || startIndex;
|
||||
|
||||
this.boundedTelemetry.splice(index, 0, datum);
|
||||
addedIndices.push(index);
|
||||
added.push(datum);
|
||||
}
|
||||
|
||||
@ -230,7 +232,7 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
this.emit('add', this.boundedTelemetry);
|
||||
}
|
||||
} else {
|
||||
this.emit('add', added);
|
||||
this.emit('add', added, addedIndices);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -330,7 +332,8 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
this.boundedTelemetry = added;
|
||||
}
|
||||
|
||||
this.emit('add', added);
|
||||
// Assumption is that added will be of length 1 here, so just send the last index of the boundedTelemetry in the add event
|
||||
this.emit('add', added, [this.boundedTelemetry.length]);
|
||||
}
|
||||
} else {
|
||||
// user bounds change, reset
|
||||
|
Reference in New Issue
Block a user