mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 18:03:54 +00:00
39 lines
826 B
JavaScript
39 lines
826 B
JavaScript
import { Paginator } from '../../utils';
|
|
import template from './alerts-list.html';
|
|
|
|
class AlertsListCtrl {
|
|
constructor(Events, Alert) {
|
|
Events.record('view', 'page', 'alerts');
|
|
|
|
this.alerts = new Paginator([], { itemsPerPage: 20 });
|
|
|
|
Alert.query((alerts) => {
|
|
const stateClass = {
|
|
ok: 'label label-success',
|
|
triggered: 'label label-danger',
|
|
unknown: 'label label-warning',
|
|
};
|
|
|
|
alerts.forEach((alert) => {
|
|
alert.class = stateClass[alert.state];
|
|
});
|
|
|
|
this.alerts.updateRows(alerts);
|
|
});
|
|
}
|
|
}
|
|
|
|
export default function (ngModule) {
|
|
ngModule.component('alertsListPage', {
|
|
template,
|
|
controller: AlertsListCtrl,
|
|
});
|
|
|
|
return {
|
|
'/alerts': {
|
|
template: '<alerts-list-page></alerts-list-page>',
|
|
title: 'Alerts',
|
|
},
|
|
};
|
|
}
|