[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:
Khalid Adil 2023-08-17 11:18:25 -05:00 committed by GitHub
parent 99a3e3fc32
commit 3f80b53ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 21 deletions

View File

@ -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];
let telemetryPath = [];
if (objectDetails?.type === 'folder') {
return telemetryPath;
}
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) =>
this.makeKeyString(telemetrySource) === this.makeKeyString(telemetryIdentifier)
sourceTelemetry = objectDetails.composition.find((telemetrySource) =>
utils.identifierEquals(telemetrySource, 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;
}

View File

@ -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();
}
/**

View File

@ -3,6 +3,7 @@
height: auto;
width: auto;
padding: $interiorMargin;
overflow-wrap: break-word;
}
.c-tooltip {