mirror of
https://github.com/nasa/openmct.git
synced 2025-06-05 09:00:49 +00:00
addressing PR comments
This commit is contained in:
parent
4ab19e394e
commit
b467f9ce20
@ -67,11 +67,13 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
|
|
||||||
const metadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
const metadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||||
const telemetryMetaData = metadata ? metadata.valueMetadatas : [];
|
const telemetryMetaData = metadata ? metadata.valueMetadatas : [];
|
||||||
const telemetryProcessor = this.telemetryReceived.bind(this, telemetryObject);
|
|
||||||
|
|
||||||
this.telemetryObjects[keyString] = Object.assign({}, telemetryObject, { telemetryMetaData });
|
this.telemetryObjects[keyString] = { ...telemetryObject, telemetryMetaData };
|
||||||
|
|
||||||
this.telemetryCollections[keyString].on('add', telemetryProcessor);
|
this.telemetryCollections[keyString].on(
|
||||||
|
'add',
|
||||||
|
this.telemetryReceived.bind(this, telemetryObject)
|
||||||
|
);
|
||||||
this.telemetryCollections[keyString].load();
|
this.telemetryCollections[keyString].load();
|
||||||
|
|
||||||
this.updateConditionTelemetryObjects();
|
this.updateConditionTelemetryObjects();
|
||||||
@ -84,8 +86,8 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.telemetryCollections[keyString].destroy();
|
this.telemetryCollections[keyString].destroy();
|
||||||
delete this.telemetryCollections[keyString];
|
this.telemetryCollections[keyString] = null;
|
||||||
delete this.telemetryObjects[keyString];
|
this.telemetryObjects[keyString] = null;
|
||||||
this.removeConditionTelemetryObjects();
|
this.removeConditionTelemetryObjects();
|
||||||
|
|
||||||
//force re-computation of condition set result as we might be in a state where
|
//force re-computation of condition set result as we might be in a state where
|
||||||
|
@ -137,22 +137,17 @@ export default {
|
|||||||
// handle visibility separately
|
// handle visibility separately
|
||||||
if (styleObj.isStyleInvisible !== undefined) {
|
if (styleObj.isStyleInvisible !== undefined) {
|
||||||
elemToStyle.classList.toggle(STYLE_CONSTANTS.isStyleInvisible, styleObj.isStyleInvisible);
|
elemToStyle.classList.toggle(STYLE_CONSTANTS.isStyleInvisible, styleObj.isStyleInvisible);
|
||||||
delete styleObj.isStyleInvisible;
|
styleObj.isStyleInvisible = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// build style string
|
|
||||||
const styleString = Object.entries(styleObj)
|
|
||||||
.map(([key, value]) => {
|
|
||||||
if (typeof value === 'string' && value.includes('__no_value')) {
|
|
||||||
return `${key}: ;`; // removes the property
|
|
||||||
}
|
|
||||||
return `${key}: ${value};`;
|
|
||||||
})
|
|
||||||
.join(' ');
|
|
||||||
|
|
||||||
// apply styles in one operation
|
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
elemToStyle.style.cssText += styleString;
|
Object.entries(styleObj).forEach(([key, value]) => {
|
||||||
|
if (typeof value !== 'string' || !value.includes('__no_value')) {
|
||||||
|
elemToStyle.style[key] = value;
|
||||||
|
} else {
|
||||||
|
elemToStyle.style[key] = ''; // remove the property
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user