Skip to content

Commit

Permalink
Closes #7936
Browse files Browse the repository at this point in the history
- Styling added to tooltip for event severity.
  • Loading branch information
charlesh88 committed Dec 18, 2024
1 parent 099153b commit 546714b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/plugins/events/components/EventTimelineView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ export default {
}
this.openmct.selection.select(selection, true);
},
getLimitClass(event) {
const limitEvaluation = this.limitEvaluator.evaluate(event, this.valueMetadata);
return limitEvaluation?.cssClass;
},
createEventWrapper(event) {
const id = `${ID_PREFIX}${event.time}`;
const eventWrapper = document.createElement('div');
Expand All @@ -418,16 +422,15 @@ export default {
const textToShow = event[this.titleKey];
eventWrapper.ariaLabel = textToShow;
eventWrapper.addEventListener('mouseover', () => {
this.showToolTip(textToShow, eventWrapper);
this.showToolTip(textToShow, eventWrapper, event);
this.extendedLinesBus.updateHoverExtendEventLine(this.keyString, event.time);
});
eventWrapper.addEventListener('mouseleave', () => {
this.tooltip?.destroy();
this.extendedLinesBus.updateHoverExtendEventLine(this.keyString, null);
});
}
const limitEvaluation = this.limitEvaluator.evaluate(event, this.valueMetadata);
const limitClass = limitEvaluation?.cssClass;
const limitClass = this.getLimitClass(event);
if (limitClass) {
eventWrapper.classList.add(limitClass);
event.limitClass = limitClass;
Expand Down Expand Up @@ -456,12 +459,22 @@ export default {
});
}
},
showToolTip(textToShow, referenceElement) {
showToolTip(textToShow, referenceElement, event) {
const aClasses = ['c-events-tooltip'];
const limitClass = this.getLimitClass(event);
if (limitClass) {
aClasses.push(limitClass);
}
const showToLeft = false; // Temp, stubbed in
if (showToLeft) {
aClasses.push('--left');
}

this.tooltip = this.openmct.tooltips.tooltip({
toolTipText: textToShow,
toolTipLocation: this.openmct.tooltips.TOOLTIP_LOCATIONS.RIGHT,
parentElement: referenceElement,
cssClasses: ['c-timeline-event-tooltip']
cssClasses: [aClasses.join(' ')]
});
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/events/components/events-view.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@
}
}
}

.c-events-tooltip {
// Default to right of event line
border-radius: 0 !important;
//transform: translate(0, $interiorMargin);
}

0 comments on commit 546714b

Please sign in to comment.