Advertisement
Guest User

Untitled

a guest
May 26th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. Template.incidentsWrapper.onCreated(function() {
  2. this.subscribe('currentSnapshot');
  3. });
  4.  
  5. Template.incidents.onCreated(function() {
  6. var instance = this;
  7. // Set incident data here
  8. incident = Snapshots.findOne();
  9. instance.data.incident = incident;
  10.  
  11. });
  12.  
  13. Template.incidents.onRendered(function() {
  14. var instance = this;
  15. console.log(this.data.incident);
  16. this.$('.incidents-page').fadeIn();
  17. this.$('.badges-wrapper').height($('.badges').height());
  18. this.$('.badges').affix({
  19. offset: {
  20. top: 10,
  21. bottom: 0
  22. }
  23. });
  24.  
  25. // console.log(this.data.incident.active_incidents);
  26. $('#incidentsTable').DataTable({
  27. responsive: true,
  28. select: true,
  29. data: instance.data.incident.active_incidents,
  30. columns: [
  31. { data: 'incident_id', title: 'Incident ID' },
  32. { data: 'incident_type', title: 'Type' },
  33. { data: 'incident_source', title: 'Source' },
  34. { data: 'associated_alarms', title: 'Associated Alarm IDs' },
  35. { data: 'incident_regions', title: 'Regions' },
  36. { data: 'bounce_count', title: 'Bounce/Flap Count' },
  37. { data: 'incident_raise_time', title: 'Timestamp', name: 'date' }
  38. ],
  39. "columnDefs": [
  40. {
  41. "targets": [6],
  42. "render": function( data, type, row ) {
  43. return moment(data, 'X').format('YYYY-MM-DD hh:mm:ss');
  44. }
  45. }
  46. ],
  47. dom: '<"incidents-table"<"col-sm-6"B><"col-sm-6"f>rt<"col-sm-6"i><"col-sm-6"p>>',
  48. buttons: {
  49. buttons: [
  50. { extend: 'copyHtml5', className: 'btn-primary btn-xs' },
  51. { extend: 'csvHtml5', className: 'btn-primary btn-xs', filename: 'active_incidents' }
  52. ]
  53. },
  54. "language": {
  55. "search": "Filter <i class=\"fa fa-filter\" aria-hidden=\"true\"></i>",
  56. }
  57. });
  58.  
  59. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement