inspector and colors work

This commit is contained in:
Scott Bell 2024-12-11 11:34:07 +01:00
parent 2776cc8ac9
commit 5b006b69b7
2 changed files with 17 additions and 11 deletions

View File

@ -12,8 +12,6 @@ export default function EventInspectorViewProvider(openmct) {
return false; return false;
} }
console.debug(`🧟 Event Inspector received selection`, selection);
const selectionType = selection[0][0].context?.type; const selectionType = selection[0][0].context?.type;
const event = selection[0][0].context?.event; const event = selection[0][0].context?.event;
return selectionType === 'time-strip-event-selection' && event; return selectionType === 'time-strip-event-selection' && event;

View File

@ -78,6 +78,12 @@ export default {
this.setTimeContext = this.setTimeContext.bind(this); this.setTimeContext = this.setTimeContext.bind(this);
this.setTimeContext(); this.setTimeContext();
this.limitEvaluator = this.openmct.telemetry.limitEvaluator(this.domainObject);
const metadata = this.openmct.telemetry.getMetadata(this.domainObject);
if (metadata) {
this.valueMetadata =
metadata.valuesForHints(['range'])[0] || this.firstNonDomainAttribute(metadata);
}
this.updateViewBounds(); this.updateViewBounds();
this.resize = _.debounce(this.resize, 400); this.resize = _.debounce(this.resize, 400);
@ -106,6 +112,11 @@ export default {
this.timeContext.on('timeSystem', this.setScaleAndPlotEvents); this.timeContext.on('timeSystem', this.setScaleAndPlotEvents);
this.timeContext.on('boundsChanged', this.updateViewBounds); this.timeContext.on('boundsChanged', this.updateViewBounds);
}, },
firstNonDomainAttribute(metadata) {
return metadata
.values()
.find((metadatum) => metadatum.hints.domain === undefined && metadatum.key !== 'name');
},
stopFollowingTimeContext() { stopFollowingTimeContext() {
if (this.timeContext) { if (this.timeContext) {
this.timeContext.off('timeSystem', this.setScaleAndPlotEvents); this.timeContext.off('timeSystem', this.setScaleAndPlotEvents);
@ -294,15 +305,6 @@ export default {
element.setAttributeNS(null, key, attributes[key]); element.setAttributeNS(null, key, attributes[key]);
}); });
}, },
setStyles(element, styles) {
if (!element) {
return;
}
Object.keys(styles).forEach((key) => {
element.style[key] = styles[key];
});
},
getEventWrapper(item) { getEventWrapper(item) {
const id = `${ID_PREFIX}${item.time}`; const id = `${ID_PREFIX}${item.time}`;
@ -384,6 +386,12 @@ export default {
eventTickElement.style.height = `${String(ROW_HEIGHT - 10)}px`; eventTickElement.style.height = `${String(ROW_HEIGHT - 10)}px`;
eventWrapper.appendChild(eventTickElement); eventWrapper.appendChild(eventTickElement);
const limitEvaluation = this.limitEvaluator.evaluate(event, this.valueMetadata);
const limitClass = limitEvaluation?.cssClass;
if (limitClass) {
eventWrapper.classList.add(limitClass);
}
eventWrapper.addEventListener('click', (mouseEvent) => { eventWrapper.addEventListener('click', (mouseEvent) => {
mouseEvent.stopPropagation(); mouseEvent.stopPropagation();
this.createSelectionForInspector(event); this.createSelectionForInspector(event);