check_mk.coffee 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. class Index extends App.ControllerIntegrationBase
  2. featureIntegration: 'check_mk_integration'
  3. featureName: 'Checkmk'
  4. featureConfig: 'check_mk_config'
  5. description: [
  6. ['This service receives http requests or emails from %s and creates tickets with host and service.', 'Checkmk']
  7. ['If the host and service has recovered, the ticket can be closed automatically.']
  8. ]
  9. render: =>
  10. super
  11. new App.SettingsForm(
  12. area: 'Integration::CheckMK'
  13. el: @$('.js-form')
  14. )
  15. new Form(
  16. el: @$('.js-usage')
  17. )
  18. new App.HttpLog(
  19. el: @$('.js-log')
  20. facility: 'check_mk'
  21. )
  22. class State
  23. @current: ->
  24. App.Setting.get('check_mk_integration')
  25. class Form extends App.Controller
  26. events:
  27. 'click .js-tabItem': 'toogle'
  28. 'click .js-select': 'selectAll'
  29. constructor: ->
  30. super
  31. @render()
  32. render: ->
  33. @html App.view('integration/check_mk')()
  34. @$('.js-code').each((i, block) ->
  35. hljs.highlightBlock block
  36. )
  37. toogle: (e) =>
  38. target = $(e.target).data('tablist')
  39. @$('.js-tablistItem').addClass('hidden')
  40. @$(".js-#{target}").removeClass('hidden')
  41. App.Config.set(
  42. 'IntegrationCheckMk'
  43. {
  44. name: 'Checkmk'
  45. target: '#system/integration/check_mk'
  46. description: 'An open source monitoring tool.'
  47. controller: Index
  48. state: State
  49. permission: ['admin.integration.check_mk']
  50. }
  51. 'NavBarIntegrations'
  52. )