09f6bca470
Displays all scale events in the form of an annotated line chart. When annotations are clicked, the timestamp, message, and meta propeties for the event are displayed below the chart.
39 lines
819 B
JavaScript
39 lines
819 B
JavaScript
import Component from '@ember/component';
|
|
import { computed } from '@ember/object';
|
|
import { tagName } from '@ember-decorators/component';
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
@classic
|
|
@tagName('')
|
|
export default class ScaleEventsChart extends Component {
|
|
events = [];
|
|
|
|
activeEvent = null;
|
|
|
|
@computed('events.[]')
|
|
get data() {
|
|
return this.events.filterBy('hasCount').sortBy('time');
|
|
}
|
|
|
|
@computed('events.[]')
|
|
get annotations() {
|
|
return this.events.rejectBy('hasCount').map(ev => ({
|
|
type: ev.error ? 'error' : 'info',
|
|
time: ev.time,
|
|
event: ev,
|
|
}));
|
|
}
|
|
|
|
toggleEvent(ev) {
|
|
if (this.activeEvent === ev) {
|
|
this.closeEventDetails();
|
|
} else {
|
|
this.set('activeEvent', ev);
|
|
}
|
|
}
|
|
|
|
closeEventDetails() {
|
|
this.set('activeEvent', null);
|
|
}
|
|
}
|