mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[Tooltips] Fixes for dictionary objects and self-referential objects (#6916)
* Fix getTelemetryPath to handle cases where parent is the same as the child, handle yamcs aggregate telemetry, and fix how identifiers are passed in * Cleanup getTelemetryPath * Switch to filter instead of forEach * Get path item names * Remove tooltips on scroll of tree * Remove handing for scroll * Allow break-words * Cleanup
This commit is contained in:
parent
99a3e3fc32
commit
3f80b53ea6
@ -554,28 +554,34 @@ export default class ObjectAPI {
|
||||
*/
|
||||
async getTelemetryPath(identifier, telemetryIdentifier) {
|
||||
const objectDetails = await this.get(identifier);
|
||||
const telemetryPath = [];
|
||||
if (objectDetails.composition && !['folder'].includes(objectDetails.type)) {
|
||||
let sourceTelemetry = objectDetails.composition[0];
|
||||
if (telemetryIdentifier) {
|
||||
sourceTelemetry = objectDetails.composition.find(
|
||||
(telemetrySource) =>
|
||||
this.makeKeyString(telemetrySource) === this.makeKeyString(telemetryIdentifier)
|
||||
);
|
||||
}
|
||||
const compositionElement = await this.get(sourceTelemetry);
|
||||
if (!['yamcs.telemetry', 'generator'].includes(compositionElement.type)) {
|
||||
let telemetryPath = [];
|
||||
if (objectDetails?.type === 'folder') {
|
||||
return telemetryPath;
|
||||
}
|
||||
const telemetryKey = compositionElement.identifier.key;
|
||||
const telemetryPathObjects = await this.getOriginalPath(telemetryKey);
|
||||
telemetryPathObjects.forEach((pathObject) => {
|
||||
if (pathObject.type === 'root') {
|
||||
return;
|
||||
|
||||
let sourceTelemetry = null;
|
||||
if (telemetryIdentifier && utils.identifierEquals(identifier, telemetryIdentifier)) {
|
||||
sourceTelemetry = identifier;
|
||||
} else if (objectDetails.composition) {
|
||||
sourceTelemetry = objectDetails.composition[0];
|
||||
if (telemetryIdentifier) {
|
||||
sourceTelemetry = objectDetails.composition.find((telemetrySource) =>
|
||||
utils.identifierEquals(telemetrySource, telemetryIdentifier)
|
||||
);
|
||||
}
|
||||
telemetryPath.unshift(pathObject.name);
|
||||
});
|
||||
}
|
||||
|
||||
const compositionElement = await this.get(sourceTelemetry);
|
||||
if (!['yamcs.telemetry', 'generator', 'yamcs.aggregate'].includes(compositionElement.type)) {
|
||||
return telemetryPath;
|
||||
}
|
||||
|
||||
const telemetryPathObjects = await this.getOriginalPath(compositionElement.identifier);
|
||||
telemetryPath = telemetryPathObjects
|
||||
.reverse()
|
||||
.filter((pathObject) => pathObject.type !== 'root')
|
||||
.map((pathObject) => pathObject.name);
|
||||
|
||||
return telemetryPath;
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,22 @@ class TooltipAPI {
|
||||
* @private for platform-internal use
|
||||
*/
|
||||
showTooltip(tooltip) {
|
||||
this.removeAllTooltips();
|
||||
this.activeToolTips.push(tooltip);
|
||||
tooltip.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* API method to allow for removing all tooltips
|
||||
*/
|
||||
removeAllTooltips() {
|
||||
if (!this.activeToolTips?.length) {
|
||||
return;
|
||||
}
|
||||
for (let i = this.activeToolTips.length - 1; i > -1; i--) {
|
||||
this.activeToolTips[i].destroy();
|
||||
this.activeToolTips.splice(i, 1);
|
||||
}
|
||||
this.activeToolTips.push(tooltip);
|
||||
|
||||
tooltip.show();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,6 +3,7 @@
|
||||
height: auto;
|
||||
width: auto;
|
||||
padding: $interiorMargin;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.c-tooltip {
|
||||
|
Loading…
Reference in New Issue
Block a user