mirror of
https://github.com/nasa/openmct.git
synced 2025-05-30 14:14:19 +00:00
Mods to Event Generator and limit provider
- Changed SEVERE to use `is-event--purple` style. - Mods to EventTelemetryProvider.js: - Adds a more random start time to each event. - Reduces frequency at which a severity is applied to events.
This commit is contained in:
parent
b865d8c038
commit
27af030566
@ -25,7 +25,7 @@ export const SEVERITY_CSS = {
|
|||||||
WARNING: 'is-event--yellow',
|
WARNING: 'is-event--yellow',
|
||||||
DISTRESS: 'is-event--red',
|
DISTRESS: 'is-event--red',
|
||||||
CRITICAL: 'is-event--red',
|
CRITICAL: 'is-event--red',
|
||||||
SEVERE: 'is-event--red'
|
SEVERE: 'is-event--purple'
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOMINAL_SEVERITY = {
|
const NOMINAL_SEVERITY = {
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
import { SEVERITY_CSS } from './EventLimitProvider.js';
|
import { SEVERITY_CSS } from './EventLimitProvider.js';
|
||||||
import messages from './transcript.json';
|
import messages from './transcript.json';
|
||||||
|
|
||||||
|
const DUR_MIN = 1000;
|
||||||
|
const DUR_MAX = 10000;
|
||||||
class EventTelemetryProvider {
|
class EventTelemetryProvider {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.defaultSize = 25;
|
this.defaultSize = 25;
|
||||||
@ -34,12 +36,17 @@ class EventTelemetryProvider {
|
|||||||
|
|
||||||
generateData(firstObservedTime, count, startTime, duration, name) {
|
generateData(firstObservedTime, count, startTime, duration, name) {
|
||||||
const millisecondsSinceStart = startTime - firstObservedTime;
|
const millisecondsSinceStart = startTime - firstObservedTime;
|
||||||
const utc = startTime + count * duration;
|
const randStartDelay = Math.max(DUR_MIN, Math.random() * DUR_MAX);
|
||||||
|
const utc = startTime + randStartDelay + count * duration;
|
||||||
const ind = count % messages.length;
|
const ind = count % messages.length;
|
||||||
const message = messages[ind] + ' - [' + millisecondsSinceStart + ']';
|
const message = messages[ind] + ' - [' + millisecondsSinceStart + ']';
|
||||||
// pick a random severity level + 1 for an undefined level so we can do nominal
|
// pick a random severity level + 1 for an undefined level so we can do nominal
|
||||||
const severity =
|
const severity =
|
||||||
Object.keys(SEVERITY_CSS)[Math.floor(Math.random() * Object.keys(SEVERITY_CSS).length + 1)];
|
Math.random() > 0.4
|
||||||
|
? Object.keys(SEVERITY_CSS)[
|
||||||
|
Math.floor(Math.random() * Object.keys(SEVERITY_CSS).length + 1)
|
||||||
|
]
|
||||||
|
: undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
@ -58,7 +65,7 @@ class EventTelemetryProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subscribe(domainObject, callback) {
|
subscribe(domainObject, callback) {
|
||||||
const duration = domainObject.telemetry.duration * 1000;
|
const duration = domainObject.telemetry.duration * DUR_MIN;
|
||||||
const firstObservedTime = Date.now();
|
const firstObservedTime = Date.now();
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
@ -83,7 +90,7 @@ class EventTelemetryProvider {
|
|||||||
request(domainObject, options) {
|
request(domainObject, options) {
|
||||||
let start = options.start;
|
let start = options.start;
|
||||||
const end = Math.min(Date.now(), options.end); // no future values
|
const end = Math.min(Date.now(), options.end); // no future values
|
||||||
const duration = domainObject.telemetry.duration * 1000;
|
const duration = domainObject.telemetry.duration * DUR_MIN;
|
||||||
const size = options.size ? options.size : this.defaultSize;
|
const size = options.size ? options.size : this.defaultSize;
|
||||||
const data = [];
|
const data = [];
|
||||||
const firstObservedTime = options.start;
|
const firstObservedTime = options.start;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user