20181023163804_add_stats_backends.rb 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class AddStatsBackends < ActiveRecord::Migration[5.1]
  3. def up
  4. return if !Setting.exists?(name: 'system_init_done')
  5. # add the dashboard stats backend for 'Stats::TicketWaitingTime'
  6. Setting.create_if_not_exists(
  7. title: 'Stats Backend',
  8. name: 'Stats::TicketWaitingTime',
  9. area: 'Dashboard::Stats',
  10. description: 'Defines a dashboard stats backend that get scheduled automatically.',
  11. options: {},
  12. state: 'Stats::TicketWaitingTime',
  13. preferences: {
  14. permission: ['ticket.agent'],
  15. prio: 1,
  16. },
  17. frontend: false
  18. )
  19. # add the dashboard stats backend for 'Stats::TicketEscalation'
  20. Setting.create_if_not_exists(
  21. title: 'Stats Backend',
  22. name: 'Stats::TicketEscalation',
  23. area: 'Dashboard::Stats',
  24. description: 'Defines a dashboard stats backend that get scheduled automatically.',
  25. options: {},
  26. state: 'Stats::TicketEscalation',
  27. preferences: {
  28. permission: ['ticket.agent'],
  29. prio: 2,
  30. },
  31. frontend: false
  32. )
  33. # add the dashboard stats backend for 'Stats::TicketChannelDistribution'
  34. Setting.create_if_not_exists(
  35. title: 'Stats Backend',
  36. name: 'Stats::TicketChannelDistribution',
  37. area: 'Dashboard::Stats',
  38. description: 'Defines a dashboard stats backend that get scheduled automatically.',
  39. options: {},
  40. state: 'Stats::TicketChannelDistribution',
  41. preferences: {
  42. permission: ['ticket.agent'],
  43. prio: 3,
  44. },
  45. frontend: false
  46. )
  47. # add the dashboard stats backend for 'Stats::TicketLoadMeasure'
  48. Setting.create_if_not_exists(
  49. title: 'Stats Backend',
  50. name: 'Stats::TicketLoadMeasure',
  51. area: 'Dashboard::Stats',
  52. description: 'Defines a dashboard stats backend that get scheduled automatically.',
  53. options: {},
  54. state: 'Stats::TicketLoadMeasure',
  55. preferences: {
  56. permission: ['ticket.agent'],
  57. prio: 4,
  58. },
  59. frontend: false
  60. )
  61. # add the dashboard stats backend for 'Stats::TicketInProcess'
  62. Setting.create_if_not_exists(
  63. title: 'Stats Backend',
  64. name: 'Stats::TicketInProcess',
  65. area: 'Dashboard::Stats',
  66. description: 'Defines a dashboard stats backend that get scheduled automatically.',
  67. options: {},
  68. state: 'Stats::TicketInProcess',
  69. preferences: {
  70. permission: ['ticket.agent'],
  71. prio: 5,
  72. },
  73. frontend: false
  74. )
  75. # add the dashboard stats backend for 'Stats::TicketReopen'
  76. Setting.create_if_not_exists(
  77. title: 'Stats Backend',
  78. name: 'Stats::TicketReopen',
  79. area: 'Dashboard::Stats',
  80. description: 'Defines a dashboard stats backend that get scheduled automatically.',
  81. options: {},
  82. state: 'Stats::TicketReopen',
  83. preferences: {
  84. permission: ['ticket.agent'],
  85. prio: 6,
  86. },
  87. frontend: false
  88. )
  89. end
  90. end