mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
prevent composition from adding a dupe into layout
This commit is contained in:
@ -445,16 +445,44 @@ export default {
|
|||||||
this.objectViewMap = {};
|
this.objectViewMap = {};
|
||||||
this.layoutItems.forEach(this.trackItem);
|
this.layoutItems.forEach(this.trackItem);
|
||||||
},
|
},
|
||||||
addChild(child) {
|
isItemAlreadyTracked(child) {
|
||||||
let keyString = this.openmct.objects.makeKeyString(child.identifier);
|
let found = false,
|
||||||
if (this.isTelemetry(child)) {
|
keyString = this.openmct.objects.makeKeyString(child.identifier);
|
||||||
if (!this.telemetryViewMap[keyString] && !this.objectViewMap[keyString]) {
|
|
||||||
this.addItem('telemetry-view', child);
|
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) {
|
removeChild(identifier) {
|
||||||
let keyString = this.openmct.objects.makeKeyString(identifier);
|
let keyString = this.openmct.objects.makeKeyString(identifier);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user