mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +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:
@ -554,28 +554,34 @@ export default class ObjectAPI {
|
|||||||
*/
|
*/
|
||||||
async getTelemetryPath(identifier, telemetryIdentifier) {
|
async getTelemetryPath(identifier, telemetryIdentifier) {
|
||||||
const objectDetails = await this.get(identifier);
|
const objectDetails = await this.get(identifier);
|
||||||
const telemetryPath = [];
|
let telemetryPath = [];
|
||||||
if (objectDetails.composition && !['folder'].includes(objectDetails.type)) {
|
if (objectDetails?.type === 'folder') {
|
||||||
let sourceTelemetry = objectDetails.composition[0];
|
return telemetryPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sourceTelemetry = null;
|
||||||
|
if (telemetryIdentifier && utils.identifierEquals(identifier, telemetryIdentifier)) {
|
||||||
|
sourceTelemetry = identifier;
|
||||||
|
} else if (objectDetails.composition) {
|
||||||
|
sourceTelemetry = objectDetails.composition[0];
|
||||||
if (telemetryIdentifier) {
|
if (telemetryIdentifier) {
|
||||||
sourceTelemetry = objectDetails.composition.find(
|
sourceTelemetry = objectDetails.composition.find((telemetrySource) =>
|
||||||
(telemetrySource) =>
|
utils.identifierEquals(telemetrySource, telemetryIdentifier)
|
||||||
this.makeKeyString(telemetrySource) === this.makeKeyString(telemetryIdentifier)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const compositionElement = await this.get(sourceTelemetry);
|
|
||||||
if (!['yamcs.telemetry', 'generator'].includes(compositionElement.type)) {
|
|
||||||
return telemetryPath;
|
|
||||||
}
|
|
||||||
const telemetryKey = compositionElement.identifier.key;
|
|
||||||
const telemetryPathObjects = await this.getOriginalPath(telemetryKey);
|
|
||||||
telemetryPathObjects.forEach((pathObject) => {
|
|
||||||
if (pathObject.type === 'root') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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;
|
return telemetryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,13 +57,22 @@ class TooltipAPI {
|
|||||||
* @private for platform-internal use
|
* @private for platform-internal use
|
||||||
*/
|
*/
|
||||||
showTooltip(tooltip) {
|
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--) {
|
for (let i = this.activeToolTips.length - 1; i > -1; i--) {
|
||||||
this.activeToolTips[i].destroy();
|
this.activeToolTips[i].destroy();
|
||||||
this.activeToolTips.splice(i, 1);
|
this.activeToolTips.splice(i, 1);
|
||||||
}
|
}
|
||||||
this.activeToolTips.push(tooltip);
|
|
||||||
|
|
||||||
tooltip.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: $interiorMargin;
|
padding: $interiorMargin;
|
||||||
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.c-tooltip {
|
.c-tooltip {
|
||||||
|
Reference in New Issue
Block a user