mirror of
https://github.com/nasa/openmct.git
synced 2025-04-16 07:26:53 +00:00
Merge pull request #3130 from nasa/display-layout-fix-3128
[Display Layouts] Prevent duplicate from being added when composition 'add' is fired
This commit is contained in:
commit
9ceb3c5b1e
@ -457,16 +457,44 @@ export default {
|
||||
this.objectViewMap = {};
|
||||
this.layoutItems.forEach(this.trackItem);
|
||||
},
|
||||
addChild(child) {
|
||||
let keyString = this.openmct.objects.makeKeyString(child.identifier);
|
||||
if (this.isTelemetry(child)) {
|
||||
if (!this.telemetryViewMap[keyString] && !this.objectViewMap[keyString]) {
|
||||
this.addItem('telemetry-view', child);
|
||||
isItemAlreadyTracked(child) {
|
||||
let found = false,
|
||||
keyString = this.openmct.objects.makeKeyString(child.identifier);
|
||||
|
||||
this.layoutItems.forEach(item => {
|
||||
if (item.identifier) {
|
||||
let itemKeyString = this.openmct.objects.makeKeyString(item.identifier);
|
||||
|
||||
if (itemKeyString === keyString) {
|
||||
found = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (!this.objectViewMap[keyString]) {
|
||||
this.addItem('subobject-view', child);
|
||||
});
|
||||
|
||||
if (found) {
|
||||
return true;
|
||||
} else if (this.isTelemetry(child)) {
|
||||
return this.telemetryViewMap[keyString] && this.objectViewMap[keyString];
|
||||
} else {
|
||||
return this.objectViewMap[keyString];
|
||||
}
|
||||
},
|
||||
addChild(child) {
|
||||
if (this.isItemAlreadyTracked(child)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let type;
|
||||
|
||||
if (this.isTelemetry(child)) {
|
||||
type = 'telemetry-view';
|
||||
} else {
|
||||
type = 'subobject-view';
|
||||
}
|
||||
|
||||
this.addItem(type, child);
|
||||
},
|
||||
removeChild(identifier) {
|
||||
let keyString = this.openmct.objects.makeKeyString(identifier);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user